38 #define BACKFACE_EPSILON 0.01
40 #define MAX_BSPS_TO_RENDER 1024
69 cullState |= planeSide;
93 if (!(clipflags & bit))
111 if (!e->model->bsp.nummodelsurfaces)
114 AABB modBox = e->model->modBox;
115 if (e->isOriginBrushModel) {
116 modBox.
expand(e->model->radius);
136 const vec4_t color = {1.0, 0.0, 0.0, 1.0};
162 glDrawArrays(GL_LINES, 0, k / 3);
168 for (
int j = 0; j < surf->
numedges; j++) {
170 const GLfloat* vertex = &bsp->
verts[(surf->
index + j) * 3];
171 const GLfloat* normal = &bsp->
normals[(surf->
index + j) * 3];
173 VectorMA(vertex, 12.0, normal, end);
182 glDrawArrays(GL_LINES, 0, k / 3);
292 if (
i && !(
i & mask))
327 Com_Printf(
"Cannot add BSP model rendering reference: MAX_BSPS_TO_RENDER exceeded\n");
341 if (!forceVisibility)
359 glEnable(GL_CULL_FACE);
360 glCullFace(GL_FRONT);
404 glDisable(GL_CULL_FACE);
unsigned short numsurfaces
r_program_t * warp_program
#define VectorCopy(src, dest)
void R_EnableTexture(gltexunit_t *texunit, bool enable)
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb, vec3_t outVector)
Sets vector_out (vc) to vevtor1 (va) + scale * vector2 (vb)
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_RenderBspRRefs(drawSurfaceFunc drawFunc, surfaceArrayType_t surfType)
mBspSurfaces_t * sorted_surfaces[NUM_SURFACES_ARRAYS]
model_t * r_mapTiles[MAX_MAPTILES]
The world model(s)
static bspRenderRef_t bspRRefs[MAX_BSPS_TO_RENDER]
void R_EnableAlphaTest(bool enable)
GLfloat * vertex_array_3d
#define LEVEL_LASTVISIBLE
surfaces are assigned to arrays based on their primary rendering type and then sorted by world textur...
void R_DrawFlareSurfaces(const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr)
Flares are batched by their texture. Usually, this means one draw operation for all flares in view...
void R_DrawBspNormals(int tile)
Developer tool for viewing BSP vertex normals. Only Phong interpolated surfaces show their normals wh...
void R_RenderMaterialBspRRefs(void)
local graphics definitions
void R_RenderAlphaTestBspRRefs(void)
static void R_RecursiveVisibleWorldNode(const mBspNode_t *node, int tile)
Recurse down the bsp tree and mark all surfaces as visible for being rendered.
void Com_Printf(const char *const fmt,...)
void R_DrawBoundingBox(const AABB &absBox)
Draws the model bounding box.
void R_DrawMaterialSurfaces(const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr)
Iterates the specified surfaces list, updating materials as they are encountered, and rendering all v...
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 expand(const float byVal)
expand the box in all directions, but clip them to the maximum boundaries
#define MAX_BSPS_TO_RENDER
void R_ClearBspRRefs(void)
bool R_CullSphere(const vec3_t centre, const float radius, const unsigned int clipflags)
Performs a spherical frustum check.
glElementIndex_t * indexes
static int R_CullBox(const vec3_t mins, const vec3_t maxs)
Returns whether if the specified bounding box is completely culled by the view frustum (PSIDE_BACK)...
#define DotProduct(x, y)
Returns the distance between two 3-dimensional vectors.
struct mBspNode_s * children[2]
void R_EnableWarp(r_program_t *program, bool enable)
void R_ResetArrayState(void)
void R_GetLevelSurfaceLists(void)
Fills the surface chains for the current worldlevel and hide other levels.
void R_RenderOpaqueBspRRefs(void)
Draw all simple opaque bsp surfaces with multitexture enabled and light enabled.
#define CONTENTS_PATHFINDING_NODE
const GLuint *typedef void(APIENTRY *GenRenderbuffersEXT_t)(GLsizei
static void R_RecursiveWorldNode(const mBspNode_t *node, int tile)
Recurse down the bsp tree and mark surfaces that are visible (not culled) for being rendered...
unsigned short firstsurface
void(* drawSurfaceFunc)(const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr)
r_program_t * world_program
const vec3_t & getMins() const
struct bspRenderRef_s bspRenderRef_t
void R_DrawSurfaces(const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr)
General surface drawing function, that draw the surface chains.
void R_RenderBlendBspRRefs(void)
Draw all translucent bsp surfaces with multitexture enabled and blend enabled.
void R_SetArrayState(const mBspModel_t *bsp)
void shift(const vec3_t shiftVec)
shove the whole box by the given vector
static void R_RecurseWorld(const mBspNode_t *node, int tile)
Wrapper that recurses the bsp nodes but skip the pathfinding nodes.
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_EnableWorldLights(void)
Set up lighting data for the GLSL world shader.
void R_RenderBlendWarpBspRRefs(void)
Draw all warped translucent bsp surfaces via warp shader and with blend enabled.
void R_ReallocateStateArrays(int size)
Reallocate arrays of GL primitives if needed.
const vec3_t & getMaxs() const
void R_RenderOpaqueWarpBspRRefs(void)
Draw all warped opaque bsp surfaces via warp shader.
void R_RenderFlareBspRRefs(void)
void R_EnableGlowMap(const image_t *image)
Header file for the render material subsystem.
int TR_BoxOnPlaneSide(const vec3_t mins, const vec3_t maxs, const TR_PLANE_TYPE *plane)
Returns PSIDE_FRONT, PSIDE_BACK, or PSIDE_BOTH.