Changeset 11136 for OpenSceneGraph/trunk/src/osgShadow/DebugShadowMap.cpp
- Timestamp:
- 03/01/10 12:52:44 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgShadow/DebugShadowMap.cpp
r9555 r11136 14 14 * Thanks to to my company http://www.ai.com.pl for allowing me free this work. 15 15 */ 16 16 #include <osgShadow/ShadowedScene> 17 17 #include <osgShadow/DebugShadowMap> 18 18 #include <osgShadow/ConvexPolyhedron> 19 19 #include <osgUtil/RenderLeaf> 20 #include <osgDB/WriteFile> 20 21 #include <osg/Geometry> 21 22 #include <osg/PrimitiveSet> … … 416 417 { 417 418 public: 418 DrawableDrawWithDepthShadowComparisonOffCallback( osg::Texture 2D*pTex )419 DrawableDrawWithDepthShadowComparisonOffCallback( osg::Texture *pTex ) 419 420 : _pTexture( pTex ) 420 421 { … … 427 428 428 429 // Turn off depth comparison mode 429 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE );430 glTexParameteri( _pTexture->getTextureTarget(), GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE ); 430 431 431 432 drawable->drawImplementation(ri); 432 433 433 434 // Turn it back on 434 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,435 glTexParameteri( _pTexture->getTextureTarget(), GL_TEXTURE_COMPARE_MODE_ARB, 435 436 GL_COMPARE_R_TO_TEXTURE_ARB ); 436 437 } 437 438 438 osg::ref_ptr< osg::Texture 2D> _pTexture;439 osg::ref_ptr< osg::Texture > _pTexture; 439 440 }; 441 442 void DebugShadowMap::ViewData::dump( const char * filename ) 443 { 444 osg::ref_ptr< osg::Group > root = new osg::Group; 445 osgUtil::CullVisitor * cv = _cv.get(); 446 447 #if 1 448 osg::Group * cam = cv->getRenderStage()->getCamera(); 449 450 for( unsigned int i = 0; i < cam->getNumChildren(); i++ ) 451 { 452 root->addChild( cam->getChild( i ) ); 453 } 454 #endif 455 456 root->addChild( _st->getShadowedScene() ); 457 458 osg::ref_ptr< osg::MatrixTransform > transform = new osg::MatrixTransform; 459 root->addChild( transform.get() ); 460 461 // updateDebugGeometry( _viewCamera.get(), _camera.get() ); 462 463 for( PolytopeGeometryMap::iterator itr = _polytopeGeometryMap.begin(); 464 itr != _polytopeGeometryMap.end(); 465 ++itr ) 466 { 467 PolytopeGeometry & pg = itr->second; 468 int i = 0; 469 { 470 471 ConvexPolyhedron cp( pg._polytope ); 472 473 pg._geometry[i] = cp.buildGeometry 474 ( pg._colorOutline, pg._colorInside, pg._geometry[i].get() ); 475 } 476 } 477 478 for( unsigned int i = 0; i < _transform[0]->getNumChildren(); i++ ) 479 { 480 root->addChild( _transform[0]->getChild( i ) ); 481 } 482 483 osgDB::writeNodeFile( *root, std::string( filename ) ); 484 485 root->removeChildren( 0, root->getNumChildren() ); 486 } 440 487 441 488 void DebugShadowMap::ViewData::createDebugHUD( ) … … 483 530 484 531 osg::StateSet* stateset = _cameraDebugHUD->getOrCreateStateSet(); 485 stateset->setTextureAttribute AndModes(0,_texture.get(),osg::StateAttribute::ON );532 stateset->setTextureAttribute(0,_texture.get(),osg::StateAttribute::ON ); 486 533 stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF); 487 534 // stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
