Added option to use osgShadow::ShadowMap technique

This commit is contained in:
Robert Osfield
2007-02-19 14:21:01 +00:00
parent 37526e3bea
commit bc0fb12d0a
3 changed files with 79 additions and 19 deletions

View File

@@ -16,6 +16,7 @@
#include <osgShadow/ShadowedScene>
#include <osgShadow/ShadowVolume>
#include <osgShadow/ShadowTexture>
#include <osgShadow/ShadowMap>
// include the call which creates the shadowed subgraph.
#include "CreateShadowedScene.h"
@@ -204,6 +205,30 @@ osg::Node* createModel(osg::ArgumentParser& arguments)
return shadowedScene;
}
else if (arguments.read("--sm"))
{
osgShadow::ShadowedScene* shadowedScene = new osgShadow::ShadowedScene;
osg::ref_ptr<osgShadow::ShadowMap> shadowMap = new osgShadow::ShadowMap;
shadowedScene->setShadowTechnique(shadowMap.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
{