UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
check.cpp File Reference

Some checks during compile, warning on -check and changes .map on -fix. More...

#include "check.h"
#include "../common/shared.h"
#include "../common/bspfile.h"
#include "../common/scriplib.h"
#include "../../../shared/entitiesdef.h"
#include "checklib.h"
#include "../bsp.h"
#include "../ufo2map.h"

Go to the source code of this file.

Macros

#define CH_DIST_EPSILON   0.001f
 
#define CH_DIST_EPSILON_SQR   0.000001
 
#define CH_DIST_EPSILON_COLLINEAR_POINTS   0.02f
 
#define COS_EPSILON   0.9999f
 
#define SIN_EPSILON   0.0001f
 
#define NEARDOWN_COS   0.985
 
#define VERT_BUF_SIZE_DISJOINT_SIDES   21
 
#define OVERLAP_AREA_TOL   0.2f
 
#define OVERLAP_WIDTH_TOL   0.1f
 
#define CH_COMP_NDR_EDGE_INTSCT_BUF   21
 
#define M(x)   if (flags & CONTENTS_##x) Check_Printf(VERB_CHECK, false, NUM_SAME, NUM_SAME, " " #x)
 

Enumerations

enum  pointInBrush_t { PIB_EXCL_SURF, PIB_INCL_SURF_EXCL_EDGE, PIB_INCL_SURF, PIB_ON_SURFACE_ONLY }
 wether the surface of a brush is included when testing if a point is in a brush determines how epsilon is applied. More...
 

Functions

static bool Check_SidePointsDown (const side_t *s)
 faces that are near pointing down may be set nodraw, as views are always slightly down More...
 
static float Check_PointPlaneDistance (const vec3_t point, const plane_t *plane)
 distance from a point to a plane. More...
 
static bool FacingAndCoincidentTo (const side_t *side1, const side_t *side2)
 calculates whether side1 faces side2 and touches. More...
 
static bool ParallelAndCoincidentTo (const side_t *side1, const side_t *side2)
 calculates whether side1 and side2 are on a common plane More...
 
static bool Check_IsPointInsideBrush (const vec3_t point, const mapbrush_t *brush, const pointInBrush_t mode)
 tests if a point is in a map brush. More...
 
static bool Check_SurfProp (const int flag, const side_t *s)
 textures take priority over flags. checks if a tex marks a side as having a special property. More...
 
static bool Check_SurfProps (const int flags, const side_t *s)
 textures take priority over flags. checks if a tex marks a side as having a special property. More...
 
static bool Check_IsOptimisable (const mapbrush_t *b)
 
static bool Check_BoundingBoxIntersects (const mapbrush_t *a, const mapbrush_t *b)
 
static void Check_NearList (void)
 add a list of near brushes to each mapbrush. near meaning that the bounding boxes are intersecting or within CH_DIST_EPSILON of touching. More...
 
static bool Check_SideIsInBrush (const side_t *side, const mapbrush_t *brush, pointInBrush_t mode)
 tests the vertices in the winding of side s. More...
 
static bool Check_SidesTouch (side_t *a, side_t *b)
 test if sides abut or intersect More...
 
static void Check_FindCompositeSides (void)
 a composite side is a side made of sides from neighbouring brushes. the sides abut. these sides can cooperate to hide a face, this is used for nodraw setting. composite sides may be used for other things in the future. More...
 
static int Check_EdgePlaneIntersection (const vec3_t vert1, const vec3_t vert2, const plane_t *plane, vec3_t intersection)
 calculate where an edge (defined by the vertices) intersects a plane. http://local.wasp.uwa.edu.au/~pbourke/geometry/planeline/ More...
 
static bool Check_WindingIntersects (const winding_t *winding, const mapbrush_t *brush)
 tests the lines joining the vertices in the winding More...
 
void Check_BrushIntersection (void)
 reports intersection between optimisable map brushes More...
 
static bool Check_EdgeEdgeIntersection (const vec3_t e1p1, const vec3_t e1p2, const vec3_t e2p1, const vec3_t e2p2, vec3_t intersection)
 finds point of intersection of two finite lines, if one exists More...
 
