Domanda

I am building a physic engine in Ogre3d and I need to have access to the vertices. I searched the wiki and found http://www.ogre3d.org/tikiwiki/tiki-index.php?page=RetrieveVertexData

But it behaves super strange. I have a cube and the function RetrieveVertexDataoutputs 24 vertices and 32 indices, but I expected 8 vertices and 4*4 indices(or4*3*2 indices if the cube is build with triangles).

Is there another way to access the vertices of a mesh?

È stato utile?

Soluzione

Keep in mind that a vertex is more than just a position. There's 24 vertices because each face needs 4 vertices to itself. A vertex can't be shared with the other two faces touching it, because it has a distinct normal from them.

If you want unique vertex positions, just sort the returned list and remove the duplicates.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top