Changeset 10933

Show
Ignore:
Timestamp:
01/08/10 12:16:22 (4 years ago)
Author:
robert
Message:

From Paul Martz, "OcclusionQueryNode? was incorrectly marking itself as DYNAMIC, so I removed that code. And I also found some uses of dynamic_cast that could be changed to static_cast.
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osg/OcclusionQueryNode.cpp

    r9460 r10933  
    528528    _debugBB( false ) 
    529529{ 
    530     setDataVariance( osg::Object::DYNAMIC ); 
    531  
    532530    // OQN has two Geode member variables, one for doing the 
    533531    //   query and one for rendering the debug geometry. 
     
    562560        return true; 
    563561 
    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) 
    568563    { 
    569564        osg::notify( osg::FATAL ) << 
     
    572567        return true; 
    573568    } 
     569    QueryGeometry* qg = static_cast< QueryGeometry* >( _queryGeode->getDrawable( 0 ) ); 
    574570 
    575571    // If the distance to the bounding sphere shell is positive, retrieve 
     
    642638        (*v)[7] = osg::Vec3( bb._max.x(), bb._max.y(), bb._max.z() ); 
    643639 
    644         osg::Geometry* geom = dynamic_cast< osg::Geometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) ); 
     640        osg::Geometry* geom = static_cast< osg::Geometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) ); 
    645641        geom->setVertexArray( v.get() ); 
    646642 
    647         geom = dynamic_cast< osg::Geometry* >( nonConstThis->_debugGeode->getDrawable( 0 ) ); 
     643        geom = static_cast< osg::Geometry* >( nonConstThis->_debugGeode->getDrawable( 0 ) ); 
    648644        geom->setVertexArray( v.get() ); 
    649645    } 
     
    799795OcclusionQueryNode::releaseGLObjects( osg::State* state ) const 
    800796{ 
    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    } 
    805804} 
    806805