Changeset 7974 for OpenSceneGraph/trunk/src/osgShadow/ShadowMap.cpp
- Timestamp:
- 03/19/08 13:09:20 (5 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgShadow/ShadowMap.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgShadow/ShadowMap.cpp
r7972 r7974 82 82 83 83 ShadowMap::ShadowMap(): 84 _baseTextureUnit(0),84 _baseTextureUnit(0), 85 85 _shadowTextureUnit(1), 86 86 _ambientBias(0.5f,0.5f), 87 _textureSize(1024,1024) 87 _textureSize(1024,1024), 88 _polyOffset(1.0,1.0) 88 89 { 89 90 } … … 101 102 { 102 103 _shadowTextureUnit = unit; 104 } 105 106 void ShadowMap::setPolygonOffset(const osg::Vec2& polyOffset) 107 { 108 _polyOffset = polyOffset; 103 109 } 104 110 … … 210 216 #if 1 211 217 // cull front faces so that only backfaces contribute to depth map 218 212 219 213 220 osg::ref_ptr<osg::CullFace> cull_face = new osg::CullFace; … … 218 225 // negative polygonoffset - move the backface nearer to the eye point so that backfaces 219 226 // shadow themselves 220 float factor = - 1.0f;221 float units = -1.0f;227 float factor = -_polyOffset[0]; 228 float units = -_polyOffset[1]; 222 229 223 230 osg::ref_ptr<osg::PolygonOffset> polygon_offset = new osg::PolygonOffset; … … 232 239 // negative polygonoffset - move the backface nearer to the eye point 233 240 // so that front faces do not shadow themselves. 234 float factor = 1.0f;235 float units = 1.0f;241 float factor = _polyOffset[0]; 242 float units = _polyOffset[1]; 236 243 237 244 osg::ref_ptr<osg::PolygonOffset> polygon_offset = new osg::PolygonOffset; … … 328 335 osgUtil::RenderStage* orig_rs = cv.getRenderStage(); 329 336 330 // do traversal of shadow rec eiving scene which does need to be decorated by the shadow map337 // do traversal of shadow recieving scene which does need to be decorated by the shadow map 331 338 { 332 339 cv.pushStateSet(_stateset.get()); … … 608 615 stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF); 609 616 stateset->setMode(GL_BLEND,osg::StateAttribute::ON); 610 //stateset->setAttribute(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON);611 617 stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); 612 618
