85 Sys_Error(
"AddPortalToNodes: already included");
111 Sys_Error(
"RemovePortalFromNode: portal not in leaf");
116 if (t->
nodes[0] == l)
118 else if (t->
nodes[1] == l)
121 Sys_Error(
"RemovePortalFromNode: portal not bounding leaf");
124 if (portal->
nodes[0] == l) {
125 *pp = portal->
next[0];
126 portal->
nodes[0] =
nullptr;
127 }
else if (portal->
nodes[1] == l) {
128 *pp = portal->
next[1];
129 portal->
nodes[1] =
nullptr;
146 for (i = 0; i < 3; i++) {
156 for (i = 0; i < 3; i++)
157 for (j = 0; j < 2; j++) {
158 const int n = j * 3 +
i;
167 pl->
dist = -bounds[j][
i];
170 pl->
dist = bounds[j][
i];
178 for (i = 0; i < 6; i++) {
179 for (j = 0; j < 6; j++) {
187 #define BASE_WINDING_EPSILON 0.001
188 #define SPLIT_WINDING_EPSILON 0.001
199 for (n = node->
parent; n && w;) {
234 for (p = node->
portals; p && w; p = p->
next[side]) {
235 if (p->
nodes[0] == node) {
239 }
else if (p->
nodes[1] == node) {
244 Sys_Error(
"CutNodePortals_r: mislinked portal");
260 new_portal->
onnode = node;
272 portal_t* p, *next_portal, *new_portal;
282 for (p = node->
portals; p; p = next_portal) {
283 if (p->
nodes[0] == node)
285 else if (p->
nodes[1] == node)
288 Sys_Error(
"SplitNodePortals: mislinked portal");
289 next_portal = p->
next[side];
301 frontwinding =
nullptr;
307 backwinding =
nullptr;
311 if (!frontwinding && !backwinding) {
335 new_portal->
winding = backwinding;
359 s = (p->nodes[1] == node);
362 for (
int i = 0;
i < p->winding->numpoints;
i++)
372 Com_Printf(
"WARNING: node without a volume\n");
375 for (
int i = 0;
i < 3;
i++) {
409 side_t* bestside =
nullptr;
412 for (
int j = 0; j < 2; j++) {
431 if ((side->
planenum &~ 1) == planenum) {
472 s = (p->
nodes[0] == node);
487 for (
int i = startbrush;
i < endbrush;
i++) {
490 for (
int j = 0; j < numsides; j++)
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 RemovePortalFromNode(portal_t *portal, node_t *l)
Removes references to the given portal from the given node.
#define VectorCopy(src, dest)
void setNegativeVolume()
Sets mins and maxs to their starting points before using addPoint.
void Sys_Error(const char *error,...)
#define LAST_VISIBLE_CONTENTS
static int c_active_portals
static void MakeHeadnodePortals(tree_t *tree)
The created portals will face the global outside_node.
struct portal_s * next[2]
static void AddPortalToNodes(portal_t *p, node_t *front, node_t *back)
Links a portal into the given back and front nodes.
void ChopWindingInPlace(winding_t **inout, const vec3_t normal, const vec_t dist, const vec_t epsilon)
static void MakeTreePortals_r(node_t *node)
static int c_peak_portals
uint32_t VisibleContents(uint32_t contentFlags)
Returns the single content bit of the strongest visible content present.
void Com_Printf(const char *const fmt,...)
static winding_t * BaseWindingForNode(node_t *node)
#define BASE_WINDING_EPSILON
mapbrush_t mapbrushes[MAX_MAP_BRUSHES]
void add(const vec3_t point)
If the point is outside the box, expand the box to accommodate it.
#define DotProduct(x, y)
Returns the distance between two 3-dimensional vectors.
struct node_s * children[2]
void ClipWindingEpsilon(const winding_t *in, const vec3_t normal, const vec_t dist, const vec_t epsilon, winding_t **front, winding_t **back)
#define SPLIT_WINDING_EPSILON
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 o...
struct side_s * original_sides
struct mapbrush_s * brush
for storing the vertices of the side of a brush or other polygon
bool WindingIsTiny(winding_t *w)
Returns true if the winding would be crunched out of existance by the vertex snapping.
plane_t mapplanes[MAX_MAP_PLANES]
struct portal_s * portals
void FreePortal(portal_t *p)
void MarkVisibleSides(tree_t *tree, int startbrush, int endbrush)
winding_t * BaseWindingForPlane(const vec3_t normal, const vec_t dist)
#define MAX_WORLD_WIDTH
-MAX_WORLD_WIDTH up tp +MAX_WORLD_WIDTH
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...
#define Mem_AllocType(type)
struct node_s outside_node
static void CalcNodeBounds(node_t *node)
static portal_t * AllocPortal(void)
#define VectorSubtract(a, b, dest)
void MakeTreePortals(tree_t *tree)
void FreeWinding(winding_t *w)