diff --git a/examples/osgshadowtexture/osgshadowtexture.cpp b/examples/osgshadowtexture/osgshadowtexture.cpp index 10103b14a..f04ae0825 100644 --- a/examples/osgshadowtexture/osgshadowtexture.cpp +++ b/examples/osgshadowtexture/osgshadowtexture.cpp @@ -15,6 +15,7 @@ #include #include +#include // include the call which creates the shadowed subgraph. #include "CreateShadowedScene.h" @@ -179,6 +180,30 @@ osg::Node* createModel(osg::ArgumentParser& arguments) return shadowedScene; + } + else if (arguments.read("--st")) + { + + osgShadow::ShadowedScene* shadowedScene = new osgShadow::ShadowedScene; + + osg::ref_ptr shadowTexture = new osgShadow::ShadowTexture; + shadowedScene->setShadowTechnique(shadowTexture.get()); + + osg::ref_ptr ls = new osg::LightSource; + ls->getLight()->setPosition(osg::Vec4(lightPosition,1.0)); + + shadowedScene->setRecievesShadowTraversalMask(0x1); + shadowed->setNodeMask(shadowedScene->getRecievesShadowTraversalMask()); + + shadowedScene->setCastsShadowTraversalMask(0x2); + shadower->setNodeMask(shadowedScene->getCastsShadowTraversalMask()); + + shadowedScene->addChild(shadower); + shadowedScene->addChild(shadowed); + shadowedScene->addChild(ls.get()); + + return shadowedScene; + } else {