Hi Patrice,
I'm also glad we've killed that beast of a bug!

Two answers:
The short one: just use a pair of reasonably large and small values. I'm currently using -/+ 1,000,000.0f (w/o comma separators). I've never seen a vertex whose coords would exceed, say, -/+10,000.f on any axis even in the world coordinate system. This is usually the maximum setting of view frustum's far Z plane when observing vast 3D terrains with distant oceans and mountains.
The long one:
-- ObjReader's code is built around floats. Objector's 100% compatible C code is built around doubles. This is because it's tightly interleaved with high-level
interpreted BASIC procedures for non-time critical parts of the program flow. BASIC interpreters historically use doubles for their floating point calc, and FBSL is no exception to this rule.
-- FPU casts in C are
very costly because they aren't just textual preproc directives. Each such cast is rather coded by the compiler into a chain of FPU instructions to be executed by the FPU module on the processor's VLSI chip
at run time.
(so use floating-point casts sparingly in your C code if you're after the fastest code possible!)-- Consequently, Objector uses a double-precision set of C trig library and OpenGL functions like sin(), cos(), glNormal3
d, glVertex3
d, etc. where ObjReader would use single precision glNormal3
f, glVertex3
f and sinf(), cosf(), etc. overloads.
-- Mobj-bounds()'s original 8.43000030517578e-37f/3.40000009536743e+38f (FLT_MIN/FLT_MAX) are perfectly OK for Objector that runs in double precision but appeared too much for the FPU under the MS VC compiler digesting the ObjReader's sources.
-- Apart from different value ranges for single and double precision, the compiler may choose different sets of FPU instructions to machine-code the C sources with. FBSL's C JIT compiler prefers to use the faster set of FPU instructions that neglect FPU overflows and automatically and transparently recover the FPU state back to normal after the overflow occurs. Apparently the MS VC compiler prefers to follow another strategy under similar circumstances.
Seriously, a bug of such type would be difficult to crack for a casual C programmer. We are lucky to have a compiler developer in our ranks, even if for just one such latent bug in the entire set of ObjReader sources.
