[osg-users] Adding shadow to an existing scenegraph
Basic Soft
basicsoft_webmaster at yahoo.com
Fri Jan 11 06:38:37 PST 2008
I want to add shadowing to a complex already loaded
scene in a larger framework context. Possibly
shadowing should only be activated for subgraphs.
So far I'm trying to add a osgShadow::ShadowedScene to
the scenegraph which crashes on me while the
scenegraph is traversed. Error message is as follows:
osg25-osgd.dll!osg::Object::getDataVariance()
Do I need to register the ShadowedScene with the
Viewer or the associated Camera? Must there be a light
present in the ShadowedScene?
Any help greatly appreciated here.
Here is a code snippet:
osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene =
new osgShadow::ShadowedScene;
shadowedScene->setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
shadowedScene->setCastsShadowTraversalMask(CastsShadowTraversalMask);
osg::ref_ptr<osgShadow::ShadowMap> sm = new
osgShadow::ShadowMap;
shadowedScene->setShadowTechnique(sm.get());
selectedNode->setNodeMask(CastsShadowTraversalMask);
selectedNode->setNodeMask(ReceivesShadowTraversalMask);
shadowedScene->addChild(selectedNode);
shadowedScene->addChild(selectedNode);
root->asGroup()->replaceChild(selectedNode, shadowedScene.get());
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
More information about the osg-users
mailing list