I am writing a animator/format converter for Unreal Tournament...game related, I know.
Anyway, I need a little help with this algorithm from 3DS2UNR developed by Legend Entertainment:
Packed Vertex = ( int( v.X * 8.0 ) & 0x7ff ) |
(( int( v.Y * 8.0 ) & 0x7ff ) << 11 ) |
(( int( v.Z * 4.0 ) & 0x3ff ) << 22 )
I can tell you also that:
* v.X, v.Y, and v.Z are all 4-byte floats
* Packed Vertex is a single 4-byte signed integer
Now I'm guessing that the program multplies each vertex by either 8.0 (x, y ) or 4.0 (z). However, I am not too sure as what exactly the bitwise AND operator (&) or the | operator do.
I know it would be asking a lot for the exact manner in which this algorithm works but if anyone could shed any light it would be greatly appreciated!
Thanks