33 #define MAX_ENTITIES 2048*2
69 const vec4_t color = {e->color[0], e->color[1], e->color[2], e->alpha};
83 glDisable(GL_TEXTURE_2D);
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],
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);
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);
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);
120 glEnable(GL_TEXTURE_2D);
134 glGetIntegerv(GL_DEPTH_FUNC, &oldDepthFunc);
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 } };
151 R_BindArray(GL_TEXTURE_COORD_ARRAY, GL_FLOAT, texcoords);
153 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
155 glDepthFunc(GL_GREATER);
156 glColor4f(color[0], color[1], color[2], color[3] * 0.25
f);
158 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
160 glDepthFunc(oldDepthFunc);
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] } };
186 glDisable(GL_TEXTURE_2D);
187 glEnable(GL_LINE_SMOOTH);
190 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
195 glDisable(GL_LINE_SMOOTH);
196 glEnable(GL_TEXTURE_2D);
212 glGetIntegerv(GL_DEPTH_FUNC, &oldDepthFunc);
216 if (actorIndicator ==
nullptr) {
228 glMultMatrixf(e->transform.matrix);
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,
234 const vec2_t texcoords[] = { { 0.0, 1.0 }, { 1.0, 1.0 }, { 1.0, 0.0 }, { 0.0, 0.0 } };
243 R_BindArray(GL_TEXTURE_COORD_ARRAY, GL_FLOAT, texcoords);
245 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
253 const float size = 15.0;
256 vec4_t color = {1, 1, 1, 1};
260 const vec2_t texcoords[] = { { 0.0, 1.0 }, { 1.0, 1.0 }, { 1.0, 0.0 }, { 0.0, 0.0 } };
276 texnum = selectedActorIndicator->
texnum;
278 texnum = actorIndicator->
texnum;
285 R_BindArray(GL_TEXTURE_COORD_ARRAY, GL_FLOAT, texcoords);
288 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
295 glDepthFunc(GL_GREATER);
296 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
297 glDepthFunc(oldDepthFunc);
323 switch (e->model->type) {
367 if (a->distanceFromViewOrigin > b->distanceFromViewOrigin) {
391 if (c ==
nullptr || c->next ==
nullptr)
397 while (b !=
nullptr && b->next !=
nullptr) {
442 glMultMatrixf(e->transform.matrix);
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;
452 glDrawArrays(GL_TRIANGLE_FAN, 0, 6);
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;
462 glDrawArrays(GL_TRIANGLE_FAN, 0, 6);
488 }
else if (e->flags &
RF_PATH) {
527 e->angles[2], e->getScaleX());
541 float mt[16], mc[16];
559 const model_t* model = e->tagent->model;
565 if (current !=
nullptr && old !=
nullptr) {
566 float interpolated[16];
586 memcpy(t->
matrix, mc,
sizeof(
float) * 16);
633 r_opaque_mesh_entities = r_special_entities =
634 r_blend_mesh_entities = r_null_entities =
nullptr;
652 switch (e->model->type) {
659 skin =
R_AliasModelState(e->model, &e->as.mesh, &e->as.frame, &e->as.oldframe, &e->skinnum);
660 if (skin ==
nullptr || skin->
texnum == 0)
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);
698 return &r_entities[
id];
712 if (ent->model && ent->model->type ==
mod_bsp)
void R_EnableDrawAsGlow(bool enable)
void Matrix4x4_Invert_Simple(matrix4x4_t *out, const matrix4x4_t *in1)
#define VectorCopy(src, dest)
entity_t * R_GetEntity(int id)
Returns a specific entity from the list.
void R_EnableTexture(gltexunit_t *texunit, bool enable)
#define VectorSet(v, x, y, z)
void GLMatrixAssemble(const vec3_t origin, const vec3_t angles, float *matrix)
Builds an opengl translation and rotation matrix.
void R_DrawOpaqueMeshEntities(entity_t *ents)
static entity_t r_entities[MAX_ENTITIES]
void R_AddBspRRef(const mBspModel_t *model, const vec3_t origin, const vec3_t angles, const bool forceVisibility)
Adds bsp render references.
static void R_DrawBox(const entity_t *e)
Draws the field marker entity is specified in CL_AddTargeting.
static void R_DrawNullModel(const entity_t *e)
Draw replacement model (e.g. when model wasn't found)
void R_DrawEntityEffects(void)
Draws shadow and highlight effects for the entities (actors)
void R_DrawNullEntities(const entity_t *ents)
Draw entities which models couldn't be loaded.
const GLenum *typedef GLint
local graphics definitions
void R_DrawAliasModel(entity_t *e)
Draw a model from the battlescape entity list.
void R_DrawBoundingBox(const AABB &absBox)
Draws the model bounding box.
void R_EntityAddToOrigin(entity_t *ent, const vec3_t offset)
Translates the origin of the given entity by the given offset vector.
bool R_CullBspModel(const entity_t *e)
Returns true if the specified entity is completely culled by the view frustum, false otherwise...
void R_Color(const vec4_t rgba)
Change the color to given value.
void Com_Error(int code, const char *fmt,...)
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
entity_t * r_blend_mesh_entities
image_t * R_FindImage(const char *pname, imagetype_t type)
Finds or loads the given image.
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
cvar_t * r_stencilshadows
static void R_DrawFloor(const entity_t *e)
Draws a marker on the ground to indicate pathing CL_AddPathingBox.
static bool R_CullEntity(entity_t *e)
Perform a frustum cull check for a given entity.
#define Vector4Set(v, r, g, b, a)
void R_DrawSpecialEntities(const entity_t *ents)
entity_t * R_GetFreeEntity(void)
Get the next free entry in the entity list (the last one)
static float * R_CalcTransform(entity_t *e)
Calculates transformation matrix for the model and its tags.
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.
entity_t * r_null_entities
void R_BindDefaultArray(GLenum target)
Binds the appropriate shared vertex array to the specified target.
#define VectorNotEmpty(a)
static image_t * actorIndicator
static entity_t * R_MergeSortEntList(entity_t *c)
Merge sort for the entity list.
void R_DrawMeshEntities(entity_t *ents)
Draws the list of entities.
void GLMatrixMultiply(const float a[16], const float b[16], float c[16])
Multiply 4*4 matrix by 4*4 matrix.
static void R_DrawArrow(const entity_t *e)
Draws an arrow between two points.
#define VectorAdd(a, b, dest)
void R_DrawBlendMeshEntities(entity_t *ents)
static entity_t * R_MergeSortMerge(entity_t *a, entity_t *b)
entity_t * r_special_entities
void R_EnableBlend(bool enable)
image_t * R_AliasModelState(const model_t *mod, int *mesh, int *frame, int *oldFrame, int *skin)
entity_t * r_opaque_mesh_entities
void R_GetTags(const model_t *mod, const char *tagName, int currentFrame, int oldFrame, const mAliasTagOrientation_t **current, const mAliasTagOrientation_t **old)
void R_GetEntityLists(void)
Primary entry point for drawing all entities.
void R_EntitySetOrigin(entity_t *ent, const vec3_t origin)
setter for entity origin
int R_AddEntity(const entity_t *ent)
Adds a copy of the specified entity to the list of all known render entities.
bool R_EnableLighting(r_program_t *program, bool enable)
Enables hardware-accelerated lighting with the specified program. This should be called after any tex...
r_program_t * model_program
void R_TransformForEntity(const entity_t *e, const vec3_t in, vec3_t out)
bool R_CullMeshModel(const entity_t *e)
Checks whether a model is visible in the current scene.
void R_DrawTexturedBox(const vec3_t a0, const vec3_t a1)
Draws the textured box, the caller should bind the texture.
#define R_BindTexture(tn)
void R_EnableGlowMap(const image_t *image)
static image_t * selectedActorIndicator
void R_BindArray(GLenum target, GLenum type, const void *array)