Thanks J-S, changes now merged and submitted to SVN. Reply on other details below:
On Dec 13, 2007 7:02 PM, Jean-Sébastien Guay <[EMAIL PROTECTED]> wrote: > Some clients at my new job noticed that picking did not work with the > osg::Capsule subclass of osg::Shape in an osg::ShapeDrawable. Other > shapes worked fine. So I have fixed this. Code attached. > > My modification is in the PrimitiveShapeVisitor, and is based on the > DrawShapeVisitor - I added methods called createCylinderBody and > createHalfSphere, and used them in apply(Cylinder&) and > apply(Capsule&). In my testing they work fine, tested even with > transforms and moving around the scene. > > > On a related note: > > The code in PrimitiveShapeVisitor is basically a copy of the code in > DrawShapeVisitor, but without the OpenGL code and without normals and > texcoords. I wonder, wouldn't it have been simpler to just create a > straight osg::Geometry object (with the same vertices, normals and > texcoords as DrawShapeVisitor) and be done with it, thus removing the > code duplication? Why do osg::Shape and osg::ShapeDrawable even exist? > And would you accept a submission making the subclasses of osg::Shape > into osg::Geometry objects? > > I don't really care as long as it all works, but it just strikes me as > unnecessary duplication, and a recent question about how to create > geometry for primitives could be answered (or made obsolete) by doing > this. Also, I seem to remember other things that just were not > possible with osg::Shape subclasses... osg::Shape came about as a means for supporting primitive based collision/physics modelling. osg:ShapeDrawable kinda grew out of making it convenient to display shapes, I now regret this though, I think it'd be better to just have a osg::Geometry* createGeometry(Shape*) function. Another way forward might be to have ShapeDrawable have a local ref_ptr<osg::Geometry> and let geometry do all the rendering/collision detection, and thereby maintain backwards compatibility for those that need it. Robert. Robert. _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
