Changeset 10933
- Timestamp:
- 01/08/10 12:16:22 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osg/OcclusionQueryNode.cpp
r9460 r10933 528 528 _debugBB( false ) 529 529 { 530 setDataVariance( osg::Object::DYNAMIC );531 532 530 // OQN has two Geode member variables, one for doing the 533 531 // query and one for rendering the debug geometry. … … 562 560 return true; 563 561 564 // In the future, we could hold a reference directly to the QueryDrawable 565 // to avoid the dynamic_cast. 566 QueryGeometry* qg = dynamic_cast< QueryGeometry* >( _queryGeode->getDrawable( 0 ) ); 567 if (qg == NULL) 562 if (_queryGeode->getDrawable( 0 ) == NULL) 568 563 { 569 564 osg::notify( osg::FATAL ) << … … 572 567 return true; 573 568 } 569 QueryGeometry* qg = static_cast< QueryGeometry* >( _queryGeode->getDrawable( 0 ) ); 574 570 575 571 // If the distance to the bounding sphere shell is positive, retrieve … … 642 638 (*v)[7] = osg::Vec3( bb._max.x(), bb._max.y(), bb._max.z() ); 643 639 644 osg::Geometry* geom = dynamic_cast< osg::Geometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) );640 osg::Geometry* geom = static_cast< osg::Geometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) ); 645 641 geom->setVertexArray( v.get() ); 646 642 647 geom = dynamic_cast< osg::Geometry* >( nonConstThis->_debugGeode->getDrawable( 0 ) );643 geom = static_cast< osg::Geometry* >( nonConstThis->_debugGeode->getDrawable( 0 ) ); 648 644 geom->setVertexArray( v.get() ); 649 645 } … … 799 795 OcclusionQueryNode::releaseGLObjects( osg::State* state ) const 800 796 { 801 // Query object discard and deletion is handled by QueryGeometry support class. 802 OcclusionQueryNode* nonConstThis = const_cast< OcclusionQueryNode* >( this ); 803 QueryGeometry* qg = dynamic_cast< QueryGeometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) ); 804 qg->releaseGLObjects( state ); 797 if(_queryGeode->getDrawable( 0 ) != NULL) 798 { 799 // Query object discard and deletion is handled by QueryGeometry support class. 800 OcclusionQueryNode* nonConstThis = const_cast< OcclusionQueryNode* >( this ); 801 QueryGeometry* qg = static_cast< QueryGeometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) ); 802 qg->releaseGLObjects( state ); 803 } 805 804 } 806 805
