UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
r_entity.h File Reference
#include "r_light.h"
#include "r_lighting.h"

Go to the source code of this file.

Data Structures

struct  animState_s
 
struct  transform_t
 entity transform matrix More...
 
struct  entity_s
 

Macros

#define MAX_ANIMLIST   8
 
#define MAX_ENTITY_LIGHTS   7
 
#define RF_NONE   0x00000000
 
#define RF_TRANSLUCENT   0x00000001
 
#define RF_BOX   0x00000002
 
#define RF_PATH   0x01000000
 
#define RF_ARROW   0x02000000
 
#define RF_NO_SHADOW   0x00000004
 
#define RF_BLOOD   0x00000008
 
#define RF_SELECTED   0x00000010
 
#define RF_MEMBER   0x00000020
 
#define RF_ALLIED   0x00000040
 
#define RF_ACTOR   0x00000080
 
#define RF_PULSE   0x00000100
 
#define RF_IRGOGGLES   0x00000200
 
#define RF_NEUTRAL   0x00000400
 
#define RF_SHADOW   0x00000800
 
#define RF_OPPONENT   0x00001000
 
#define RF_IRGOGGLESSHOT   0x00002000
 

Typedefs

typedef struct animState_s animState_t
 
typedef struct entity_s entity_t
 

Functions

int R_AddEntity (const entity_t *ent)
 Adds a copy of the specified entity to the list of all known render entities. More...
 
entity_tR_GetFreeEntity (void)
 Get the next free entry in the entity list (the last one) More...
 
entity_tR_GetEntity (int id)
 Returns a specific entity from the list. More...
 
void R_EntitySetOrigin (entity_t *ent, const vec3_t origin)
 setter for entity origin More...
 
void R_EntityAddToOrigin (entity_t *ent, const vec3_t offset)
 Translates the origin of the given entity by the given offset vector. More...
 
void R_TransformForEntity (const entity_t *e, const vec3_t in, vec3_t out)
 
void R_DrawEntityEffects (void)
 Draws shadow and highlight effects for the entities (actors) More...
 
void R_DrawMeshEntities (entity_t *ents)
 Draws the list of entities. More...
 
void R_DrawOpaqueMeshEntities (entity_t *ents)
 
void R_DrawBlendMeshEntities (entity_t *ents)
 
void R_DrawSpecialEntities (const entity_t *ents)
 
void R_DrawNullEntities (const entity_t *ents)
 Draw entities which models couldn't be loaded. More...
 

Variables

entity_tr_opaque_mesh_entities
 
entity_tr_blend_mesh_entities
 
entity_tr_null_entities
 
entity_tr_special_entities
 

Macro Definition Documentation

#define MAX_ANIMLIST   8

Definition at line 27 of file r_entity.h.

Referenced by R_AnimGetName(), and R_AnimRun().

#define MAX_ENTITY_LIGHTS   7

Definition at line 28 of file r_entity.h.

Referenced by R_CvarCheckDynamicLights().

#define RF_ACTOR   0x00000080

this is an actor

Definition at line 46 of file r_entity.h.

Referenced by CL_AddActor(), CL_AddUGV(), R_DrawEntityEffects(), and R_UpdateLightList().

#define RF_ALLIED   0x00000040

actor in an allied team (controlled by another player)

Definition at line 45 of file r_entity.h.

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

#define RF_ARROW   0x02000000

arrow, debugging only

Definition at line 38 of file r_entity.h.

Referenced by CL_AddArrow(), R_DrawSpecialEntities(), and R_GetEntityLists().

#define RF_BLOOD   0x00000008

blood (when dead) for this entity

Definition at line 42 of file r_entity.h.

Referenced by CL_AddActor(), and R_DrawEntityEffects().

#define RF_BOX   0x00000002
#define RF_IRGOGGLES   0x00000200

this is visible if the actor uses ir goggles

Definition at line 48 of file r_entity.h.

Referenced by CL_AddActor(), and R_DrawAliasModel().

#define RF_IRGOGGLESSHOT   0x00002000

this is the actor that used an irgoggle

Definition at line 52 of file r_entity.h.

Referenced by CL_ActorDoShoot(), and CL_ActorSelect().

#define RF_MEMBER   0x00000020

actor in the same team

Definition at line 44 of file r_entity.h.

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

#define RF_NEUTRAL   0x00000400

actor from a neutral team

Definition at line 49 of file r_entity.h.

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

#define RF_NO_SHADOW   0x00000004

the following ent flags also draw entity effects shadow (when living) for this entity

Definition at line 41 of file r_entity.h.

Referenced by R_DrawMeshShadow().

#define RF_NONE   0x00000000

