UFO: Alien Invasion
|
model loading and caching More...
#include "r_local.h"
Go to the source code of this file.
Macros | |
#define | MEM_TAG_STATIC_MODELS 1 |
Functions | |
void | R_ModModellist_f (void) |
Prints all loaded models. More... | |
model_t * | R_AllocModelSlot (void) |
static void | R_LoadModelAsync (model_t *mod, byte *buf, int modfilelen) |
static bool | R_LoadModel (model_t *mod, const char *filename) |
Loads in a model for the given name. More... | |
bool | R_ModelExists (const char *name) |
model_t * | R_FindModel (const char *name) |
Tries to load a model. More... | |
model_t * | R_GetModel (const char *name) |
Get a model for the given name already loaded. More... | |
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. More... | |
int | R_ModAllocateActorSkin (const char *name) |
Register an actorskin name. More... | |
bool | R_UseActorSkin (void) |
static const char * | R_GetActorSkin (int id) |
void | R_LoadActorSkinsFromModel (mAliasMesh_t *outMesh, image_t *defaultSkin) |
Load actor skins from a default skin to a a mesh. More... | |
void | R_ShutdownModels (bool complete) |
Frees the model pool. More... | |
void | R_ModelInit () |
void | R_ModelShutdown () |
Variables | |
static model_t | r_models [MAX_MOD_KNOWN] |
static int | r_numModels |
static int | r_numModelsStatic |
model_t * | r_mapTiles [MAX_MAPTILES] |
The world model(s) More... | |
int | r_numMapTiles |
model_t | r_modelsInline [MAX_MOD_KNOWN] |
int | r_numModelsInline |
static char * | r_actorSkinNames [MAX_ACTORSKINNAME] |
static int | r_numActorSkinName |
static char const *const | mod_extensions [] |
all supported model formats More... | |
model loading and caching
Definition in file r_model.cpp.
#define MEM_TAG_STATIC_MODELS 1 |
Definition at line 292 of file r_model.cpp.
Referenced by R_SwitchModelMemPoolTag().
Definition at line 100 of file r_model.cpp.
References Com_Error(), ERR_DROP, MAX_MOD_KNOWN, and r_numModels.
Referenced by R_ModAddMapTile().
model_t* R_FindModel | ( | const char * | name | ) |
Tries to load a model.
[in] | name | The model path or name (with or without extension) - see notes this parameter is always relative to the game base dir - it can also be relative to the models/ dir in the game folder |
Definition at line 203 of file r_model.cpp.
References Com_Error(), Com_GetExtension(), Com_Printf(), Com_sprintf(), ERR_FATAL, i, MAX_MOD_KNOWN, MAX_QPATH, mod_extensions, model_s::name, Q_strncpyz(), R_GetModel(), R_LoadModel(), and r_numModels.
Referenced by CL_AddBrushModel(), CL_CameraAppear(), 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().
|
static |
Definition at line 347 of file r_model.cpp.
References r_actorSkinNames, and r_numActorSkinName.
Referenced by R_LoadActorSkinsFromModel().
model_t* R_GetModel | ( | const char * | name | ) |
Get a model for the given name already loaded.
[in] | name | Short name of the model relative to base dir without (models/model) |
Definition at line 269 of file r_model.cpp.
References Com_Error(), ERR_FATAL, i, model_s::name, Q_streq, r_numModels, and r_numModelsInline.
Referenced by R_FindModel().
void R_LoadActorSkinsFromModel | ( | mAliasMesh_t * | outMesh, |
image_t * | defaultSkin | ||
) |
Load actor skins from a default skin to a a mesh.
outMesh | Mesh target of skins |
defaultSkin | Default skin of the mesh |
Definition at line 358 of file r_model.cpp.
References Com_Printf(), i, Mem_PoolAllocTypeN, image_s::name, mAliasSkin_s::name, mAliasMesh_s::name, mAliasMesh_s::num_skins, Q_strncpyz(), R_AliasModelGetSkin(), R_GetActorSkin(), r_noTexture, r_numActorSkinName, mAliasSkin_s::skin, mAliasMesh_s::skins, va(), and vid_modelPool.
Referenced by R_ModLoadAliasMD2MeshUnindexed().
|
static |
Loads in a model for the given name.
[in] | filename | Filename relative to base dir and with extension (models/model.md2) |
[in,out] | mod | Structure to initialize |
Definition at line 157 of file r_model.cpp.
References Com_Error(), ERR_FATAL, FS_LoadFile(), model_s::name, OBJZERO, Q_strncpyz(), and R_LoadModelAsync().
Referenced by R_FindModel().
Definition at line 108 of file r_model.cpp.
References model_s::alias, Com_DefaultExtension(), Com_Error(), Com_GetExtension(), Com_StripExtension(), ERR_FATAL, FS_CheckFile(), FS_FreeFile(), IDALIASHEADER, IDBSPHEADER, IDMD3HEADER, LittleLong, model_s::loaded, MAX_QPATH, model_s::name, Q_strcasecmp, R_LoadObjModel(), R_ModLoadAliasMD2Model(), R_ModLoadAliasMD3Model(), and R_ModLoadAnims().
Referenced by R_LoadModel().
int R_ModAllocateActorSkin | ( | const char * | name | ) |
Register an actorskin name.
Definition at line 332 of file r_model.cpp.
References lengthof, Mem_StrDup, r_actorSkinNames, and r_numActorSkinName.
Referenced by CL_AllocateActorSkin().
bool R_ModelExists | ( | const char * | name | ) |
Definition at line 177 of file r_model.cpp.
References Com_GetExtension(), FS_CheckFile(), i, and mod_extensions.
Referenced by GAME_LoadCharacter().
void R_ModelInit | ( | ) |
Definition at line 436 of file r_model.cpp.
Referenced by R_Init().
void R_ModelShutdown | ( | ) |
Definition at line 440 of file r_model.cpp.
References R_ShutdownModels().
Referenced by R_Shutdown().
Prints all loaded models.
Definition at line 53 of file r_model.cpp.
References model_s::alias, Com_Printf(), i, mAliasModel_s::meshes, mod_alias_md2, mod_alias_md3, mod_bsp, mod_bsp_submodel, mod_obj, model_s::name, mAliasSkin_s::name, mAliasModel_s::num_meshes, mAliasMesh_s::num_skins, mAliasMesh_s::num_tris, r_numMapTiles, r_numModels, r_numModelsInline, r_numModelsStatic, mAliasSkin_s::skin, mAliasMesh_s::skins, image_s::texnum, model_s::type, and image_s::type.
void R_ShutdownModels | ( | bool | complete | ) |
Frees the model pool.
complete | If this is true the static mesh models are freed, too |
Definition at line 391 of file r_model.cpp.
References model_s::bsp, i, mBspModel_s::index_buffer, mBspModel_s::lmtexcoord_buffer, Mem_FreePool, Mem_FreeTag, mBspModel_s::normal_buffer, OBJZERO, r_numMapTiles, r_numModels, r_numModelsInline, 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_ModelShutdown().
After all static models are loaded, switch the pool tag for these models to not free them everytime R_ShutdownModels is called.
Definition at line 299 of file r_model.cpp.
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().
bool R_UseActorSkin | ( | void | ) |
Definition at line 342 of file r_model.cpp.
References r_numActorSkinName.
Referenced by R_ModLoadAliasMD2MeshUnindexed().
|
static |
all supported model formats
Definition at line 46 of file r_model.cpp.
Referenced by R_FindModel(), and R_ModelExists().
|
static |
Definition at line 39 of file r_model.cpp.
Referenced by R_GetActorSkin(), and R_ModAllocateActorSkin().
model_t* r_mapTiles[MAX_MAPTILES] |
The world model(s)
Definition at line 32 of file r_model.cpp.
Referenced by R_CreateMaterialData(), R_DrawBspNormals(), R_DrawSurfaceStage(), R_GenerateGrass(), R_GenerateTriangleSoup(), R_GenerateTriangleSoup_(), R_GetLevelSurfaceLists(), R_LoadSurfacesArrays(), R_ModAddMapTile(), R_ModReloadSurfacesArrays(), R_RecursiveVisibleWorldNode(), R_RecursiveWorldNode(), R_ReinitOpenglContext(), R_RenderBspRRefs(), and R_RenderFrame().
|
static |
Definition at line 28 of file r_model.cpp.
model_t r_modelsInline[MAX_MOD_KNOWN] |
Definition at line 36 of file r_model.cpp.
Referenced by R_CreateMaterialData(), R_GenerateTriangleSoup(), R_LoadSurfacesArrays(), and R_SetupSubmodels().
|
static |
Definition at line 40 of file r_model.cpp.
Referenced by R_GetActorSkin(), R_LoadActorSkinsFromModel(), R_ModAllocateActorSkin(), and R_UseActorSkin().
int r_numMapTiles |
Definition at line 33 of file r_model.cpp.
Referenced by R_CreateMaterialData(), R_GenerateGrass(), R_GenerateTriangleSoup(), R_GetLevelSurfaceLists(), R_LoadSurfacesArrays(), R_ModAddMapTile(), R_ModBeginLoading(), R_ModLoadSurfaces(), R_ModModellist_f(), R_ModReloadSurfacesArrays(), R_ReinitOpenglContext(), R_RenderFrame(), R_SetupSubmodels(), R_ShutdownModels(), and R_Trace().
|
static |
Definition at line 29 of file r_model.cpp.
Referenced by R_AllocModelSlot(), R_FindModel(), R_GetModel(), R_ModModellist_f(), R_ShutdownModels(), and R_SwitchModelMemPoolTag().
int r_numModelsInline |
Definition at line 37 of file r_model.cpp.
Referenced by R_CreateMaterialData(), R_GenerateTriangleSoup(), R_GetModel(), R_LoadSurfacesArrays(), R_ModBeginLoading(), R_ModModellist_f(), R_SetupSubmodels(), and R_ShutdownModels().
|
static |
Definition at line 30 of file r_model.cpp.
Referenced by R_ModModellist_f(), R_ShutdownModels(), and R_SwitchModelMemPoolTag().