Ruud,
I got a little further today with my first 3-D file loader. Figured I'd post
this here so others could copy it and ask similar questions too :-) I'm
opening up a DOF file in binary as you said to do, reading in 4 bytes at a time
and am finding lots of the GOB1's, VERT's, etc., as shown on your site,
scattered throughout the file. I'd like to try and get a nothing but a list of
triangle vertices loaded for starters. Strange thing though, when doing this
with the Ferrari file, I find on only 33 GOB1's, with 33 VERT's. These
indicate the beginning of a list of vertices, right?
If so, when I hit the first GOB1 and VERT, I check the next 4-byte chunk
(after VERT), reading it in as a long integer. This gives the number of
vertices coming up. Then, if I start reading in data as floats, I'm getting
one vertex at a time from there on out (until some other GOB1 or something
similar is hit), right?
Problem is, I'm seeing numbers that range from 1*10^-33 to 1*10^+23 at first
glance. I'll try loading them as different data types. What approximate range
of values should I be seeing here?
Thanks,
Todd Wasson
---
Performance Simulations
Drag Racing and Top Speed Prediction
Software
http://PerformanceSimulations.Com
Whoops! Hold on a second, think I might have just got it. When reading in
the vertex data, I was not moving the pointer ahead four byes at a time when
moving through the vertex list (reading in as floats). Now, the first 3 sets
of vertices shown in the Ferrari "body.dof" file are:
(1) 3.363116E-44 (Wrong probably, why? Wrong address?), -.436, .186
(2) .985,-.435,.176
(3) 1.123, .429, .186
Is this right?
Thanks,
Todd Wasson
---
Performance Simulations
Drag Racing and Top Speed Prediction
Software
http://PerformanceSimulations.Com
One more thing :-) Going through the entire file, I'm finding 17940
vertices. Dividing by three would indicate 5980 triangles in the Ferrari.
Seems rather high. Is this right? Also, the very first vertex loaded after
VERT is still a bizarre number every time. Any idea what I might be doing
wrong there?
Thanks,
Todd Wasson
---
Performance Simulations
Drag Racing and Top Speed Prediction
Software
http://PerformanceSimulations.Com
On 15 Jul 2001 18:43:18 GMT, [email hidden] (J. Todd Wasson) wrote:
> Ruud,
>
> I got a little further today with my first 3-D file loader. Figured I'd post
>this here so others could copy it and ask similar questions too :-)
Ah, gee, I went to Ireland and have been busy on the Racer forum, so
it's just now that I saw this. :)
Yes, vertex information:
VERT; vertices (triangle data only)
int vertices;
float vertex[vertices*3];
BUT make sure that the first 'int32' you read after VERT is the length
of the VERT chunk. So it will be sizeof(int)+vertices*3*sizeof(float).
This is because you might not handle the VERT chunk, and want to skip
it; you can just skip 'chunkLen' bytes.
> If so, when I hit the first GOB1 and VERT, I check the next 4-byte chunk
>(after VERT), reading it in as a long integer. This gives the number of
>vertices coming up.
As above, this is probably the chunk length, and only the NEXT
(4-byte) integer gives you the number of vertices.
Note that the number of actually DRAWN vertices is given by the INDI
chunks; since OpenGL can handle indexed vertices (which has some
advantages with caching and geometry/lighting), these are used to
point into the vertex array and pick out the correct vertex/normal
pairs.
> Then, if I start reading in data as floats, I'm getting
>one vertex at a time from there on out (until some other GOB1 or something
>similar is hit), right?
You read nVertices*{ float vertex[3] } yes. Don't check for chunk you
know about, just read the exact number of vertices.
> Problem is, I'm seeing numbers that range from 1*10^-33 to 1*10^+23 at first
>glance. I'll try loading them as different data types. What approximate range
>of values should I be seeing here?
The float should probably not exceed 10 or so; Racer uses 1.0f = 1
meter.
Hope this helps,
Ruud van Gaal, GPL Rank +53.25
Pencil art : http://www.marketgraph.nl/gallery/
Free car sim : http://www.marketgraph.nl/gallery/racer/
Quoted text (7 lines)
> I'm >opening up a DOF file in binary as you said to do, reading in 4 bytes at a time >and am finding lots of the GOB1's, VERT's, etc., as shown on your site, >scattered throughout the file. I'd like to try and get a nothing but a list of >triangle vertices loaded for starters. Strange thing though, when doing this >with the Ferrari file, I find on only 33 GOB1's, with 33 VERT's. These >indicate the beginning of a list of vertices, right?On 15 Jul 2001 19:02:32 GMT, [email hidden] (J. Todd Wasson) wrote:
> Whoops! Hold on a second, think I might have just got it. When reading in
>the vertex data, I was not moving the pointer ahead four byes at a time when
>moving through the vertex list (reading in as floats). Now, the first 3 sets
>of vertices shown in the Ferrari "body.dof" file are:
>
>(1) 3.363116E-44 (Wrong probably, why? Wrong address?), -.436, .186
First might probably be the nVertices integer that you needed. So
you're probably using the chunk length as the vertex count (the chunk
length is probably about 12x that of the vertex count).
That would also explain finding 5900 or so vertices; it's more like
1590 (try Modelers' information button, it gives the #poly's).
Ruud van Gaal, GPL Rank +53.25
Pencil art : http://www.marketgraph.nl/gallery/
Free car sim : http://www.marketgraph.nl/gallery/racer/
Ruud!!
You went to Ireland and didnt come to visit!! I am offended! :)
Ash - see if I care <g>
| Ah, gee, I went to Ireland and have been busy on the Racer forum, so
| it's just now that I saw this. :)
|
On Thu, 19 Jul 2001 12:06:49 +0100, "Ashley McConnell"
<[email hidden]> wrote:
>Ruud!!
>
>You went to Ireland and didnt come to visit!! I am offended! :)
Ah, ofcourse the Mc should have given your location away. :) Sorry,
Ash! ;-)
I was in Spiddal, near Galway, but it was quite a hop in, lots of
work, a Guinness (too bitter for me, so I switched to Smithwicks and
whiskey), and hop out.
Ruud van Gaal, GPL Rank +53.25
Pencil art : http://www.marketgraph.nl/gallery/
Free car sim : http://www.marketgraph.nl/gallery/racer/
Ahhh, you were VERY VERY far away.....thats ok then :)
If you are ever coming up North anywhere, you have a place to stay!
All the best,
Ash
"Ruud van Gaal" <[email hidden]> wrote in message
news:[email hidden]...


































