diff --git a/examples/osgshadow/osgshadow.cpp b/examples/osgshadow/osgshadow.cpp index 34d33390c..501d70d3f 100644 --- a/examples/osgshadow/osgshadow.cpp +++ b/examples/osgshadow/osgshadow.cpp @@ -328,7 +328,7 @@ public: osg::Vec4 ambient(0.2,0.2,0.2,1.0); osg::Vec4 diffuse(0.8,0.8,0.8,1.0); osg::Vec4 zero_colour(0.0,0.0,0.0,1.0); - _lightpos.set(0.0,0.0,1.0,0.0); + _lightpos.set(0.0,1.0,0.0,0.0); // first group, render the depth buffer + ambient light contribution { @@ -363,7 +363,7 @@ public: depth->setWriteMask(false); depth->setFunction(osg::Depth::LEQUAL); _shadowVolumeStateSet->setAttribute(depth); - _shadowVolumeStateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); + _shadowVolumeStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE); _shadowVolumeStateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON); @@ -406,7 +406,7 @@ public: depth->setFunction(osg::Depth::LEQUAL); _shadowedSceneStateSet->setAttribute(depth); _shadowedSceneStateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON); - _shadowedSceneStateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); + // _shadowedSceneStateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); osg::LightModel* lm1 = new osg::LightModel; @@ -433,7 +433,7 @@ public: osg::BlendFunc* blend = new osg::BlendFunc; blend->setFunction(osg::BlendFunc::ONE, osg::BlendFunc::ONE); _shadowedSceneStateSet->setAttributeAndModes(blend, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); - _shadowedSceneStateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); + // _shadowedSceneStateSet->setMode(GL_LIGHTING, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); } _ss1->setThreadSafeRefUnref(true); @@ -452,7 +452,7 @@ public: return; } -// osg::notify(osg::NOTICE)< original_bin = cv->getCurrentRenderBin(); @@ -475,7 +475,11 @@ public: itr != new_bin->getRenderBinList().end(); ++itr) { - osg::notify(osg::NOTICE)<<"bin num = "<first<getStateGraphList().size()= "<second->getStateGraphList().size()<getRenderBinList().size()= "<second->getRenderBinList().size()<getRenderLeafList().size()= "<second->getRenderLeafList().size()<setReadBuffer(orig_rs->getReadBuffer()); new_rs->setColorMask(orig_rs->getColorMask()); new_rs->setPositionalStateContainer(orig_rs->getPositionalStateContainer()); -#if 1 -#if 0 - osg::notify(osg::NOTICE)<<"orig_rs="<getRenderBinList()[0] = new_bin; - + nested_bin->getRenderBinList()[0] = new_bin; nested_bin->setStateSet(_shadowedSceneStateSet.get()); - -#if 0 - osg::notify(osg::NOTICE)<<"shadowVolumeBin="<getStateGraphList().size()= "<getStateGraphList().size()<getRenderBinList().size()= "<getRenderBinList().size()<getRenderLeafList().size()= "<getRenderLeafList().size()<getRenderBinList().begin(); + itr != new_bin->getRenderBinList().end(); + ++itr) + { + osg::notify(osg::NOTICE)<<" bin num = "<first<getStateGraphList().size()= "<second->getStateGraphList().size()<getRenderBinList().size()= "<second->getRenderBinList().size()<getRenderLeafList().size()= "<second->getRenderLeafList().size()<