static float Check_LongestEdge (const winding_t *w)
 
static float Check_SidesOverlap (const side_t *s1, const side_t *s2)
 tests if sides overlap, for z-fighting check More...
 
void CheckZFighting (void)
 check all brushes for overlapping shared faces More...
 
void Check_ContainedBrushes (void)
 find duplicated brushes and brushes contained inside brushes More...
 
static int Check_LevelForNodraws (const side_t *coverer, const side_t *coveree)
 
static void Check_SetNodraw (side_t *s)
 
void CheckNodraws (void)
 check for faces which can safely be set to SURF_NODRAW because they are pressed against the faces of other brushes. Also set faces pointing near straight down nodraw. More...
 
static bool Check_DuplicateBrushPlanes (const mapbrush_t *b)
 
static vec_t Check_MapBrushVolume (const mapbrush_t *brush)
 
void CheckMapMicro (void)
 report brushes from the map below 1 unit^3 More...
 
void DisplayContentFlags (const int flags)
 prints a list of the names of the set content flags or "no contentflags" if all bits are 0 More...
 
static int Check_CalculateLevelFlagFill (int contentFlags)
 calculate the bits that have to be set to fill levelflags such that they are contiguous More...
 
void CheckFillLevelFlags (void)
 ensures set levelflags are in one contiguous block More...
 
void CheckLevelFlags (void)
 sets all levelflags, if none are set. More...
 
void SetImpliedFlags (side_t *side, brush_texture_t *tex, const mapbrush_t *brush)
 Sets surface flags dependent on assigned texture. More...
 
void CheckFlagsBasedOnTextures (void)
 sets content flags based on textures More...
 
void CheckTexturesBasedOnFlags (void)
 check that sides have textures and that where content/surface flags are set the texture is correct. More...
 
void CheckPropagateParserContentFlags (mapbrush_t *b)
 some contentlflags are set as a result of some surface flag. For example, if one face is TRANS* then the brush is TRANSLUCENT. this is required by the .map parser as well as th check/fix code. More...
 
void CheckMixedFaceContents (void)
 contentflags should be the same on each face of a brush. print warnings if they are not. remove contentflags that are set on less than half of the faces. some content flags are transferred to all faces on parsing, ParseBrush(). More...
 
void CheckBrushes (void)
 

Variables

compositeSide_t compositeSides [MAX_MAP_SIDES/2]
 
int numCompositeSides
 

Detailed Description

Some checks during compile, warning on -check and changes .map on -fix.

Definition in file check.cpp.

Macro Definition Documentation

#define CH_COMP_NDR_EDGE_INTSCT_BUF   21

Definition at line 975 of file check.cpp.

Referenced by CheckNodraws().

#define CH_DIST_EPSILON   0.001f

how close faces have to be in order for one to be hidden and set to SURF_NODRAW. Also the margin for abutting brushes to be considered not intersecting

Definition at line 42 of file check.cpp.

Referenced by Check_BoundingBoxIntersects(), Check_EdgeEdgeIntersection(), Check_EdgePlaneIntersection(), Check_IsPointInsideBrush(), Check_PointPlaneDistance(), Check_SidesOverlap(), FacingAndCoincidentTo(), and ParallelAndCoincidentTo().

#define CH_DIST_EPSILON_COLLINEAR_POINTS   0.02f

this epsilon does need to be this big for the odd difficult case

Definition at line 45 of file check.cpp.

#define CH_DIST_EPSILON_SQR   0.000001

Definition at line 43 of file check.cpp.

Referenced by CheckNodraws().

#define COS_EPSILON   0.9999f

if the cosine of an angle is greater than this, then the angle is negligibly different from zero

Definition at line 48 of file check.cpp.

Referenced by Check_EdgeEdgeIntersection(), FacingAndCoincidentTo(), and ParallelAndCoincidentTo().

#define M (   x)    if (flags & CONTENTS_##x) Check_Printf(VERB_CHECK, false, NUM_SAME, NUM_SAME, " " #x)

Referenced by DisplayContentFlags().

#define NEARDOWN_COS   0.985

