UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
r_model.h File Reference

Brush model header file. More...

#include "r_entity.h"
#include "r_model_alias.h"
#include "r_model_brush.h"
#include "r_model_md2.h"
#include "r_model_md3.h"
#include "r_model_obj.h"

Go to the source code of this file.

Data Structures

struct  model_s
 

Macros

#define MAX_ACTORSKINNAME   32
 

Typedefs

typedef struct model_s model_t
 

Enumerations

enum  modtype_t {
  mod_bad, mod_bsp, mod_bsp_submodel, mod_alias_md2,
  mod_alias_md3, mod_obj
}
 All supported model formats. More...
 

Functions

void R_ModModellist_f (void)
 Prints all loaded models. More...
 
image_tR_AliasModelState (const model_t *mod, int *mesh, int *frame, int *oldFrame, int *skin)
 
image_tR_AliasModelGetSkin (const char *modelFileName, const char *skin)
 
void R_DrawAliasModel (entity_t *e)
 Draw a model from the battlescape entity list. More...
 
void R_ShutdownModels (bool complete)
 Frees the model pool. More...
 
void R_ModReloadSurfacesArrays (void)
 
int R_ModAllocateActorSkin (const char *name)
 Register an actorskin name. More...
 
void R_LoadActorSkinsFromModel (mAliasMesh_t *outMesh, image_t *defaultSkin)
 Load actor skins from a default skin to a a mesh. More...
 
bool R_UseActorSkin (void)
 
model_tR_FindModel (const char *name)
 Tries to load a model. More...
 
bool R_ModelExists (const char *name)
 
model_tR_GetModel (const char *name)
 Get a model for the given name already loaded. More...
 
model_tR_AllocModelSlot (void)
 
void R_ModelInit ()
 
void R_ModelShutdown ()
 

Variables

model_tr_mapTiles [MAX_MAPTILES]
 The world model(s) More...
 
int r_numMapTiles
 
model_t r_modelsInline [MAX_MOD_KNOWN]
 
int r_numModelsInline
 

Detailed Description

Brush model header file.

Note
d*_t structures are on-disk representations
m*_t structures are in-memory

Definition in file r_model.h.

Macro Definition Documentation

#define MAX_ACTORSKINNAME   32

Definition at line 66 of file r_model.h.

Typedef Documentation

typedef struct model_s model_t

Enumeration Type Documentation

enum modtype_t

All supported model formats.

See also
mod_extensions
Enumerator
mod_bad 
mod_bsp 
mod_bsp_submodel 
mod_alias_md2 
mod_alias_md3 
mod_obj 

Definition at line 41 of file r_model.h.

Function Documentation

image_t* R_AliasModelGetSkin ( const char *  modelFileName,
const char *  skin 
)
model_t* R_AllocModelSlot ( void  )

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.

Parameters
[in]nameThe 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
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
nullptr if no model could be found with the given name, model_t otherwise
Todo:
this case should be useless, do we ever use extension?

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

model_t* R_GetModel ( const char *  name)

Get a model for the given name already loaded.

Returns
A model for the given name, else nullptr.
See also
R_FindModel
Parameters
[in]nameShort 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.

Parameters
outMeshMesh target of skins
defaultSkinDefault skin of the mesh
Todo:
should we add warning here?

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

int R_ModAllocateActorSkin ( const char *  name)

Register an actorskin name.

Returns
The id where the actorskin is registered

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

void R_ModReloadSurfacesArrays ( void  )
Todo:
fix this for threaded renderer mode

Definition at line 1167 of file r_model_brush.cpp.

References model_s::bsp, i, lengthof, Mem_Free, R_LoadSurfacesArrays(), r_mapTiles, r_numMapTiles, and mBspModel_s::sorted_surfaces.

Referenced by UI_MaterialEditorChangeValue_f().

void R_ShutdownModels ( bool  complete)
bool R_UseActorSkin ( void  )

Definition at line 342 of file r_model.cpp.

References r_numActorSkinName.

Referenced by R_ModLoadAliasMD2MeshUnindexed().

Variable Documentation