UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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"

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. 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_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. 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
 

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

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

Function Documentation

static 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_s::next, portal_s::nodes, node_s::portals, and Sys_Error().

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

static portal_t* AllocPortal ( void  )
static
static void CalcNodeBounds ( node_t node)
static

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

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_s::winding.

Referenced by FreeTreePortals_r().

static void MakeNodePortal ( node_t node)
static
void MakeTreePortals ( tree_t tree)

Definition at line 391 of file portals.cpp.

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

Referenced by ConstructLevelNodes_r(), and ProcessSubModel().

static void MakeTreePortals_r ( node_t node)
static
void MarkVisibleSides ( tree_t tree,
int  startbrush,
int  endbrush 
)
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_s::next, portal_s::nodes, node_s::portals, and Sys_Error().

Referenced by FreeTreePortals_r(), and SplitNodePortals().

static void SplitNodePortals ( node_t node)
static
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

int c_active_portals = 0
static

Definition at line 32 of file portals.cpp.

Referenced by AllocPortal(), and FreePortal().

int c_peak_portals = 0
static

Definition at line 33 of file portals.cpp.

Referenced by AllocPortal().

int c_tinyportals = 0
static

Definition at line 34 of file portals.cpp.

Referenced by MakeNodePortal(), and SplitNodePortals().