Jump to content
  • Advertisement
Sign in to follow this  
devronious

returning verts from mesh...

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

will this return the vertices of my mesh???
[source lang=c#]
VertexBuffer vb = mesh.VertexBuffer;
int[] p = { mesh.mesh.NumberVertices };
Array na = vb.Lock(0, typeof(Vector3), LockFlags.ReadOnly, p);

thanks, Devin

Share this post


Link to post
Share on other sites
Advertisement
I am not really experienced with MDX, but I will give it a shot. I was looking at the documentation here and just about everything you are doing seems right. Except for the 2nd parameter, the type of the vertex structure. Are you sure that the vertex structure of this VB is just a Vector3? Normally, you are going to have a structure with multiple members, such as:

struct MyVertexStruct
{
Vector3 position;
Vector3 normal;
Vector2 texCoords;
};


Beyond that, are you getting any messages from the debug output?

Share this post


Link to post
Share on other sites
Sure looks ok to me other than what Mr. Dustin Franklin talked about.

using (VertexBuffer vb = mesh.VertexBuffer)
{
int[] p = {mesh.NumberVertices};
Array ar = vb.Lock(0, typeof(CustomVertex.PositionNormalTextured), LockFlags.None, p);
}


This should work. Remember that you can get the mesh's vertex format from the Mesh.VertexFormat property and then plug that into the appropriate field for the lock method.

I hope this helps.
Take care.
PS: thanks for Dustin that highlighted the fact of the vertex format.

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!