#include <tr_types.h>
Public Attributes | |
tr5_vertex_t | bbox_low |
tr5_vertex_t | bbox_high |
tr5_vertex_t | offset |
std::vector< tr5_vertex_t > | rotations |
bit32 | byte_offset |
Frames indicates how composite meshes are positioned and rotated. They work in conjunction with Animations[] and Bone2[].
A given frame has the following format: short BB1x, BB1y, BB1z // bounding box (low) short BB2x, BB2y, BB2z // bounding box (high) short OffsetX, OffsetY, OffsetZ // starting offset for this moveable (TR1 ONLY: short NumValues // number of angle sets to follow) (TR2/3: NumValues is implicitly NumMeshes (from moveable))
What follows next is a list of angle sets. In TR2/3, an angle set can specify either one or three axes of rotation. If either of the high two bits (0xc000) of the first angle unsigned short are set, it's one axis: only one unsigned short, low 10 bits (0x03ff), scale is 0x100 == 90 degrees; the high two bits are interpreted as follows: 0x4000 == X only, 0x8000 == Y only, 0xC000 == Z only.
If neither of the high bits are set, it's a three-axis rotation. The next 10 bits (0x3ff0) are the X rotation, the next 10 (including the following unsigned short) (0x000f, 0xfc00) are the Y rotation, the next 10 (0x03ff) are the Z rotation, same scale as before (0x100 == 90 degrees).
Rotations are performed in Y, X, Z order. TR1 ONLY: All angle sets are two words and interpreted like the two-word sets in TR2/3, EXCEPT that the word order is reversed.