Writing .dat to .obj converter in JS, but having BFC problems


Writing .dat to .obj converter in JS, but having BFC problems
#1
I'm writing a .dat to .obj converter in JavaScript so I can do LEGO modelling using WebGL, and the following the documentation for data interpreting is pretty straight forward, except I'm gettting weird looking inverted faces when loading several parts.

So, I took part 75535 (technic pin joiner round) and commented off the parts after the initial two inner cylindrical surfaces. This turns it into the following extremely simple .dat file:

75535.dat reduced version Wrote:0 BFC CERTIFY CCW
0 BFC INVERTNEXT
1 16 18 0 0 0 -16 0 6 0 0 0 0 6 4-4cyli.dat
0 BFC INVERTNEXT
1 16 -18 0 0 0 16 0 6 0 0 0 0 6 4-4cyli.dat

They're both inner cylinders, with the same definition, so they should both face the same direction. However, one part faces inward (correctly) and the other part faces outward (incorrectly): http://www.int13h.com/webgl/matviewer/testParse.html (four meshes, twice, visualisation of this .obj definition is at http://www.int13h.com/webgl/matviewer for the duration of this thread)

Viewing the .dat file in LDView shows two cylinders, facing inward, so the .dat file is interpreted correctly by .dat readers. However, the converted .obj data is very wrong. Somehow my parser is screwing up, but at this point the only thing I can think of is that the RT matrix for the include operation is doing something really funky, flipping the vertices to effect a reversed winding or something. I'm kind of at my wits end, following the documentation is apparently not enough to interpet the .dat format... what am I still missing here?

- Pomax

N.B: parser code is in http://www.int13h.com/webgl/matviewer/DATParser.js
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Writing .dat to .obj converter in JS, but having BFC problems - by Mike "Pomax" Kamermans - 2012-12-30, 20:16

Forum Jump:


Users browsing this thread: 1 Guest(s)