UFO: Alien Invasion
Loading...
Searching...
No Matches
r_entity.h
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 1997-2001 Id Software, Inc.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, 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
39
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
53
54typedef struct animState_s {
55 int frame;
57 float backlerp;
58 int time;
59 int dt;
60 int mesh;
61
63 byte lcur;
64 byte ladd;
65 byte change;
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 {
79 }
81
85typedef struct transform_s {
86 bool done;
88 float matrix[16];
89
90 transform_s() : done(false), processing(false)
91 {
93 }
95
96typedef struct entity_s {
97 struct model_s* model;
104
105 /* tag positioning */
106 struct entity_s* tagent;
107 const char* tagname;
108
109 /* misc */
111 float alpha;
112 int flags;
114
116
118
120
122
124
126
127 struct entity_s* next;
128
129
130 inline entity_s (int flag = RF_NONE) :
131 model(nullptr),
132 eBox(AABB()),
135 skinnum(0),
136 alpha(0.0f),
137 flags(flag),
139 isOriginBrushModel(false),
140 as(animState_s()),
141 transform(transform_s()),
145 {
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 */
170
171
172int R_AddEntity(const entity_t* ent);
174entity_t* R_GetEntity(int id);
175void R_EntitySetOrigin(entity_t* ent, const vec3_t origin);
176void R_EntityAddToOrigin(entity_t* ent, const vec3_t offset);
177void R_TransformForEntity(const entity_t* e, const vec3_t in, vec3_t out);
178
179void R_DrawEntityEffects(void);
180void R_DrawMeshEntities(entity_t* ents);
183void R_DrawSpecialEntities(const entity_t* ents);
184void R_DrawNullEntities(const entity_t* ents);
Definition aabb.h:42
#define nullptr
Definition cxx.h:53
voidpf uLong int origin
Definition ioapi.h:45
voidpf uLong offset
Definition ioapi.h:45
entity_t * r_blend_mesh_entities
Definition r_entity.cpp:38
entity_t * r_null_entities
Definition r_entity.cpp:39
entity_t * r_special_entities
Definition r_entity.cpp:40
entity_t * r_opaque_mesh_entities
Definition r_entity.cpp:37
void R_DrawSpecialEntities(const entity_t *ents)
Definition r_entity.cpp:473
void R_TransformForEntity(const entity_t *e, const vec3_t in, vec3_t out)
Definition r_entity.cpp:522
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_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
void R_DrawOpaqueMeshEntities(entity_t *ents)
Definition r_entity.cpp:339
void R_DrawBlendMeshEntities(entity_t *ents)
Definition r_entity.cpp:411
entity_t * R_GetEntity(int id)
Returns a specific entity from the list.
Definition r_entity.cpp:694
void R_DrawEntityEffects(void)
Draws shadow and highlight effects for the entities (actors).
Definition r_entity.cpp:208
entity_t * R_GetFreeEntity(void)
Get the next free entry in the entity list (the last one).
Definition r_entity.cpp:684
#define MAX_ANIMLIST
Definition r_entity.h:27
void R_EntitySetOrigin(entity_t *ent, const vec3_t origin)
setter for entity origin
Definition r_entity.cpp:47
#define RF_NONE
Definition r_entity.h:34
void R_DrawMeshEntities(entity_t *ents)
Draws the list of entities.
Definition r_entity.cpp:316
void R_DrawNullEntities(const entity_t *ents)
Draw entities which models couldn't be loaded.
Definition r_entity.cpp:503
#define OBJZERO(obj)
Definition shared.h:178
byte change
Definition r_entity.h:65
byte lcur
Definition r_entity.h:63
byte list[MAX_ANIMLIST]
Definition r_entity.h:62
byte ladd
Definition r_entity.h:64
float backlerp
Definition r_entity.h:57
int oldframe
Definition r_entity.h:56
vec3_t scale
Definition r_entity.h:99
float alpha
Definition r_entity.h:111
int flags
Definition r_entity.h:112
float distanceFromViewOrigin
Definition r_entity.h:113
lighting_t * lighting
Definition r_entity.h:125
vec3_t angles
Definition r_entity.h:98
struct model_s * model
Definition r_entity.h:97
void setScale(const vec3_t scale_)
Definition r_entity.h:154
vec_t getScaleX() const
Definition r_entity.h:159
vec4_t shell
Definition r_entity.h:121
const char * tagname
Definition r_entity.h:107
struct entity_s * next
Definition r_entity.h:127
vec3_t origin
Definition r_entity.h:101
vec3_t color
Definition r_entity.h:100
int skinnum
Definition r_entity.h:110
animState_t as
Definition r_entity.h:117
entity_s(int flag=RF_NONE)
Definition r_entity.h:130
const image_t * texture
Definition r_entity.h:123
transform_t transform
Definition r_entity.h:119
struct entity_s * tagent
Definition r_entity.h:106
vec3_t oldorigin
Definition r_entity.h:102
AABB eBox
Definition r_entity.h:103
bool isOriginBrushModel
Definition r_entity.h:115
lighting structure which contains static and dynamic lighting info for entities
Definition r_lighting.h:29
entity transform matrix
Definition r_entity.h:85
float matrix[16]
Definition r_entity.h:88
bool done
Definition r_entity.h:86
bool processing
Definition r_entity.h:87
float vec_t
Definition ufotypes.h:37
vec_t vec3_t[3]
Definition ufotypes.h:39
vec_t vec4_t[4]
Definition ufotypes.h:40
#define VectorClear(a)
Definition vector.h:55
#define Vector4Clear(a)
Definition vector.h:57
#define VectorCopy(src, dest)
Definition vector.h:51