UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
r_entity.h
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 1997-2001 Id Software, Inc.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 #pragma once
26 
27 #define MAX_ANIMLIST 8
28 #define MAX_ENTITY_LIGHTS 7
29 
30 #include "r_light.h"
31 #include "r_lighting.h"
32 
34 #define RF_NONE 0x00000000
35 #define RF_TRANSLUCENT 0x00000001
36 #define RF_BOX 0x00000002
37 #define RF_PATH 0x01000000
38 #define RF_ARROW 0x02000000
41 #define RF_NO_SHADOW 0x00000004
42 #define RF_BLOOD 0x00000008
43 #define RF_SELECTED 0x00000010
44 #define RF_MEMBER 0x00000020
45 #define RF_ALLIED 0x00000040
46 #define RF_ACTOR 0x00000080
47 #define RF_PULSE 0x00000100
48 #define RF_IRGOGGLES 0x00000200
49 #define RF_NEUTRAL 0x00000400
50 #define RF_SHADOW 0x00000800
51 #define RF_OPPONENT 0x00001000
52 #define RF_IRGOGGLESSHOT 0x00002000
54 typedef struct animState_s {
55  int frame;
56  int oldframe;
57  float backlerp;
58  int time;
59  int dt;
60  int mesh;
66 } animState_t;
67 
71 typedef struct {
72  bool done;
73  bool processing;
74  float matrix[16];
75 } transform_t;
76 
77 typedef struct entity_s {
78  struct model_s* model;
85 
86  /* tag positioning */
87  struct entity_s* tagent;
88  const char* tagname;
90  /* misc */
91  int skinnum;
92  float alpha;
93  int flags;
95 
99 
101 
104  const image_t* texture;
105 
108  struct entity_s* next;
110  inline entity_s (int flag = RF_NONE) {
111  OBJZERO(*this);
112  flags = flag;
113  }
114  inline void setScale(const vec3_t scale_) {
115  VectorCopy(scale_, scale);
116  }
117  inline vec_t getScaleX() const {
118  return scale[0];
119  }
120 } entity_t;
121 
122 /* entity chains for rendering */
125 extern entity_t* r_null_entities;
127 
128 
129 int R_AddEntity(const entity_t* ent);
131 entity_t* R_GetEntity(int id);
132 void R_EntitySetOrigin(entity_t* ent, const vec3_t origin);
133 void R_EntityAddToOrigin(entity_t* ent, const vec3_t offset);
134 void R_TransformForEntity(const entity_t* e, const vec3_t in, vec3_t out);
135 
136 void R_DrawEntityEffects(void);
137 void R_DrawMeshEntities(entity_t* ents);
140 void R_DrawSpecialEntities(const entity_t* ents);
141 void R_DrawNullEntities(const entity_t* ents);
int oldframe
Definition: r_entity.h:56
void R_DrawOpaqueMeshEntities(entity_t *ents)
Definition: r_entity.cpp:339
#define VectorCopy(src, dest)
Definition: vector.h:51
void R_DrawMeshEntities(entity_t *ents)
Draws the list of entities.
Definition: r_entity.cpp:316
entity_s(int flag=RF_NONE)
Definition: r_entity.h:110
void R_EntityAddToOrigin(entity_t *ent, const vec3_t offset)
Translates the origin of the given entity by the given offset vector.
Definition: r_entity.cpp:57
vec3_t origin
Definition: r_entity.h:82
animState_t as
Definition: r_entity.h:98
vec3_t angles
Definition: r_entity.h:79
struct entity_s * tagent
Definition: r_entity.h:87
int time
Definition: r_entity.h:58
voidpf uLong int origin
Definition: ioapi.h:45
bool processing
Definition: r_entity.h:73
entity_t * R_GetEntity(int id)
Returns a specific entity from the list.
Definition: r_entity.cpp:694
Definition: aabb.h:42
float distanceFromViewOrigin
Definition: r_entity.h:94
float vec_t
Definition: ufotypes.h:37
entity_t * r_blend_mesh_entities
Definition: r_entity.cpp:38
void R_EntitySetOrigin(entity_t *ent, const vec3_t origin)
setter for entity origin
Definition: r_entity.cpp:47
void R_TransformForEntity(const entity_t *e, const vec3_t in, vec3_t out)
Definition: r_entity.cpp:522
vec3_t scale
Definition: r_entity.h:80
void R_DrawSpecialEntities(const entity_t *ents)
Definition: r_entity.cpp:473
entity transform matrix
Definition: r_entity.h:71
entity_t * r_special_entities
Definition: r_entity.cpp:40
vec3_t color
Definition: r_entity.h:81
#define MAX_ANIMLIST
Definition: r_entity.h:27
lighting structure which contains static and dynamic lighting info for entities
Definition: r_lighting.h:29
vec3_t oldorigin
Definition: r_entity.h:83
void R_DrawBlendMeshEntities(entity_t *ents)
Definition: r_entity.cpp:411
transform_t transform
Definition: r_entity.h:100
int frame
Definition: r_entity.h:55
vec4_t shell
Definition: r_entity.h:102
#define OBJZERO(obj)
Definition: shared.h:178
struct entity_s * next
Definition: r_entity.h:108
byte lcur
Definition: r_entity.h:63
struct model_s * model
Definition: r_entity.h:78
entity_t * R_GetFreeEntity(void)
Get the next free entry in the entity list (the last one)
Definition: r_entity.cpp:684
lighting_t * lighting
Definition: r_entity.h:106
#define RF_NONE
Definition: r_entity.h:34
byte change
Definition: r_entity.h:65
float alpha
Definition: r_entity.h:92
void setScale(const vec3_t scale_)
Definition: r_entity.h:114
int R_AddEntity(const entity_t *ent)
Adds a copy of the specified entity to the list of all known render entities.
Definition: r_entity.cpp:706
void R_DrawNullEntities(const entity_t *ents)
Draw entities which models couldn't be loaded.
Definition: r_entity.cpp:503
struct animState_s animState_t
bool isOriginBrushModel
Definition: r_entity.h:96
void R_DrawEntityEffects(void)
Draws shadow and highlight effects for the entities (actors)
Definition: r_entity.cpp:208
vec_t getScaleX() const
Definition: r_entity.h:117
entity_t * r_null_entities
Definition: r_entity.cpp:39
int mesh
Definition: r_entity.h:60
vec_t vec3_t[3]
Definition: ufotypes.h:39
int flags
Definition: r_entity.h:93
byte ladd
Definition: r_entity.h:64
int skinnum
Definition: r_entity.h:91
struct entity_s entity_t
voidpf uLong offset
Definition: ioapi.h:45
AABB eBox
Definition: r_entity.h:84
entity_t * r_opaque_mesh_entities
Definition: r_entity.cpp:37
const char * tagname
Definition: r_entity.h:88
uint8_t byte
Definition: ufotypes.h:34
bool done
Definition: r_entity.h:72
float backlerp
Definition: r_entity.h:57
const image_t * texture
Definition: r_entity.h:104
vec_t vec4_t[4]
Definition: ufotypes.h:40