rec.autos.simulators

Racer-- DOF1 file loading

J. Todd Wass

Racer-- DOF1 file loading

by J. Todd Wass » Tue, 17 Jul 2001 03:43:18

  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://www.racesimcentral.net/

J. Todd Wass

Racer-- DOF1 file loading

by J. Todd Wass » Tue, 17 Jul 2001 04:02:32

  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

J. Todd Wass

Racer-- DOF1 file loading

by J. Todd Wass » Tue, 17 Jul 2001 04:12:31

  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

Ruud van Ga

Racer-- DOF1 file loading

by Ruud van Ga » Fri, 20 Jul 2001 19:25:31


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.

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.

You read nVertices*{ float vertex[3] } yes. Don't check for chunk you
know about, just read the exact number of vertices.

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/

Ruud van Ga

Racer-- DOF1 file loading

by Ruud van Ga » Fri, 20 Jul 2001 19:26:58


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/

Ashley McConnel

Racer-- DOF1 file loading

by Ashley McConnel » Fri, 20 Jul 2001 20:06:49

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. :)
|

Ruud van Ga

Racer-- DOF1 file loading

by Ruud van Ga » Fri, 20 Jul 2001 20:59:49

On Thu, 19 Jul 2001 12:06:49 +0100, "Ashley McConnell"


>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/

Ashley McConnel

Racer-- DOF1 file loading

by Ashley McConnel » Fri, 20 Jul 2001 21:24:19

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



| On Thu, 19 Jul 2001 12:06:49 +0100, "Ashley McConnell"
|
| >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/


rec.autos.simulators is a usenet newsgroup formed in December, 1993. As this group was always unmoderated there may be some spam or off topic articles included. Some links do point back to racesimcentral.net as we could not validate the original address. Please report any pages that you believe warrant deletion from this archive (include the link in your email). RaceSimCentral.net is in no way responsible and does not endorse any of the content herein.