faces close to pointing down may be set to nodraw. this is the cosine of the angle of how close it has to be. around 10 degrees

Definition at line 67 of file check.cpp.

Referenced by Check_SidePointsDown().

#define OVERLAP_AREA_TOL   0.2f

Definition at line 732 of file check.cpp.

Referenced by Check_SidesOverlap().

#define OVERLAP_WIDTH_TOL   0.1f

Definition at line 733 of file check.cpp.

Referenced by Check_SidesOverlap().

#define SIN_EPSILON   0.0001f

if the sine of an angle is less than this, then the angle is negligibly different from zero

Definition at line 51 of file check.cpp.

Referenced by Check_EdgePlaneIntersection().

#define VERT_BUF_SIZE_DISJOINT_SIDES   21

Definition at line 731 of file check.cpp.

Referenced by Check_SidesOverlap().

Enumeration Type Documentation

wether the surface of a brush is included when testing if a point is in a brush determines how epsilon is applied.

See also
Check_IsPointInsideBrush
Enumerator
PIB_EXCL_SURF 

surface is excluded

PIB_INCL_SURF_EXCL_EDGE 

surface is included, but edges of brush are excluded

PIB_INCL_SURF 

surface is included

PIB_ON_SURFACE_ONLY 

point on the surface, and the inside of the brush is excluded

Definition at line 58 of file check.cpp.

Function Documentation

static bool Check_BoundingBoxIntersects ( const mapbrush_t a,
const mapbrush_t b 
)
static
Returns
true if the bounding boxes intersect or are within CH_DIST_EPSILON of intersecting

Definition at line 279 of file check.cpp.

References CH_DIST_EPSILON, i, AABB::maxs, mapbrush_s::mbBox, and AABB::mins.

Referenced by Check_NearList().

static int Check_CalculateLevelFlagFill ( int  contentFlags)
static

calculate the bits that have to be set to fill levelflags such that they are contiguous

Definition at line 1342 of file check.cpp.

References CONTENTS_LEVEL_1, and CONTENTS_LEVEL_8.

Referenced by CheckFillLevelFlags().

static bool Check_DuplicateBrushPlanes ( const mapbrush_t b)
static
Returns
false if the brush has a mirrored set of planes, meaning it encloses no volume. also checks for planes without any normal

Definition at line 1228 of file check.cpp.

References mapbrush_s::brushnum, Check_Printf(), mapbrush_s::entitynum, i, mapbrush_s::numsides, mapbrush_s::original_sides, and VERB_CHECK.

Referenced by CheckBrushes().

static bool Check_EdgeEdgeIntersection ( const vec3_t  e1p1,
const vec3_t  e1p2,
const vec3_t  e2p1,
const vec3_t  e2p2,
vec3_t  intersection 
)
static

finds point of intersection of two finite lines, if one exists

Parameters
[in]e1p1first point defining line 1
[in]e1p2second point defining line 1
[in]e2p1,e2p2The points defining line 2
[out]intersectionwill be set to the point of intersection, if one exists
Returns
true if the lines intersect between the given points
Note
http://mathworld.wolfram.com/Line-LineDistance.html

Definition at line 627 of file check.cpp.

References CH_DIST_EPSILON, COS_EPSILON, CrossProduct(), DotProduct, f, VectorAdd, VectorLength(), VectorNormalize(), VectorScale, and VectorSubtract.

Referenced by Check_SidesOverlap(), and CheckNodraws().

static int Check_EdgePlaneIntersection ( const vec3_t  vert1,
const vec3_t  vert2,
const plane_t plane,
vec3_t  intersection 
)
static

calculate where an edge (defined by the vertices) intersects a plane. http://local.wasp.uwa.edu.au/~pbourke/geometry/planeline/

Parameters
[in]vert1,vert2The vertices defining the edge to check.
[in]planeThe plane to check against.
[out]intersectionthe position of the intersection, if the edge is not too close to parallel.
Returns
zero if the edge is within an epsilon angle of parallel to the plane, or the edge is near zero length.
Note
an epsilon is used to exclude the actual vertices from passing the test.

Definition at line 539 of file check.cpp.

