Added osgShadow::ShadowTexture set up

This commit is contained in:
Robert Osfield
2007-02-16 10:19:15 +00:00
parent e096a5f44a
commit 9119f4d3c3

View File

@@ -15,6 +15,7 @@
#include <osgShadow/ShadowedScene>
#include <osgShadow/ShadowVolume>
#include <osgShadow/ShadowTexture>
// 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<osgShadow::ShadowTexture> shadowTexture = new osgShadow::ShadowTexture;
shadowedScene->setShadowTechnique(shadowTexture.get());
osg::ref_ptr<osg::LightSource> 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
{