UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
r_entity.cpp
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 #include "r_local.h"
26 #include "r_matrix.h"
27 #include "r_entity.h"
28 #include "r_mesh.h"
29 #include "r_mesh_anim.h"
30 #include "r_draw.h"
31 #include "r_matrix.h"
32 
33 #define MAX_ENTITIES 2048*2
34 
36 
41 
48 {
49  VectorCopy(origin, ent->origin);
50 }
51 
58 {
59  VectorAdd(ent->origin, offset, ent->origin);
60 }
61 
67 static void R_DrawBox (const entity_t* e)
68 {
69  const vec4_t color = {e->color[0], e->color[1], e->color[2], e->alpha};
70 
71  if (e->texture) {
72  R_Color(color);
73  R_BindTexture(e->texture->texnum);
74  if (VectorNotEmpty(e->eBox.mins) && VectorNotEmpty(e->eBox.maxs)) {
75  R_DrawTexturedBox(e->eBox.mins, e->eBox.maxs);
76  } else {
77  R_DrawTexturedBox(e->oldorigin, e->origin);
78  }
79  R_Color(nullptr);
80  return;
81  }
82 
83  glDisable(GL_TEXTURE_2D);
84 
85  R_Color(color);
86 
87  if (VectorNotEmpty(e->eBox.mins) && VectorNotEmpty(e->eBox.maxs)) {
88  R_DrawBoundingBox(e->eBox);
89  } else {
90  vec3_t points[] = { { e->oldorigin[0], e->oldorigin[1], e->oldorigin[2] }, { e->oldorigin[0], e->origin[1],
91  e->oldorigin[2] }, { e->origin[0], e->origin[1], e->oldorigin[2] }, { e->origin[0], e->oldorigin[1],
92  e->oldorigin[2] } };
93 
94  glLineWidth(2.0f);
95  R_BindArray(GL_VERTEX_ARRAY, GL_FLOAT, points);
96 
98  glDrawArrays(GL_LINE_LOOP, 0, 4);
100  points[0][2] = e->origin[2];
101  points[1][2] = e->origin[2];
102  points[2][2] = e->origin[2];
103  points[3][2] = e->origin[2];
104  glDrawArrays(GL_LINE_LOOP, 0, 4);
105  refdef.batchCount++;
106  points[0][2] = e->oldorigin[2];
107  points[1][1] = e->oldorigin[1];
108  points[2][2] = e->oldorigin[2];
109  points[3][1] = e->origin[1];
110  glDrawArrays(GL_LINES, 0, 4);
111  refdef.batchCount++;
112  points[0][0] = e->origin[0];
113  points[1][0] = e->origin[0];
114  points[2][0] = e->oldorigin[0];
115  points[3][0] = e->oldorigin[0];
116  glDrawArrays(GL_LINES, 0, 4);
117  refdef.batchCount++;
118  R_BindDefaultArray(GL_VERTEX_ARRAY);
119  }
120  glEnable(GL_TEXTURE_2D);
121 
122  R_Color(nullptr);
123 }
124 
125 
131 static void R_DrawFloor (const entity_t* e)
132 {
133  GLint oldDepthFunc;
134  glGetIntegerv(GL_DEPTH_FUNC, &oldDepthFunc);
135 
136  image_t* cellIndicator = R_FindImage("pics/sfx/cell", it_pic);
137  const float dx = PLAYER_WIDTH * 2;
138  const vec4_t color = {e->color[0], e->color[1], e->color[2], e->alpha};
139  const float size = 4.0;
141  const vec2_t texcoords[] = { { 0.0, 1.0 }, { 1.0, 1.0 }, { 1.0, 0.0 }, { 0.0, 0.0 } };
142  const vec3_t points[] = { { e->origin[0] - size, e->origin[1] + dx + size, e->origin[2] }, { e->origin[0] + dx
143  + size, e->origin[1] + dx + size, e->origin[2] }, { e->origin[0] + dx + size, e->origin[1] - size,
144  e->origin[2] }, { e->origin[0] - size, e->origin[1] - size, e->origin[2] } };
145 
146  /* Draw it twice, with and without depth check, so it will still be visible if obscured by a wall */
147  R_Color(color);
148  R_BindTexture(cellIndicator->texnum);
149 
150  /* circle points */
151  R_BindArray(GL_TEXTURE_COORD_ARRAY, GL_FLOAT, texcoords);
152  R_BindArray(GL_VERTEX_ARRAY, GL_FLOAT, points);
153  glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
154 
155  glDepthFunc(GL_GREATER);
156  glColor4f(color[0], color[1], color[2], color[3] * 0.25f);
157 
158  glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
159 
160  glDepthFunc(oldDepthFunc);
161 
162  R_BindDefaultArray(GL_TEXTURE_COORD_ARRAY);
163  R_BindDefaultArray(GL_VERTEX_ARRAY);
164 
165  refdef.batchCount += 2;
166 
167  R_Color(nullptr);
168 }
169 
175 static void R_DrawArrow (const entity_t* e)
176 {
177  const vec3_t upper = { e->origin[0] + 2, e->origin[1], e->origin[2] };
178  const vec3_t mid = { e->origin[0], e->origin[1] + 2, e->origin[2] };
179  const vec3_t lower = { e->origin[0], e->origin[1], e->origin[2] + 2 };
180  const vec4_t color = { e->color[0], e->color[1], e->color[2], e->alpha };
181  const vec3_t points[] = { { e->oldorigin[0], e->oldorigin[1], e->oldorigin[2] }, { upper[0], upper[1], upper[2] },
182  { mid[0], mid[1], mid[2] }, { lower[0], lower[1], lower[2] } };
183 
184  R_Color(color);
185 
186  glDisable(GL_TEXTURE_2D);
187  glEnable(GL_LINE_SMOOTH);
188 
189  R_BindArray(GL_VERTEX_ARRAY, GL_FLOAT, points);
190  glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
191  R_BindDefaultArray(GL_VERTEX_ARRAY);
192 
193  refdef.batchCount++;
194 
195  glDisable(GL_LINE_SMOOTH);
196  glEnable(GL_TEXTURE_2D);
197 
198  R_Color(nullptr);
199 }
200 
203 
209 {
210  const int mask = r_stencilshadows->integer ? RF_BLOOD : (RF_SHADOW | RF_BLOOD);
211  GLint oldDepthFunc;
212  glGetIntegerv(GL_DEPTH_FUNC, &oldDepthFunc);
213 
214  R_EnableBlend(true);
215 
216  if (actorIndicator == nullptr) {
217  selectedActorIndicator = R_FindImage("pics/sfx/actor_selected", it_effect);
218  actorIndicator = R_FindImage("pics/sfx/actor", it_effect);
219  }
220 
221  for (int i = 0; i < refdef.numEntities; i++) {
222  const entity_t* e = &r_entities[i];
223 
224  if (e->flags <= RF_BOX)
225  continue;
226 
227  glPushMatrix();
228  glMultMatrixf(e->transform.matrix);
229 
230  if (e->flags & mask) {
231  const vec3_t points[] = { { -18.0, 14.0, -28.5 }, { 10.0, 14.0, -28.5 }, { 10.0, -14.0, -28.5 }, { -18.0,
232  -14.0, -28.5 } };
234  const vec2_t texcoords[] = { { 0.0, 1.0 }, { 1.0, 1.0 }, { 1.0, 0.0 }, { 0.0, 0.0 } };
235 
236  if (e->flags & RF_SHADOW) {
238  } else {
239  assert(e->texture);
240  R_BindTexture(e->texture->texnum);
241  }
242 
243  R_BindArray(GL_TEXTURE_COORD_ARRAY, GL_FLOAT, texcoords);
244  R_BindArray(GL_VERTEX_ARRAY, GL_FLOAT, points);
245  glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
246  R_BindDefaultArray(GL_TEXTURE_COORD_ARRAY);
247  R_BindDefaultArray(GL_VERTEX_ARRAY);
248 
249  refdef.batchCount++;
250  }
251 
252  if (e->flags & RF_ACTOR) {
253  const float size = 15.0;
254  int texnum;
255  /* draw the circles for team-members and allied troops */
256  vec4_t color = {1, 1, 1, 1};
257  const vec3_t points[] = { { -size, size, -SELECTION_DELTA }, { size, size, -SELECTION_DELTA }, { size, -size,
258  -SELECTION_DELTA }, { -size, -size, -SELECTION_DELTA } };
260  const vec2_t texcoords[] = { { 0.0, 1.0 }, { 1.0, 1.0 }, { 1.0, 0.0 }, { 0.0, 0.0 } };
261 
262  if (e->flags & RF_SELECTED)
263  Vector4Set(color, 0, 1, 0, 0.5);
264  else if (e->flags & RF_MEMBER)
265  Vector4Set(color, 0, 0.8, 0, 0.5);
266  else if (e->flags & RF_ALLIED)
267  Vector4Set(color, 0, 1, 0.5, 0.5);
268  else if (e->flags & RF_NEUTRAL)
269  Vector4Set(color, 1, 1, 0, 0.5);
270  else if (e->flags & RF_OPPONENT)
271  Vector4Set(color, 1, 0, 0, 0.5);
272  else
273  Vector4Set(color, 0.3, 0.3, 0.3, 0.5);
274 
275  if (e->flags & RF_SELECTED)
276  texnum = selectedActorIndicator->texnum;
277  else
278  texnum = actorIndicator->texnum;
279 
280  R_BindTexture(texnum);
281  R_Color(color);
282  R_EnableDrawAsGlow(true);
283 
284  /* circle points */
285  R_BindArray(GL_TEXTURE_COORD_ARRAY, GL_FLOAT, texcoords);
286  R_BindArray(GL_VERTEX_ARRAY, GL_FLOAT, points);
287 
288  glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
289 
290  refdef.batchCount++;
291 
292  /* add transparency when something is in front of the circle */
293  color[3] *= 0.25;
294  R_Color(color);
295  glDepthFunc(GL_GREATER);
296  glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
297  glDepthFunc(oldDepthFunc);
298 
299  refdef.batchCount++;
300 
301  R_BindDefaultArray(GL_TEXTURE_COORD_ARRAY);
302  R_BindDefaultArray(GL_VERTEX_ARRAY);
303 
304  R_Color(nullptr);
305  R_EnableDrawAsGlow(false);
306  }
307  glPopMatrix();
308  }
309 }
310 
317 {
318  entity_t* e;
319 
320  e = ents;
321 
322  while (e) {
323  switch (e->model->type) {
324  case mod_alias_md2:
325  case mod_alias_md3:
326  case mod_obj:
327  R_DrawAliasModel(e);
328  break;
329  default:
330  break;
331  }
332  e = e->next;
333  }
334 }
335 
340 {
341  if (!ents)
342  return;
343 
346  }
347  R_DrawMeshEntities(ents);
349  R_EnableLighting(nullptr, false);
350  R_EnableGlowMap(nullptr);
351  }
352 }
353 
358 {
359  entity_t* c;
360 
361  if (a == nullptr)
362  return b;
363 
364  if (b == nullptr)
365  return a;
366 
367  if (a->distanceFromViewOrigin > b->distanceFromViewOrigin) {
368  c = a;
369  c->next = R_MergeSortMerge(a->next, b);
370  } else {
371  c = b;
372  c->next = R_MergeSortMerge(a, b->next);
373  }
374 
375  return c;
376 }
377 
387 {
388  entity_t* a, *b;
389 
390  /* list containing one or no entities is already sorted by definition */
391  if (c == nullptr || c->next == nullptr)
392  return c;
393 
394  /* two element or longer lists are bisected */
395  a = c;
396  b = c->next;
397  while (b != nullptr && b->next != nullptr) {
398  c = c->next;
399  b = b->next->next;
400  }
401  b = c->next;
402  c->next = nullptr;
403 
404  /* these halves are sorted recursively, and merged into one sorted list */
406 }
407 
412 {
413  if (!ents)
414  return;
415 
418  }
419  R_EnableBlend(true);
420 
422 
423  R_EnableBlend(false);
425  R_EnableLighting(nullptr, false);
426  R_EnableGlowMap(nullptr);
427  }
428 }
429 
434 static void R_DrawNullModel (const entity_t* e)
435 {
436  int i;
437  vec3_t points[6];
438 
440 
441  glPushMatrix();
442  glMultMatrixf(e->transform.matrix);
443 
444  R_BindArray(GL_VERTEX_ARRAY, GL_FLOAT, points);
445 
446  VectorSet(points[0], 0, 0, -16);
447  for (i = 0; i <= 4; i++) {
448  points[i + 1][0] = 16 * cos(i * (M_PI / 2));
449  points[i + 1][1] = 16 * sin(i * (M_PI / 2));
450  points[i + 1][2] = 0;
451  }
452  glDrawArrays(GL_TRIANGLE_FAN, 0, 6);
453 
454  refdef.batchCount++;
455 
456  VectorSet(points[0], 0, 0, 16);
457  for (i = 4; i >= 0; i--) {
458  points[i + 1][0] = 16 * cos(i * (M_PI / 2));
459  points[i + 1][1] = 16 * sin(i * (M_PI / 2));
460  points[i + 1][2] = 0;
461  }
462  glDrawArrays(GL_TRIANGLE_FAN, 0, 6);
463 
464  refdef.batchCount++;
465 
466  R_BindDefaultArray(GL_VERTEX_ARRAY);
467 
468  glPopMatrix();
469 
471 }
472 
473 void R_DrawSpecialEntities (const entity_t* ents)
474 {
475  const entity_t* e;
476 
477  if (!ents)
478  return;
479 
480  e = ents;
481 
482  R_EnableBlend(true);
483  R_EnableDrawAsGlow(true);
484 
485  while (e) {
486  if (e->flags & RF_BOX) {
487  R_DrawBox(e);
488  } else if (e->flags & RF_PATH) {
489  R_DrawFloor(e);
490  } else if (e->flags & RF_ARROW) {
491  R_DrawArrow(e);
492  }
493  e = e->next;
494  }
495 
496  R_EnableDrawAsGlow(false);
497  R_EnableBlend(false);
498 }
499 
503 void R_DrawNullEntities (const entity_t* ents)
504 {
505  const entity_t* e;
506 
507  if (!ents)
508  return;
509 
510  e = ents;
511 
512  while (e) {
513  R_DrawNullModel(e);
514  e = e->next;
515  }
516 }
517 
522 void R_TransformForEntity (const entity_t* e, const vec3_t in, vec3_t out)
523 {
524  matrix4x4_t tmp, mat;
525 
526  Matrix4x4_CreateFromQuakeEntity(&tmp, e->origin[0], e->origin[1], e->origin[2], e->angles[0], e->angles[1],
527  e->angles[2], e->getScaleX());
528 
529  Matrix4x4_Invert_Simple(&mat, &tmp);
530  Matrix4x4_Transform(&mat, in, out);
531 }
532 
537 static float* R_CalcTransform (entity_t* e)
538 {
539  transform_t* t;
540  float* mp;
541  float mt[16], mc[16];
542 
543  /* check if this entity is already transformed */
544  t = &e->transform;
545 
546  if (t->processing)
547  Com_Error(ERR_DROP, "Ring in entity transformations!");
548 
549  if (t->done)
550  return t->matrix;
551 
552  /* process this matrix */
553  t->processing = true;
554  mp = nullptr;
555 
556  /* do parent object transformations first */
557  if (e->tagent) {
558  /* tag transformation */
559  const model_t* model = e->tagent->model;
560  const mAliasTagOrientation_t* current = nullptr;
561  const mAliasTagOrientation_t* old = nullptr;
562  const animState_t* as = &e->tagent->as;
563 
564  R_GetTags(model, e->tagname, as->frame, as->oldframe, &current, &old);
565  if (current != nullptr && old != nullptr) {
566  float interpolated[16];
567 
568  /* parent transformation */
569  mp = R_CalcTransform(e->tagent);
570 
571  /* do interpolation */
572  R_InterpolateTransform(as->backlerp, model->alias.num_frames, current, old, interpolated);
573 
574  /* transform */
575  GLMatrixMultiply(mp, interpolated, mt);
576  mp = mt;
577  }
578  }
579 
580  GLMatrixAssemble(e->origin, e->angles, mc);
581 
582  /* combine transformations */
583  if (mp)
584  GLMatrixMultiply(mp, mc, t->matrix);
585  else
586  memcpy(t->matrix, mc, sizeof(float) * 16);
587 
588  /* matrix elements 12..14 contain (forward) translation vector, which is also the origin of model after transform */
589  e->distanceFromViewOrigin = VectorDist(&t->matrix[12], refdef.viewOrigin);
590 
591  /* we're done */
592  t->done = true;
593  t->processing = false;
594 
595  return t->matrix;
596 }
597 
604 static bool R_CullEntity (entity_t* e)
605 {
607  return false;
608 
609  if (r_nocull->integer)
610  return false;
611 
612  if (!e->model) /* don't bother culling null model ents */
613  return false;
614 
615  if (e->model->type == mod_bsp_submodel)
616  return R_CullBspModel(e);
617  else
618  return R_CullMeshModel(e);
619 }
620 
625 void R_GetEntityLists (void)
626 {
627  int i;
628  entity_t** chain;
629 
630  if (!r_drawentities->integer)
631  return;
632 
633  r_opaque_mesh_entities = r_special_entities =
634  r_blend_mesh_entities = r_null_entities = nullptr;
635 
636  for (i = 0; i < refdef.numEntities; i++) {
637  entity_t* e = &r_entities[i];
638 
639  /* frustum cull check */
640  if (R_CullEntity(e))
641  continue;
642 
643  R_CalcTransform(e);
644 
645  if (!e->model) {
646  if ((e->flags & RF_BOX) || (e->flags & RF_PATH) || (e->flags & RF_ARROW))
647  chain = &r_special_entities;
648  else
649  chain = &r_null_entities;
650  } else {
651  const image_t* skin;
652  switch (e->model->type) {
653  case mod_bsp_submodel:
654  R_AddBspRRef(&(e->model->bsp), e->origin, e->angles, true);
655  continue;
656  case mod_alias_md2:
657  case mod_alias_md3:
658  case mod_obj:
659  skin = R_AliasModelState(e->model, &e->as.mesh, &e->as.frame, &e->as.oldframe, &e->skinnum);
660  if (skin == nullptr || skin->texnum == 0)
661  Com_Error(ERR_DROP, "Model '%s' has no skin assigned", e->model->name);
662  if (skin->has_alpha || (e->flags & RF_TRANSLUCENT))
663  chain = &r_blend_mesh_entities;
664  else
665  chain = &r_opaque_mesh_entities;
666  break;
667  default:
668  if (e->model->loaded)
669  Com_Error(ERR_DROP, "Unknown model type in R_GetEntityLists entity chain: %i (%s)",
670  e->model->type, e->model->name);
671  return;
672  }
673  }
674  e->next = *chain;
675  *chain = e;
676  }
677 }
678 
685 {
687  Com_Error(ERR_DROP, "R_GetFreeEntity: MAX_ENTITIES exceeded");
688  return &r_entities[refdef.numEntities];
689 }
690 
695 {
697  return nullptr;
698  return &r_entities[id];
699 }
700 
706 int R_AddEntity (const entity_t* ent)
707 {
709  Com_Error(ERR_DROP, "R_AddEntity: MAX_ENTITIES exceeded");
710 
711  /* don't add the bsp tiles from random map assemblies */
712  if (ent->model && ent->model->type == mod_bsp)
713  return -1;
714 
715  r_entities[refdef.numEntities] = *ent;
716 
718 
719  return refdef.numEntities - 1;
720 }
int oldframe
Definition: r_entity.h:56
float matrix[16]
Definition: r_entity.h:74
void R_EnableDrawAsGlow(bool enable)
Definition: r_state.cpp:692
void Matrix4x4_Invert_Simple(matrix4x4_t *out, const matrix4x4_t *in1)
Definition: r_matrix.cpp:462
#define PLAYER_WIDTH
Definition: q_sizes.h:10
#define VectorCopy(src, dest)
Definition: vector.h:51
entity_t * R_GetEntity(int id)
Returns a specific entity from the list.
Definition: r_entity.cpp:694
void R_EnableTexture(gltexunit_t *texunit, bool enable)
Definition: r_state.cpp:303
mAliasModel_t alias
Definition: r_model.h:63
#define VectorSet(v, x, y, z)
Definition: vector.h:59
void GLMatrixAssemble(const vec3_t origin, const vec3_t angles, float *matrix)
Builds an opengl translation and rotation matrix.
Definition: mathlib.cpp:325
void R_DrawOpaqueMeshEntities(entity_t *ents)
Definition: r_entity.cpp:339
static entity_t r_entities[MAX_ENTITIES]
Definition: r_entity.cpp:35
void R_AddBspRRef(const mBspModel_t *model, const vec3_t origin, const vec3_t angles, const bool forceVisibility)
Adds bsp render references.
Definition: r_bsp.cpp:324
vec3_t origin
Definition: bspfile.h:47
static void R_DrawBox(const entity_t *e)
Draws the field marker entity is specified in CL_AddTargeting.
Definition: r_entity.cpp:67
static void R_DrawNullModel(const entity_t *e)
Draw replacement model (e.g. when model wasn't found)
Definition: r_entity.cpp:434
void R_DrawEntityEffects(void)
Draws shadow and highlight effects for the entities (actors)
Definition: r_entity.cpp:208
voidpf uLong int origin
Definition: ioapi.h:45
bool processing
Definition: r_entity.h:73
void R_DrawNullEntities(const entity_t *ents)
Draw entities which models couldn't be loaded.
Definition: r_entity.cpp:503
const GLenum *typedef GLint
Definition: r_gl.h:205
#define RF_MEMBER
Definition: r_entity.h:44
#define RF_OPPONENT
Definition: r_entity.h:51
#define VectorDist(a, b)
Definition: vector.h:69
local graphics definitions
entity transform matrix
Definition: r_entity.h:71
void R_DrawAliasModel(entity_t *e)
Draw a model from the battlescape entity list.
Definition: r_mesh.cpp:717
Definition: r_image.h:45
#define RF_BLOOD
Definition: r_entity.h:42
int integer
Definition: cvar.h:81
void R_DrawBoundingBox(const AABB &absBox)
Draws the model bounding box.
Definition: r_draw.cpp:690
cvar_t * r_drawentities
Definition: r_main.cpp:60
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
bool R_CullBspModel(const entity_t *e)
Returns true if the specified entity is completely culled by the view frustum, false otherwise...
Definition: r_bsp.cpp:108
void R_Color(const vec4_t rgba)
Change the color to given value.
Definition: r_state.cpp:1011
void Com_Error(int code, const char *fmt,...)
Definition: common.cpp:417
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
Definition: r_matrix.cpp:1587
entity_t * r_blend_mesh_entities
Definition: r_entity.cpp:38
image_t * R_FindImage(const char *pname, imagetype_t type)
Finds or loads the given image.
Definition: r_image.cpp:603
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
Definition: r_matrix.cpp:748
int frame
Definition: r_entity.h:55
vec3_t viewOrigin
Definition: cl_renderer.h:172
GLuint * id
Definition: r_gl.h:149
#define RF_PATH
Definition: r_entity.h:37
cvar_t * r_stencilshadows
Definition: r_main.cpp:88
static void R_DrawFloor(const entity_t *e)
Draws a marker on the ground to indicate pathing CL_AddPathingBox.
Definition: r_entity.cpp:131
#define ERR_DROP
Definition: common.h:211
#define SELECTION_DELTA
Definition: defines.h:118
static bool R_CullEntity(entity_t *e)
Perform a frustum cull check for a given entity.
Definition: r_entity.cpp:604
GLsizei size
Definition: r_gl.h:152
rendererData_t refdef
Definition: r_main.cpp:45
#define Vector4Set(v, r, g, b, a)
Definition: vector.h:62
void R_DrawSpecialEntities(const entity_t *ents)
Definition: r_entity.cpp:473
#define RF_BOX
Definition: r_entity.h:36
entity_t * R_GetFreeEntity(void)
Get the next free entry in the entity list (the last one)
Definition: r_entity.cpp:684
#define M_PI
Definition: mathlib.h:34
#define RF_SELECTED
Definition: r_entity.h:43
static float * R_CalcTransform(entity_t *e)
Calculates transformation matrix for the model and its tags.
Definition: r_entity.cpp:537
void R_InterpolateTransform(float backLerp, int numframes, const mAliasTagOrientation_t *current, const mAliasTagOrientation_t *old, float *interpolated)
Interpolate the transform for a model places on a tag of another model.
Definition: r_mesh.cpp:212
#define RF_TRANSLUCENT
Definition: r_entity.h:35
#define RF_NEUTRAL
Definition: r_entity.h:49
entity_t * r_null_entities
Definition: r_entity.cpp:39
void R_BindDefaultArray(GLenum target)
Binds the appropriate shared vertex array to the specified target.
Definition: r_state.cpp:182
#define VectorNotEmpty(a)
Definition: vector.h:72
static image_t * actorIndicator
Definition: r_entity.cpp:202
#define RF_ALLIED
Definition: r_entity.h:45
#define RDF_NOWORLDMODEL
Definition: cl_renderer.h:34
static entity_t * R_MergeSortEntList(entity_t *c)
Merge sort for the entity list.
Definition: r_entity.cpp:386
QGL_EXTERN GLfloat f
Definition: r_gl.h:114
void R_DrawMeshEntities(entity_t *ents)
Draws the list of entities.
Definition: r_entity.cpp:316
void GLMatrixMultiply(const float a[16], const float b[16], float c[16])
Multiply 4*4 matrix by 4*4 matrix.
Definition: mathlib.cpp:350
static void R_DrawArrow(const entity_t *e)
Draws an arrow between two points.
Definition: r_entity.cpp:175
#define VectorAdd(a, b, dest)
Definition: vector.h:47
void R_DrawBlendMeshEntities(entity_t *ents)
Definition: r_entity.cpp:411
#define texunit_diffuse
Definition: r_state.h:68
static entity_t * R_MergeSortMerge(entity_t *a, entity_t *b)
Definition: r_entity.cpp:357
QGL_EXTERN GLint i
Definition: r_gl.h:113
entity_t * r_special_entities
Definition: r_entity.cpp:40
void R_EnableBlend(bool enable)
Definition: r_state.cpp:261
image_t * shadow
Definition: r_draw.cpp:35
image_t * R_AliasModelState(const model_t *mod, int *mesh, int *frame, int *oldFrame, int *skin)
entity_t * r_opaque_mesh_entities
Definition: r_entity.cpp:37
#define RF_ARROW
Definition: r_entity.h:38
#define MAX_ENTITIES
Definition: r_entity.cpp:33
void R_GetTags(const model_t *mod, const char *tagName, int currentFrame, int oldFrame, const mAliasTagOrientation_t **current, const mAliasTagOrientation_t **old)
Definition: r_mesh.cpp:168
void R_GetEntityLists(void)
Primary entry point for drawing all entities.
Definition: r_entity.cpp:625
void R_EntitySetOrigin(entity_t *ent, const vec3_t origin)
setter for entity origin
Definition: r_entity.cpp:47
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
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec_t vec2_t[2]
Definition: ufotypes.h:38
bool R_EnableLighting(r_program_t *program, bool enable)
Enables hardware-accelerated lighting with the specified program. This should be called after any tex...
Definition: r_state.cpp:350
rstate_t r_state
Definition: r_main.cpp:48
r_program_t * model_program
Definition: r_state.h:133
bool has_alpha
Definition: r_image.h:67
cvar_t * r_nocull
Definition: r_main.cpp:62
#define RF_SHADOW
Definition: r_entity.h:50
voidpf uLong offset
Definition: ioapi.h:45
void R_TransformForEntity(const entity_t *e, const vec3_t in, vec3_t out)
Definition: r_entity.cpp:522
bool R_CullMeshModel(const entity_t *e)
Checks whether a model is visible in the current scene.
Definition: r_mesh.cpp:446
bool done
Definition: r_entity.h:72
void R_DrawTexturedBox(const vec3_t a0, const vec3_t a1)
Draws the textured box, the caller should bind the texture.
Definition: r_draw.cpp:714
float backlerp
Definition: r_entity.h:57
#define R_BindTexture(tn)
Definition: r_state.h:184
#define RF_ACTOR
Definition: r_entity.h:46
void R_EnableGlowMap(const image_t *image)
Definition: r_state.cpp:664
static image_t * selectedActorIndicator
Definition: r_entity.cpp:201
void R_BindArray(GLenum target, GLenum type, const void *array)
Definition: r_state.cpp:148
GLuint texnum
Definition: r_image.h:66
vec_t vec4_t[4]
Definition: ufotypes.h:40