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"
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_t * | R_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. |
Mesh Model drawing code.
Definition in file r_mesh.c.
Definition at line 324 of file r_mesh.c.
References AngleVectors(), cBspPlane_s::dist, DotProduct, f, rlocals_s::frustum, i, lengthof, cBspPlane_s::normal, entity_t::origin, qfalse, qtrue, r_locals, VectorAdd, VectorCopy, and YAW.
Referenced by R_CullEntity().
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.
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.
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 model render function.
Definition at line 101 of file r_mesh.c.
References rstate_t::bumpmap_enabled, rstate_t::dynamic_lighting_enabled, GL_TANGENT_ARRAY, mAliasMesh_s::normals, mAliasMesh_s::num_tris, R_BindArray(), R_BindDefaultArray(), R_DrawMeshModelShell(), r_state, mAliasMesh_s::tangents, mAliasMesh_s::texcoords, and mAliasMesh_s::verts.
Referenced by R_DrawModelDirect(), and R_DrawModelParticle().
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 | |||
) |
Definition at line 191 of file r_mesh.c.
References model_s::alias, rendererData_t::aliasCount, modelInfo_t::backlerp, animState_s::backlerp, modelInfo_t::color, Com_Printf(), animState_s::frame, modelInfo_t::frame, mAliasModel_s::frames, cvar_s::integer, mAliasFrame_s::maxs, modelInfo_t::mesh, mAliasModel_s::meshes, mAliasFrame_s::mins, modelInfo_t::model, modelInfo_t::name, mAliasModel_s::num_frames, dMD2tag_t::num_frames, mAliasMesh_s::num_tris, animState_s::oldframe, modelInfo_t::oldframe, R_AliasModelState(), R_BindTexture, R_CheckError, R_Color(), R_DrawAliasFrameLerp(), R_DrawAliasStatic(), R_DrawBoundingBox(), R_GetTagMatrix(), R_InterpolateTransform(), R_RegisterModelShort(), r_showbox, R_TransformModelDirect(), refdef, viddef_t::rx, viddef_t::ry, modelInfo_t::skin, mAliasModel_s::tagdata, image_s::texnum, vec4_origin, and viddef.
Referenced by R_Draw2DMapMarkers(), R_Draw3DMapMarkers(), UI_DrawItem(), UI_DrawModelNode(), and UI_DrawModelNodeWithUIModel().
void R_DrawModelParticle | ( | modelInfo_t * | mi | ) |
Definition at line 279 of file r_mesh.c.
References model_s::alias, rendererData_t::aliasCount, modelInfo_t::angles, modelInfo_t::backlerp, modelInfo_t::color, Com_Printf(), modelInfo_t::frame, mAliasModel_s::frames, cvar_s::integer, mAliasFrame_s::maxs, modelInfo_t::mesh, mAliasModel_s::meshes, mAliasFrame_s::mins, modelInfo_t::model, modelInfo_t::name, mAliasModel_s::num_frames, mAliasMesh_s::num_tris, modelInfo_t::oldframe, modelInfo_t::origin, PITCH, R_AliasModelState(), R_BindTexture, R_Color(), R_DrawAliasFrameLerp(), R_DrawAliasStatic(), R_DrawBoundingBox(), r_showbox, refdef, ROLL, modelInfo_t::skin, image_s::texnum, vec4_origin, and YAW.
Referenced by R_DrawParticleModel().
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.
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 |
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.
[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 |
NULL
is returned. The same is true if the given tag name was not found in the assigned tag data. 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.
[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) |
modelInfo_t
struct only holds pointers to the vectors. 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().