Problem reading mesh vertices

Recommended Posts

hey guys i am using this function to get vertex data from a mesh but i am having an error when i want to use these vertexs so i don't get the same result of the original mesh vertexs the vertexs are arranged like circles but not like the ellipse mesh i have plz see this sourse for the function i used and the pictures that shows 1st the vertexs as points and the ellipse that i took the vertex from it which is around the car and in the 2nd picture see when i draw the triangles of the vertexs in white collor it gave me a terrible shape
private PositionNormalTexVertex[] vbData;
public struct PositionNormalTexVertex
{
public Vector3 Position;
public Vector3 Normal;
public  float Tu0, Tv0;
public static readonly VertexFormats FVF = VertexFormats.Position | VertexFormats.Texture1;
}
{
//Create a vertex buffer in the managed pool
VertexBuffer vb = BoundMeshClass.mesh.VertexBuffer;
//Fill an array of the appropriate type with the VB data using Lock()
//This lock overload simply locks the entire VB -- setting ReadOnly can improve perf when reading a vertexbuffer
vbData = vb.Lock(
0, typeof(PositionNormalTexVertex),
LockFlags.None, BoundMeshClass.mesh.NumberVertices) as
PositionNormalTexVertex[];

//Unlock the buffer
vb.Unlock();
vb.Dispose();
}


[Edited by - Muhammad Haggag on November 13, 2005 2:47:16 AM]

Share on other sites
how to add pictures ????????????? it's in a:\1.jpg and a:\2.jpg

Share on other sites
Upload them to someplace like http://tinypic.com/ and post the link in here.

Share on other sites
see the pictures on those links plz and thanks DrEvil

http://tinypic.com/flztc6.jpg

http://tinypic.com/flzti8.jpg

Share on other sites
Could be that you're not specifying the normal in the FVF.

Share on other sites

no i don't think so , i tried it but the same problem :(

Share on other sites

it is a littel better see it in this picture on the following URL : http://tinypic.com/fm0zuv.jpg

Share on other sites
Are you sure that the mesh data you are locking is in the same format as you're extracting? if it isn't then you'll get all sorts of funky corruption [grin]

Check the FVF you're using against the one that the mesh reports; if they're *not* the same then you've found your problem.

Secondly, meshes tend to have index buffers to arrange the vertices into actual triangles - which is probably part of the reason why you're getting a complete mess when you try to render the vertex data as triangles (second picture).

hth
Jack

Share on other sites
You have managed to skillfully ignore not only the sticky rules thread and the Forum FAQ, but also common sense. There's nothing important about your thread. It's a thread, like every other thread. Except it's given a meaningless title.

Thread closed. Don't try to create another on the same problem, because I'll delete it. Read the rules. And follow them.

EDIT: Now that you've hopefully read the rules, thread re-opened. However, the next time you break the rules, I will suspend you.

[Edited by - Muhammad Haggag on November 13, 2005 2:27:20 AM]

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

• Forum Statistics

• Total Topics
627736
• Total Posts
2978868

• 10
• 10
• 21
• 14
• 12