r_model_alias.h
Go to the documentation of this file.00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef R_MODEL_ALIAS_H
00027 #define R_MODEL_ALIAS_H
00028
00029 #define MODEL_MAX_PATH 64
00030 #define MAX_ALIAS_TRIS 4096
00031 #define MAX_ALIAS_VERTS 8192
00032
00033 #define mAliasCoord_t vec2_t
00034
00035 typedef struct mAliasVertex_s {
00036 vec3_t point;
00037 vec3_t normal;
00038 } mAliasVertex_t;
00039
00040 typedef struct mAliasComplexVertex_s {
00041 vec3_t point;
00042 vec3_t normal;
00043 vec4_t tangent;
00044 } mAliasComplexVertex_t;
00045
00046 typedef struct mAliasBoneMatrix_s {
00047 vec4_t matrix[3];
00048 } mAliasBoneMatrix_t;
00049
00050 typedef struct mAliasBoneVertex_s {
00051 vec3_t origin;
00052 float influence;
00053 vec3_t normal;
00054 unsigned int bonenum;
00055 } mAliasBoneVertex_t;
00056
00057 typedef struct mAliasFrame_s {
00058 vec3_t mins, maxs;
00059 vec3_t translate;
00060 vec3_t scale;
00061 float radius;
00062 mAliasBoneMatrix_t *boneMatrix;
00063 } mAliasFrame_t;
00064
00065 typedef struct mAliasTagOrientation_s {
00066 vec3_t origin;
00067 float axis[3][3];
00068 } mAliasTagOrientation_t;
00069
00070 typedef struct mAliasTag_s {
00071 char name[MODEL_MAX_PATH];
00072 mAliasTagOrientation_t orient;
00073 } mAliasTag_t;
00074
00075 typedef struct mAliasSkin_s {
00076 char name[MODEL_MAX_PATH];
00077 int shader;
00078 image_t *skin;
00079 } mAliasSkin_t;
00080
00081 typedef struct mIndexList_s {
00082 int length;
00083 int32_t *list;
00084 } mIndexList_t;
00085
00086 typedef struct mAliasMesh_s {
00087 int32_t num_verts;
00088 char name[MODEL_MAX_PATH];
00089 mAliasVertex_t *vertexes;
00090 mAliasCoord_t *stcoords;
00091
00092
00093 vec_t *verts;
00094 vec_t *texcoords;
00095 vec_t *normals;
00096 vec_t *tangents;
00097 vec_t *next_verts;
00098 vec_t *next_normals;
00099 vec_t *next_tangents;
00100
00101 int num_tris;
00102 int32_t *indexes;
00103 mIndexList_t *revIndexes;
00104
00105 int num_bones;
00106 mAliasBoneVertex_t *bonesVertexes;
00107
00108 int num_skins;
00109 int skinHeight;
00110 int skinWidth;
00111 mAliasSkin_t *skins;
00112 } mAliasMesh_t;
00113
00114 #define MAX_ANIMS 128
00115 #define MAX_ANIMNAME 16
00116
00117 typedef struct mAliasAnim_s {
00118 char name[MAX_ANIMNAME];
00119 int from, to;
00120 int time;
00121 } mAliasAnim_t;
00122
00123 typedef struct mAliasBone_s {
00124 char name[MAX_VAR];
00125 int flags;
00126 int parent;
00127 } mAliasBone_t;
00128
00129 typedef struct mAliasModel_s {
00130 int num_frames;
00131 mAliasFrame_t *frames;
00132 int curFrame;
00133 int oldFrame;
00134
00135 int num_tags;
00136 mAliasTag_t *tags;
00137
00138 int num_meshes;
00139 mAliasMesh_t *meshes;
00140
00141 int num_bones;
00142 mAliasBone_t *bones;
00143
00145 char animname[MAX_QPATH];
00146 int num_anims;
00147 mAliasAnim_t *animdata;
00148 int curAnim;
00149
00151 char tagname[MAX_QPATH];
00152 void *tagdata;
00153 } mAliasModel_t;
00154
00155 void R_ModLoadAnims(mAliasModel_t *mod, void *buffer);
00156 qboolean R_ModLoadMDX(struct model_s *mod);
00157 void R_ModCalcUniqueNormalsAndTangents(mAliasMesh_t *mesh, int nFrames, float smoothness);
00158 void R_FillArrayData(mAliasModel_t* mod, mAliasMesh_t *mesh, float backlerp, int framenum, int oldframenum, qboolean prerender);
00159 void R_ModLoadArrayData(mAliasModel_t *mod, mAliasMesh_t *mesh, qboolean loadNormals);
00160 #endif