the memblock setup is
(positions are done in bytes from 0)
position 0 - dword (4byte) = fvf version
position 4 - dword (4byte) = size of vertex data
position 8 - dword (4byte) = number of vertex
then you have the vertex data which the first bit of data always starts at position 12 as this is the size of the header (the data above)
so each vertex offset would be
offset = 12 + ( vertexnumber * size of vertex data )
FVF is an odd format which doesn't have a specific setup, so your vertex data setup although linear in design can change
the fvf version 338 (standard db version) includes the following data
Vertex Position
Vertex Normal
Vertex Colour
Vertex Texture Coords
the position & normal are a 3D vector which means 3 floats to represent X Y Z
position offset+0 - float (4byte) = x position
position offset+4 - float (4byte) = y position
position offset+8 - float (4byte) = z position
position offset+12- float (4byte) = x normal
position offset+16- float (4byte) = y normal
position offset+20- float (4byte) = z normal
a normal is just the default position of a standard light, when more than one vertex uses the same normal (lightsource) this allows them to blend together to create a smooth shading across the surface.
next you have the vertex colour aka diffuse colour, this is a simple RGB() value (which is a dword)
position offset+24- dword (4byte) = diffuse colour (rgb(red,green,blue))
and finally we have the texture points, these are float values which tell the program where on a bitmap the vertex is positioned ...
its from 0.0-100.0 so for a 256x256 bitmap 0=0pixel and 100=256pixel, the program calculates based on the size where you vertex would actually be then displays the image across the surface based on where the other three vertex in the face are.
position offset+28- float (4byte) = width (u) texture coord
position offset+32- float (4byte) = height(v) texture coord
there are more formats that FVF can follow, and in the help they are listed within the order in which you use them,
Vertex & Normal Data
Extra Data (Colours and such)
Texture Data
is really the entire setup, and they'll appear in the memblock in the exact order listed here
`// position & normal
FVF_XYZ=0x002 `(float3)
FVF_XYZRHW=0x004 `(float4)
FVF_XYZB1=0x006 `(float4)
FVF_XYZB2=0x008 `(float5)
FVF_XYZB3=0x00a `(float6)
FVF_XYZB4=0x00c `(float7)
FVF_XYZB5=0x00e `(float8)
FVF_NORMAL=0x010 `(float3)
`// extras
FVF_PSIZE=0x020 `(dword)
FVF_DIFFUSE=0x040 `(dword)
FVF_SPECULAR=0x080 `(dword)
`// texture coords
FVF_TEX0=0x000 `(no data)
FVF_TEX1=0x100 `(float2)
FVF_TEX2=0x200 `(float3)
FVF_TEX3=0x300 `(float4)
FVF_TEX4=0x400 `(float5)
FVF_TEX5=0x500 `(float6)
FVF_TEX6=0x600 `(float7)
FVF_TEX7=0x700 `(float8)
FVF_TEX8=0x800 `(float9)
theres obviously a little more to it, and if you use
FVF_XYZRHW instead of
FVF_XYZ or
FVF_XYZBn then you don't use Normal
to declare a new FVF Type all you do select which of the FVF setup you want to use, the you declare it by using the values above using a '||' between them and then using the Convert Object FVF command.
so like
Convert Object FVF object, (FVF_XYZ||FVF_NORMAL||FVFTEX1)