check.c File Reference

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

#include "../common/shared.h"
#include "../common/bspfile.h"
#include "../common/scriplib.h"
#include "../../../shared/entitiesdef.h"
#include "../map.h"
#include "check.h"
#include "checklib.h"
#include "../bsp.h"
#include "../ufo2map.h"
Include dependency graph for check.c:

Go to the source code of this file.

Defines

#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, qfalse, 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 qboolean Check_SidePointsDown (const side_t *s)
 faces that are near pointing down may be set nodraw, as views are always slightly down
static float Check_PointPlaneDistance (const vec3_t point, const plane_t *plane)
 distance from a point to a plane.
static qboolean FacingAndCoincidentTo (const side_t *side1, const side_t *side2)
 calculates whether side1 faces side2 and touches.
static qboolean ParallelAndCoincidentTo (const side_t *side1, const side_t *side2)
 calculates whether side1 and side2 are on a common plane
static qboolean Check_IsPointInsideBrush (const vec3_t point, const mapbrush_t *brush, const pointInBrush_t mode)
 tests if a point is in a map brush.
static qboolean 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.
static qboolean 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.
static qboolean Check_IsOptimisable (const mapbrush_t *b)
static qboolean 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.
static qboolean Check_SideIsInBrush (const side_t *side, const mapbrush_t *brush, pointInBrush_t mode)
 tests the vertices in the winding of side s.
static qboolean Check_SidesTouch (side_t *a, side_t *b)
 test if sides abut or intersect
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.
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/
static qboolean Check_WindingIntersects (const winding_t *winding, const mapbrush_t *brush)
 tests the lines joining the vertices in the winding
void Check_BrushIntersection (void)
 reports intersection between optimisable map brushes
static qboolean 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
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
void CheckZFighting (void)
 check all brushes for overlapping shared faces
void Check_ContainedBrushes (void)
 find duplicated brushes and brushes contained inside brushes
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.
static qboolean 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
void DisplayContentFlags (const int flags)
 prints a list of the names of the set content flags or "no contentflags" if all bits are 0
static int Check_CalculateLevelFlagFill (int contentFlags)
 calculate the bits that have to be set to fill levelflags such that they are contiguous
void CheckFillLevelFlags (void)
 ensures set levelflags are in one contiguous block
void CheckLevelFlags (void)
 sets all levelflags, if none are set.
void SetImpliedFlags (side_t *side, brush_texture_t *tex, const mapbrush_t *brush)
 Sets surface flags dependent on assigned texture.
void CheckFlagsBasedOnTextures (void)
 sets content flags based on textures
void CheckTexturesBasedOnFlags (void)
 check that sides have textures and that where content/surface flags are set the texture is correct.
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.
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().
void CheckBrushes (void)

Detailed Description

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

Definition in file check.c.


Define Documentation

#define CH_COMP_NDR_EDGE_INTSCT_BUF   21

Definition at line 990 of file check.c.

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 40 of file check.c.

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 43 of file check.c.

#define CH_DIST_EPSILON_SQR   0.000001

Definition at line 41 of file check.c.

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 46 of file check.c.

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

#define M (  )     if (flags & CONTENTS_##x) Check_Printf(VERB_CHECK, qfalse, NUM_SAME, NUM_SAME, " " #x)
#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 65 of file check.c.

Referenced by Check_SidePointsDown().

#define OVERLAP_AREA_TOL   0.2f

Definition at line 743 of file check.c.

Referenced by Check_SidesOverlap().

#define OVERLAP_WIDTH_TOL   0.1f

Definition at line 744 of file check.c.

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 49 of file check.c.

Referenced by Check_EdgePlaneIntersection().

#define VERT_BUF_SIZE_DISJOINT_SIDES   21

Definition at line 742 of file check.c.

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 56 of file check.c.


Function Documentation

static qboolean Check_BoundingBoxIntersects ( const mapbrush_t a,
const mapbrush_t b 
) [static]
Returns:
qtrue if the bounding boxes intersect or are within CH_DIST_EPSILON of intersecting

Definition at line 278 of file check.c.

References CH_DIST_EPSILON, i, mapbrush_s::maxs, mapbrush_s::mins, qfalse, and qtrue.

Referenced by Check_NearList().

void Check_BrushIntersection ( void   ) 
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 1366 of file check.c.

References CONTENTS_LEVEL_1, and CONTENTS_LEVEL_8.

Referenced by CheckFillLevelFlags().

void Check_ContainedBrushes ( void   ) 
static qboolean 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 1243 of file check.c.

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

Referenced by CheckBrushes().

static qboolean 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] e1p1 first point defining line 1
[in] e1p2 second point defining line 1
[out] intersection will be set to the point of intersection, if one exists
Returns:
qtrue if the lines intersect between the given points
Note:
http://mathworld.wolfram.com/Line-LineDistance.html

Definition at line 637 of file check.c.

References CH_DIST_EPSILON, COS_EPSILON, CrossProduct(), DotProduct, f, qfalse, qtrue, 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:
[out] intersection the 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 551 of file check.c.

References CH_DIST_EPSILON, DIST_EPSILON, DotProduct, plane_s::normal, plane_s::planeVector, qfalse, 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 420 of file check.c.

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

Referenced by CheckNodraws().

