UFO: Alien Invasion
Loading...
Searching...
No Matches
r_model_alias.h File Reference

Shared alias model functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mAliasVertex_t
struct  mAliasComplexVertex_t
struct  mAliasBoneMatrix_t
struct  mAliasBoneVertex_t
struct  mAliasFrame_t
struct  mAliasTagOrientation_t
struct  mAliasTag_t
struct  mAliasSkin_t
struct  mIndexList_t
struct  mAliasMesh_t
struct  mAliasAnim_t
struct  mAliasBone_t
struct  mAliasModel_t

Macros

#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

Functions

void R_ModLoadAnims (mAliasModel_t *mod, const char *animname)
bool R_ModLoadMDX (struct model_s *mod)
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, 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.

Detailed Description

Shared alias model functions.

Definition in file r_model_alias.h.

Macro Definition Documentation

◆ mAliasCoord_t

◆ MAX_ALIAS_TRIS

#define MAX_ALIAS_TRIS   4096

◆ MAX_ALIAS_VERTS

◆ MAX_ANIMNAME

#define MAX_ANIMNAME   16

Definition at line 130 of file r_model_alias.h.

◆ MAX_ANIMS

#define MAX_ANIMS   128

Definition at line 129 of file r_model_alias.h.

Referenced by R_ModLoadAnims().

◆ MODEL_MAX_PATH

#define MODEL_MAX_PATH   64

Definition at line 28 of file r_model_alias.h.

Referenced by R_ModLoadAliasMD3Model().

Function Documentation

◆ R_FillArrayData()

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.

Parameters
modThe model to convert
meshThe particular mesh of the model to convert
backlerpThe linear back interpolation when loading the data
framenumThe frame number of the mesh to load (if animated)
oldframenumThe old frame number (used to interpolate)
prerenderIf 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.
Note
If GLSL programs are enabled, the actual interpolation will be done on the GPU, but this function is still needed to fill the GL arrays for the keyframes
Todo
damn slow - optimize this

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().

◆ R_ModCalcUniqueNormalsAndTangents()

void R_ModCalcUniqueNormalsAndTangents ( mAliasMesh_t * mesh,
int nFrames,
float smoothness )

Calculates normals and tangents for all frames and does vertex merging based on smoothness.

Parameters
meshThe mesh to calculate normals for
nFramesHow many frames the mesh has
smoothnessHow aggressively should normals be smoothed; value is compared with dotproduct of vectors to decide if they should be merged
See also
R_ModCalcNormalsAndTangents

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().

◆ R_ModLoadAnims()

◆ R_ModLoadArrayData()

◆ R_ModLoadMDX()

bool R_ModLoadMDX ( struct model_s * mod)