Coordinates of mesh  
Author Message
M.A.T





PostPosted: Game Technologies: General, Coordinates of mesh Top

Hi..

I create a mesh with loading from a x.File

How can I set/change the coordinates of the meshsurface

thanks



Game Technologies: DirectX, XNA, XACT, etc.1  
 
 
Etienne2005





PostPosted: Game Technologies: General, Coordinates of mesh Top

In a mesh you have a Vertex Buffer and an Index Buffer

Each vertex in the Buffer is defined with a FVF (flexible vertex format)

So sometime you only have x,y,z value

Most of the time it comes with u,v value for the texture coordinate

and with a color value (diffuse color)

Some time you get a normal vector also

You need to know the FVF of your mesh

Then when you lock a pointer to the buffer you can use your structure to access
Those value and set them

struct MyStructFVF{

float x,y,z;

float u,v;

}

MyStructFVF myBuffer;

Lock this ptr on your vertex buffer and you can access each vertex to change u,v

coordinate for the texture...


 
 
The ZMan





PostPosted: Game Technologies: General, Coordinates of mesh Top

Check out

http://msdn.microsoft.com/coding4fun/zman/zmanTextures/default.aspx

In this article I modify the normals for a mesh but you can use the same code to modify the coordinates.