static qboolean Check_IsOptimisable ( const mapbrush_t b  )  [static]
static qboolean Check_IsPointInsideBrush ( const vec3_t  point,
const mapbrush_t brush,
const pointInBrush_t  mode 
) [inline, static]

tests if a point is in a map brush.

Parameters:
[in] point The point to check whether it's inside the brush boundaries or not
[in] brush The brush to check against
[in] mode determines how epsilons are applied
Returns:
qtrue if the supplied point is inside the brush

Definition at line 150 of file check.c.

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, side_s::planenum, qfalse, and qtrue.

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 965 of file check.c.

References side_s::contentFlags, and CONTENTS_LEVEL_ALL.

Referenced by CheckNodraws().

static float Check_LongestEdge ( const winding_t w  )  [static]

Definition at line 730 of file check.c.

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 295 of file check.c.

References Check_BoundingBoxIntersects(), i, mapbrushes, MAX_MAP_BRUSHES, Mem_Alloc, mapbrush_s::nearBrushes, nummapbrushes, mapbrush_s::numNear, qfalse, qtrue, 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 
) [inline, static]

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 84 of file check.c.

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 qboolean 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] side The side
[in] brush The brush
[in] mode determines how epsilon is applied
Returns:
qtrue if they are all in or on (within epsilon) brush b
See also:
Check_IsPointInsideBrush

Definition at line 349 of file check.c.

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

Referenced by Check_ContainedBrushes(), and CheckNodraws().

static qboolean 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 71 of file check.c.

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 755 of file check.c.

References AllocWinding(), side_s::brush, CH_DIST_EPSILON, Check_EdgeEdgeIntersection(), Check_IsPointInsideBrush(), Check_LongestEdge(), Check_Printf(), i, Mem_Free, winding_s::numpoints, OVERLAP_AREA_TOL, OVERLAP_WIDTH_TOL, winding_s::p, PIB_INCL_SURF, Print3Vector(), qfalse, qtrue, VectorCopy, VectorLength(), VectorSubtract, VERB_CHECK, VERT_BUF_SIZE_DISJOINT_SIDES, side_s::winding, and WindingArea().

Referenced by CheckZFighting().

static qboolean Check_SidesTouch ( side_t a,
side_t b 
) [static]

test if sides abut or intersect

Note:
return qtrue 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 384 of file check.c.

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

Referenced by Check_FindCompositeSides().

static qboolean 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:
flag The (surface or content) flag the property to check for. should only have one bit set.
s the side to check the texture of
Returns:
qtrue if the tex indicates the side has the property. Also returns qfalse 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 189 of file check.c.

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

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

static qboolean 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:
flags the properties to check for. may have several bits set
s the side to check the texture of
Returns:
qtrue if the tex indicates the side has one of the properties in flags Also returns qfalse 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 221 of file check.c.

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

Referenced by Check_IsOptimisable().

static qboolean Check_WindingIntersects ( const winding_t winding,
const mapbrush_t brush 
) [static]

tests the lines joining the vertices in the winding

Returns:
qtrue if the any lines intersect the brush

Definition at line 578 of file check.c.

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

Referenced by Check_BrushIntersection().

void CheckBrushes ( void   ) 
void CheckFillLevelFlags ( void   ) 
void CheckFlagsBasedOnTextures ( void   ) 

sets content flags based on textures

Definition at line 1558 of file check.c.

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

Referenced by main().

void CheckLevelFlags ( void   ) 
void CheckMapMicro ( void   ) 

report brushes from the map below 1 unit^3

Definition at line 1315 of file check.c.

References mapbrush_s::brushnum, Check_MapBrushVolume(), Check_Printf(), config, mapbrush_s::entitynum, i, mapbrushes, nummapbrushes, qtrue, 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 1678 of file check.c.

References mapbrush_s::brushnum, brushsides, Check_Printf(), CheckPropagateParserContentFlags(), side_s::contentFlags, mapbrush_s::contentFlags, CONTENTS_ACTORCLIP, CONTENTS_ORIGIN, DisplayContentFlags(), mapbrush_s::entitynum, i, mapbrushes, brush_texture_s::name, NUM_SAME, nummapbrushes, mapbrush_s::numsides, mapbrush_s::original_sides, Q_strncpyz(), qfalse, qtrue, 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 999 of file check.c.

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(), compositeSides, 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, mapbrush_s::original_sides, winding_s::p, PIB_INCL_SURF, side_s::planenum, qfalse, qtrue, 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 1649 of file check.c.

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

Referenced by CheckMixedFaceContents(), and ParseBrush().

void CheckTexturesBasedOnFlags ( void   ) 
void CheckZFighting ( void   ) 
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 1333 of file check.c.

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

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

static qboolean 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 104 of file check.c.

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

Referenced by CheckNodraws().

static qboolean 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 129 of file check.c.

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

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 1474 of file check.c.

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, qtrue, SURF_HINT, SURF_NODRAW, SURF_PHONG, SURF_SKIP, SURF_SLICK, SURF_WARP, side_s::surfaceFlags, brush_texture_s::surfaceFlags, and VERB_CHECK.

Referenced by CheckFlagsBasedOnTextures(), and ParseBrush().


Generated by  doxygen 1.6.2