References CH_DIST_EPSILON, DIST_EPSILON, DotProduct, length, plane_s::normal, plane_s::planeVector, SIN_EPSILON, VectorAdd, VectorLength(), VectorMul, and VectorSubtract.

Referenced by Check_WindingIntersects().

static void Check_FindCompositeSides ( void  )
static

a composite side is a side made of sides from neighbouring brushes. the sides abut. these sides can cooperate to hide a face, this is used for nodraw setting. composite sides may be used for other things in the future.

Definition at line 406 of file check.cpp.

References side_s::brush, Check_IsOptimisable(), Check_NearList(), Check_Printf(), Check_SidesTouch(), Check_SurfProp(), i, side_s::isCompositeMember, m, mapbrushes, MAX_MAP_SIDES, Mem_AllocTypeN, compositeSide_s::memberSides, mapbrush_s::nearBrushes, numCompositeSides, nummapbrushes, compositeSide_s::numMembers, mapbrush_s::numNear, mapbrush_s::numsides, mapbrush_s::original_sides, ParallelAndCoincidentTo(), SURF_NODRAW, Sys_Error(), VERB_EXTRA, and side_s::winding.

Referenced by CheckNodraws().

static bool Check_IsOptimisable ( const mapbrush_t b)
static
static bool Check_IsPointInsideBrush ( const vec3_t  point,
const mapbrush_t brush,
const pointInBrush_t  mode 
)
inlinestatic

tests if a point is in a map brush.

Parameters
[in]pointThe point to check whether it's inside the brush boundaries or not
[in]brushThe brush to check against
[in]modedetermines how epsilons are applied
Returns
true if the supplied point is inside the brush

Definition at line 152 of file check.cpp.

References CH_DIST_EPSILON, Check_PointPlaneDistance(), i, mapplanes, mapbrush_s::numsides, mapbrush_s::original_sides, PIB_EXCL_SURF, PIB_INCL_SURF_EXCL_EDGE, PIB_ON_SURFACE_ONLY, and side_s::planenum.

Referenced by Check_SideIsInBrush(), Check_SidesOverlap(), Check_SidesTouch(), Check_WindingIntersects(), and CheckNodraws().

static int Check_LevelForNodraws ( const side_t coverer,
const side_t coveree 
)
static
Returns
nonzero if for any level selection the coveree will only be hidden when the coverer is too. so the coveree may safely be set to nodraw, as far as levelflags are concerned.

Definition at line 950 of file check.cpp.

References side_s::contentFlags, and CONTENTS_LEVEL_ALL.

Referenced by CheckNodraws().

static float Check_LongestEdge ( const winding_t w)
static

Definition at line 720 of file check.cpp.

References i, winding_s::numpoints, winding_s::p, and VectorDistSqr.

Referenced by Check_SidesOverlap().

static vec_t Check_MapBrushVolume ( const mapbrush_t brush)
static
static void Check_NearList ( void  )
static

add a list of near brushes to each mapbrush. near meaning that the bounding boxes are intersecting or within CH_DIST_EPSILON of touching.

Warning
includes changeable brushes: mostly non-optimisable brushes will need to be excluded.
See also
Check_IsOptimisable

Definition at line 294 of file check.cpp.

References Check_BoundingBoxIntersects(), i, mapbrushes, MAX_MAP_BRUSHES, Mem_AllocTypeN, mapbrush_s::nearBrushes, nummapbrushes, mapbrush_s::numNear, and Sys_Error().

Referenced by Check_BrushIntersection(), Check_ContainedBrushes(), Check_FindCompositeSides(), and CheckZFighting().

static float Check_PointPlaneDistance ( const vec3_t  point,
const plane_t plane 
)
inlinestatic

distance from a point to a plane.

Note
the sign of the result depends on which side of the plane the point is
Returns
a negative distance if the point is on the inside of the plane

Definition at line 86 of file check.cpp.

References CH_DIST_EPSILON, plane_s::dist, DotProduct, plane_s::normal, and VectorLengthSqr.

Referenced by Check_IsPointInsideBrush(), FacingAndCoincidentTo(), and ParallelAndCoincidentTo().

