Jump to content

OBD:CRSA: Difference between revisions

240 bytes removed ,  27 December 2006
m
mNo edit summary
m (→‎Corpses: matrix)
Line 70: Line 70:
*A space for notes (160 bytes) : often the name of the file the corpse was taken from when packing the array.
*A space for notes (160 bytes) : often the name of the file the corpse was taken from when packing the array.
*A link to the [[OBD:ONCC|ONCC]] (model that should be used for the corpse) : that's 4 bytes as usual.
*A link to the [[OBD:ONCC|ONCC]] (model that should be used for the corpse) : that's 4 bytes as usual.
*Then, 19 bones, each of them defined by absolute orientation and position (unlike in a [[OBD:TRAM/raw0x34|TRAM]], where orientations are relative)<br>Every bone is (3*3 + 3)*4 = 48 bytes, so that's 19*48 = 912 bytes.
*Then, 19 bones, each of them defined by absolute position and transformation matrix<br>Every bone is (3*3 + 3)*4 = 48 bytes, so that's 19*48 = 912 bytes.
*Finally, an axis-aligned bounding box (2*3*4 = 24 bytes)
*Finally, an axis-aligned bounding box (2*3*4 = 24 bytes)
The total size of a corpse is thus 1100 bytes.
The total size of a corpse is thus 1100 bytes.


;What's in a bone?:The absolute orientation is defined in a "heavy" way ''via'' an orthonormal trihedron :
;What's in a bone?
:three 3D vectors '''x''', '''y''' and '''z''', each of length 1, at right angles with each other, and ordered "directly"
:The transformation matrix and the offset.
:(like Oni's world axes : if '''x''' points left and '''y''' points up then '''z''' points to ''front'', not back).
 
:Each one of those vectors is stored as 3 floats (3*4 bytes), first '''x''', then '''y''', then '''z''' (so 3*3*4 = 36 bytes in total).
:The transformation matrix can define rotation, stretching, mirroring etc, in the following way.
:The absolute position '''R''' of a bone (of its parent node, actually) is stored as 3 floats right after the orientation trihedron.
:It can be seen as three 3D vectors '''x''', '''y''' and '''z''' (see table below).
:That's another 12 bytes, so 48 bytes in total.
 
Reminder : the 2nd coordinate of '''R''' aka ''y'' is the height; same for '''x''', '''y''' and '''z'''.
:If a bone mesh has a vertex at (x, y, z) in its native coordinates,
::then the actual position of that vertex in the level will be '''R''' + x '''x''' + y '''y''' + z '''z'''
:That's the transformation defined by the matrix and the offset '''R'''.
 
Reminder : the 2nd coordinate of '''R''' is the height; same for '''x''', '''y''' and '''z'''.


;Example:first corpse of '''00565-.CRSA''' in '''level3_Final.dat'''.
;Example:first corpse of '''00565-.CRSA''' in '''level3_Final.dat'''.