Hey experts, I need help loading a file. I have never really tried loading a binary file without a component like a jpeg bmp or anything else for that matter. I have loaded my own file before without problem.
Here is my problem.
I want to load a b3d file. Its a 3d model file format. I have the info for the file format located here.
I mainly need the vrts section of the file and I can seem to follow most the file down to the vrts section then I get lost.
I can seek down to the vrts section using a loop once I get there this is what I'm trying to do.
//Read length verts
BlockRead(f, Alonginta, 4, amt);
BlockRead(f, Vflaga, 4, amt);
//read texture cords
BlockRead(f, Alongintb, 4, amt);
//read texture cords set size
BlockRead(f, Alongintc, 4, amt);
BlockRead(f, xreal, 4, amt);
BlockRead(f, yreal, 4, amt);
BlockRead(f, zreal, 4, amt);
If I have done it right so far these should be the x,y,z locations of verts placed in the model...
But the values look like this
and I don't think thats right. So I'm not sure I'm reading it right.
Then it gets really confusing because I'm not sure if any or all of this info comes next
float nx,ny,nz ;vertex normal: present if (flags&1)
float red,green,blue,alpha ;vertex color: present if (flags&2)
or if I'm supposed to start back at here or move on to the next set.
int flags ;1=normal values present, 2=rgba values present
int tex_coord_sets ;texture coords per vertex (eg: 1 for simple U/V) max=8
int tex_coord_set_size ;components per set (eg: 2 for simple U/V) max=4
So if someone could show me how to do this from the start of the file to the end or even just from the vert section down, I would really appreciate it. I have been trying to figure this out for about a week with no luck.
As you can see right now im just trying to pull the information and place it in a memo so I can learn this.
I'm using delphi 7. I would think this would be easy to do given I have the file format but I'm lost. I assigned 500 points to this because I need help asap.
Thanks in advance
Oh forgot here is a sample b3d file http://www.gecko-grotto.com/test.b3d
There should be 3 verts in the file.
If you need more info about what should be in that file or something please email me or post a reply question.
Email is email@example.com