static void Check_SetNodraw ( side_t s)
static
static bool Check_SideIsInBrush ( const side_t side,
const mapbrush_t brush,
pointInBrush_t  mode 
)
static

tests the vertices in the winding of side s.

Parameters
[in]sideThe side
[in]brushThe brush
[in]modedetermines how epsilon is applied
Returns
true if they are all in or on (within epsilon) brush b
See also
Check_IsPointInsideBrush

Definition at line 348 of file check.cpp.

References Check_IsPointInsideBrush(), i, winding_s::numpoints, winding_s::p, and side_s::winding.

Referenced by Check_ContainedBrushes(), and CheckNodraws().

static bool Check_SidePointsDown ( const side_t s)
static

faces that are near pointing down may be set nodraw, as views are always slightly down

Definition at line 73 of file check.cpp.

References DotProduct, down, mapplanes, NEARDOWN_COS, plane_s::normal, and side_s::planenum.

Referenced by CheckNodraws(), and CheckZFighting().

static float Check_SidesOverlap ( const side_t s1,
const side_t s2 
)
static

tests if sides overlap, for z-fighting check

Note
the sides must be on a common plane. if they are not, the result is unspecified
http://mathworld.wolfram.com/Collinear.html
See also
CheckZFighting
Note
the width of the overlap is defined here as the area divided by the length of the longest edge
Returns
the width of overlap or -1.0f

Definition at line 744 of file check.cpp.

References AllocWinding(), side_s::brush, mapbrush_s::brushnum, CH_DIST_EPSILON, Check_EdgeEdgeIntersection(), Check_IsPointInsideBrush(), Check_LongestEdge(), Check_Printf(), Com_Printf(), mapbrush_s::entitynum, i, Mem_Free, winding_s::numpoints, OVERLAP_AREA_TOL, OVERLAP_WIDTH_TOL, winding_s::p, PIB_INCL_SURF, v, VectorCopy, VectorLength(), VectorSubtract, VERB_CHECK, VERT_BUF_SIZE_DISJOINT_SIDES, side_s::winding, and WindingArea().

Referenced by CheckZFighting().

static bool Check_SidesTouch ( side_t a,
side_t b 
)
static

test if sides abut or intersect

Note
return true if they do
assumes the sides are parallel and coincident
tests for either side having a vertex in the other's brush, this will miss some odd types of intersection
See also
ParallelAndCoincident

Definition at line 382 of file check.cpp.

References side_s::brush, Check_IsPointInsideBrush(), i, winding_s::numpoints, winding_s::p, PIB_INCL_SURF, and side_s::winding.

Referenced by Check_FindCompositeSides().

static bool Check_SurfProp ( const int  flag,
const side_t s 
)
static

textures take priority over flags. checks if a tex marks a side as having a special property.

Parameters
flagThe (surface or content) flag the property to check for. should only have one bit set.
sthe side to check the texture of
Returns
true if the tex indicates the side has the property. Also returns false if the property is not one of those covered by this function.
See also
Check_SurfProps to check for one of several properties with one call

Definition at line 190 of file check.cpp.

References brushsides, CONTENTS_ACTORCLIP, CONTENTS_LADDER, CONTENTS_LIGHTCLIP, CONTENTS_ORIGIN, CONTENTS_WEAPONCLIP, brush_texture_s::name, Q_streq, side_brushtextures, and SURF_NODRAW.

Referenced by Check_FindCompositeSides(), Check_IsOptimisable(), CheckLevelFlags(), CheckNodraws(), CheckZFighting(), and SetImpliedFlags().

static bool Check_SurfProps ( const int  flags,
const side_t s 
)
static

textures take priority over flags. checks if a tex marks a side as having a special property.

Parameters
flagsthe properties to check for. may have several bits set
sthe side to check the texture of
Returns
true if the tex indicates the side has one of the properties in flags Also returns false if the property is not one of those covered by this function.
See also
Check_SurfProp to check for one property with a call

Definition at line 222 of file check.cpp.

