[osg-users] Can I add more then one ClipNodeBox to a scene?

Karl Karsten kkarsten62 at yahoo.de
Sun Sep 14 11:33:33 PDT 2008


Hello,

I am still a newbie and I am just coding around ClipNode Boxes. My intention is to have multiple ClipNode Boxes in a scene.
I try to extend the osgclip example with a simple second box. Now my problem is that only the last ClipNodeBox will taken into account.
Can have I have more than one ClipNodeBox  in a scene?
If yes does anybody have an example code?

Many thanks for a  help .

Best regards
Karl ...

...
//Code from osgclip.cpp
    osg::ClipNode* clipnode = new osg::ClipNode;
    osg::BoundingSphere bs = subgraph->getBound();
    bs.radius()*= 0.4f;

    osg::BoundingBox bb;
    bb.expandBy(bs);

    clipnode->createClipBox(bb);
    clipnode->setCullingActive(false);

    transform->addChild(clipnode);
    rootnode->addChild(transform);

    // create clipped part.
    osg::Group* clipped_subgraph = new osg::Group;

    clipped_subgraph->setStateSet(clipnode->getStateSet());
    clipped_subgraph->addChild(subgraph);
    rootnode->addChild(clipped_subgraph);

// My extension code for a 2nd ClipNodeBox
    osg::ClipNode * clipNode2 = new osg::ClipNode;
    clipNode2->createClipBox(osg::BoundingBox(-5, -5, -5, -3, 5, 5));
    clipNode2->setCullingActive(false);
    rootnode->addChild(clipNode2);

    osg::Group* clipped_subgraph2 = new osg::Group;
    clipped_subgraph2->setStateSet(clipNode2->getStateSet());
    clipped_subgraph2->addChild(subgraph);
    rootnode->addChild(clipped_subgraph2);
...

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080914/d7607039/attachment-0002.htm>


More information about the osg-users mailing list