Hi,

today I would like to contribute a new group core node which allows the
user to 
select none, some or all children nodes for rendering. Basically, it is
very (very)
similar to the already existing Switch core but with a slightly altered
semantic.

Following I will give a simple usage example:

NodePtr root1 = ...
NodePtr root2 = ...
NodePtr root3 = ...
NodePtr root4 = ...

SelectPtr selectCore = Select::create();
FCEditGuard guardSelect(selectCore);    // Convenience macro
selectCore-> setChoice(Select::ALL);    // Show all

NodePtr root = Node::create();
FCEditGuard guardRoot(root);
root->setCore(selectCore);
root->addChild(root1);
root->addChild(root2);
root->addChild(root3);
root->addChild(root4);

// Later on
selectCore->setChoice(1 << 0);          // Show only the first
selectCore->setChoice(1 << 1);          // Show only the second
selectCore->setChoice(1 << 2);          // Show only the third
selectCore->setChoice(1 << 3);          // Show only the fourth

selectCore->setChoice(1 << 0 + 1 << 1); // Show the first and the second
selectCore->setChoice(1 << 1 + 1 << 3); // Show the second and the
fourth
...
selectCore->setChoice(Select::None);    // Show none

// Or like this inside of some loop with Int32 idx = 0 as a loop
variable
if (idx < 0 || idx >= maxNumNodes)
    idx = 0;

Int32 val = 0;
for (Int32 i = 0; i <= idx; ++i)
    val += (1 << i);

selectCore-> setChoice(val);            // show the first until the
idx'th node
idx++;

If this would be a valuable contribution I could send the files to this
list or to any place which is
appropriate.

With best regards,

Johannes



____________
Virus checked by G DATA AntiVirusKit
Version: AVK 18.4786 from 04.08.2008
Virus news: www.antiviruslab.com

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to