r_entity.c File Reference

#include "r_local.h"
#include "r_matrix.h"
#include "r_entity.h"
#include "r_mesh.h"
#include "r_mesh_anim.h"
#include "r_draw.h"
Include dependency graph for r_entity.c:

Go to the source code of this file.

Defines

#define MAX_ENTITIES   2048

Functions

const vec3_tR_EntityGetOrigin (const entity_t *ent)
void R_EntitySetOrigin (entity_t *ent, const vec3_t ovec)
void R_EntityCopyOrigin (entity_t *ent, const entity_t *other)
void R_EntityAddToOrigin (entity_t *ent, const vec3_t offs)
void R_EntitySubtractFromOrigin (entity_t *ent, const vec3_t offs)
static void R_DrawBox (const entity_t *e)
 Draws the field marker entity is specified in cl_actor.c CL_AddTargeting.
static void R_DrawFloor (const entity_t *e)
 Draws a marker on the ground to indicate pathing CL_AddPathingBox.
static void R_DrawArrow (const entity_t *e)
 Draws an arrow between two points.
static void R_DrawEntityEffects (void)
 Draws shadow and highlight effects for the entities (actors).
static void R_DrawBspEntities (const entity_t *ents)
static void R_DrawMeshEntities (entity_t *ents)
static void R_DrawOpaqueMeshEntities (entity_t *ents)
static void R_DrawBlendMeshEntities (entity_t *ents)
static void R_DrawNullModel (const entity_t *e)
 Draw replacement model (e.g. when model wasn't found).
static void R_DrawSpecialEntities (const entity_t *ents)
static void R_DrawNullEntities (const entity_t *ents)
 Draw entities which models couldn't be loaded.
static float * R_CalcTransform (entity_t *e)
 Calculates transformation matrix for the model and its tags.
static qboolean R_CullEntity (entity_t *e)
 Perform a frustum cull check for a given entity.
void R_DrawEntities (void)
 Primary entry point for drawing all entities.
entity_tR_GetFreeEntity (void)
 Get the next free entry in the entity list (the last one).
entity_tR_GetEntity (int id)
 Returns a specific entity from the list.
int R_AddEntity (const entity_t *ent)
 Adds a copy of the specified entity to the list of all known render entities.

Variables

static entity_t r_entities [MAX_ENTITIES]

Detailed Description

Definition in file r_entity.c.


Define Documentation

#define MAX_ENTITIES   2048

Definition at line 32 of file r_entity.c.

Referenced by R_AddEntity(), and R_GetFreeEntity().


Function Documentation

int R_AddEntity ( const entity_t ent  ) 

Adds a copy of the specified entity to the list of all known render entities.

See also:
R_GetFreeEntity
Returns:
The position of the entity in the render entity array or -1 in case the entity wasn't added.

Definition at line 630 of file r_entity.c.

References Com_Error(), ERR_DROP, MAX_ENTITIES, mod_bsp, rendererData_t::numEntities, entity_t::origin, refdef, VectorDist, and rendererData_t::viewOrigin.

Referenced by CL_AddActor(), CL_AddArrow(), CL_AddPathingBox(), CL_AddTargetingBox(), CL_AddUGV(), LE_AddToScene(), LM_AddToSceneOrder(), and SEQ_Render3D().

static float* R_CalcTransform ( entity_t e  )  [static]

Calculates transformation matrix for the model and its tags.

Note:
The transformation matrix is only calculated once

Definition at line 437 of file r_entity.c.

References Com_Error(), transform_t::done, ERR_DROP, GLMatrixAssemble(), GLMatrixMultiply(), transform_t::matrix, dMD2tag_t::num_frames, entity_t::origin, transform_t::processing, qfalse, qtrue, R_GetTagMatrix(), and R_InterpolateTransform().

Referenced by R_DrawEntities().

static qboolean R_CullEntity ( entity_t e  )  [static]

Perform a frustum cull check for a given entity.

Parameters:
[in,out] e The entity to perform the frustum cull check for
Returns:
false if visible, true is the origin of the entity is outside the current frustum view

Definition at line 497 of file r_entity.c.

References cvar_s::integer, mod_bsp_submodel, qfalse, R_CullBspModel(), R_CullMeshModel(), r_nocull, RDF_NOWORLDMODEL, refdef, and rendererData_t::rendererFlags.

Referenced by R_DrawEntities().

static void R_DrawArrow ( const entity_t e  )  [static]

Draws an arrow between two points.

See also:
CL_AddArrow
RF_BOX

Definition at line 168 of file r_entity.c.

References entity_t::origin, R_Color(), and VectorCopy.

Referenced by R_DrawSpecialEntities().

static void R_DrawBlendMeshEntities ( entity_t ents  )  [static]
static void R_DrawBox ( const entity_t e  )  [static]

Draws the field marker entity is specified in cl_actor.c CL_AddTargeting.

See also:
CL_AddTargeting
RF_BOX

Definition at line 48 of file r_entity.c.

References f, entity_t::origin, R_Color(), R_DrawBoundingBox(), VectorCopy, and VectorNotEmpty.

Referenced by R_DrawSpecialEntities().

static void R_DrawBspEntities ( const entity_t ents  )  [static]
See also:
R_DrawEntities
R_DrawBrushModel

Definition at line 285 of file r_entity.c.

References R_DrawBrushModel().

Referenced by R_DrawEntities().

void R_DrawEntities ( void   ) 
static void R_DrawEntityEffects ( void   )  [static]

Draws shadow and highlight effects for the entities (actors).

Note:
The origins are already transformed

Definition at line 204 of file r_entity.c.

References i, cvar_s::integer, rendererData_t::numEntities, qtrue, R_BindTexture, R_Color(), R_EnableBlend(), r_shadows, refdef, RF_ALLIED, RF_BLOOD, RF_BOX, RF_MEMBER, RF_SELECTED, RF_SHADOW, shadow, image_s::texnum, and Vector4Set.

Referenced by R_DrawEntities().

static void R_DrawFloor ( const entity_t e  )  [static]

Draws a marker on the ground to indicate pathing CL_AddPathingBox.

See also:
CL_AddPathing
RF_BOX

Definition at line 105 of file r_entity.c.

References entity_t::origin, PLAYER_WIDTH, R_Color(), and VectorCopy.

Referenced by R_DrawSpecialEntities().

static void R_DrawMeshEntities ( entity_t ents  )  [static]
static void R_DrawNullEntities ( const entity_t ents  )  [static]

Draw entities which models couldn't be loaded.

Definition at line 418 of file r_entity.c.

References R_DrawNullModel().

Referenced by R_DrawEntities().

static void R_DrawNullModel ( const entity_t e  )  [static]

Draw replacement model (e.g. when model wasn't found).

See also:
R_DrawNullEntities

Definition at line 364 of file r_entity.c.

References i, qfalse, qtrue, R_EnableTexture(), and texunit_diffuse.

Referenced by R_DrawNullEntities().

static void R_DrawOpaqueMeshEntities ( entity_t ents  )  [static]
static void R_DrawSpecialEntities ( const entity_t ents  )  [static]

Definition at line 390 of file r_entity.c.

References qfalse, qtrue, R_DrawArrow(), R_DrawBox(), R_DrawFloor(), R_EnableBlend(), RF_ARROW, RF_BOX, and RF_PATH.

Referenced by R_DrawEntities().

void R_EntityAddToOrigin ( entity_t ent,
const vec3_t  offs 
)

Definition at line 40 of file r_entity.c.

References entity_t::origin, and VectorAdd.

Referenced by LE_AddToScene().

void R_EntityCopyOrigin ( entity_t ent,
const entity_t other 
)

Definition at line 39 of file r_entity.c.

References entity_t::origin, and VectorCopy.

const vec3_t* R_EntityGetOrigin ( const entity_t ent  ) 

Definition at line 37 of file r_entity.c.

References entity_t::origin.

Referenced by LE_BrushModelAction(), R_CullBspModel(), and R_DrawBrushModel().

void R_EntitySetOrigin ( entity_t ent,
const vec3_t  ovec 
)

Definition at line 38 of file r_entity.c.

References entity_t::origin, and VectorCopy.

Referenced by CL_AddEdictFunc(), LE_AddToScene(), LM_AddToSceneOrder(), and SEQ_Render3D().

void R_EntitySubtractFromOrigin ( entity_t ent,
const vec3_t  offs 
)

Definition at line 41 of file r_entity.c.

References entity_t::origin, and VectorSubtract.

entity_t* R_GetEntity ( int  id  ) 

Returns a specific entity from the list.

Definition at line 618 of file r_entity.c.

References rendererData_t::numEntities, and refdef.

Referenced by LM_AddToSceneOrder(), and R_Trace().

entity_t* R_GetFreeEntity ( void   ) 

Get the next free entry in the entity list (the last one).

Note:
This can't overflow, because R_AddEntity checks the bounds
See also:
R_AddEntity

Definition at line 608 of file r_entity.c.

References Com_Error(), ERR_DROP, MAX_ENTITIES, rendererData_t::numEntities, and refdef.

Referenced by CL_AddActor(), CL_AddUGV(), and SEQ_Render3D().


Variable Documentation

entity_t r_entities[MAX_ENTITIES] [static]

Definition at line 34 of file r_entity.c.


Generated by  doxygen 1.6.2