portals.c 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.c:

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_tAllocPortal (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_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.c.


Define Documentation

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


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] p The portal to link into the front and back nodes
[in,out] front The front node
[in,out] back The back node
See also:
RemovePortalFromNode

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]
See also:
FreePortal

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

static winding_t* BaseWindingForNode ( node_t node  )  [static]
static void CalcNodeBounds ( node_t node  )  [static]
static void FindPortalSide ( portal_t p  )  [static]
void FreePortal ( portal_t p  ) 
See also:
AllocPortal

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]
static void MakeNodePortal ( node_t node  )  [static]
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]
void MarkVisibleSides ( tree_t tree,
int  startbrush,
int  endbrush 
)
static void MarkVisibleSides_r ( node_t node  )  [static]
void RemovePortalFromNode ( portal_t portal,
node_t l 
)

Removes references to the given portal from the given node.

Parameters:
[in,out] portal The portal to remove from the node
[in,out] l The node to remove the portal from
See also:
AddPortalToNodes

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


Variable Documentation

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


Generated by  doxygen 1.6.2