BSP model code. More...
#include "r_local.h"
#include "r_lightmap.h"
#include "r_material.h"
#include "r_light.h"
#include "r_draw.h"
Go to the source code of this file.
Defines | |
#define | BACKFACE_EPSILON 0.01 |
Functions | |
static qboolean | R_CullBox (const vec3_t mins, const vec3_t maxs) |
Returns true if the specified bounding box is completely culled by the view frustum, false otherwise. | |
qboolean | R_CullSphere (const vec3_t centre, const float radius, const unsigned int clipflags) |
Performs a spherical frustum check. | |
qboolean | R_CullBspModel (const entity_t *e) |
Returns true if the specified entity is completely culled by the view frustum, false otherwise. | |
static void | R_DrawBspModelSurfaces (const entity_t *e, const vec3_t modelorg) |
Renders all the surfaces that belongs to an inline bsp model entity. | |
void | R_DrawBrushModel (const entity_t *e) |
Draws a brush model. | |
void | R_DrawBspNormals (int tile) |
Developer tool for viewing BSP vertex normals. Only Phong interpolated surfaces show their normals when r_shownormals > 1. | |
static void | R_RecursiveWorldNode (const mBspNode_t *node, int tile) |
Recurse down the bsp tree and mark surfaces that are visible (not culled and in front) for being rendered. | |
static void | R_RecurseWorld (const mBspNode_t *node, int tile) |
Wrapper that recurses the bsp nodes but skip the pathfinding nodes. | |
void | R_GetLevelSurfaceLists (void) |
Fills the surface chains for the current worldlevel and hide other levels. |
BSP model code.
Definition in file r_bsp.c.
#define BACKFACE_EPSILON 0.01 |
Definition at line 38 of file r_bsp.c.
Referenced by R_DrawBspModelSurfaces().
Returns true if the specified bounding box is completely culled by the view frustum, false otherwise.
[in] | mins | The mins of the bounding box |
[in] | maxs | The maxs of the bounding box |
Definition at line 47 of file r_bsp.c.
References rlocals_s::frustum, i, cvar_s::integer, lengthof, PSIDE_BACK, qfalse, qtrue, r_locals, r_nocull, and TR_BoxOnPlaneSide().
Referenced by R_CullBspModel(), and R_RecursiveWorldNode().
Returns true if the specified entity is completely culled by the view frustum, false otherwise.
[in] | e | The entity to check |
Definition at line 93 of file r_bsp.c.
References i, qtrue, R_CullBox(), R_EntityGetOrigin(), VectorAdd, and VectorCopy.
Referenced by R_CullEntity().
Performs a spherical frustum check.
[in] | centre | The world coordinate that is the center of the sphere |
[in] | radius | The radius of the sphere to check the frustum for |
[in] | clipflags | Can be used to skip sides of the frustum planes |
true
if the sphere is completely outside the frustum, false
otherwise Definition at line 68 of file r_bsp.c.
References cBspPlane_s::dist, DotProduct, rlocals_s::frustum, i, cvar_s::integer, lengthof, cBspPlane_s::normal, qfalse, qtrue, r_locals, and r_nocull.
void R_DrawBrushModel | ( | const entity_t * | e | ) |
Draws a brush model.
[in] | e | The inline bsp model entity |
Definition at line 181 of file r_bsp.c.
References cvar_s::integer, PITCH, R_DrawBoundingBox(), R_DrawBspModelSurfaces(), R_EntityGetOrigin(), R_ShiftLights(), r_showbox, refdef, ROLL, vec3_origin, VectorCopy, VectorCreateRotationMatrix(), VectorNotEmpty, VectorRotatePoint(), VectorSubtract, rendererData_t::viewOrigin, and YAW.
Referenced by R_DrawBspEntities().
Renders all the surfaces that belongs to an inline bsp model entity.
[in] | e | The inline bsp model entity |
[in] | modelorg | relative to viewpoint |
Definition at line 121 of file r_bsp.c.
References AXIAL, BACKFACE_EPSILON, cBspPlane_s::dist, DotProduct, f, mBspSurface_s::flags, mBspSurface_s::frame, rlocals_s::frame, i, MSURF_PLANEBACK, cBspPlane_s::normal, mBspSurface_s::plane, qfalse, qtrue, R_DrawAlphaTestSurfaces(), R_DrawBlendSurfaces(), R_DrawBlendWarpSurfaces(), R_DrawFlareSurfaces(), R_DrawMaterialSurfaces(), R_DrawOpaqueSurfaces(), R_DrawOpaqueWarpSurfaces(), R_EnableBlend(), R_EnableFog(), r_locals, and cBspPlane_s::type.
Referenced by R_DrawBrushModel().
void R_DrawBspNormals | ( | int | tile | ) |
Developer tool for viewing BSP vertex normals. Only Phong interpolated surfaces show their normals when r_shownormals > 1.
Definition at line 227 of file r_bsp.c.
References model_s::bsp, Com_Error(), ERR_DROP, mBspTexInfo_s::flags, rlocals_s::frame, mBspSurface_s::frame, i, mBspSurface_s::index, cvar_s::integer, MAX_GL_ARRAY_LENGTH, mBspModel_s::normals, mBspSurface_s::numedges, mBspModel_s::numsurfaces, qfalse, qtrue, R_Color(), R_EnableTexture(), r_locals, r_mapTiles, R_ResetArrayState(), r_shownormals, r_state, SURF_PHONG, SURF_WARP, mBspModel_s::surfaces, mBspSurface_s::texinfo, texunit_diffuse, VectorMA(), rstate_t::vertex_array_3d, and mBspModel_s::verts.
Referenced by R_RenderFrame().
void R_GetLevelSurfaceLists | ( | void | ) |
Fills the surface chains for the current worldlevel and hide other levels.
Definition at line 366 of file r_bsp.c.
References model_s::bsp, rlocals_s::frame, mBspHeader_s::headnode, i, cvar_s::integer, LEVEL_LASTVISIBLE, r_drawworld, r_locals, r_mapTiles, r_numMapTiles, R_RecurseWorld(), refdef, mBspModel_s::submodels, and rendererData_t::worldlevel.
Referenced by R_RenderFrame(), and R_RunThread().
static void R_RecurseWorld | ( | const mBspNode_t * | node, | |
int | tile | |||
) | [static] |
Wrapper that recurses the bsp nodes but skip the pathfinding nodes.
[in] | node | The bsp node to check |
[in] | tile | The maptile (map assembly) |
Definition at line 350 of file r_bsp.c.
References mBspNode_s::children, mBspNode_s::contents, CONTENTS_PATHFINDING_NODE, and R_RecursiveWorldNode().
Referenced by R_GetLevelSurfaceLists().
static void R_RecursiveWorldNode | ( | const mBspNode_t * | node, | |
int | tile | |||
) | [static] |
Recurse down the bsp tree and mark surfaces that are visible (not culled and in front) for being rendered.
[in] | node | The bsp node to check |
[in] | tile | The maptile (map assembly) |
Definition at line 292 of file r_bsp.c.
References AXIAL, model_s::bsp, mBspNode_s::children, mBspNode_s::contents, CONTENTS_NODE, CONTENTS_SOLID, cBspPlane_s::dist, DotProduct, mBspNode_s::firstsurface, mBspSurface_s::flags, rlocals_s::forward, rlocals_s::frame, mBspSurface_s::frame, i, cvar_s::integer, mBspNode_s::minmaxs, MSURF_PLANEBACK, cBspPlane_s::normal, mBspNode_s::numsurfaces, mBspNode_s::plane, R_CullBox(), r_isometric, r_locals, r_mapTiles, refdef, mBspModel_s::surfaces, cBspPlane_s::type, and rendererData_t::viewOrigin.
Referenced by R_RecurseWorld().