From Morten Hauknes, "I have been using the getLastVisiblePixelCount on pre 3.0 osg. I believe maybe this was a private function that we made public in our side. I use(d) this method to make a simple algorithm to tell how much visible an object was in percent.

So with the 3.0 api change we propose the following change:
- put OSG_EXPORT on the QueryGeometry class so that we get access to the getNumPixels method.
- Create a function called getQueryGeometry that returns a casted _queryGeode->getDrawable(). Or a function called getQueryGeode that returns _queryGeode."
This commit is contained in:
Robert Osfield
2011-09-13 13:38:26 +00:00
parent 6c46956918
commit c1af863f78
2 changed files with 25 additions and 1 deletions

View File

@@ -60,7 +60,7 @@ public:
// QueryGeometry -- A Drawable that performs an occlusion query,
// using its geometric data as the query geometry.
class QueryGeometry : public osg::Geometry
class OSG_EXPORT QueryGeometry : public osg::Geometry
{
public:
QueryGeometry( const std::string& oqnName=std::string("") );
@@ -141,6 +141,10 @@ public:
osg::StateSet* getQueryStateSet();
const osg::StateSet* getQueryStateSet() const;
// Get the QueryGeometry object used for occlusion query. Returns 0 if no QueryGeometry is created.
osg::QueryGeometry* getQueryGeometry();
const osg::QueryGeometry* getQueryGeometry() const;
// Set and get the StateSet used by the OcclusionQueryNode
// when rendering the debug query geometry (see setDebugDisplay).
void setDebugStateSet( osg::StateSet* ss );

View File

@@ -754,5 +754,25 @@ void OcclusionQueryNode::discardDeletedQueryObjects( unsigned int contextID )
QueryGeometry::discardDeletedQueryObjects( contextID );
}
osg::QueryGeometry* OcclusionQueryNode::getQueryGeometry()
{
if (_queryGeode && _queryGeode->getDrawable( 0 ))
{
QueryGeometry* qg = static_cast< QueryGeometry* >( _queryGeode->getDrawable( 0 ) );
return qg;
}
return 0;
}
const osg::QueryGeometry* OcclusionQueryNode::getQueryGeometry() const
{
if (_queryGeode && _queryGeode->getDrawable( 0 ))
{
QueryGeometry* qg = static_cast< QueryGeometry* >( _queryGeode->getDrawable( 0 ) );
return qg;
}
return 0;
}
}