UFO: Alien Invasion
Loading...
Searching...
No Matches
portals.cpp File Reference

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"
Include dependency graph for portals.cpp:

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_tAllocPortal (void)
void FreePortal (portal_t *p)
uint32_t VisibleContents (uint32_t 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_tBaseWindingForNode (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

Detailed Description

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.

Macro Definition Documentation

◆ BASE_WINDING_EPSILON

#define BASE_WINDING_EPSILON   0.001

Definition at line 187 of file portals.cpp.

Referenced by BaseWindingForNode().

◆ SIDESPACE

#define SIDESPACE   8

Definition at line 133 of file portals.cpp.

Referenced by MakeHeadnodePortals().

◆ SPLIT_WINDING_EPSILON

#define SPLIT_WINDING_EPSILON   0.001

Definition at line 188 of file portals.cpp.

Referenced by SplitNodePortals().

Function Documentation

◆ AddPortalToNodes()

void AddPortalToNodes ( portal_t * p,
node_t * front,
node_t * back )
static

Links a portal into the given back and front nodes.

Parameters
[in,out]pThe portal to link into the front and back nodes
[in,out]frontThe front node
[in,out]backThe back node
See also
RemovePortalFromNode

Definition at line 82 of file portals.cpp.

References portal_t::next, portal_t::nodes, node_t::portals, and Sys_Error().

Referenced by MakeHeadnodePortals(), MakeNodePortal(), and SplitNodePortals().

◆ AllocPortal()

portal_t * AllocPortal ( void )
static

◆ BaseWindingForNode()

◆ CalcNodeBounds()

void CalcNodeBounds ( node_t * node)
static

Definition at line 352 of file portals.cpp.

References AABB::add(), i, node_t::nBox, node_t::portals, and AABB::setNegativeVolume().

Referenced by MakeTreePortals_r().

◆ FindPortalSide()

◆ FreePortal()

void FreePortal ( portal_t * p)
See also
AllocPortal

Definition at line 52 of file portals.cpp.

References c_active_portals, FreeWinding(), Mem_Free, threadstate, and portal_t::winding.

Referenced by FreeTreePortals_r().

◆ MakeHeadnodePortals()

void MakeHeadnodePortals ( tree_t * tree)
static

◆ MakeNodePortal()

void MakeNodePortal ( node_t * node)
static

◆ MakeTreePortals()

void MakeTreePortals ( tree_t * tree)

Definition at line 391 of file portals.cpp.

References tree_t::headnode, MakeHeadnodePortals(), and MakeTreePortals_r().

Referenced by ConstructLevelNodes_r(), and ProcessSubModel().

◆ MakeTreePortals_r()

◆ MarkVisibleSides()

void MarkVisibleSides ( tree_t * tree,
int startbrush,
int endbrush )

◆ MarkVisibleSides_r()

◆ RemovePortalFromNode()

void RemovePortalFromNode ( portal_t * portal,
node_t * l )

Removes references to the given portal from the given node.

Parameters
[in,out]portalThe portal to remove from the node
[in,out]lThe node to remove the portal from
See also
AddPortalToNodes

Definition at line 102 of file portals.cpp.

References portal_t::next, portal_t::nodes, node_t::portals, and Sys_Error().

Referenced by FreeTreePortals_r(), and SplitNodePortals().

◆ SplitNodePortals()

void SplitNodePortals ( node_t * node)
static

◆ VisibleContents()

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().

Variable Documentation

◆ c_active_portals

int c_active_portals = 0
static

Definition at line 32 of file portals.cpp.

Referenced by AllocPortal(), and FreePortal().

◆ c_peak_portals

int c_peak_portals = 0
static

Definition at line 33 of file portals.cpp.

Referenced by AllocPortal().

◆ c_tinyportals

int c_tinyportals = 0
static

Definition at line 34 of file portals.cpp.

Referenced by MakeNodePortal(), and SplitNodePortals().