r_mesh.c File Reference

Mesh Model drawing code. More...

#include "r_local.h"
#include "r_lightmap.h"
#include "r_light.h"
#include "r_mesh.h"
#include "r_mesh_anim.h"
#include "r_error.h"
#include "r_draw.h"
Include dependency graph for r_mesh.c:

Go to the source code of this file.

Functions

static void R_TransformModelDirect (modelInfo_t *mi)
static void R_DrawMeshModelShell (const mAliasMesh_t *mesh, const vec4_t color)
 Draws an animated, colored shell for the specified entity. Rather than re-lerping or re-scaling the entity, the currently bound vertex arrays are simply re-drawn using a small depth offset and varying texcoord delta.
static void R_DrawAliasFrameLerp (mAliasModel_t *mod, mAliasMesh_t *mesh, float backlerp, int framenum, int oldframenum, const vec4_t shellColor)
 Animated model render function.
static void R_DrawAliasStatic (const mAliasMesh_t *mesh, const vec4_t shellColor)
 Static model render function.
const float * R_GetTagMatrix (const model_t *mod, const char *tagName)
 Searches the tag data for the given name.
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.
void R_DrawModelDirect (modelInfo_t *mi, modelInfo_t *pmi, const char *tagname)
void R_DrawModelParticle (modelInfo_t *mi)
qboolean R_CullMeshModel (entity_t *e)
static mAliasMesh_tR_GetLevelOfDetailForModel (const vec3_t origin, const mAliasModel_t *mod)
 Searches an appropriate level-of-detail mesh for the given model.
void R_DrawAliasModel (entity_t *e)
 Draw the models in the entity list.

Detailed Description

Mesh Model drawing code.

Definition in file r_mesh.c.


Function Documentation

qboolean R_CullMeshModel ( entity_t e  ) 
static void R_DrawAliasFrameLerp ( mAliasModel_t mod,
mAliasMesh_t mesh,
float  backlerp,
int  framenum,
int  oldframenum,
const vec4_t  shellColor 
) [static]

Animated model render function.

See also:
R_DrawAliasStatic

Definition at line 82 of file r_mesh.c.

References mAliasMesh_s::num_tris, qfalse, qtrue, R_CheckError, R_DrawMeshModelShell(), R_EnableAnimation(), and R_FillArrayData().

Referenced by R_DrawModelDirect(), and R_DrawModelParticle().

void R_DrawAliasModel ( entity_t e  ) 

Draw the models in the entity list.

Note:
this is only called in ca_active or ca_sequence mode
See also:
R_DrawEntities

Definition at line 430 of file r_mesh.c.

References i, mAliasModel_s::meshes, mAliasSkin_s::skin, and mAliasMesh_s::skins.

Referenced by R_DrawMeshEntities().

static void R_DrawAliasStatic ( const mAliasMesh_t mesh,
const vec4_t  shellColor 
) [static]
static void R_DrawMeshModelShell ( const mAliasMesh_t mesh,
const vec4_t  color 
) [static]

Draws an animated, colored shell for the specified entity. Rather than re-lerping or re-scaling the entity, the currently bound vertex arrays are simply re-drawn using a small depth offset and varying texcoord delta.

Definition at line 59 of file r_mesh.c.

References mAliasMesh_s::num_tris, qfalse, qtrue, R_BindTexture, R_Color(), R_EnableShell(), r_envmaptextures, and VectorNotEmpty.

Referenced by R_DrawAliasFrameLerp(), and R_DrawAliasStatic().

void R_DrawModelDirect ( modelInfo_t mi,
modelInfo_t pmi,
const char *  tagname 
)
void R_DrawModelParticle ( modelInfo_t mi  ) 
static mAliasMesh_t* R_GetLevelOfDetailForModel ( const vec3_t  origin,
const mAliasModel_t mod 
) [static]

Searches an appropriate level-of-detail mesh for the given model.

Parameters:
origin The origin the model should be placed to in the world
mod The model where we are searching an appropriate level-of-detail mesh for
Returns:
The mesh to render

Definition at line 402 of file r_mesh.c.

References mAliasModel_s::meshes, mAliasModel_s::num_meshes, RDF_NOWORLDMODEL, refdef, rendererData_t::rendererFlags, VectorLength(), VectorSubtract, and rendererData_t::viewOrigin.

const float* R_GetTagMatrix ( const model_t mod,
const char *  tagName 
)

Searches the tag data for the given name.

Parameters:
[in] mod The model to search the tag data. Can be NULL
[in] tagName The name of the tag to get the matrix for. Might not be NULL
Returns:
The tag matrix. In case the model has no tag data assigned, NULL is returned. The same is true if the given tag name was not found in the assigned tag data.
Note:
Matrix format:
  • 0-11: rotation (forward, right, up)
  • 12-14: translation
  • 15:

Definition at line 131 of file r_mesh.c.

References model_s::alias, byte, i, MD2_MAX_TAGNAME, name, dMD2tag_t::num_frames, dMD2tag_t::num_tags, dMD2tag_t::ofs_names, dMD2tag_t::ofs_tags, and mAliasModel_s::tagdata.

Referenced by CL_ActorGetMuzzle(), R_CalcTransform(), and R_DrawModelDirect().

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] boxSize The size the model should fit into
[in,out] mi The model info that contains the model that should be scaled
[out] scale The scale vector
[out] center The 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 171 of file r_mesh.c.

References modelInfo_t::center, model_s::maxs, model_s::mins, modelInfo_t::model, modelInfo_t::scale, VectorCenterFromMinsMaxs(), VectorNegate, and VectorSet.

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

static void R_TransformModelDirect ( modelInfo_t mi  )  [static]

Definition at line 36 of file r_mesh.c.

References modelInfo_t::angles, modelInfo_t::center, modelInfo_t::origin, and modelInfo_t::scale.

Referenced by R_DrawModelDirect().


Generated by  doxygen 1.6.2