[osg-users] Getting texture coordinates and normals of each vertex of a loaded model

Alberto Luaces aluaces at udc.es
Mon Jul 28 02:09:20 PDT 2008


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.
>



More information about the osg-users mailing list