The role of the osg::TriangleFunctor is to decomposs all GL_POLYGON, GL_QUADS, GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP e etc into straight triangles. This is what makes the TriangleFunctor and TriangleIndexFunctor much easier to use for polygon querry type work.
Robert.
On 8/30/06, Mustafa <[EMAIL PROTECTED]> wrote:
If the Geometry is a colletion of TriangleFan or GL_POLYGONS etc...
will this function again generate a distinct triangles from this
QUADS, POLYGONS and TRIANGLEFANs etc ?
2006/8/30, Don Burns < [EMAIL PROTECTED]>:
> Hi Jeff,
>
> An improvement would be to use a osg::Vec3Array instead of a
> std::vector<float> m_VertexList. An osg::Vec3Array is, in essence, an
> std::vector<osg::Vec3> ... . This keeps your triples together.
>
> -don
>
>
> On 8/29/06, Jeff Kershner <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> >
> > I am using the TriangleFunctor like Robert suggested to get triangle
> information. What I need is a vertex buffer that I can give to the physics
> objects. Something is not working between OSG and ODE and I am not sure if
> I am not getting the triangles correctly.
> >
> >
> >
> > This is what I do:
> >
> >
> >
> > struct Triangle
> >
> > {
> >
> > void operator() (const osg::Vec3& v1, const osg::Vec3& v2,
> const osg::Vec3& v3, bool)
> >
> > {
> >
> > m_VertexList.push_back(v1[0]);
> >
> > m_VertexList.push_back(v1[1]);
> >
> > m_VertexList.push_back(v1[2]);
> >
> >
> >
> > m_VertexList.push_back(v2[0]);
> >
> > m_VertexList.push_back(v2[1]);
> >
> > m_VertexList.push_back(v2[2]);
> >
> >
> >
> > m_VertexList.push_back(v3[0]);
> >
> > m_VertexList.push_back(v3[1]);
> >
> > m_VertexList.push_back(v3[2]);
> >
> > }
> >
> >
> >
> > std::vector<float> m_VertexList;
> >
> > };
> >
> >
> >
> > …
> >
> > osg::TriangleFunctor<Triangle> tf;
> >
> > pGeometry->accept(tf);
> >
> >
> >
> > So after this m_VertexList should be a list of all the vertices… correct?
> >
> >
> >
> > Then to create a vertex array I am doing the following:
> >
> >
> >
> > float* pVertexArray = new float[tf.m_VertexList.size()];
> >
> > int c = 0;
> >
> > for (vector<float>::iterator it = tf.m_VertexList.begin (); it !=
> tf.VertexList.end(); it++)
> >
> > pVertexBuffer[c++] = *it;
> >
> >
> >
> > Is this a correct to create a Vertex Array?
> >
> > /jk
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> > http://openscenegraph.net/mailman/listinfo/osg-users
> > http://www.openscenegraph.org/
> >
> >
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
