- Timestamp:
- 04/23/09 12:24:27 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/GeometryRecords.cpp
r9041 r10084 24 24 #include <osg/Texture2D> 25 25 #include <osg/CullFace> 26 #include <osg/PolygonOffset>27 #include <osg/Depth>28 26 #include <osg/BlendFunc> 29 27 #include <osgUtil/TransformAttributeFunctor> … … 384 382 if (document.subfaceLevel() > 0) 385 383 { 386 static osg::ref_ptr<osg::PolygonOffset> polygonOffset = new osg::PolygonOffset(-10.0f, -40.0f); 387 stateset->setAttributeAndModes(polygonOffset.get(), osg::StateAttribute::ON); 388 389 static osg::ref_ptr<osg::Depth> depth = new osg::Depth(osg::Depth::LESS, 0.0, 1.0,false); 390 stateset->setAttribute(depth.get()); 384 stateset->setAttributeAndModes(document.getSubSurfacePolygonOffset(document.subfaceLevel()), osg::StateAttribute::ON); 385 stateset->setAttribute(document.getSubSurfaceDepth()); 391 386 392 387 stateset->setRenderBinDetails(document.subfaceLevel(),"RenderBin"); 393 388 } 394 395 #if 0396 // note from Robert Osfield, this "optimization" breaks multi-textured datasets that mix single texture397 // and mulit-texture geometries as the Multitexture parsing can come after the below code, and accidentally398 // polute the non multi-texture geometries StateSet.399 400 // A simple share stateset optimization.401 static osg::ref_ptr<osg::StateSet> lastStateset;402 if (lastStateset.valid() && (stateset->compare(*lastStateset,false)==0))403 stateset = lastStateset;404 else405 lastStateset = stateset;406 #endif407 389 408 390 _geode->setStateSet(stateset.get()); … … 953 935 if (document.subfaceLevel() > 0) 954 936 { 955 static osg::ref_ptr<osg::PolygonOffset> polygonOffset = new osg::PolygonOffset(-10.0f, -40.0f); 956 stateset->setAttributeAndModes(polygonOffset.get(), osg::StateAttribute::ON); 957 958 static osg::ref_ptr<osg::Depth> depth = new osg::Depth(osg::Depth::LESS, 0.0, 1.0,false); 959 stateset->setAttribute(depth.get()); 937 stateset->setAttributeAndModes(document.getSubSurfacePolygonOffset(document.subfaceLevel()), osg::StateAttribute::ON); 938 stateset->setAttribute(document.getSubSurfaceDepth()); 960 939 961 940 stateset->setRenderBinDetails(document.subfaceLevel(),"RenderBin"); 962 941 } 963 964 #if 0965 // note from Robert Osfield, this "optimization" breaks multi-textured datasets that mix single texture966 // and mulit-texture geometries as the Multitexture parsing can come after the below code, and accidentally967 // polute the non multi-texture geometries StateSet.968 969 // A simple share stateset optimization.970 static osg::ref_ptr<osg::StateSet> lastStateset;971 if (lastStateset.valid() && (stateset->compare(*lastStateset,false)==0))972 stateset = lastStateset;973 else974 lastStateset = stateset;975 #endif976 942 977 943 _geode->setStateSet(stateset.get());
