UFO: Alien Invasion
|
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.
Data Structures | |
struct | bspRenderRef_s |
Macros | |
#define | BACKFACE_EPSILON 0.01 |
#define | MAX_BSPS_TO_RENDER 1024 |
Typedefs | |
typedef struct bspRenderRef_s | bspRenderRef_t |
typedef void(* | drawSurfaceFunc )(const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr) |
Functions | |
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), completely not culled (PSIDE_FRONT) or split by it (PSIDE_BOTH) More... | |
bool | R_CullSphere (const vec3_t centre, const float radius, const unsigned int clipflags) |
Performs a spherical frustum check. More... | |
bool | R_CullBspModel (const entity_t *e) |
Returns true if the specified entity is completely culled by the view frustum, false otherwise. More... | |
void | R_DrawBspNormals (int tile) |
Developer tool for viewing BSP vertex normals. Only Phong interpolated surfaces show their normals when r_shownormals > 1. More... | |
static void | R_RecursiveVisibleWorldNode (const mBspNode_t *node, int tile) |
Recurse down the bsp tree and mark all surfaces as visible for being rendered. More... | |
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. More... | |
static void | R_RecurseWorld (const mBspNode_t *node, int tile) |
Wrapper that recurses the bsp nodes but skip the pathfinding nodes. More... | |
void | R_GetLevelSurfaceLists (void) |
Fills the surface chains for the current worldlevel and hide other levels. More... | |
void | R_ClearBspRRefs (void) |
void | R_AddBspRRef (const mBspModel_t *model, const vec3_t origin, const vec3_t angles, const bool forceVisibility) |
Adds bsp render references. More... | |
static void | R_RenderBspRRefs (drawSurfaceFunc drawFunc, surfaceArrayType_t surfType) |
void | R_RenderOpaqueBspRRefs (void) |
Draw all simple opaque bsp surfaces with multitexture enabled and light enabled. More... | |
void | R_RenderOpaqueWarpBspRRefs (void) |
Draw all warped opaque bsp surfaces via warp shader. More... | |
void | R_RenderAlphaTestBspRRefs (void) |
void | R_RenderMaterialBspRRefs (void) |
void | R_RenderFlareBspRRefs (void) |
void | R_RenderBlendBspRRefs (void) |
Draw all translucent bsp surfaces with multitexture enabled and blend enabled. More... | |
void | R_RenderBlendWarpBspRRefs (void) |
Draw all warped translucent bsp surfaces via warp shader and with blend enabled. More... | |
Variables | |
static bspRenderRef_t | bspRRefs [MAX_BSPS_TO_RENDER] |
static int | numBspRRefs |
BSP model code.
Definition in file r_bsp.cpp.
#define MAX_BSPS_TO_RENDER 1024 |
Definition at line 40 of file r_bsp.cpp.
Referenced by R_AddBspRRef().
typedef struct bspRenderRef_s bspRenderRef_t |
typedef void(* drawSurfaceFunc)(const mBspSurfaces_t *surfs, glElementIndex_t *indexPtr) |
void R_AddBspRRef | ( | const mBspModel_t * | model, |
const vec3_t | origin, | ||
const vec3_t | angles, | ||
const bool | forceVisibility | ||
) |
Adds bsp render references.
[in] | model | The bsp model to add to the render chain |
[in] | origin | |
[in] | angles | |
[in] | forceVisibility | force model to be fully visible |
Definition at line 324 of file r_bsp.cpp.
References bspRenderRef_s::angles, bspRenderRef_s::bsp, Com_Printf(), mBspModel_s::firstmodelsurface, mBspSurface_s::frame, rlocals_s::frame, i, MAX_BSPS_TO_RENDER, numBspRRefs, mBspModel_s::nummodelsurfaces, bspRenderRef_s::origin, r_locals, mBspModel_s::surfaces, and VectorCopy.
Referenced by R_GetEntityLists(), and R_RenderFrame().
Returns whether if the specified bounding box is completely culled by the view frustum (PSIDE_BACK), completely not culled (PSIDE_FRONT) or split by it (PSIDE_BOTH)
[in] | mins | The mins of the bounding box |
[in] | maxs | The maxs of the bounding box |
Definition at line 57 of file r_bsp.cpp.
References rlocals_s::frustum, i, cvar_s::integer, lengthof, PSIDE_BACK, PSIDE_FRONT, r_locals, r_nocull, and TR_BoxOnPlaneSide().
Referenced by R_CullBspModel(), and R_RecursiveWorldNode().
bool R_CullBspModel | ( | const entity_t * | e | ) |
Returns true if the specified entity is completely culled by the view frustum, false otherwise.
[in] | e | The entity to check |
Definition at line 108 of file r_bsp.cpp.
References AABB::expand(), AABB::getMaxs(), AABB::getMins(), entity_t::origin, PSIDE_BACK, R_CullBox(), and AABB::shift().
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 83 of file r_bsp.cpp.
References cBspPlane_s::dist, DotProduct, rlocals_s::frustum, i, cvar_s::integer, lengthof, cBspPlane_s::normal, r_locals, and r_nocull.
Developer tool for viewing BSP vertex normals. Only Phong interpolated surfaces show their normals when r_shownormals > 1.
Definition at line 134 of file r_bsp.cpp.
References rstate_s::array_size, rendererData_t::batchCount, model_s::bsp, mBspTexInfo_s::flags, mBspSurface_s::frame, rlocals_s::frame, i, mBspSurface_s::index, cvar_s::integer, mBspModel_s::normals, mBspSurface_s::numedges, mBspModel_s::numsurfaces, R_Color(), R_EnableTexture(), r_locals, r_mapTiles, R_ReallocateStateArrays(), R_ResetArrayState(), r_shownormals, r_state, refdef, SURF_PHONG, SURF_WARP, mBspModel_s::surfaces, mBspSurface_s::texinfo, texunit_diffuse, VectorMA(), rstate_s::vertex_array_3d, and mBspModel_s::verts.
Referenced by R_RenderFrame().
Fills the surface chains for the current worldlevel and hide other levels.
Definition at line 281 of file r_bsp.cpp.
References model_s::bsp, mBspHeader_s::headnode, i, cvar_s::integer, LEVEL_LASTVISIBLE, mBspModel_s::nodes, mBspHeader_s::numfaces, r_drawworld, r_mapTiles, r_numMapTiles, R_RecurseWorld(), refdef, mBspModel_s::submodels, and rendererData_t::worldlevel.
Referenced by R_RenderFrame(), and R_RunThread().
|
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 265 of file r_bsp.cpp.
References mBspNode_s::children, mBspNode_s::contents, CONTENTS_PATHFINDING_NODE, and R_RecursiveWorldNode().
Referenced by R_GetLevelSurfaceLists().
|
static |
Recurse down the bsp tree and mark all surfaces as visible for being rendered.
[in] | node | The bsp node to mark |
[in] | tile | The maptile (map assembly) |
Definition at line 200 of file r_bsp.cpp.
References model_s::bsp, mBspNode_s::children, mBspNode_s::contents, CONTENTS_NODE, mBspNode_s::firstsurface, mBspSurface_s::frame, rlocals_s::frame, i, mBspNode_s::numsurfaces, mBspNode_s::plane, r_locals, r_mapTiles, and mBspModel_s::surfaces.
Referenced by R_RecursiveWorldNode().
|
static |
Recurse down the bsp tree and mark surfaces that are visible (not culled) for being rendered.
[in] | node | The bsp node to check |
[in] | tile | The maptile (map assembly) |
Definition at line 227 of file r_bsp.cpp.
References model_s::bsp, mBspNode_s::children, mBspNode_s::contents, CONTENTS_NODE, mBspNode_s::firstsurface, mBspSurface_s::frame, rlocals_s::frame, i, AABB::maxs, mBspNode_s::minmaxs, AABB::mins, mBspNode_s::numsurfaces, mBspNode_s::plane, PSIDE_BACK, PSIDE_FRONT, R_CullBox(), r_locals, r_mapTiles, R_RecursiveVisibleWorldNode(), and mBspModel_s::surfaces.
Referenced by R_RecurseWorld().
Definition at line 436 of file r_bsp.cpp.
References R_DrawSurfaces(), R_EnableAlphaTest(), R_EnableGlowMap(), R_EnableLighting(), R_EnableWorldLights(), R_RenderBspRRefs(), r_state, S_ALPHA_TEST, and rstate_s::world_program.
Referenced by R_RenderFrame().
Draw all translucent bsp surfaces with multitexture enabled and blend enabled.
Definition at line 462 of file r_bsp.cpp.
References rstate_s::blend_enabled, R_DrawSurfaces(), R_EnableTexture(), R_RenderBspRRefs(), r_state, S_BLEND, and texunit_lightmap.
Referenced by R_RenderFrame().
Draw all warped translucent bsp surfaces via warp shader and with blend enabled.
Definition at line 475 of file r_bsp.cpp.
References rstate_s::blend_enabled, R_DrawSurfaces(), R_EnableGlowMap(), R_EnableWarp(), R_RenderBspRRefs(), r_state, S_BLEND_WARP, and rstate_s::warp_program.
Referenced by R_RenderFrame().
|
static |
[in] | drawFunc | The function pointer to the surface draw function |
[in] | surfType | The primary rendering type of the surface |
Definition at line 357 of file r_bsp.cpp.
References bspRenderRef_s::angles, bspRenderRef_s::bsp, model_s::bsp, mBspSurfaces_s::count, i, mBspModel_s::indexes, cvar_s::integer, mBspModel_s::maptile, numBspRRefs, bspRenderRef_s::origin, PITCH, R_DrawBoundingBox(), r_mapTiles, R_ResetArrayState(), R_SetArrayState(), r_showbox, r_vertexbuffers, ROLL, mBspModel_s::sorted_surfaces, and YAW.
Referenced by R_RenderAlphaTestBspRRefs(), R_RenderBlendBspRRefs(), R_RenderBlendWarpBspRRefs(), R_RenderFlareBspRRefs(), R_RenderMaterialBspRRefs(), R_RenderOpaqueBspRRefs(), and R_RenderOpaqueWarpBspRRefs().
Definition at line 454 of file r_bsp.cpp.
References R_DrawFlareSurfaces(), R_RenderBspRRefs(), and S_FLARE.
Referenced by R_RenderFrame().
Definition at line 449 of file r_bsp.cpp.
References R_DrawMaterialSurfaces(), R_RenderBspRRefs(), and S_MATERIAL.
Referenced by R_RenderFrame().
Draw all simple opaque bsp surfaces with multitexture enabled and light enabled.
Definition at line 410 of file r_bsp.cpp.
References R_DrawSurfaces(), R_EnableGlowMap(), R_EnableLighting(), R_EnableTexture(), R_EnableWorldLights(), R_RenderBspRRefs(), r_state, S_OPAQUE, texunit_lightmap, and rstate_s::world_program.
Referenced by R_RenderFrame().
Draw all warped opaque bsp surfaces via warp shader.
Definition at line 426 of file r_bsp.cpp.
References R_DrawSurfaces(), R_EnableGlowMap(), R_EnableWarp(), R_RenderBspRRefs(), r_state, S_OPAQUE_WARP, and rstate_s::warp_program.
Referenced by R_RenderFrame().
|
static |
|
static |
Definition at line 49 of file r_bsp.cpp.
Referenced by R_AddBspRRef(), R_ClearBspRRefs(), and R_RenderBspRRefs().