Hi Franclin,

The references to the vertices that osg::TriangleFunctor returns point to the 
real data of the geometry, so if you subtract their pointers to the first 
vertex pointer of the geometry, you'll get the index to that vertex and you 
will be able to get its normal and UV coordinates:

Vec3 &myvertex; // From the TriangleFunctor, we want to have its normal and UV

int index = &(Mygeometry->getVertexArray[0])- &myvertex;
Vec3 normal = Mygeometry->getNormalArray[index];
Vec2 uv = (Mygeometry->getTexCoordArray(0))[index];

Alberto

El Domingo 27 Julio 2008ES 11:50:13 Franclin Foping escribió:
> Dear All,
>  Is there any algorithm in OSG to compute normals and texture coordinates
> of each vertex of a loaded model? With the osg::TriangleFunctor and
> osg::TriangleIndexFunctor, I can perfectly find out all triangles making up
> of a given node. However, the (big) issue is to be able to find out normals
> and texture coordinates of each vertex of a loaded model. Any help will be
> appreciated.
>  Waiting for your reply.
>  Franclin.
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to