Ahh, i spent like 10 minutes trying to decide where to post this -_- Sorry if this is the wrong forum :/
Im trying to read mesh data from a memblock. My problem is it seems data is arranged differently depending on the FVF version? The manual gives the data layout for 338, unfortunatly any mesh i try to use (be it loaded or made from a dbp primitive!) tells me its FVF is 274.
I can read out the FVF version, FVF size, Vertice count for the mesh and the combined size of all vertex data fine, but when i start trying to read the vertex data I get my problems. Unfortunatly, because im reading it how the manual describes for FVF 338 I dont know if my errors are coding faults or simply if the code would work fine for 338 but my 274's are arranged differently and its exploding on me. Anyone got a link to a page about the different FVF versions and how their data is laid out so I account for all the version? I would probably use a select statement on the FVF version i guess and read accordingly. Unless anyone knows a peice of code that works for all and reads all mesh data fine? Any info appreichated.
Incase anyone is intrested, heres the code i got down currently to read my mesh data:
RemStart *******************************************************
Show Mesh Data
Returns information about the mesh number it was called with
Vars:
FVF = FVF Version
FVFS = FVF Size (size in bytes of a single vertex element)
NVTX = Num VerTeX - Number of vertexes in this mesh
VDS = Vertex data size
VTXX = Vertex Position X
VTXY = Vertex Position Y
VTXZ = Vertex Position Z
NRMX = Normal X Position
NRMY = Normal Y Position
NRMZ = Normal Z Position
DCOL = Diffuse Colour for vertex
U/V = U/V texture co-ordinates
********************************************************* RemEnd
Function ShowMeshData(Mesh)
Make Memblock From Mesh 1, Mesh
FVF = Memblock Dword(1, 0)
FVFS = Memblock Dword(1, 4)
NVTX = Memblock Dword(1, 8)
VDS = NVTX * FVFS
Text 0, 0, "Mesh FVF: " + Str$(FVF)
Text 0, 15, "Mesh FVF Size: " + Str$(FVFS)
Text 0, 30, "Mesh Vertex Count: " + Str$(NVTX)
Text 0, 45, "Size of vertex data: " + Str$(VDS)
For CurrentMem = 12 to VDS Step FVFS
VTXX = Memblock Float (1, CurrentMem)
VTXY = Memblock Float (1, CurrentMem + 4)
VTXZ = Memblock Float (1, CurrentMem + 8)
NRMX = Memblock Float (1, CurrentMem + 12)
NRMY = Memblock Float (1, CurrentMem + 16)
NRMZ = Memblock Float (1, CurrentMem + 20)
DCOL = Memblock DWord (1, CurrentMem + 24)
U = Memblock Float (1, CurrentMem + 28)
V = Memblock Float (1, CurrentMem + 32)
rem would usually use text statements here to print it all out
Next CurrentMem
Delete Memblock 1
EndFunction
p4 2.4ghz, 256ddr ram, Geforce4 MX 440
Innovate, redefine, recreate whats in your mind. It isnt fate, you decide, only you can cross that line.