References brushsides, CONTENTS_ACTORCLIP, CONTENTS_LADDER, CONTENTS_LIGHTCLIP, CONTENTS_ORIGIN, CONTENTS_WEAPONCLIP, MASK_CLIP, brush_texture_s::name, Q_streq, side_brushtextures, and SURF_NODRAW.

Referenced by Check_IsOptimisable().

static bool Check_WindingIntersects ( const winding_t winding,
const mapbrush_t brush 
)
static

tests the lines joining the vertices in the winding

Returns
true if the any lines intersect the brush

Definition at line 569 of file check.cpp.

References Check_EdgePlaneIntersection(), Check_IsPointInsideBrush(), mapplanes, winding_s::numpoints, mapbrush_s::numsides, mapbrush_s::original_sides, winding_s::p, PIB_INCL_SURF_EXCL_EDGE, and side_s::planenum.

Referenced by Check_BrushIntersection().

void CheckFillLevelFlags ( void  )
void CheckFlagsBasedOnTextures ( void  )

sets content flags based on textures

Definition at line 1532 of file check.cpp.

References brushsides, i, index, mapbrushes, nummapbrushes, mapbrush_s::numsides, mapbrush_s::original_sides, SetImpliedFlags(), and side_brushtextures.

Referenced by main().

void CheckMapMicro ( void  )

report brushes from the map below 1 unit^3

Definition at line 1293 of file check.cpp.

References mapbrush_s::brushnum, Check_MapBrushVolume(), Check_Printf(), config, mapbrush_s::entitynum, i, mapbrushes, nummapbrushes, mapbrush_s::skipWriteBack, and VERB_CHECK.

Referenced by main().

void CheckMixedFaceContents ( void  )

contentflags should be the same on each face of a brush. print warnings if they are not. remove contentflags that are set on less than half of the faces. some content flags are transferred to all faces on parsing, ParseBrush().

Todo:
at the moment only actorclip is removed if only set on less than half of the faces. there may be other contentflags that would benefit from this treatment
See also
ParseBrush

Definition at line 1647 of file check.cpp.

References mapbrush_s::brushnum, brushsides, Check_Printf(), CheckPropagateParserContentFlags(), side_s::contentFlags, mapbrush_s::contentFlags, CONTENTS_ACTORCLIP, CONTENTS_ORIGIN, DisplayContentFlags(), mapbrush_s::entitynum, i, index, mapbrushes, brush_texture_s::name, NUM_SAME, nummapbrushes, mapbrush_s::numsides, mapbrush_s::original_sides, Q_streq, Q_strncpyz(), side_brushtextures, and VERB_CHECK.

Referenced by main().

void CheckNodraws ( void  )

check for faces which can safely be set to SURF_NODRAW because they are pressed against the faces of other brushes. Also set faces pointing near straight down nodraw.

Note
probably cannot warn about faces which are nodraw, but might be visible, as there will always be planty of optimisations beyond faces being hidden by one brush, or composite faces.

Definition at line 984 of file check.cpp.

References side_s::brush, mapbrush_s::brushnum, CH_COMP_NDR_EDGE_INTSCT_BUF, CH_DIST_EPSILON_SQR, Check_EdgeEdgeIntersection(), Check_FindCompositeSides(), Check_IsOptimisable(), Check_IsPointInsideBrush(), Check_LevelForNodraws(), Check_Printf(), Check_SetNodraw(), Check_SideIsInBrush(), Check_SidePointsDown(), Check_SurfProp(), Com_Printf(), mapbrush_s::entitynum, FacingAndCoincidentTo(), i, m, mapbrushes, compositeSide_s::memberSides, mapbrush_s::nearBrushes, numCompositeSides, nummapbrushes, compositeSide_s::numMembers, mapbrush_s::numNear, winding_s::numpoints, mapbrush_s::numsides, OBJZERO, mapbrush_s::original_sides, winding_s::p, PIB_INCL_SURF, side_s::planenum, SURF_LIGHT, SURF_NODRAW, side_s::surfaceFlags, VectorCopy, VectorDistSqr, VERB_CHECK, VERB_EXTRA, VERB_LESS, and side_s::winding.

Referenced by main().

void CheckPropagateParserContentFlags ( mapbrush_t b)

