UFO: Alien Invasion
|
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.
Macros | |
#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) |
uint32_t | VisibleContents (uint32_t contentFlags) |
Returns the single content bit of the strongest visible content present. More... | |
static void | AddPortalToNodes (portal_t *p, node_t *front, node_t *back) |
Links a portal into the given back and front nodes. More... | |
void | RemovePortalFromNode (portal_t *portal, node_t *l) |
Removes references to the given portal from the given node. More... | |
static void | MakeHeadnodePortals (tree_t *tree) |
The created portals will face the global outside_node. More... | |
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. More... | |
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. More... | |
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. More... | |
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.cpp.
#define BASE_WINDING_EPSILON 0.001 |
Definition at line 187 of file portals.cpp.
Referenced by BaseWindingForNode().
#define SIDESPACE 8 |
Definition at line 133 of file portals.cpp.
Referenced by MakeHeadnodePortals().
#define SPLIT_WINDING_EPSILON 0.001 |
Definition at line 188 of file portals.cpp.
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.cpp.
References portal_s::next, portal_s::nodes, node_s::portals, and Sys_Error().
Referenced by MakeHeadnodePortals(), MakeNodePortal(), and SplitNodePortals().
Definition at line 39 of file portals.cpp.
References c_active_portals, c_peak_portals, Mem_AllocType, and threadstate.
Referenced by MakeHeadnodePortals(), MakeNodePortal(), and SplitNodePortals().
Definition at line 190 of file portals.cpp.
References BASE_WINDING_EPSILON, BaseWindingForPlane(), node_s::children, ChopWindingInPlace(), plane_s::dist, mapplanes, plane_s::normal, node_s::parent, node_s::planenum, vec3_origin, and VectorSubtract.
Referenced by MakeNodePortal().
Definition at line 352 of file portals.cpp.
References AABB::add(), i, node_s::nBox, portal_s::next, node_s::portals, and AABB::setNegativeVolume().
Referenced by MakeTreePortals_r().
Finds a brush side to use for texturing the given portal.
Definition at line 400 of file portals.cpp.
References side_s::bevel, side_s::brush, node_s::brushlist, node_s::contentFlags, mapbrush_s::contentFlags, DotProduct, i, mapplanes, bspbrush_s::next, portal_s::nodes, plane_s::normal, mapbrush_s::numsides, portal_s::onnode, mapbrush_s::original_sides, node_s::planenum, side_s::planenum, portal_s::side, portal_s::sidefound, side_s::texinfo, TEXINFO_NODE, VERB_EXTRA, Verb_Printf(), and VisibleContents().
Referenced by MarkVisibleSides_r().
Definition at line 52 of file portals.cpp.
References c_active_portals, FreeWinding(), Mem_Free, threadstate, and portal_s::winding.
Referenced by FreeTreePortals_r().
The created portals will face the global outside_node.
Definition at line 137 of file portals.cpp.
References tree_s::aabb, AddPortalToNodes(), AllocPortal(), BaseWindingForPlane(), node_s::brushlist, ChopWindingInPlace(), node_s::contentFlags, plane_s::dist, tree_s::headnode, i, AABB::maxs, AABB::mins, plane_s::normal, OBJZERO, ON_EPSILON, tree_s::outside_node, portal_s::plane, node_s::planenum, PLANENUM_LEAF, node_s::portals, SIDESPACE, side_s::winding, and portal_s::winding.
Referenced by MakeTreePortals().
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 223 of file portals.cpp.
References AddPortalToNodes(), AllocPortal(), BaseWindingForNode(), c_tinyportals, node_s::children, ChopWindingInPlace(), plane_s::dist, FreeWinding(), mapplanes, portal_s::next, portal_s::nodes, plane_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().
Definition at line 391 of file portals.cpp.
References tree_s::headnode, MakeHeadnodePortals(), and MakeTreePortals_r().
Referenced by ConstructLevelNodes_r(), and ProcessSubModel().
Definition at line 368 of file portals.cpp.
References CalcNodeBounds(), node_s::children, Com_Printf(), i, MakeNodePortal(), MAX_WORLD_WIDTH, AABB::maxs, AABB::mins, node_s::nBox, node_s::planenum, PLANENUM_LEAF, and SplitNodePortals().
Referenced by MakeTreePortals().
Definition at line 482 of file portals.cpp.
References tree_s::headnode, i, mapbrushes, MarkVisibleSides_r(), mapbrush_s::numsides, mapbrush_s::original_sides, VERB_EXTRA, Verb_Printf(), and side_s::visible.
Referenced by ConstructLevelNodes_r(), and ProcessSubModel().
Definition at line 455 of file portals.cpp.
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, 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.cpp.
References portal_s::next, portal_s::nodes, node_s::portals, and Sys_Error().
Referenced by FreeTreePortals_r(), and SplitNodePortals().
Move or split the portals that bound node so that the node's children have portals instead of node.
Definition at line 270 of file portals.cpp.
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().
uint32_t VisibleContents | ( | uint32_t | contentFlags | ) |
Returns the single content bit of the strongest visible content present.
Definition at line 64 of file portals.cpp.
References i, and LAST_VISIBLE_CONTENTS.
Referenced by FaceFromPortal(), and FindPortalSide().
|
static |
Definition at line 32 of file portals.cpp.
Referenced by AllocPortal(), and FreePortal().
|
static |
Definition at line 33 of file portals.cpp.
Referenced by AllocPortal().
|
static |
Definition at line 34 of file portals.cpp.
Referenced by MakeNodePortal(), and SplitNodePortals().