Jump to content
  • Advertisement
Sign in to follow this  
kandemor

Getting vertex and indices from x mesh

This topic is 4777 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

Hello, I make a collision system that works fine with static data and now I want to add support to dynamic data (animated meshes). I'm using X meshes for my animated data and I need to know the position of its vertices in each period of time. How can I do it? Thank you!

Share this post


Link to post
Share on other sites
Advertisement
In animated meshs you do not need vertex positions because they are the same in every frame. List of matrices are data that represents animation, so if you need position of every vertex in some point of time just multiply vertex with animation matrix.

To get vertices just Lock/Unlock vertex buffer:

VERTEX *v;
Mesh->LockVertexBuffer(0, (void**)&v);
// do what you need
Mesh->UnlockVertexBuffer();

Ofcourse, better solution is to make copy of vertices in memory rather than using Lock/Unlock sequence.


Best,
Zaharije Pasalic

Share this post


Link to post
Share on other sites
So I can do this once at loading time and recalc the transformation matrix every frame in order to calculate the exact position of each vertex, isn't it?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!