Re: How I learned to stop worrying and love Ldraw. (Subtitle: questions for programmers)
2012-12-18, 3:07
2012-12-18, 3:07
Paul Griffin Wrote:-How do you approach non-certified BFC files? Do you check for bowtied parts? Do you treat it as uncertified even if it only contains subparts/primitives? Unfortunately, due to resource limitations, I cannot simply duplicate every noncertified polygon I come across, so I've had to learn to process said polygons as if they are two-sided (which has NOT been fun). I cannot recall, but somewhere between 2997/2998 and 6581/6582, I encountered flipped polygons, bowtied polygons, and more...enough that I have a headache from all that checking.
If you look at the BFC spec, you will see that it's perfectly valid to have a BFC certified file with non-BFC certified sections, so BFC certification isn't actually on a file-by-file basis, but a line-by-line basis. LDView determines the BFC status of every line while loading, and sends all the non-BFC-certified lines to a separate section, where both sides are rendered and lit. All the rest are rendered based on the final BFC state determined by the BFC certification. LDView enables OpenGL's two-sided lighting and disables back-face-culling for non-certified geometry. I'm sure this could be done in OpenGL ES 2 with a proper shader if you wanted. However, it probably makes more sense to just treat non-certified polygons as two back-to-back polygons, because my experience has been that there are more and more BFC-certified parts as time goes by.
LDView does check for bow-tie quads. These can be auto-corrected in non-BFC geometry. In BFC geometry, bow-tie quads are an outright error, so LDView disables BFC for them if it detects them (and then corrects). (I don't think the official library has any bow-tie quads in BFC-certified portions of files.)