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

Go to the source code of this file.

Functions

void R_DrawModelDirect (modelInfo_t *mi, modelInfo_t *pmi, const char *tagname)
 Draws a model in 2d mode (for rendering model data from the ui) More...
 
void R_ModelAutoScale (const vec2_t boxSize, modelInfo_t *mi, vec3_t scale, vec3_t center)
 Compute scale and center for a model info data structure. More...
 
int R_GetTagIndexByName (const model_t *mod, const char *tagName)
 Searches the tag data for the given name. More...
 
void R_GetTags (const model_t *mod, const char *tagName, int currentFrame, int oldFrame, const mAliasTagOrientation_t **current, const mAliasTagOrientation_t **old)
 
bool R_GetTagMatrix (const model_t *mod, const char *tagName, int frame, float matrix[16])
 

Function Documentation

void R_DrawModelDirect ( modelInfo_t mi,
modelInfo_t pmi,
const char *  tagname 
)

Draws a model in 2d mode (for rendering model data from the ui)

Parameters
[in,out]miAll the needed model information to render the model
[in,out]pmiThe model information of the parent model. This is used in those cases, where the model that should get rendered here is placed relativly to an already existing model in the world.
[in]tagnameIf a parent model is given, a tagname is given in most cases, too. It's used to transform the model location relative to the parent model location again. E.g. a tagname of tag_rweapon will transform the location to the right hand of an actor.
See also
R_DrawAliasModel

Definition at line 306 of file r_mesh.cpp.

References model_s::alias, rendererData_t::aliasCount, modelInfo_t::backlerp, modelInfo_t::color, Com_Printf(), mAliasFrame_s::fBox, modelInfo_t::frame, mAliasModel_s::frames, cvar_s::integer, model_s::loaded, modelInfo_t::mesh, mAliasModel_s::meshes, modelInfo_t::model, modelInfo_t::name, mAliasModel_s::num_frames, mAliasMesh_s::num_tris, modelInfo_t::oldframe, Q_strnull(), R_AliasModelState(), R_BindTexture, R_CheckError, R_Color(), R_DrawAliasFrameLerp(), R_DrawAliasStaticWithReset(), R_DrawBoundingBox(), R_FindModel(), R_GetTags(), R_InterpolateTransform(), r_showbox, R_TransformModelDirect(), refdef, viddef_t::rx, viddef_t::ry, modelInfo_t::skin, image_s::texnum, vec4_origin, and viddef.

Referenced by R_Draw2DMapMarkers(), R_Draw3DMapMarkers(), UI_DrawItem(), UI_DrawModelNode(), and UI_DrawModelNodeWithUIModel().

int R_GetTagIndexByName ( const model_t mod,
const char *  tagName 
)

Searches the tag data for the given name.

Parameters
[in]modThe model to search the tag data. Can be nullptr
[in]tagNameThe name of the tag to get the matrix for. Might not be nullptr
Returns
-1 if no tag with the given name was found

Definition at line 247 of file r_mesh.cpp.

References model_s::alias, i, mAliasTag_s::name, mAliasModel_s::num_tags, Q_streq, and mAliasModel_s::tags.

Referenced by CL_ActorGetMuzzle(), CL_AddActor(), R_GetTagMatrix(), and R_GetTags().

bool R_GetTagMatrix ( const model_t mod,
const char *  tagName,
int  frame,
float  matrix[16] 
)
Parameters
[in]modThe model to get the tag transformation matrix for
[in]tagNameThe name of the tag to get the transformation matrix for
[in]frameThe frame of the tag to get the transformation matrix for
[out]matrixThe transformation matrix
Returns
false if the tag name for the given model wasn't found, true if the matrix was filled.

Definition at line 189 of file r_mesh.cpp.

References Com_Printf(), index, model_s::name, R_ComputeGLMatrixFromTag(), R_GetTagIndexByName(), and R_GetTagOrientByFrame.

Referenced by CL_ActorGetMuzzle().

void R_GetTags ( const model_t mod,
const char *  tagName,
int  currentFrame,
int  oldFrame,
const mAliasTagOrientation_t **  current,
const mAliasTagOrientation_t **  old 
)
void R_ModelAutoScale ( const vec2_t  boxSize,
modelInfo_t mi,
vec3_t  scale,
vec3_t  center 
)

Compute scale and center for a model info data structure.

Parameters
[in]boxSizeThe size the model should fit into
[in,out]miThe model info that contains the model that should be scaled
[out]scaleThe scale vector
[out]centerThe center of the model (center of the model's bounding box)
Note
The scale and center vectors are parameters here because the modelInfo_t struct only holds pointers to the vectors.
Todo:
Take the rotation info from modelInfo_t into account

Definition at line 278 of file r_mesh.cpp.

References modelInfo_t::center, AABB::getCenter(), AABB::getWidthX(), AABB::getWidthZ(), model_s::modBox, modelInfo_t::model, modelInfo_t::scale, scale, VectorNegate, and VectorSet.

Referenced by R_Draw2DMapMarkers(), R_Draw3DMapMarkers(), UI_DrawModelNode(), and UI_DrawModelNodeWithUIModel().