UFO: Alien Invasion
Doxygen documentation generating
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 
68  frame(0),
69  oldframe(0),
70  backlerp(0.0f),
71  time(0),
72  dt(0),
73  mesh(0),
74  lcur(0),
75  ladd(0),
76  change(0)
77  {
78  OBJZERO(list);
79  }
80 } animState_t;
81 
85 typedef struct transform_s {
86  bool done;
87  bool processing;
88  float matrix[16];
90  transform_s() : done(false), processing(false)
91  {
92  OBJZERO(matrix);
93  }
94 } transform_t;
95 
96 typedef struct entity_s {
97  struct model_s* model;
104 
105  /* tag positioning */
106  struct entity_s* tagent;
107  const char* tagname;
109  /* misc */
110  int skinnum;
111  float alpha;
112  int flags;
114 
118 
120 
123  const image_t* texture;
124 
127  struct entity_s* next;
130  inline entity_s (int flag = RF_NONE) :
131  model(nullptr),
132  eBox(AABB()),
133  tagent(nullptr),
134  tagname(nullptr),
135  skinnum(0),
136  alpha(0.0f),
137  flags(flag),
138  distanceFromViewOrigin(0.0f),
139  isOriginBrushModel(false),
140  as(animState_s()),
141  transform(transform_s()),
142  texture(nullptr),
143  lighting(nullptr),
144  next(nullptr)
145  {
146  VectorClear(angles);
148  VectorClear(color);
150  VectorClear(oldorigin);
151  Vector4Clear(shell);
152  }
153 
154  inline void setScale(const vec3_t scale_)
155  {
156  VectorCopy(scale_, scale);
157  }
158 
159  inline vec_t getScaleX() const
160  {
161  return scale[0];
162  }
163 } entity_t;
164 
165 /* entity chains for rendering */
168 extern entity_t* r_null_entities;
170 
171 
172 int R_AddEntity(const entity_t* ent);
174 entity_t* R_GetEntity(int id);
175 void R_EntitySetOrigin(entity_t* ent, const vec3_t origin);
176 void R_EntityAddToOrigin(entity_t* ent, const vec3_t offset);
177 void R_TransformForEntity(const entity_t* e, const vec3_t in, vec3_t out);
178 
179 void R_DrawEntityEffects(void);
180 void R_DrawMeshEntities(entity_t* ents);
183 void R_DrawSpecialEntities(const entity_t* ents);
184 void R_DrawNullEntities(const entity_t* ents);
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:130
transform_s()
Definition: r_entity.h:90
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:101
lighting structure which contains static and dynamic lighting info for entities
Definition: r_lighting.h:29
static const vec3_t scale
vec3_t scale
Definition: r_entity.h:99
voidpf uLong int origin
Definition: ioapi.h:45
bool processing
Definition: r_entity.h:87
entity_t * R_GetEntity(int id)
Returns a specific entity from the list.
Definition: r_entity.cpp:694
animState_s()
Definition: r_entity.h:67
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
void R_DrawSpecialEntities(const entity_t *ents)
Definition: r_entity.cpp:473
#define nullptr
Definition: cxx.h:53
entity transform matrix
Definition: r_entity.h:85
float alpha
Definition: r_entity.h:111
entity_t * r_special_entities
Definition: r_entity.cpp:40
int skinnum
Definition: r_entity.h:110
int time
Definition: r_entity.h:58
#define MAX_ANIMLIST
Definition: r_entity.h:27
void R_DrawBlendMeshEntities(entity_t *ents)
Definition: r_entity.cpp:411
AABB eBox
Definition: r_entity.h:103
void setScale(const vec3_t scale_)
Definition: r_entity.h:154
vec3_t color
Definition: r_entity.h:100
float backlerp
Definition: r_entity.h:57
int flags
Definition: r_entity.h:112
#define OBJZERO(obj)
Definition: shared.h:178
vec3_t oldorigin
Definition: r_entity.h:102
byte lcur
Definition: r_entity.h:63
bool isOriginBrushModel
Definition: r_entity.h:115
struct entity_s * tagent
Definition: r_entity.h:106
Definition: aabb.h:42
struct entity_s * next
Definition: r_entity.h:127
entity_t * R_GetFreeEntity(void)
Get the next free entry in the entity list (the last one)
Definition: r_entity.cpp:684
const char * tagname
Definition: r_entity.h:107
#define RF_NONE
Definition: r_entity.h:34
int frame
Definition: r_entity.h:55
QGL_EXTERN GLfloat f
Definition: r_gl.h:114
#define VectorClear(a)
Definition: vector.h:55
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
transform_t transform
Definition: r_entity.h:119
vec4_t shell
Definition: r_entity.h:121
byte ladd
Definition: r_entity.h:64
struct model_s * model
Definition: r_entity.h:97
void R_DrawEntityEffects(void)
Draws shadow and highlight effects for the entities (actors)
Definition: r_entity.cpp:208
lighting_t * lighting
Definition: r_entity.h:125
animState_t as
Definition: r_entity.h:117
entity_t * r_null_entities
Definition: r_entity.cpp:39
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec3_t angles
Definition: r_entity.h:98
int oldframe
Definition: r_entity.h:56
voidpf uLong offset
Definition: ioapi.h:45
entity_t * r_opaque_mesh_entities
Definition: r_entity.cpp:37
uint8_t byte
Definition: ufotypes.h:34
bool done
Definition: r_entity.h:86
const image_t * texture
Definition: r_entity.h:123
float distanceFromViewOrigin
Definition: r_entity.h:113
vec_t getScaleX() const
Definition: r_entity.h:159
#define Vector4Clear(a)
Definition: vector.h:57
byte change
Definition: r_entity.h:65
int mesh
Definition: r_entity.h:60
vec_t vec4_t[4]
Definition: ufotypes.h:40