On 12/2/2011 8:04 PM, [email protected] wrote:
My question is this, if I load a file usingosgDB::readNodeFile("somefile.osg"); How would I set it up for instanced drawing? My guess is that I would need to write a node-visitor that collects all of the geometry -> drawables and sets them up to use the instanced call overload instead of the default. I have tried doing this, but my implementation has gotten pretty complex, and I want to make sure there isn't a more simple way I have overlooked.
Yes, you'd need to write a NodeVisitor. It would have an apply(Geode&) that iterates over each Drawable. If the Drawable is a Geometry, the code would further iterate over each PrimitiveSet and call setNumInstances() on each one. It really just boils down to a pair of nested loops. This doesn't seem particularly complex, so I wonder if you might be doing something different that is complicating things. Your description of what you're doing is pretty vague, so it's hard to tell.
-Paul _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