entity->flags (render flags) for initialization

Definition at line 34 of file r_entity.h.

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

#define RF_OPPONENT   0x00001000

opponent

Definition at line 51 of file r_entity.h.

Referenced by CL_AddActor(), and R_DrawEntityEffects().

#define RF_PATH   0x01000000

pathing marker, debugging only

Definition at line 37 of file r_entity.h.

Referenced by CL_AddPathingBox(), LE_BrushModelAction(), R_DrawSpecialEntities(), and R_GetEntityLists().

#define RF_PULSE   0x00000100

glowing entity

Definition at line 47 of file r_entity.h.

Referenced by R_DrawAliasModel(), and SP_misc_model().

#define RF_SELECTED   0x00000010

selected actor

Definition at line 43 of file r_entity.h.

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

#define RF_SHADOW   0x00000800

shadow (when living) for this entity

Definition at line 50 of file r_entity.h.

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

#define RF_TRANSLUCENT   0x00000001

Definition at line 35 of file r_entity.h.

Referenced by R_DrawMeshShadow(), and R_GetEntityLists().

Typedef Documentation

typedef struct animState_s animState_t
typedef struct entity_s entity_t

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 706 of file r_entity.cpp.

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

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

void R_DrawEntityEffects ( void  )

Draws shadow and highlight effects for the entities (actors)

Note
The origins are already transformed
Todo:
use default_texcoords
Todo:
use default_texcoords

Definition at line 208 of file r_entity.cpp.

References rendererData_t::batchCount, i, cvar_s::integer, it_effect, rendererData_t::numEntities, R_BindArray(), R_BindDefaultArray(), R_BindTexture, R_Color(), R_EnableBlend(), R_EnableDrawAsGlow(), R_FindImage(), r_stencilshadows, refdef, RF_ACTOR, RF_ALLIED, RF_BLOOD, RF_BOX, RF_MEMBER, RF_NEUTRAL, RF_OPPONENT, RF_SELECTED, RF_SHADOW, SELECTION_DELTA, shadow, image_s::texnum, and Vector4Set.

Referenced by R_RenderFrame().

void R_DrawMeshEntities ( entity_t ents)

Draws the list of entities.

Parameters
[in,out]entsThe list of entities that are going to get rendered
See also
R_GetEntityLists

Definition at line 316 of file r_entity.cpp.

References mod_alias_md2, mod_alias_md3, mod_obj, and R_DrawAliasModel().

Referenced by R_DrawBlendMeshEntities(), and R_DrawOpaqueMeshEntities().

void R_DrawNullEntities ( const entity_t ents)

Draw entities which models couldn't be loaded.

Definition at line 503 of file r_entity.cpp.

References R_DrawNullModel().

Referenced by R_RenderFrame().

void R_DrawSpecialEntities ( const entity_t ents)
void R_EntityAddToOrigin ( entity_t ent,
const vec3_t  offset 
)

Translates the origin of the given entity by the given offset vector.

Parameters
[in,out]entThe entity to translate
[in]offsetThe translation vector

Definition at line 57 of file r_entity.cpp.

References entity_t::origin, and VectorAdd.

void R_EntitySetOrigin ( entity_t ent,
const vec3_t  origin 
)

setter for entity origin

Parameters
[out]entThe entity to set the origin for
[in]originThe new origin for the given entity

Definition at line 47 of file r_entity.cpp.

References entity_t::origin, and VectorCopy.

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

entity_t* R_GetEntity ( int  id)

Returns a specific entity from the list.

Definition at line 694 of file r_entity.cpp.

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 684 of file r_entity.cpp.

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

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

void R_TransformForEntity ( const entity_t e,
const vec3_t  in,
vec3_t  out 
)

Transforms a point by the inverse of the world-model matrix for the specified entity.

Definition at line 522 of file r_entity.cpp.

References Matrix4x4_CreateFromQuakeEntity(), Matrix4x4_Invert_Simple(), Matrix4x4_Transform(), and entity_t::origin.

Referenced by R_RotateForMeshShadow().

Variable Documentation

entity_t* r_blend_mesh_entities

Definition at line 38 of file r_entity.cpp.

Referenced by R_GetEntityLists(), and R_RenderFrame().

entity_t* r_null_entities

Definition at line 39 of file r_entity.cpp.

Referenced by R_GetEntityLists(), and R_RenderFrame().

entity_t* r_opaque_mesh_entities

Definition at line 37 of file r_entity.cpp.

Referenced by R_GetEntityLists(), and R_RenderFrame().

entity_t* r_special_entities

Definition at line 40 of file r_entity.cpp.

Referenced by R_GetEntityLists(), and R_RenderFrame().