Jacob Huckaby
2008-04-11 17:10:30 UTC
Hi,
Quick question (at least I hope it is.) I am trying to find the Drawable
inside a Node that I read from a file, to which I can apply a custom
TriangleIntersector. I have tried casting the Node as a Geode, and using
getDrawable(), but it crashes on the getDrawable(). Here is the code I am
trying:
osg::Geode* geode = dynamic_cast<osg::Geode*> (node);
osg::Drawable* drawable = geode->getDrawable(0);
drawable->accept(ti);
I have been able to make this work with Shapes that I have put into
ShapeDrawables:
osg::Box* box = new osg::Box(osg::Vec3(1.0f,1.0f,1.0f),1.0f,1.0f,1.0f);
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(box);
drawable->accept(ti);
My question: how can I get access to the Drawable in my Node (so that I can
apply my TriangleIntersector)? It is only a single node. If you have any
advice, I would greatly appreciate it. Thank you,
Jake
Quick question (at least I hope it is.) I am trying to find the Drawable
inside a Node that I read from a file, to which I can apply a custom
TriangleIntersector. I have tried casting the Node as a Geode, and using
getDrawable(), but it crashes on the getDrawable(). Here is the code I am
trying:
osg::Geode* geode = dynamic_cast<osg::Geode*> (node);
osg::Drawable* drawable = geode->getDrawable(0);
drawable->accept(ti);
I have been able to make this work with Shapes that I have put into
ShapeDrawables:
osg::Box* box = new osg::Box(osg::Vec3(1.0f,1.0f,1.0f),1.0f,1.0f,1.0f);
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(box);
drawable->accept(ti);
My question: how can I get access to the Drawable in my Node (so that I can
apply my TriangleIntersector)? It is only a single node. If you have any
advice, I would greatly appreciate it. Thank you,
Jake