33#define MAX_ENTITIES 2048*2
83 glDisable(GL_TEXTURE_2D);
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);
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];
116 glDrawArrays(GL_LINES, 0, 4);
120 glEnable(GL_TEXTURE_2D);
134 glGetIntegerv(GL_DEPTH_FUNC, &oldDepthFunc);
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.25f);
158 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
160 glDepthFunc(oldDepthFunc);
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);
221 for (
int i = 0;
i <
refdef.numEntities;
i++) {
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 } };
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) {
391 if (c ==
nullptr || c->
next ==
nullptr)
397 while (b !=
nullptr && b->
next !=
nullptr) {
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);
541 float mt[16], mc[16];
565 if (current !=
nullptr && old !=
nullptr) {
566 float interpolated[16];
586 memcpy(t->
matrix, mc,
sizeof(
float) * 16);
636 for (
i = 0;
i <
refdef.numEntities;
i++) {
652 switch (e->
model->type) {
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)",
719 return refdef.numEntities - 1;
void R_Color(const vec4_t rgba)
Change the color to given value.
void Com_Error(int code, const char *fmt,...)
void GLMatrixAssemble(const vec3_t origin, const vec3_t angles, float *matrix)
Builds an opengl translation and rotation matrix.
void GLMatrixMultiply(const float a[16], const float b[16], float c[16])
Multiply 4*4 matrix by 4*4 matrix.
bool R_CullBspModel(const entity_t *e)
Returns true if the specified entity is completely culled by the view frustum, false otherwise.
void R_AddBspRRef(const mBspModel_t *model, const vec3_t origin, const vec3_t angles, const bool forceVisibility)
Adds bsp render references.
void R_DrawTexturedBox(const vec3_t a0, const vec3_t a1)
Draws the textured box, the caller should bind the texture.
void R_DrawBoundingBox(const AABB &absBox)
Draws the model bounding box.
void R_DrawSpecialEntities(const entity_t *ents)
void R_TransformForEntity(const entity_t *e, const vec3_t in, vec3_t out)
static image_t * selectedActorIndicator
entity_t * r_blend_mesh_entities
static entity_t * R_MergeSortEntList(entity_t *c)
Merge sort for the entity list.
int R_AddEntity(const entity_t *ent)
Adds a copy of the specified entity to the list of all known render entities.
static void R_DrawFloor(const entity_t *e)
Draws a marker on the ground to indicate pathing CL_AddPathingBox.
void R_EntityAddToOrigin(entity_t *ent, const vec3_t offset)
Translates the origin of the given entity by the given offset vector.
void R_DrawOpaqueMeshEntities(entity_t *ents)
void R_DrawBlendMeshEntities(entity_t *ents)
static void R_DrawBox(const entity_t *e)
Draws the field marker entity is specified in CL_AddTargeting.
entity_t * R_GetEntity(int id)
Returns a specific entity from the list.
entity_t * r_null_entities
static entity_t r_entities[MAX_ENTITIES]
void R_GetEntityLists(void)
Primary entry point for drawing all entities.
void R_DrawEntityEffects(void)
Draws shadow and highlight effects for the entities (actors).
entity_t * r_special_entities
entity_t * r_opaque_mesh_entities
entity_t * R_GetFreeEntity(void)
Get the next free entry in the entity list (the last one).
static entity_t * R_MergeSortMerge(entity_t *a, entity_t *b)
static float * R_CalcTransform(entity_t *e)
Calculates transformation matrix for the model and its tags.
static void R_DrawArrow(const entity_t *e)
Draws an arrow between two points.
void R_EntitySetOrigin(entity_t *ent, const vec3_t origin)
setter for entity origin
static image_t * actorIndicator
static void R_DrawNullModel(const entity_t *e)
Draw replacement model (e.g. when model wasn't found).
void R_DrawMeshEntities(entity_t *ents)
Draws the list of entities.
static bool R_CullEntity(entity_t *e)
Perform a frustum cull check for a given entity.
void R_DrawNullEntities(const entity_t *ents)
Draw entities which models couldn't be loaded.
image_t * R_FindImage(const char *pname, imagetype_t type)
Finds or loads the given image.
local graphics definitions
cvar_t * r_stencilshadows
bool R_CullMeshModel(const entity_t *e)
Checks whether a model is visible in the current scene.
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
void Matrix4x4_CreateFromQuakeEntity(matrix4x4_t *out, double x, double y, double z, double pitch, double yaw, double roll, double scale)
void Matrix4x4_Invert_Simple(matrix4x4_t *out, const matrix4x4_t *in1)
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.
void R_GetTags(const model_t *mod, const char *tagName, int currentFrame, int oldFrame, const mAliasTagOrientation_t **current, const mAliasTagOrientation_t **old)
void R_DrawAliasModel(entity_t *e)
Draw a model from the battlescape entity list.
image_t * R_AliasModelState(const model_t *mod, int *mesh, int *frame, int *oldFrame, int *skin)
void R_EnableTexture(gltexunit_t *texunit, bool enable)
void R_BindDefaultArray(GLenum target)
Binds the appropriate shared vertex array to the specified target.
void R_EnableGlowMap(const image_t *image)
void R_EnableDrawAsGlow(bool enable)
bool R_EnableLighting(r_program_t *program, bool enable)
Enables hardware-accelerated lighting with the specified program. This should be called after any tex...
void R_EnableBlend(bool enable)
void R_BindArray(GLenum target, GLenum type, const void *array)
#define R_BindTexture(tn)
float distanceFromViewOrigin
#define Vector4Set(v, r, g, b, a)
#define VectorNotEmpty(a)
#define VectorCopy(src, dest)
#define VectorAdd(a, b, dest)
#define VectorSet(v, x, y, z)