|
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_t |
Macros | |
| #define | BACKFACE_EPSILON 0.01 |
| #define | MAX_BSPS_TO_RENDER 1024 |
Typedefs | |
| 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). | |
| bool | R_CullSphere (const vec3_t centre, const float radius, const unsigned int clipflags) |
| Performs a spherical frustum check. | |
| bool | R_CullBspModel (const entity_t *e) |
| Returns true if the specified entity is completely culled by the view frustum, false otherwise. | |
| 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_RecursiveVisibleWorldNode (const mBspNode_t *node, int tile) |
| Recurse down the bsp tree and mark all surfaces as visible for being rendered. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| void | R_RenderOpaqueWarpBspRRefs (void) |
| Draw all warped opaque bsp surfaces via warp shader. | |
| 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. | |
| void | R_RenderBlendWarpBspRRefs (void) |
| Draw all warped translucent bsp surfaces via warp shader and with blend enabled. | |
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 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_t::angles, bspRenderRef_t::bsp, bspRRefs, Com_Printf(), mBspModel_t::firstmodelsurface, mBspSurface_t::frame, i, MAX_BSPS_TO_RENDER, numBspRRefs, mBspModel_t::nummodelsurfaces, bspRenderRef_t::origin, r_locals, mBspModel_t::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 i, 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::isOriginBrushModel, entity_t::model, 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_t::dist, DotProduct, i, lengthof, cBspPlane_t::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 mBspTexInfo_t::flags, mBspSurface_t::frame, i, mBspSurface_t::index, mBspModel_t::normals, mBspSurface_t::numedges, mBspModel_t::numsurfaces, R_Color(), R_EnableTexture(), r_locals, r_mapTiles, R_ReallocateStateArrays(), R_ResetArrayState(), r_shownormals, r_state, refdef, SURF_PHONG, SURF_WARP, mBspModel_t::surfaces, mBspSurface_t::texinfo, texunit_diffuse, VectorMA(), and mBspModel_t::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 mBspHeader_t::headnode, i, LEVEL_LASTVISIBLE, mBspModel_t::nodes, mBspHeader_t::numfaces, r_drawworld, r_mapTiles, r_numMapTiles, R_RecurseWorld(), refdef, and mBspModel_t::submodels.
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_t::children, mBspNode_t::contents, CONTENTS_PATHFINDING_NODE, R_RecurseWorld(), and R_RecursiveWorldNode().
Referenced by R_GetLevelSurfaceLists(), and R_RecurseWorld().
|
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 mBspNode_t::children, mBspNode_t::contents, CONTENTS_NODE, mBspNode_t::firstsurface, mBspSurface_t::frame, i, mBspNode_t::numsurfaces, mBspNode_t::plane, r_locals, r_mapTiles, and R_RecursiveVisibleWorldNode().
Referenced by R_RecursiveVisibleWorldNode(), and 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 mBspNode_t::children, mBspNode_t::contents, CONTENTS_NODE, mBspNode_t::firstsurface, mBspSurface_t::frame, i, AABB::maxs, mBspNode_t::minmaxs, AABB::mins, mBspNode_t::numsurfaces, mBspNode_t::plane, PSIDE_BACK, PSIDE_FRONT, R_CullBox(), r_locals, r_mapTiles, R_RecursiveVisibleWorldNode(), and R_RecursiveWorldNode().
Referenced by R_RecurseWorld(), and R_RecursiveWorldNode().
Definition at line 436 of file r_bsp.cpp.
References R_DrawSurfaces(), R_EnableAlphaTest(), R_EnableGlowMap(), R_EnableLighting(), R_EnableWorldLights(), R_RenderBspRRefs(), r_state, and S_ALPHA_TEST.
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 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 R_DrawSurfaces(), R_EnableGlowMap(), R_EnableWarp(), R_RenderBspRRefs(), r_state, and S_BLEND_WARP.
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_t::angles, bspRenderRef_t::bsp, bspRRefs, mBspSurfaces_t::count, i, mBspModel_t::indexes, mBspModel_t::maptile, numBspRRefs, bspRenderRef_t::origin, PITCH, R_DrawBoundingBox(), r_mapTiles, R_ResetArrayState(), R_SetArrayState(), r_showbox, r_vertexbuffers, ROLL, mBspModel_t::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, and texunit_lightmap.
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, and S_OPAQUE_WARP.
Referenced by R_RenderFrame().
|
static |
Definition at line 48 of file r_bsp.cpp.
Referenced by R_AddBspRRef(), and R_RenderBspRRefs().
|
static |
Definition at line 49 of file r_bsp.cpp.
Referenced by R_AddBspRRef(), R_ClearBspRRefs(), and R_RenderBspRRefs().