Rtm Binarised File Format: Difference between revisions
| mNo edit summary | mNo edit summary | ||
| Line 29: | Line 29: | ||
|   CompressedFloats |   CompressedFloats | ||
|   { |   { | ||
|    ulong nFrameTimes; |    ulong nFrameTimes;          // should always be same as nFrames | ||
|    float Array[nFrameTimes]; |    float Array[nFrameTimes]; | ||
|   } |   } | ||
| Line 40: | Line 40: | ||
|   CompressedFrames |   CompressedFrames | ||
|   { |   { | ||
|    ulong   ThisFrameNoOfBones;               // Should |    ulong   ThisFrameNoOfBones;               // Should always be same as nBones | ||
|    short   Transforms[7][ThisFrameNoOfBones]; |    short   Transforms[7][ThisFrameNoOfBones]; | ||
|   } |   } | ||
Revision as of 05:26, 30 April 2010
Structure
RTMB
{
  RTMBHeader       Header;
  byte             Always1;              // ??
  XYZTriplet       Displacement;
  ulong            nFrames;              // 55 eg
  ulong            Generally0;           // ??
  ulong            nBones;               // same value as NoOfBones
  ulong            NoOfBones;            // 128 eg
  Asciiz           BoneNames[NoOfBones]; // "weapon\0\rightarm\leftarm\etc..."
  CompressedFloats FrameTimes;
  CompressedFrames Frames[nFrames];
}
BoneNames are the traditional Bis catenated string. Unlike some however, there is no terminating null because the count is known
RTMBHeader
RTMBHeader
{
 char[4]       Type;          //"BMTR" 
 ulong         Version;       // =3
}
CompressedFloats
CompressedFloats
{
 ulong nFrameTimes;          // should always be same as nFrames
 float Array[nFrameTimes];
}
This is the traditional Bis potentially compressed structure, where, if, the total bytes stored >=1024, the array is compressed (in lzo format)
CompressedFrames
CompressedFrames
{
 ulong   ThisFrameNoOfBones;               // Should always be same as nBones
 short   Transforms[7][ThisFrameNoOfBones];
}
The short values are compressed floats (7 in total) for each 'frame'
conversion to float is
float ShortToFloat(short value) {return ((float)1.0 / (65534)) * (value + 32767);}
this is suspiciously similar to ofp compressed floats
float = short * 0.045
4 floats probably are used to describe a quaternion that describes the rotation. the other 3 floats are then for the translation
