Paul Melis wrote on Friday, May 29, 2009 9:55 AM:

> Thrall, Bryan wrote:
>> Paul Martz wrote on Thursday, May 28, 2009 4:50 PM:
>> 
>>> You use a NodeVisitor to walk your scene graph and look for Geodes,
>>> then iterate over the Drawables that are attached to the Geodes,
using
>>> dynamic_cast to access the Drawable as a Geometry.
>>> 
>> 
>> Even better, I notice osg::Drawable has asGeometry(), which is
cheaper than
>> dynamic_cast<> :) 
>> 
> Wow, I wasn't expecting the difference to be this large, as virtual
> function calls aren't completely free either:
...
> 16:52|p...@tabu:~> ./t
> 1
> asGeometry()    : 1.181 ms
> dynamic_cast<>(): 3.945 ms
> 16:52|p...@tabu:~> g++ -O3 -o t t.cpp -I ~/osg2.8/include/ -L
> ~/osg2.8/lib/ -losg -losgDB
> 16:52|p...@tabu:~> ./t
> 1
> asGeometry()    : 0.839 ms
> dynamic_cast<>(): 3.611 ms
> 16:52|p...@tabu:~>

That's even more impressive than I was expecting!

-- 
Bryan Thrall
FlightSafety International
[email protected]
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to