From the docs:
The first DWORD is the FVF Format, which controls which components each
vertex of your mesh will contain. The default FVF Format is 338. The second
DWORD is the FVF Size, which is the size in bytes of a single vertex
element. This size is respective of the FVF Format you specified, which has
a default of 36.
The third DWORD is the number of Vertices in your mesh. The remainder of the
memblock contains mesh data. The mesh data is a sequential list of vertices,
containing the component data arranged as specified by the FVF Format. The
default FVF Format would specify the following arrangement of data within
the vertex element, which is duplicated for every vertex specified in the
memblock. Each grouping of three vertices makes a polygon. Given the default
FVF Format of 338, the first three FLOAT values (12 bytes) of the vertex
element would be the XYZ coordinates in model space. The second three FLOAT
values (12 bytes) of the vertex element would be the normals coordinates in
model space. The next DWORD is a diffuse colour component that specifies the
colour of the vertex. The last two FLOATS are UV texture coordinates for the
vertex. This adds up to 36 bytes which is the size of a single vertex.
Multiply 36 by the number of vertices in the mesh and you get the overall
size of the mesh data.
So to grab vertex data (when passed a memblock):
DARKDLL DWORD CreateCollisionObjectPro(DWORD *ptrMesh)
{
using ios::out;
VEC3D vecTemp;
int i = 0;
int FVFFormat = ptrMesh[0];
int FVFSize = ptrMesh[1]/4;
num_verts = ptrMesh[2];
int vert_data_start = 3;
// this just states how many vertices we are going to use in the global
variable - it gets the arrays ready to use
DefineVerts(num_verts);
for (i = 0; i < num_verts; i++){
vecTemp.x = *((float*)&ptrMesh[vert_data_start+(i*FVFSize)]);
vecTemp.y = *((float*)&ptrMesh[vert_data_start+(i*FVFSize)+1]);
vecTemp.z = *((float*)&ptrMesh[vert_data_start+(i*FVFSize)+2]);
CreateCollisionVertex(vecTemp.x, vecTemp.y, vecTemp.z);
}
return *((DWORD*)&i);
}
"My ignorance amuses me..."
http://www.victory-road.co.uk