r_model.c File Reference

model loading and caching More...

#include "r_local.h"
Include dependency graph for r_model.c:

Go to the source code of this file.

Defines

#define MEM_TAG_STATIC_MODELS   1

Functions

void R_ModModellist_f (void)
 Prints all loaded models.
static model_tR_ModForName (const char *name, qboolean crash)
 Loads in a model for the given name.
model_tR_RegisterModelShort (const char *name)
 Tries to load a model.
void R_SwitchModelMemPoolTag (void)
 After all static models are loaded, switch the pool tag for these models to not free them everytime R_ShutdownModels is called.
void R_ShutdownModels (qboolean complete)
 Frees the model pool.

Variables

model_t r_models [MAX_MOD_KNOWN]
int r_numModels
static int r_numModelsStatic
model_tr_mapTiles [MAX_MAPTILES]
 The world model(s).
int r_numMapTiles
model_t r_modelsInline [MAX_MOD_KNOWN]
int r_numModelsInline
static const char * mod_extensions []
 all supported model formats

Detailed Description

model loading and caching

Definition in file r_model.c.


Define Documentation

#define MEM_TAG_STATIC_MODELS   1

Definition at line 221 of file r_model.c.

Referenced by R_SwitchModelMemPoolTag().


Function Documentation

static model_t* R_ModForName ( const char *  name,
qboolean  crash 
) [static]

Loads in a model for the given name.

Parameters:
[in] name Filename relative to base dir and with extension (models/model.md2)

Definition at line 97 of file r_model.c.

References byte, Com_Error(), DPMHEADER, ERR_FATAL, FS_FreeFile(), FS_LoadFile(), i, IDALIASHEADER, IDBSPHEADER, IDMD3HEADER, LittleLong(), MAX_MOD_KNOWN, model_s::name, Q_strcasecmp, Q_strncpyz(), qtrue, R_LoadObjModel(), R_ModLoadAliasDPMModel(), R_ModLoadAliasMD2Model(), R_ModLoadAliasMD3Model(), r_numModels, and r_numModelsInline.

Referenced by R_RegisterModelShort().

void R_ModModellist_f ( void   ) 
model_t* R_RegisterModelShort ( const char *  name  )  [read]

Tries to load a model.

Parameters:
[in] name The model path or name (with or without extension) - see notes this parameter is always relativ to the game base dir - it can also be relative to the models/ dir in the game folder
Note:
trying all supported model formats is only supported when you are using a name without extension and relative to models/ dir
if first char of name is a '*' - this is an inline model
if there is not extension in the given filename the function will try to load one of the supported model formats
Returns:
NULL if no model could be found with the given name, model_t otherwise

Definition at line 197 of file r_model.c.

References Com_Printf(), Com_sprintf(), i, MAX_QPATH, mod_extensions, qfalse, and R_ModForName().

Referenced by CL_AddBrushModel(), CL_ParseConfigString(), CL_ParticleLoadArt(), CL_PrecacheCharacterModels(), CL_ViewLoadMedia(), CL_ViewPrecacheModels(), LM_Register(), R_Draw2DMapMarkers(), R_Draw3DMapMarkers(), R_DrawModelDirect(), SEQ_ExecuteModel(), SEQ_ExecutePrecache(), UI_DrawModelNode(), and UI_DrawModelNodeWithUIModel().

void R_ShutdownModels ( qboolean  complete  ) 

Frees the model pool.

Parameters:
complete If this is true the static mesh models are freed, too
See also:
R_SwitchModelMemPoolTag

Definition at line 261 of file r_model.c.

References model_s::bsp, i, mBspModel_s::lmtexcoord_buffer, Mem_FreePool, Mem_FreeTag, mBspModel_s::normal_buffer, r_numModels, r_numModelsStatic, mBspModel_s::tangent_buffer, mBspModel_s::texcoord_buffer, mBspModel_s::vertex_buffer, vid_lightPool, and vid_modelPool.

Referenced by CL_Disconnect(), and R_Shutdown().

void R_SwitchModelMemPoolTag ( void   ) 

After all static models are loaded, switch the pool tag for these models to not free them everytime R_ShutdownModels is called.

See also:
CL_InitAfter
R_FreeWorldImages

Definition at line 228 of file r_model.c.

References model_s::alias, Com_Printf(), i, it_static, Mem_ChangeTag, MEM_TAG_STATIC_MODELS, mAliasModel_s::meshes, model_s::name, mAliasModel_s::num_meshes, mAliasMesh_s::num_skins, r_noTexture, r_numModels, r_numModelsStatic, mAliasSkin_s::skin, mAliasMesh_s::skins, image_s::type, and vid_modelPool.

Referenced by CL_ViewPrecacheModels().


Variable Documentation

const char* mod_extensions[] [static]
Initial value:
 {
    "md2", "md3", "dpm", "obj", NULL
}

all supported model formats

See also:
modtype_t

Definition at line 181 of file r_model.c.

Referenced by R_RegisterModelShort().

model_t* r_mapTiles[MAX_MAPTILES]
model_t r_models[MAX_MOD_KNOWN]

Definition at line 28 of file r_model.c.

Referenced by R_ModAddMapTile().

model_t r_modelsInline[MAX_MOD_KNOWN]

Definition at line 36 of file r_model.c.

Referenced by R_CreateMaterialData(), R_LoadSurfacesArrays(), and R_SetupSubmodels().

int r_numModelsStatic [static]

Definition at line 30 of file r_model.c.

Referenced by R_ModModellist_f(), R_ShutdownModels(), and R_SwitchModelMemPoolTag().


Generated by  doxygen 1.6.2