Shared alias model functions. More...
Go to the source code of this file.
Data Structures | |
struct | mAliasVertex_s |
struct | mAliasComplexVertex_s |
struct | mAliasBoneMatrix_s |
struct | mAliasBoneVertex_s |
struct | mAliasFrame_s |
struct | mAliasTagOrientation_s |
struct | mAliasTag_s |
struct | mAliasSkin_s |
struct | mIndexList_s |
struct | mAliasMesh_s |
struct | mAliasAnim_s |
struct | mAliasBone_s |
struct | mAliasModel_s |
Defines | |
#define | MODEL_MAX_PATH 64 |
#define | MAX_ALIAS_TRIS 4096 |
#define | MAX_ALIAS_VERTS 8192 |
#define | mAliasCoord_t vec2_t |
#define | MAX_ANIMS 128 |
#define | MAX_ANIMNAME 16 |
Typedefs | |
typedef struct mAliasVertex_s | mAliasVertex_t |
typedef struct mAliasComplexVertex_s | mAliasComplexVertex_t |
typedef struct mAliasBoneMatrix_s | mAliasBoneMatrix_t |
typedef struct mAliasBoneVertex_s | mAliasBoneVertex_t |
typedef struct mAliasFrame_s | mAliasFrame_t |
typedef struct mAliasTagOrientation_s | mAliasTagOrientation_t |
typedef struct mAliasTag_s | mAliasTag_t |
typedef struct mAliasSkin_s | mAliasSkin_t |
typedef struct mIndexList_s | mIndexList_t |
typedef struct mAliasMesh_s | mAliasMesh_t |
typedef struct mAliasAnim_s | mAliasAnim_t |
typedef struct mAliasBone_s | mAliasBone_t |
typedef struct mAliasModel_s | mAliasModel_t |
Functions | |
void | R_ModLoadAnims (mAliasModel_t *mod, void *buffer) |
qboolean | R_ModLoadMDX (struct model_s *mod) |
Tries to load a mdx file that contains the normals and the tangents for a model. | |
void | R_ModCalcUniqueNormalsAndTangents (mAliasMesh_t *mesh, int nFrames, float smoothness) |
Calculates normals and tangents for all frames and does vertex merging based on smoothness. | |
void | R_FillArrayData (mAliasModel_t *mod, mAliasMesh_t *mesh, float backlerp, int framenum, int oldframenum, qboolean prerender) |
Converts the model data into the opengl arrays. | |
void | R_ModLoadArrayData (mAliasModel_t *mod, mAliasMesh_t *mesh, qboolean loadNormals) |
Allocates data arrays for animated models. Only called once at loading time. |
Shared alias model functions.
Definition in file r_model_alias.h.
#define mAliasCoord_t vec2_t |
Definition at line 33 of file r_model_alias.h.
Referenced by R_ModCalcNormalsAndTangents(), R_ModCalcUniqueNormalsAndTangents(), R_ModLoadAliasDPMModel(), R_ModLoadAliasMD2MeshIndexed(), R_ModLoadAliasMD2MeshUnindexed(), and R_ModLoadAliasMD3Model().
#define MAX_ALIAS_TRIS 4096 |
Definition at line 30 of file r_model_alias.h.
Referenced by R_ModCalcNormalsAndTangents(), and R_ModCalcUniqueNormalsAndTangents().
#define MAX_ALIAS_VERTS 8192 |
Definition at line 31 of file r_model_alias.h.
Referenced by R_FillArrayData(), R_ModCalcUniqueNormalsAndTangents(), R_ModLoadAliasMD2MeshIndexed(), R_ModLoadAliasMD2MeshUnindexed(), and R_ModLoadMDX().
#define MAX_ANIMNAME 16 |
Definition at line 115 of file r_model_alias.h.
#define MAX_ANIMS 128 |
Definition at line 114 of file r_model_alias.h.
Referenced by R_ModLoadAnims().
#define MODEL_MAX_PATH 64 |
Definition at line 29 of file r_model_alias.h.
Referenced by R_ModLoadAliasMD3Model().
typedef struct mAliasAnim_s mAliasAnim_t |
typedef struct mAliasBone_s mAliasBone_t |
typedef struct mAliasBoneMatrix_s mAliasBoneMatrix_t |
typedef struct mAliasBoneVertex_s mAliasBoneVertex_t |
typedef struct mAliasComplexVertex_s mAliasComplexVertex_t |
typedef struct mAliasFrame_s mAliasFrame_t |
typedef struct mAliasMesh_s mAliasMesh_t |
typedef struct mAliasModel_s mAliasModel_t |
typedef struct mAliasSkin_s mAliasSkin_t |
typedef struct mAliasTag_s mAliasTag_t |
typedef struct mAliasTagOrientation_s mAliasTagOrientation_t |
typedef struct mAliasVertex_s mAliasVertex_t |
typedef struct mIndexList_s mIndexList_t |
void R_FillArrayData | ( | mAliasModel_t * | mod, | |
mAliasMesh_t * | mesh, | |||
float | backlerp, | |||
int | framenum, | |||
int | oldframenum, | |||
qboolean | prerender | |||
) |
Converts the model data into the opengl arrays.
mod | The model to convert | |
mesh | The particular mesh of the model to convert | |
backlerp | The linear back interpolation when loading the data | |
framenum | The frame number of the mesh to load (if animated) | |
oldframenum | The old frame number (used to interpolate) | |
prerender | If this is true , all data is filled to the arrays. If false , then e.g. the normals are only filled to the arrays if the lighting is activated. |
Definition at line 554 of file r_model_alias.c.
References mAliasModel_s::curFrame, mAliasModel_s::frames, i, mAliasMesh_s::indexes, lengthof, rstate_t::lighting_enabled, MAX_ALIAS_VERTS, mAliasMesh_s::next_normals, mAliasMesh_s::next_tangents, mAliasMesh_s::next_verts, mAliasMesh_s::normals, mAliasMesh_s::num_tris, mAliasMesh_s::num_verts, mAliasModel_s::oldFrame, mAliasVertex_s::point, qfalse, qtrue, R_ModCalcNormalsAndTangents(), r_state, mAliasMesh_s::stcoords, mAliasMesh_s::tangents, texunit_diffuse, mAliasFrame_s::translate, Vector2Copy, VectorCopy, VectorSet, rstate_t::vertex_array_3d, mAliasMesh_s::vertexes, and mAliasMesh_s::verts.
Referenced by R_DrawAliasFrameLerp(), and R_ModLoadArrayData().
void R_ModCalcUniqueNormalsAndTangents | ( | mAliasMesh_t * | mesh, | |
int | nFrames, | |||
float | smoothness | |||
) |
Calculates normals and tangents for all frames and does vertex merging based on smoothness.
mesh | The mesh to calculate normals for | |
nFrames | How many frames the mesh has | |
smoothness | How aggressively should normals be smoothed; value is compared with dotproduct of vectors to decide if they should be merged |
Definition at line 292 of file r_model_alias.c.
References CrossProduct(), DotProduct, i, mAliasMesh_s::indexes, mIndexList_s::length, mIndexList_s::list, mAliasCoord_t, MAX_ALIAS_TRIS, MAX_ALIAS_VERTS, Mem_Free, Mem_PoolAlloc, mAliasMesh_s::num_tris, mAliasMesh_s::num_verts, Orthogonalize(), mAliasMesh_s::revIndexes, mAliasMesh_s::stcoords, mAliasComplexVertex_s::tangent, Vector2Copy, Vector2Equal, Vector2Subtract, VectorAdd, VectorCopy, VectorEqual, VectorMul, VectorNormalize(), VectorSubtract, mAliasMesh_s::vertexes, and vid_modelPool.
Referenced by PrecalcNormalsAndTangents(), and R_ModLoadAliasMD2MeshUnindexed().
void R_ModLoadAnims | ( | mAliasModel_t * | mod, | |
void * | buffer | |||
) |
Definition at line 36 of file r_model_alias.c.
References mAliasModel_s::animdata, mAliasModel_s::animname, Com_Error(), Com_Parse(), ERR_FATAL, mAliasAnim_s::from, MAX_ANIMS, Mem_PoolAlloc, mAliasAnim_s::name, mAliasModel_s::num_anims, mAliasModel_s::num_frames, Q_strncpyz(), mAliasAnim_s::time, mAliasAnim_s::to, and vid_modelPool.
Referenced by R_ModLoadAliasMD2Model().
void R_ModLoadArrayData | ( | mAliasModel_t * | mod, | |
mAliasMesh_t * | mesh, | |||
qboolean | loadNormals | |||
) |
Allocates data arrays for animated models. Only called once at loading time.
Definition at line 642 of file r_model_alias.c.
References mAliasModel_s::curFrame, Mem_PoolAlloc, mAliasMesh_s::next_normals, mAliasMesh_s::next_tangents, mAliasMesh_s::next_verts, mAliasMesh_s::normals, mAliasModel_s::num_frames, mAliasMesh_s::num_tris, mAliasModel_s::oldFrame, R_FillArrayData(), st, mAliasMesh_s::tangents, mAliasMesh_s::texcoords, mAliasMesh_s::verts, and vid_modelPool.
Referenced by R_ModLoadAliasDPMModel(), R_ModLoadAliasMD2Model(), and R_ModLoadAliasMD3Model().
Tries to load a mdx file that contains the normals and the tangents for a model.
mod | The model to load the mdx file for |
Definition at line 217 of file r_model_alias.c.
References model_s::alias, byte, Com_DefaultExtension(), Com_Error(), Com_StripExtension(), ERR_DROP, FS_FreeFile(), FS_LoadFile(), i, IDMDXHEADER, mAliasMesh_s::indexes, mIndexList_s::length, mIndexList_s::list, LittleLong(), MAX_ALIAS_VERTS, MAX_QPATH, MDX_VERSION, Mem_PoolAlloc, mAliasModel_s::meshes, model_s::name, mAliasModel_s::num_frames, mAliasModel_s::num_meshes, mAliasMesh_s::num_verts, qfalse, qtrue, mAliasMesh_s::revIndexes, mAliasMesh_s::vertexes, and vid_modelPool.
Referenced by R_ModLoadAliasMD2Mesh().