imagine you have a series of rooms connected by doorways. Each doorway has a portal in it. If two portals can see eachother, the rooms become linked in the pvs More...
#include "bsp.h"
Go to the source code of this file.
Defines | |
#define | SIDESPACE 8 |
#define | BASE_WINDING_EPSILON 0.001 |
#define | SPLIT_WINDING_EPSILON 0.001 |
Functions | |
static portal_t * | AllocPortal (void) |
void | FreePortal (portal_t *p) |
int | VisibleContents (int contentFlags) |
Returns the single content bit of the strongest visible content present. | |
static void | AddPortalToNodes (portal_t *p, node_t *front, node_t *back) |
Links a portal into the given back and front nodes. | |
void | RemovePortalFromNode (portal_t *portal, node_t *l) |
Removes references to the given portal from the given node. | |
static void | MakeHeadnodePortals (tree_t *tree) |
The created portals will face the global outside_node. | |
static winding_t * | BaseWindingForNode (node_t *node) |
static void | MakeNodePortal (node_t *node) |
Create the new portal by taking the full plane winding for the cutting plane and clipping it by all of parents of this node. | |
static void | SplitNodePortals (node_t *node) |
Move or split the portals that bound node so that the node's children have portals instead of node. | |
static void | CalcNodeBounds (node_t *node) |
static void | MakeTreePortals_r (node_t *node) |
void | MakeTreePortals (tree_t *tree) |
static void | FindPortalSide (portal_t *p) |
Finds a brush side to use for texturing the given portal. | |
static void | MarkVisibleSides_r (node_t *node) |
void | MarkVisibleSides (tree_t *tree, int startbrush, int endbrush) |
Variables | |
static int | c_active_portals = 0 |
static int | c_peak_portals = 0 |
static int | c_tinyportals = 0 |
imagine you have a series of rooms connected by doorways. Each doorway has a portal in it. If two portals can see eachother, the rooms become linked in the pvs
Definition in file portals.c.
#define BASE_WINDING_EPSILON 0.001 |
Definition at line 189 of file portals.c.
Referenced by BaseWindingForNode().
#define SIDESPACE 8 |
Definition at line 133 of file portals.c.
Referenced by MakeHeadnodePortals().
#define SPLIT_WINDING_EPSILON 0.001 |
Definition at line 190 of file portals.c.
Referenced by SplitNodePortals().
Links a portal into the given back and front nodes.
[in,out] | p | The portal to link into the front and back nodes |
[in,out] | front | The front node |
[in,out] | back | The back node |
Definition at line 82 of file portals.c.
References portal_s::next, portal_s::nodes, node_s::portals, and Sys_Error().
Referenced by MakeHeadnodePortals(), MakeNodePortal(), and SplitNodePortals().
static portal_t* AllocPortal | ( | void | ) | [static] |
Definition at line 39 of file portals.c.
References c_active_portals, c_peak_portals, Mem_Alloc, and threadstate.
Referenced by MakeHeadnodePortals(), MakeNodePortal(), and SplitNodePortals().
Definition at line 192 of file portals.c.
References BASE_WINDING_EPSILON, BaseWindingForPlane(), node_s::children, ChopWindingInPlace(), plane_s::dist, mapplanes, light_s::normal, plane_s::normal, node_s::parent, node_s::planenum, vec3_origin, and VectorSubtract.
Referenced by MakeNodePortal().
static void CalcNodeBounds | ( | node_t * | node | ) | [static] |
Definition at line 354 of file portals.c.
References AddPointToBounds(), ClearBounds(), i, node_s::maxs, node_s::mins, portal_s::next, portal_s::nodes, winding_s::numpoints, winding_s::p, node_s::portals, and portal_s::winding.
Referenced by MakeTreePortals_r().
static void FindPortalSide | ( | portal_t * | p | ) | [static] |
Finds a brush side to use for texturing the given portal.
Definition at line 405 of file portals.c.
References side_s::bevel, node_s::brushlist, mapbrush_s::contentFlags, node_s::contentFlags, DotProduct, i, mapplanes, bspbrush_s::next, portal_s::nodes, plane_s::normal, mapbrush_s::numsides, portal_s::onnode, bspbrush_s::original, mapbrush_s::original_sides, side_s::planenum, node_s::planenum, qtrue, portal_s::side, portal_s::sidefound, side_s::texinfo, TEXINFO_NODE, VERB_EXTRA, Verb_Printf(), and VisibleContents().
Referenced by MarkVisibleSides_r().
void FreePortal | ( | portal_t * | p | ) |
Definition at line 52 of file portals.c.
References c_active_portals, FreeWinding(), Mem_Free, threadstate, and portal_s::winding.
Referenced by FreeTreePortals_r().
static void MakeHeadnodePortals | ( | tree_t * | tree | ) | [static] |
The created portals will face the global outside_node.
Definition at line 137 of file portals.c.
References AddPortalToNodes(), AllocPortal(), BaseWindingForPlane(), node_s::brushlist, ChopWindingInPlace(), node_s::contentFlags, plane_s::dist, tree_t::headnode, i, tree_t::maxs, tree_t::mins, light_s::normal, plane_s::normal, ON_EPSILON, tree_t::outside_node, portal_s::plane, node_s::planenum, PLANENUM_LEAF, node_s::portals, SIDESPACE, and portal_s::winding.
Referenced by MakeTreePortals().
static void MakeNodePortal | ( | node_t * | node | ) | [static] |
Create the new portal by taking the full plane winding for the cutting plane and clipping it by all of parents of this node.
Definition at line 225 of file portals.c.
References AddPortalToNodes(), AllocPortal(), BaseWindingForNode(), c_tinyportals, node_s::children, ChopWindingInPlace(), plane_s::dist, FreeWinding(), mapplanes, portal_s::next, portal_s::nodes, plane_s::normal, light_s::normal, portal_s::onnode, portal_s::plane, node_s::planenum, node_s::portals, Sys_Error(), vec3_origin, VectorCopy, VectorSubtract, portal_s::winding, and WindingIsTiny().
Referenced by MakeTreePortals_r().
void MakeTreePortals | ( | tree_t * | tree | ) |
Definition at line 396 of file portals.c.
References tree_t::headnode, MakeHeadnodePortals(), and MakeTreePortals_r().
Referenced by ConstructLevelNodes_r(), and ProcessSubModel().
static void MakeTreePortals_r | ( | node_t * | node | ) | [static] |
Definition at line 371 of file portals.c.
References CalcNodeBounds(), node_s::children, Com_Printf(), i, MakeNodePortal(), MAX_WORLD_WIDTH, node_s::maxs, node_s::mins, node_s::planenum, PLANENUM_LEAF, and SplitNodePortals().
Referenced by MakeTreePortals().
void MarkVisibleSides | ( | tree_t * | tree, | |
int | startbrush, | |||
int | endbrush | |||
) |
Definition at line 491 of file portals.c.
References tree_t::headnode, i, mapbrushes, MarkVisibleSides_r(), mapbrush_s::numsides, mapbrush_s::original_sides, qfalse, VERB_EXTRA, Verb_Printf(), and side_s::visible.
Referenced by ConstructLevelNodes_r(), and ProcessSubModel().
static void MarkVisibleSides_r | ( | node_t * | node | ) | [static] |
Definition at line 464 of file portals.c.
References node_s::children, node_s::contentFlags, FindPortalSide(), portal_s::next, portal_s::nodes, portal_s::onnode, node_s::planenum, PLANENUM_LEAF, node_s::portals, qtrue, portal_s::side, portal_s::sidefound, and side_s::visible.
Referenced by MarkVisibleSides().
Removes references to the given portal from the given node.
[in,out] | portal | The portal to remove from the node |
[in,out] | l | The node to remove the portal from |
Definition at line 102 of file portals.c.
References portal_s::next, portal_s::nodes, node_s::portals, and Sys_Error().
Referenced by FreeTreePortals_r(), and SplitNodePortals().
static void SplitNodePortals | ( | node_t * | node | ) | [static] |
Move or split the portals that bound node so that the node's children have portals instead of node.
Definition at line 272 of file portals.c.
References AddPortalToNodes(), AllocPortal(), c_tinyportals, node_s::children, ClipWindingEpsilon(), plane_s::dist, f, FreeWinding(), mapplanes, portal_s::next, portal_s::nodes, plane_s::normal, node_s::planenum, node_s::portals, RemovePortalFromNode(), SPLIT_WINDING_EPSILON, Sys_Error(), portal_s::winding, and WindingIsTiny().
Referenced by MakeTreePortals_r().
int VisibleContents | ( | int | contentFlags | ) |
Returns the single content bit of the strongest visible content present.
Definition at line 64 of file portals.c.
References i, and LAST_VISIBLE_CONTENTS.
Referenced by FaceFromPortal(), and FindPortalSide().
int c_active_portals = 0 [static] |
Definition at line 32 of file portals.c.
Referenced by AllocPortal(), and FreePortal().
int c_peak_portals = 0 [static] |
Definition at line 33 of file portals.c.
Referenced by AllocPortal().
int c_tinyportals = 0 [static] |
Definition at line 34 of file portals.c.
Referenced by MakeNodePortal(), and SplitNodePortals().