104 lines
2.1 KiB
C
104 lines
2.1 KiB
C
// Filename:- mdr_format.h
|
|
//
|
|
//
|
|
|
|
|
|
#ifndef MDR_FORMAT_H
|
|
#define MDR_FORMAT_H
|
|
|
|
|
|
|
|
#define MD4_IDENT (('4'<<24)+('P'<<16)+('D'<<8)+'I')
|
|
#define MD4_VERSION 1
|
|
#define MD4_MAX_BONES 128
|
|
|
|
typedef struct {
|
|
int boneIndex; // these are indexes into the boneReferences,
|
|
float boneWeight; // not the global per-frame bone list
|
|
vec3_t offset;
|
|
} md4Weight_t;
|
|
|
|
typedef struct {
|
|
vec3_t normal;
|
|
vec2_t texCoords;
|
|
int numWeights;
|
|
md4Weight_t weights[1]; // variable sized
|
|
} md4Vertex_t;
|
|
|
|
typedef struct {
|
|
int indexes[3];
|
|
} md4Triangle_t;
|
|
|
|
typedef struct {
|
|
int ident;
|
|
|
|
char name[MAX_QPATH]; // polyset name
|
|
char shader[MAX_QPATH];
|
|
int shaderIndex; // for in-game use
|
|
|
|
int ofsHeader; // this will be a negative number
|
|
|
|
int numVerts;
|
|
int ofsVerts;
|
|
|
|
int numTriangles;
|
|
int ofsTriangles;
|
|
|
|
// Bone references are a set of ints representing all the bones
|
|
// present in any vertex weights for this surface. This is
|
|
// needed because a model may have surfaces that need to be
|
|
// drawn at different sort times, and we don't want to have
|
|
// to re-interpolate all the bones for each surface.
|
|
int numBoneReferences;
|
|
int ofsBoneReferences;
|
|
|
|
int ofsEnd; // next surface follows
|
|
} md4Surface_t;
|
|
|
|
typedef struct {
|
|
float matrix[3][4];
|
|
} md4Bone_t;
|
|
|
|
typedef struct {
|
|
vec3_t bounds[2]; // bounds of all surfaces of all LOD's for this frame
|
|
vec3_t localOrigin; // midpoint of bounds, used for sphere cull
|
|
float radius; // dist from localOrigin to corner
|
|
char name[16];
|
|
md4Bone_t bones[1]; // [numBones]
|
|
} md4Frame_t;
|
|
|
|
typedef struct {
|
|
int numSurfaces;
|
|
int ofsSurfaces; // first surface, others follow
|
|
int ofsEnd; // next lod follows
|
|
} md4LOD_t;
|
|
|
|
typedef struct {
|
|
int ident;
|
|
int version;
|
|
|
|
char name[MAX_QPATH]; // model name
|
|
|
|
// frames and bones are shared by all levels of detail
|
|
int numFrames;
|
|
int numBones;
|
|
int ofsFrames; // md4Frame_t[numFrames]
|
|
|
|
// each level of detail has completely separate sets of surfaces
|
|
int numLODs;
|
|
int ofsLODs;
|
|
|
|
int ofsEnd; // end of file
|
|
} md4Header_t;
|
|
|
|
|
|
|
|
|
|
|
|
#endif // #ifndef MDR_FORMAT_H
|
|
|
|
|
|
|
|
////////////////// eof ///////////////
|
|
|