some contentlflags are set as a result of some surface flag. For example, if one face is TRANS* then the brush is TRANSLUCENT. this is required by the .map parser as well as th check/fix code.

See also
ParseBrush

Definition at line 1619 of file check.cpp.

References mapbrush_s::brushnum, Check_Printf(), side_s::contentFlags, mapbrush_s::contentFlags, CONTENTS_DETAIL, CONTENTS_TRANSLUCENT, DisplayContentFlags(), mapbrush_s::entitynum, m, mapbrush_s::numsides, mapbrush_s::original_sides, and VERB_CHECK.

Referenced by CheckMixedFaceContents(), and ParseBrush().

void DisplayContentFlags ( const int  flags)

prints a list of the names of the set content flags or "no contentflags" if all bits are 0

See also
defines.h

Definition at line 1309 of file check.cpp.

References Check_Printf(), M, NUM_SAME, and VERB_CHECK.

Referenced by CheckFillLevelFlags(), CheckMixedFaceContents(), and CheckPropagateParserContentFlags().

static bool FacingAndCoincidentTo ( const side_t side1,
const side_t side2 
)
static

calculates whether side1 faces side2 and touches.

The surface unit normals must be antiparallel (i.e. they face each other), and the distance to the origin must be such that they occupy the same region of space, to within a distance of epsilon. These are based on consideration of the planes of the faces only - they could be offset by a long way.

Note
i did some experiments that show that the plane indices alone cannot cannot be relied on to test for 2 planes facing each other. blondandy
Returns
true if the planes of the sides face and touch
See also
CheckNodraws

Definition at line 106 of file check.cpp.

References CH_DIST_EPSILON, Check_PointPlaneDistance(), COS_EPSILON, DotProduct, mapplanes, plane_s::normal, side_s::planenum, and plane_s::planeVector.

Referenced by CheckNodraws().

static bool ParallelAndCoincidentTo ( const side_t side1,
const side_t side2 
)
static

calculates whether side1 and side2 are on a common plane

normals must be parallel, planes must touch

Returns
true if the side1 and side2 are on a common plane
See also
CheckZFighting, FacingAndCoincidentTo

Definition at line 131 of file check.cpp.

References CH_DIST_EPSILON, Check_PointPlaneDistance(), COS_EPSILON, DotProduct, mapplanes, plane_s::normal, side_s::planenum, and plane_s::planeVector.

Referenced by Check_FindCompositeSides(), and CheckZFighting().

void SetImpliedFlags ( side_t side,
brush_texture_t tex,
const mapbrush_t brush 
)

Sets surface flags dependent on assigned texture.

See also
ParseBrush
CheckFlags
Note
surfaceFlags are set in side_t for map compiling and in brush_texture_t because this is saved back on -fix.
also removes phongs from nodraws. also removes legacy flags.

Definition at line 1448 of file check.cpp.

References mapbrush_s::brushnum, Check_Printf(), Check_SurfProp(), config, side_s::contentFlags, CONTENTS_ACTORCLIP, CONTENTS_LADDER, CONTENTS_LIGHTCLIP, CONTENTS_ORIGIN, CONTENTS_PASSABLE, CONTENTS_WATER, CONTENTS_WEAPONCLIP, mapbrush_s::entitynum, brush_texture_s::name, Q_streq, SURF_HINT, SURF_NODRAW, SURF_PHONG, SURF_SKIP, SURF_SLICK, SURF_WARP, brush_texture_s::surfaceFlags, side_s::surfaceFlags, and VERB_CHECK.

Referenced by CheckFlagsBasedOnTextures(), and ParseBrush().

Variable Documentation

compositeSide_t compositeSides[MAX_MAP_SIDES/2]

an array of composite mapbrush sides.

See also
Check_FindCompositeSides ensures the array is populated
Note
a composite must have at least 2 members. composites should not be duplicated, hence the largest possible number is the number of sides divided by two.

Definition at line 37 of file check.cpp.

Referenced by Check_Free().

int numCompositeSides

Definition at line 38 of file check.cpp.

Referenced by Check_FindCompositeSides(), Check_Free(), and CheckNodraws().