Constructive Solids Geometry. More...
#include "bsp.h"
Go to the source code of this file.
Functions | |
static bspbrush_t * | SubtractBrush (bspbrush_t *a, const bspbrush_t *b) |
static qboolean | BrushesDisjoint (bspbrush_t *a, bspbrush_t *b) |
static bspbrush_t * | ClipBrushToBox (bspbrush_t *brush, vec3_t clipmins, vec3_t clipmaxs) |
Any planes shared with the box edge will be set to no texinfo. | |
static qboolean | IsInLevel (const int contents, const int level) |
checks if the level# matches the contentsmask. The level# is mapped to the appropriate levelflags. | |
static bspbrush_t * | AddBrushListToTail (bspbrush_t *list, bspbrush_t *tail) |
static bspbrush_t * | CullList (bspbrush_t *list, bspbrush_t *skip) |
Builds a new list that doesn't hold the given brush. | |
static qboolean | BrushGE (bspbrush_t *b1, bspbrush_t *b2) |
Returns true if b1 is allowed to bite b2. | |
int | MapBrushesBounds (const int startbrush, const int endbrush, const int level, const vec3_t clipmins, const vec3_t clipmaxs, vec3_t mins, vec3_t maxs) |
sets mins and maxs to the smallest sizes that can contain all brushes from startbrush to endbrush that are in a given level. | |
bspbrush_t * | MakeBspBrushList (int startbrush, int endbrush, int level, vec3_t clipmins, vec3_t clipmaxs) |
bspbrush_t * | ChopBrushes (bspbrush_t *head) |
Carves any intersecting solid brushes into the minimum number of non-intersecting brushes. | |
Variables | |
static int | minplanenums [2] |
static int | maxplanenums [2] |
Constructive Solids Geometry.
each side has a count of the other sides it splits
the best split will be the one that minimizes the total split counts of all remaining sides
precalc side on plane table
evaluate split side
{ cost = 0 for all sides for all sides get if side splits side and splitside is on same child cost++; }
Definition in file csg.c.
static bspbrush_t* AddBrushListToTail | ( | bspbrush_t * | list, | |
bspbrush_t * | tail | |||
) | [static] |
Definition at line 199 of file csg.c.
References bspbrush_s::next, and next.
Referenced by ChopBrushes().
static qboolean BrushesDisjoint | ( | bspbrush_t * | a, | |
bspbrush_t * | b | |||
) | [static] |
Definition at line 87 of file csg.c.
References i, bspbrush_s::maxs, bspbrush_s::mins, bspbrush_s::numsides, side_s::planenum, qfalse, qtrue, and bspbrush_s::sides.
Referenced by ChopBrushes().
static qboolean BrushGE | ( | bspbrush_t * | b1, | |
bspbrush_t * | b2 | |||
) | [inline, static] |
Returns true if b1 is allowed to bite b2.
Definition at line 242 of file csg.c.
References mapbrush_s::contentFlags, CONTENTS_DETAIL, CONTENTS_SOLID, bspbrush_s::original, qfalse, and qtrue.
Referenced by ChopBrushes().
bspbrush_t* ChopBrushes | ( | bspbrush_t * | head | ) |
Carves any intersecting solid brushes into the minimum number of non-intersecting brushes.
Definition at line 391 of file csg.c.
References AddBrushListToTail(), BrushesDisjoint(), BrushGE(), CountBrushList(), CullList(), FreeBrushList(), bspbrush_s::next, next, SubtractBrush(), VERB_EXTRA, and Verb_Printf().
Referenced by ConstructLevelNodes_r(), and ProcessSubModel().
static bspbrush_t* ClipBrushToBox | ( | bspbrush_t * | brush, | |
vec3_t | clipmins, | |||
vec3_t | clipmaxs | |||
) | [static] |
Any planes shared with the box edge will be set to no texinfo.
Definition at line 113 of file csg.c.
References FreeBrush(), i, maxplanenums, bspbrush_s::maxs, minplanenums, bspbrush_s::mins, bspbrush_s::numsides, side_s::planenum, qfalse, bspbrush_s::sides, SplitBrush(), side_s::texinfo, TEXINFO_NODE, and side_s::visible.
Referenced by MakeBspBrushList().
static bspbrush_t* CullList | ( | bspbrush_t * | list, | |
bspbrush_t * | skip | |||
) | [static] |
Builds a new list that doesn't hold the given brush.
[in] | list | The brush list to copy |
[in] | skip | The brush to skip |
bspbrush_t
that is the old list without the skip entry Definition at line 220 of file csg.c.
References FreeBrush(), bspbrush_s::next, and next.
Referenced by ChopBrushes().
static qboolean IsInLevel | ( | const int | contents, | |
const int | level | |||
) | [static] |
checks if the level# matches the contentsmask. The level# is mapped to the appropriate levelflags.
[in] | contents | The contentsmask (of the brush, surface, etc.) to check |
[in] | level | -1 for skipping the levelflag check |
Definition at line 158 of file csg.c.
References CONTENTS_ACTORCLIP, CONTENTS_LIGHTCLIP, CONTENTS_WEAPONCLIP, LEVEL_ACTORCLIP, LEVEL_LIGHTCLIP, LEVEL_WEAPONCLIP, MASK_CLIP, qfalse, and qtrue.
Referenced by MakeBspBrushList(), and MapBrushesBounds().
bspbrush_t* MakeBspBrushList | ( | int | startbrush, | |
int | endbrush, | |||
int | level, | |||
vec3_t | clipmins, | |||
vec3_t | clipmaxs | |||
) |
Definition at line 299 of file csg.c.
References AllocBrush(), c_faces, ClipBrushToBox(), mapbrush_s::contentFlags, CopyWinding(), FindOrCreateFloatPlane(), mapbrush_s::finished, i, IsInLevel(), mapbrushes, maxplanenums, bspbrush_s::maxs, mapbrush_s::maxs, minplanenums, bspbrush_s::mins, mapbrush_s::mins, bspbrush_s::next, bspbrush_s::numsides, mapbrush_s::numsides, bspbrush_s::original, mapbrush_s::original_sides, qtrue, bspbrush_s::sides, SURF_HINT, side_s::surfaceFlags, VectorCopy, VERB_DUMP, Verb_Printf(), side_s::visible, and side_s::winding.
Referenced by ConstructLevelNodes_r(), and ProcessSubModel().
int MapBrushesBounds | ( | const int | startbrush, | |
const int | endbrush, | |||
const int | level, | |||
const vec3_t | clipmins, | |||
const vec3_t | clipmaxs, | |||
vec3_t | mins, | |||
vec3_t | maxs | |||
) |
sets mins and maxs to the smallest sizes that can contain all brushes from startbrush to endbrush that are in a given level.
[in] | startbrush | the index of the first brush to check. |
[in] | endbrush | the index after the last brush to check. |
[in] | level | the level that we are searching for brushes in. -1 for skipping the levelflag check. |
[in] | clipmins | the absolute lowest boundary to allow for brushes. |
[in] | clipmaxs | the absolute highest boundary to allow for brushes. |
[out] | mins | the lowest boundary for all accepted brushes within the clipped bounds. |
[out] | maxs | the highest boundary for all accepted brushes within the clipped bounds. |
Definition at line 266 of file csg.c.
References AddPointToBounds(), ClearBounds(), mapbrush_s::contentFlags, mapbrush_s::finished, i, IsInLevel(), mapbrushes, mapbrush_s::maxs, and mapbrush_s::mins.
Referenced by ConstructLevelNodes_r().
static bspbrush_t* SubtractBrush | ( | bspbrush_t * | a, | |
const bspbrush_t * | b | |||
) | [static] |
Definition at line 55 of file csg.c.
References FreeBrush(), FreeBrushList(), i, bspbrush_s::next, bspbrush_s::numsides, side_s::planenum, bspbrush_s::sides, and SplitBrush().
Referenced by ChopBrushes().
int maxplanenums[2] [static] |
Definition at line 108 of file csg.c.
Referenced by ClipBrushToBox(), and MakeBspBrushList().
int minplanenums[2] [static] |
Definition at line 107 of file csg.c.
Referenced by ClipBrushToBox(), and MakeBspBrushList().