User Guide

3D Gamestudio Programmer's Manual
© Conitec July 2002
19
typedef struct {
long type; // 0 for byte-packed positions, and 2 for word-packed positions
mdl_trivertx_t bboxmin,bboxmax; // bounding box of the frame
char name[16]; // name of frame, used for animation
mdl_trivertx_t vertex[numverts]; // array of vertices, either byte or short packed
} mdl_frame_t;
Thesizeofeachframeis
sizeframe = 20 + (numverts+2) * sizeof(mdl_trivertx_t)
,
while
mdl_trivertx_t
is either
mdl_trivertxb_t
or
mdl_trivertxs_t
, depending on
whether the type is 0 or 2. In the MDL3 format the type is always 0. The beginning of the
frames can be found in the .MDL file at offset
baseframes = basetri + numtris *
sizeof(mdl_triangle_t)
.
MDL bones
This is for future expansion of the MDL format, and not supported yet.
Bones are a linked list of 3D vertices that are used for animation in the MDL5 format. Each bone
vertex can have a parent, and several childs. If a bone vertex is moved, the childs move with it.
If on moving a bone vertex the connection line to his parent rotates, it's childs are rotated
likewise about the parent position. If the distance of the bone vertex to its parent changes, the
change is added onto the distance between childs and parent. So the movement of the childs is
done in a spherical coordinate system, it is a combination of a rotation and a radius change.
Each bone vertex has an influence on one or more mesh vertices. The mesh vertices influenced
by a bone vertex move the same way as it's childs. If a mesh vertex is influenced by several
bone vertices, it is moved by the average of the bone's movement.