Sign in to follow this  

Extract ALL the vertex data in a Mesh

This topic is 4686 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

lets say for example that i plan to use a big mesh for my Level, i modelled it using package like 3dsmax then export it as .X mesh, I modeled my level with lots of Objects in the scene Question: How can i retrive ALL the vertex in the mesh? DO i need to loop all Frame and extract the mesh data to get my vertices? Is retriving vertex data from a Skinned Mesh and Static Mesh different? Can somebody show me some code :) (pls excuse my english since im a korean) thanks

Share this post


Link to post
Share on other sites
Well i have had a quick look in the SDK for mesh properties etc and it appears that you can do this.


LPD3DXMESH myMesh;
LPDIRECT3DVERTEXBUFFER9 myBuff;

// Load mesh here from file etc
myBuff = myMesh->getVertexBuffer();





Then you can read the vertices out of this by locking it at the start and memcopying to an STL::vector or something. Then unlock it again.

This should work although ive never tried it...

ace

Share this post


Link to post
Share on other sites
Then how can i extract the number of Polygons it contains? and also the vertices for these polygons?
Does static mesh also stores different polygon in a Frame Heirarchy? or only SKinned Mesh does that?

Share this post


Link to post
Share on other sites
Quote:
Then how can i extract the number of Polygons it contains?

To get the polygon count you can use GetNumFaces.
Quote:
and also the vertices for these polygons?

Use LockIndexBuffer
Quote:
Does static mesh also stores different polygon in a Frame Heirarchy? or only SKinned Mesh does that?

If I understand the question, the answer is neither. There is only one instance of the mesh each frame in the hierarchy points to the single mesh instance. Depending on the skinning system, each vertex is bound (usually by index) to a set of bones and has a set of weights for these bones.
The mesh in rendered is subsets, grouped by attributes.

Share this post


Link to post
Share on other sites

This topic is 4686 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this