- Add Inter-Quake Model (IQM) Format support, patch by gimhael with minor modifications by myself (#4965)
- Changed model_t::md4 to model_t::modelData - Fix R_ModelBounds for MD4, MDR and IQM models (#4966) - Support Model format fallback similar to image formats in tr_image.c, patch by Zack Middleton (#4967)
This commit is contained in:
parent
d34c6b7e0b
commit
c5e2654b54
8 changed files with 1299 additions and 140 deletions
107
code/renderer/iqm.h
Normal file
107
code/renderer/iqm.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
#ifndef __IQM_H__
|
||||
#define __IQM_H__
|
||||
|
||||
#define IQM_MAGIC "INTERQUAKEMODEL"
|
||||
#define IQM_VERSION 1
|
||||
|
||||
typedef struct iqmheader
|
||||
{
|
||||
char magic[16];
|
||||
unsigned int version;
|
||||
unsigned int filesize;
|
||||
unsigned int flags;
|
||||
unsigned int num_text, ofs_text;
|
||||
unsigned int num_meshes, ofs_meshes;
|
||||
unsigned int num_vertexarrays, num_vertexes, ofs_vertexarrays;
|
||||
unsigned int num_triangles, ofs_triangles, ofs_adjacency;
|
||||
unsigned int num_joints, ofs_joints;
|
||||
unsigned int num_poses, ofs_poses;
|
||||
unsigned int num_anims, ofs_anims;
|
||||
unsigned int num_frames, num_framechannels, ofs_frames, ofs_bounds;
|
||||
unsigned int num_comment, ofs_comment;
|
||||
unsigned int num_extensions, ofs_extensions;
|
||||
} iqmHeader_t;
|
||||
|
||||
typedef struct iqmmesh
|
||||
{
|
||||
unsigned int name;
|
||||
unsigned int material;
|
||||
unsigned int first_vertex, num_vertexes;
|
||||
unsigned int first_triangle, num_triangles;
|
||||
} iqmMesh_t;
|
||||
|
||||
enum
|
||||
{
|
||||
IQM_POSITION = 0,
|
||||
IQM_TEXCOORD = 1,
|
||||
IQM_NORMAL = 2,
|
||||
IQM_TANGENT = 3,
|
||||
IQM_BLENDINDEXES = 4,
|
||||
IQM_BLENDWEIGHTS = 5,
|
||||
IQM_COLOR = 6,
|
||||
IQM_CUSTOM = 0x10
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
IQM_BYTE = 0,
|
||||
IQM_UBYTE = 1,
|
||||
IQM_SHORT = 2,
|
||||
IQM_USHORT = 3,
|
||||
IQM_INT = 4,
|
||||
IQM_UINT = 5,
|
||||
IQM_HALF = 6,
|
||||
IQM_FLOAT = 7,
|
||||
IQM_DOUBLE = 8,
|
||||
};
|
||||
|
||||
typedef struct iqmtriangle
|
||||
{
|
||||
unsigned int vertex[3];
|
||||
} iqmTriangle_t;
|
||||
|
||||
typedef struct iqmjoint
|
||||
{
|
||||
unsigned int name;
|
||||
int parent;
|
||||
float translate[3], rotate[3], scale[3];
|
||||
} iqmJoint_t;
|
||||
|
||||
typedef struct iqmpose
|
||||
{
|
||||
int parent;
|
||||
unsigned int mask;
|
||||
float channeloffset[9];
|
||||
float channelscale[9];
|
||||
} iqmPose_t;
|
||||
|
||||
typedef struct iqmanim
|
||||
{
|
||||
unsigned int name;
|
||||
unsigned int first_frame, num_frames;
|
||||
float framerate;
|
||||
unsigned int flags;
|
||||
} iqmAnim_t;
|
||||
|
||||
enum
|
||||
{
|
||||
IQM_LOOP = 1<<0
|
||||
};
|
||||
|
||||
typedef struct iqmvertexarray
|
||||
{
|
||||
unsigned int type;
|
||||
unsigned int flags;
|
||||
unsigned int format;
|
||||
unsigned int size;
|
||||
unsigned int offset;
|
||||
} iqmVertexArray_t;
|
||||
|
||||
typedef struct iqmbounds
|
||||
{
|
||||
float bbmin[3], bbmax[3];
|
||||
float xyradius, radius;
|
||||
} iqmBounds_t;
|
||||
|
||||
#endif
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue