Please see the section on Normals:
http://www.linux.ucla.edu/~phaethon/q3/formats/md3format.html
Here is my code:
Am I doing this right?
http://www.linux.ucla.edu/~phaethon/q3/formats/md3format.html
Decoding: (Code in q3tools/q3map/misc_model.c:InsertMD3Model) lat <- ((normal shift-right 8) binary-and 255) * (2 * 360.0 ) / 255 lng <- (normal binary-and 255) * (2 * 360.0) / 255 x <- cos ( lat ) * sin ( lng ) y <- sin ( lat ) * sin ( lng ) z <- cos ( lng )
Here is my code:
normal=ReadShort(f) lat# = (Float(( normal Shr 8 ) & 255 ) * (2.0 * Pi ) / 255.0) lng# = (Float( normal & 255 ) * (2.0 * Pi) / 255.0) nx# = Cos ( lat ) * Sin ( lng ) ny# = Sin ( lat ) * Sin ( lng ) nz# = Cos ( lng )
Am I doing this right?