Thanks for the fix Andreas, I've now merged it with svn/trunk. Cheers, Robert.
On Mon, Oct 5, 2009 at 1:34 PM, Andreas Goebel <[email protected]> wrote: > Robert Osfield schrieb: >> Hi Andreas, >> >> Thanks for the test file. I can confirm the bug at my end. My guess >> it's a bug in the geometry code for the cylinder in >> ShapeDrawable::accept(PrimtiveFunctor&). I'm not in a position to >> dive in a fix this bug right away. Can yourself or someone else help >> out? >> >> Robert. >> > Hi, > > I扉e found and fixed the error. It愀 in that function of ShapeDrawable.cpp: > void PrimitiveShapeVisitor::createCylinderBody(unsigned int numSegments, > float radius, float height, const osg::Matrix& matrix) > { > const float angleDelta = 2.0f*osg::PI/(float)numSegments; > > const float r = radius; > const float h = height; > > float basez = -h*0.5f; > float topz = h*0.5f; > > float angle = 0.0f; > > _functor.begin(GL_QUAD_STRIP); > > for(unsigned int bodyi=0; > bodyi<numSegments; > ++bodyi,angle+=angleDelta) > { > float c = cosf(angle); > float s = sinf(angle); > > _functor.vertex(osg::Vec3(c*r,s*r,topz) * matrix); > _functor.vertex(osg::Vec3(c*r,s*r,basez) * matrix); > } > > // do last point by hand to ensure no round off errors. > _functor.vertex(osg::Vec3(r,0.0f,topz) * matrix); > _functor.vertex(osg::Vec3(r,0.0f,basez) * matrix); > > _functor.end(); > } > > In the "done by hand"-point you forgot to multiply with matrix. > > I attach the whole file with the correction. OsgPick and my own software > now work as expected. > > Regards, > > Andreas > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

