Tracing functions. More...
#include "../shared/typedefs.h"
Go to the source code of this file.
Data Structures | |
struct | trace_s |
struct | boxtrace_s |
struct | box_s |
struct | mapTiles_t |
Defines | |
#define | TRACING_ALL_VISIBLE_LEVELS 0x1FF |
Typedefs | |
typedef struct trace_s | trace_t |
typedef struct boxtrace_s | boxtrace_t |
typedef struct box_s | box_t |
Functions | |
int | TR_BoxOnPlaneSide (const vec3_t mins, const vec3_t maxs, const TR_PLANE_TYPE *plane) |
Returns PSIDE_FRONT, PSIDE_BACK, or PSIDE_BOTH. | |
void | TR_BuildTracingNode_r (TR_TILE_TYPE *tile, tnode_t **tnode, int32_t nodenum, int level) |
int | TR_TestLine_r (TR_TILE_TYPE *tile, int32_t nodenum, const vec3_t start, const vec3_t stop) |
trace_t | TR_BoxTrace (TR_TILE_TYPE *tile, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, const int headnode, const int brushmask, const int brushreject, const float fraction) |
This function traces a line from start to end. It returns a trace_t indicating what portion of the line can be traveled from start to end before hitting a brush that meets the criteria in brushmask. The point that this line intersects that brush is also returned. There is a special case when start and end are the same vector. In this case, the bounding box formed by mins and maxs offset from start is examined for any brushes that meet the criteria. The first brush found inside the bounding box is returned. There is another special case when mins and maxs are both origin vectors (0, 0, 0). In this case, the. | |
qboolean | TR_TestLine (mapTiles_t *mapTiles, const vec3_t start, const vec3_t stop, const int levelmask) |
Checks traces against the world. | |
qboolean | TR_TestLineDM (mapTiles_t *mapTiles, const vec3_t start, const vec3_t stop, vec3_t end, const int levelmask) |
Checks traces against the world, gives hit position back. | |
trace_t | TR_TileBoxTrace (TR_TILE_TYPE *myTile, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, const int levelmask, const int brushmask, const int brushreject) |
Traces all submodels in the specified tile. Provides for a short circuit if the trace tries to move past fraction to save time. |
Tracing functions.
Definition in file tracing.h.
#define TRACING_ALL_VISIBLE_LEVELS 0x1FF |
mask to trace against all the different visible levels (1-8) (resp. (1<<[0-7])
Definition at line 60 of file tracing.h.
Referenced by G_TraceDraw(), R_Trace(), SV_PointContents(), and SV_Trace().
typedef struct boxtrace_s boxtrace_t |
Returns PSIDE_FRONT, PSIDE_BACK, or PSIDE_BOTH.
Definition at line 467 of file tracing.c.
References AXIAL, DotProduct, i, PLANESIDE_EPSILON, PSIDE_BACK, and PSIDE_FRONT.
Referenced by R_CullBox(), TestBrushToPlanenum(), and TR_BoxLeafnums_r().
trace_t TR_BoxTrace | ( | TR_TILE_TYPE * | tile, | |
const vec3_t | start, | |||
const vec3_t | end, | |||
const vec3_t | mins, | |||
const vec3_t | maxs, | |||
const int | headnode, | |||
const int | brushmask, | |||
const int | brushreject, | |||
const float | fraction | |||
) |
This function traces a line from start to end. It returns a trace_t indicating what portion of the line can be traveled from start to end before hitting a brush that meets the criteria in brushmask. The point that this line intersects that brush is also returned. There is a special case when start and end are the same vector. In this case, the bounding box formed by mins and maxs offset from start is examined for any brushes that meet the criteria. The first brush found inside the bounding box is returned. There is another special case when mins and maxs are both origin vectors (0, 0, 0). In this case, the.
[in] | start | trace start vector |
[in] | end | trace end vector |
[in] | mins | box mins |
[in] | maxs | box maxs |
[in] | tile | Tile to check (normally 0 - except in assembled maps) |
[in] | headnode | if < 0 we are in a leaf node |
[in] | brushmask | brushes the trace should stop at (see MASK_*) |
[in] | brushreject | brushes the trace should ignore (see MASK_*) |
[in] | fraction | The furthest distance needed to trace before we stop. |
Definition at line 958 of file tracing.c.
References boxtrace_s::absmaxs, boxtrace_s::absmins, trace_s::allsolid, checkcount, Com_Error(), boxtrace_s::contents, boxtrace_s::end, trace_s::endpos, ERR_DROP, boxtrace_s::extents, f, trace_s::fraction, i, boxtrace_s::ispoint, MAX_LEAFS, boxtrace_s::maxs, boxtrace_s::mins, qfalse, qtrue, boxtrace_s::rejects, boxtrace_s::start, trace_s::surface, boxtrace_s::tile, TR_BoxLeafnums_headnode(), TR_RecursiveHullCheck(), TR_TestInLeaf(), boxtrace_s::trace, vec3_origin, VectorAdd, VectorCenterFromMinsMaxs(), VectorClear, VectorCompare, VectorCopy, VectorInterpolation, and VectorSubtract.
Referenced by CM_HintedTransformedBoxTrace(), and TR_TileBoxTrace().
We are checking for a leaf in the tracing node. For ufo2map, planenum == PLANENUMLEAF. For the game, plane will be NULL.
Definition at line 90 of file tracing.c.
References tnode_s::children, Com_Error(), Com_Printf(), tnode_s::dist, ERR_DROP, i, MAX_MAP_NODES, tnode_s::normal, PLANE_NONE, PLANENUM_LEAF, Sys_Error(), TR_BuildTracingNode_r(), TR_MakeTracingNode(), tnode_s::type, VectorCopy, and VectorSet.
Referenced by CM_MakeTracingNodes(), MakeTracingNodes(), and TR_BuildTracingNode_r().
qboolean TR_TestLine | ( | mapTiles_t * | mapTiles, | |
const vec3_t | start, | |||
const vec3_t | stop, | |||
const int | levelmask | |||
) |
Checks traces against the world.
[in] | start | The position to start the trace. |
[in] | stop | The position where the trace ends. |
[in] | levelmask | Indicates which special levels, if any, to include in the trace. |
Definition at line 283 of file tracing.c.
References mapTiles_t::mapTiles, mapTiles_t::numTiles, qfalse, qtrue, and TR_TileTestLine().
Referenced by CL_TestLine(), CM_EntTestLine(), and SV_TestLine().
[in] | tile | The map tile containing the structures to be traced. |
[in] | nodenum | Node index |
[in] | start | The position to start the trace. |
[in] | stop | The position where the trace ends. |
Definition at line 181 of file tracing.c.
References tnode_s::children, tnode_s::dist, DotProduct, tnode_s::normal, ON_EPSILON, PLANE_NONE, PLANE_X, PLANE_Y, PLANE_Z, TR_TestLine_r(), tnode_s::type, and VectorInterpolation.
Referenced by TR_TestLine_r(), TR_TestLineSingleTile(), and TR_TileTestLine().
qboolean TR_TestLineDM | ( | mapTiles_t * | mapTiles, | |
const vec3_t | start, | |||
const vec3_t | stop, | |||
vec3_t | end, | |||
const int | levelmask | |||
) |
Checks traces against the world, gives hit position back.
[in] | start | The position to start the trace. |
[in] | stop | The position where the trace ends. |
[out] | end | The position where the trace hits a object or the stop position if nothing is in the line. |
[in] | levelmask | Indicates which special levels, if any, to include in the trace. |
Definition at line 435 of file tracing.c.
References EQUAL_EPSILON, mapTiles_t::mapTiles, mapTiles_t::numTiles, qfalse, qtrue, TR_TileTestLineDM(), VectorCompareEps(), VectorCopy, and VectorNearer().
Referenced by CM_EntTestLineDM().
trace_t TR_TileBoxTrace | ( | TR_TILE_TYPE * | myTile, | |
const vec3_t | start, | |||
const vec3_t | end, | |||
const vec3_t | mins, | |||
const vec3_t | maxs, | |||
const int | levelmask, | |||
const int | brushmask, | |||
const int | brushreject | |||
) |
Traces all submodels in the specified tile. Provides for a short circuit if the trace tries to move past fraction to save time.
[in] | myTile | The tile being traced |
[in] | start | trace start vector |
[in] | end | trace end vector |
[in] | mins | box mins |
[in] | maxs | box maxs |
[in] | levelmask | Selects which submodels get scanned. |
[in] | brushmask | brushes the trace should stop at (see MASK_*) |
[in] | brushreject | brushes the trace should ignore (see MASK_*) |
[in] | fraction | The furthest distance needed to trace before we stop. We assume that a brush was already hit at fraction. |
Definition at line 1063 of file tracing.c.
References chead_s::cnode, trace_s::fraction, i, chead_s::level, LEVEL_LASTVISIBLE, and TR_BoxTrace().
Referenced by CM_CompleteBoxTrace().