|
UFO: Alien Invasion
|
shared alias model loading code (md2, md3) More...

Go to the source code of this file.
Functions | |
| void | R_ModLoadAnims (mAliasModel_t *mod, const char *animname) |
| static void | R_ModCalcNormalsAndTangents (mAliasMesh_t *mesh, int framenum, const vec3_t translate, bool backlerp) |
| Calculates a per-vertex tangentspace basis and stores it in GL arrays attached to the mesh. | |
| bool | R_ModLoadMDX (model_t *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. | |
| image_t * | R_AliasModelGetSkin (const char *modelFileName, const char *skin) |
| image_t * | R_AliasModelState (const model_t *mod, int *mesh, int *frame, int *oldFrame, int *skin) |
| void | R_FillArrayData (mAliasModel_t *mod, mAliasMesh_t *mesh, float backlerp, int framenum, int oldframenum, bool prerender) |
| Converts the model data into the opengl arrays. | |
| void | R_ModLoadArrayData (mAliasModel_t *mod, mAliasMesh_t *mesh, bool loadNormals) |
| Allocates data arrays for animated models. Only called once at loading time. | |
shared alias model loading code (md2, md3)
Definition in file r_model_alias.cpp.
| image_t * R_AliasModelGetSkin | ( | const char * | modelFileName, |
| const char * | skin ) |
Definition at line 518 of file r_model_alias.cpp.
References Com_ReplaceFilename(), it_skin, MAX_QPATH, and R_FindImage().
Referenced by MD2Check(), MD2SkinFix(), R_LoadActorSkinsFromModel(), R_LoadObjSkin(), R_ModLoadAliasMD2MeshIndexed(), R_ModLoadAliasMD2MeshUnindexed(), and R_ModLoadAliasMD3Model().
| image_t * R_AliasModelState | ( | const model_t * | mod, |
| int * | mesh, | ||
| int * | frame, | ||
| int * | oldFrame, | ||
| int * | skin ) |
Definition at line 531 of file r_model_alias.cpp.
References model_t::alias, Com_Error(), Com_Printf(), ERR_DROP, mAliasModel_t::meshes, model_t::name, mAliasModel_t::num_frames, mAliasModel_t::num_meshes, mAliasMesh_t::num_skins, mAliasSkin_t::skin, mAliasMesh_t::skins, and image_t::texnum.
Referenced by R_DrawModelDirect(), R_DrawModelParticle(), and R_GetEntityLists().
| void R_FillArrayData | ( | mAliasModel_t * | mod, |
| mAliasMesh_t * | mesh, | ||
| float | backlerp, | ||
| int | framenum, | ||
| int | oldframenum, | ||
| bool | 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 576 of file r_model_alias.cpp.
References mAliasModel_t::curFrame, mAliasModel_t::frames, i, mAliasMesh_t::indexes, lengthof, MAX_ALIAS_VERTS, mAliasMesh_t::next_normals, mAliasMesh_t::next_tangents, mAliasMesh_t::next_verts, mAliasMesh_t::normals, mAliasMesh_t::num_tris, mAliasMesh_t::num_verts, mAliasModel_t::oldFrame, mAliasVertex_t::point, R_ModCalcNormalsAndTangents(), R_ReallocateStateArrays(), R_ReallocateTexunitArray(), r_state, mAliasMesh_t::stcoords, mAliasMesh_t::tangents, texunit_diffuse, mAliasFrame_t::translate, v, Vector2Copy, VectorCopy, VectorSet, mAliasMesh_t::vertexes, and mAliasMesh_t::verts.
Referenced by R_DrawAliasFrameLerp(), and R_ModLoadArrayData().
|
static |
Calculates a per-vertex tangentspace basis and stores it in GL arrays attached to the mesh.
| mesh | The mesh to calculate normals for |
| framenum | The animation frame to calculate normals for |
| translate | The frame translation for the given animation frame |
| backlerp | Whether to store the results in the GL arrays for the previous keyframe or the next keyframe |
Definition at line 119 of file r_model_alias.cpp.
References CrossProduct(), DotProduct, i, mAliasMesh_t::indexes, len, mIndexList_t::length, mIndexList_t::list, mAliasCoord_t, MAX_ALIAS_TRIS, mAliasMesh_t::next_normals, mAliasMesh_t::next_tangents, mAliasMesh_t::next_verts, mAliasMesh_t::normals, mAliasMesh_t::num_tris, mAliasMesh_t::num_verts, Orthogonalize(), mAliasMesh_t::revIndexes, mAliasMesh_t::stcoords, mAliasMesh_t::tangents, mAliasMesh_t::texcoords, v, Vector2Copy, Vector2Subtract, Vector4Copy, VectorAdd, VectorClear, VectorCopy, VectorMul, VectorNormalizeFast(), VectorSubtract, mAliasMesh_t::vertexes, and mAliasMesh_t::verts.
Referenced by R_FillArrayData().
| 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 313 of file r_model_alias.cpp.
References Com_Error(), CrossProduct(), DotProduct, ERR_DROP, i, mAliasMesh_t::indexes, mIndexList_t::length, mIndexList_t::list, mAliasCoord_t, MAX_ALIAS_TRIS, MAX_ALIAS_VERTS, Mem_Free, Mem_PoolAllocTypeN, mAliasMesh_t::name, mAliasMesh_t::num_tris, mAliasMesh_t::num_verts, Orthogonalize(), mAliasMesh_t::revIndexes, mAliasMesh_t::stcoords, mAliasComplexVertex_t::tangent, v, Vector2Copy, Vector2Equal, Vector2Subtract, VectorAdd, VectorCopy, VectorEqual, VectorMul, VectorNormalizeFast(), VectorSubtract, mAliasMesh_t::vertexes, and vid_modelPool.
Referenced by PrecalcNormalsAndTangents(), R_ModLoadAliasMD2MeshUnindexed(), and R_ModLoadAliasMD3Model().
| void R_ModLoadAnims | ( | mAliasModel_t * | mod, |
| const char * | animname ) |
Definition at line 36 of file r_model_alias.cpp.
References mAliasModel_t::animdata, Com_CountTokensInBuffer(), Com_Error(), Com_Parse(), ERR_DROP, ERR_FATAL, mAliasAnim_t::from, FS_FreeFile(), FS_LoadFile(), MAX_ANIMS, Mem_PoolAllocTypeN, mAliasAnim_t::name, mAliasModel_t::num_anims, mAliasModel_t::num_frames, Q_strncpyz(), mAliasAnim_t::time, mAliasAnim_t::to, and vid_modelPool.
Referenced by R_LoadModelAsync(), TEST_F(), and TEST_F().
| void R_ModLoadArrayData | ( | mAliasModel_t * | mod, |
| mAliasMesh_t * | mesh, | ||
| bool | loadNormals ) |
Allocates data arrays for animated models. Only called once at loading time.
Definition at line 665 of file r_model_alias.cpp.
References mAliasModel_t::curFrame, Mem_PoolAllocTypeN, mAliasMesh_t::next_normals, mAliasMesh_t::next_tangents, mAliasMesh_t::next_verts, mAliasMesh_t::normals, mAliasModel_t::num_frames, mAliasMesh_t::num_tris, mAliasModel_t::oldFrame, R_FillArrayData(), mAliasMesh_t::tangents, mAliasMesh_t::texcoords, v, mAliasMesh_t::verts, and vid_modelPool.
Referenced by R_ModLoadAliasMD2Model(), and R_ModLoadAliasMD3Model().
| bool R_ModLoadMDX | ( | model_t * | mod | ) |
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 233 of file r_model_alias.cpp.
References model_t::alias, Com_DefaultExtension(), Com_Error(), Com_StripExtension(), ERR_DROP, FS_FreeFile(), FS_LoadFile(), i, IDMDXHEADER, mAliasMesh_t::indexes, mIndexList_t::length, mIndexList_t::list, LittleLong, MAX_ALIAS_VERTS, MAX_QPATH, MDX_VERSION, Mem_PoolAllocTypeN, mAliasModel_t::meshes, model_t::name, mAliasModel_t::num_frames, mAliasMesh_t::num_indexes, mAliasModel_t::num_meshes, mAliasMesh_t::num_verts, mAliasMesh_t::revIndexes, mAliasMesh_t::vertexes, and vid_modelPool.
Referenced by R_ModLoadAliasMD2Mesh().