model loading and grid oriented movement and scanning More...
#include "common.h"
#include "grid.h"
#include "tracing.h"
#include "routing.h"
#include "../shared/parse.h"
Go to the source code of this file.
Functions | |
static void | CM_CalculateBoundingBox (const cBspModel_t *model, vec3_t mins, vec3_t maxs) |
Calculates the bounding box for the given bsp model. | |
static qboolean | CM_LineMissesModel (const vec3_t start, const vec3_t stop, const cBspModel_t *model) |
A quick test if the trace might hit the inline model. | |
trace_t | CM_HintedTransformedBoxTrace (mapTile_t *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 brushrejects, const vec3_t origin, const vec3_t angles, const vec3_t rmaShift, const float fraction) |
Handles offseting and rotation of the end points for moving and rotating entities. | |
int32_t | CM_HeadnodeForBox (mapTile_t *tile, const vec3_t mins, const vec3_t maxs) |
To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly. | |
qboolean | CM_EntTestLine (mapTiles_t *mapTiles, const const vec3_t start, const vec3_t stop, const int levelmask, const char **entlist) |
Checks traces against the world and all inline models. | |
qboolean | CM_EntTestLineDM (mapTiles_t *mapTiles, const vec3_t start, const vec3_t stop, vec3_t end, const int levelmask, const char **entlist) |
Checks traces against the world and all inline models, gives the hit position back. | |
trace_t | CM_CompleteBoxTrace (mapTiles_t *mapTiles, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, int levelmask, int brushmask, int brushreject) |
Traces all submodels in all tiles. Used by ufo and ufo_ded. | |
trace_t | CM_EntCompleteBoxTrace (mapTiles_t *mapTiles, const vec3_t start, const vec3_t end, const box_t *traceBox, int levelmask, int brushmask, int brushreject, const char **list) |
Performs box traces against the world and all inline models, gives the hit position back. |
model loading and grid oriented movement and scanning
Definition in file cmodel.c.
static void CM_CalculateBoundingBox | ( | const cBspModel_t * | model, | |
vec3_t | mins, | |||
vec3_t | maxs | |||
) | [static] |
Calculates the bounding box for the given bsp model.
[in] | model | The model to calculate the bbox for |
[out] | mins | The maxs of the bbox |
[out] | maxs | The mins of the bbox |
Definition at line 45 of file cmodel.c.
References cBspModel_s::angles, cBspModel_s::maxs, cBspModel_s::mins, cBspModel_s::origin, VectorAdd, VectorCenterFromMinsMaxs(), VectorNotEmpty, VectorSet, and VectorSubtract.
Referenced by CM_EntCompleteBoxTrace(), and CM_LineMissesModel().
trace_t CM_CompleteBoxTrace | ( | mapTiles_t * | mapTiles, | |
const vec3_t | start, | |||
const vec3_t | end, | |||
const vec3_t | mins, | |||
const vec3_t | maxs, | |||
int | levelmask, | |||
int | brushmask, | |||
int | brushreject | |||
) |
Traces all submodels in all tiles. Used by ufo and ufo_ded.
[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_*) |
Definition at line 304 of file cmodel.c.
References trace_s::fraction, i, trace_s::mapTile, mapTiles_t::mapTiles, mapTiles_t::numTiles, PosToVec, TR_TileBoxTrace(), UNIT_HEIGHT, UNIT_SIZE, VectorAdd, VectorSubtract, mapTile_t::wpMaxs, and mapTile_t::wpMins.
Referenced by CL_Trace(), CM_EntCompleteBoxTrace(), R_Trace(), SV_PointContents(), and SV_Trace().
trace_t CM_EntCompleteBoxTrace | ( | mapTiles_t * | mapTiles, | |
const vec3_t | start, | |||
const vec3_t | end, | |||
const box_t * | traceBox, | |||
int | levelmask, | |||
int | brushmask, | |||
int | brushreject, | |||
const char ** | list | |||
) |
Performs box traces against the world and all inline models, gives the hit position back.
[in] | start | The position to start the trace. |
[in] | end | The position where the trace ends. |
[in] | traceBox | The minimum/maximum extents of the collision box that is projected. |
[in] | levelmask | A mask of the game levels to trace against. Mask 0x100 filters clips. |
[in] | brushmask | Any brush detected must at least have one of these contents. |
[in] | brushreject | Any brush detected with any of these contents will be ignored. |
[in] | list | The local models list (a local model has a name starting with * followed by the model number) |
Definition at line 368 of file cmodel.c.
References cBspModel_s::angles, CM_CalculateBoundingBox(), CM_CompleteBoxTrace(), CM_HintedTransformedBoxTrace(), CM_InlineModel(), Com_Error(), ERR_DROP, trace_s::fraction, cBspModel_s::headnode, mapTiles_t::mapTiles, box_s::maxs, box_s::mins, name, cBspModel_s::origin, cBspModel_s::shift, cBspModel_s::tile, VectorAdd, and VectorSet.
qboolean CM_EntTestLine | ( | mapTiles_t * | mapTiles, | |
const const vec3_t | start, | |||
const vec3_t | stop, | |||
const int | levelmask, | |||
const char ** | entlist | |||
) |
Checks traces against the world and all inline models.
[in] | start | The position to start the trace. |
[in] | stop | The position where the trace ends. |
[in] | levelmask |
Definition at line 197 of file cmodel.c.
References cBspModel_s::angles, CM_HintedTransformedBoxTrace(), CM_InlineModel(), CM_LineMissesModel(), Com_Error(), ERR_DROP, trace_s::fraction, cBspModel_s::headnode, mapTiles_t::mapTiles, MASK_VISIBILILITY, name, cBspModel_s::origin, qfalse, qtrue, cBspModel_s::shift, trace_s::startsolid, cBspModel_s::tile, TR_TestLine(), and vec3_origin.
Referenced by SV_TestLineWithEnt().
qboolean CM_EntTestLineDM | ( | mapTiles_t * | mapTiles, | |
const vec3_t | start, | |||
const vec3_t | stop, | |||
vec3_t | end, | |||
const int | levelmask, | |||
const char ** | entlist | |||
) |
Checks traces against the world and all inline models, gives the 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 line hits a object or the stop position if nothing is in the line |
[in] | levelmask |
Definition at line 246 of file cmodel.c.
References cBspModel_s::angles, CM_HintedTransformedBoxTrace(), CM_InlineModel(), CM_LineMissesModel(), Com_Error(), trace_s::endpos, ERR_DROP, trace_s::fraction, cBspModel_s::headnode, mapTiles_t::mapTiles, MASK_ALL, name, cBspModel_s::origin, qtrue, trace_s::startsolid, cBspModel_s::tile, TR_TestLineDM(), vec3_origin, and VectorCopy.
Referenced by CL_ActorMouseTrace().
To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly.
creates a clipping hull for an arbitrary box
Definition at line 165 of file cmodel.c.
References mapTile_t::box_headnode, mapTile_t::box_planes, cBspPlane_s::dist, and MAX_MAP_NODES.
Referenced by CL_HullForEntity(), and SV_HullForEntity().
trace_t CM_HintedTransformedBoxTrace | ( | mapTile_t * | 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 | brushrejects, | |||
const vec3_t | origin, | |||
const vec3_t | angles, | |||
const vec3_t | rmaShift, | |||
const float | fraction | |||
) |
Handles offseting and rotation of the end points for moving and rotating entities.
[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] | origin | center for rotating objects |
[in] | angles | current rotation status (in degrees) for rotating objects |
[in] | rmaShift | how much the object was shifted by the RMA process (needed for doors) |
[in] | fraction | The furthest distance needed to trace before we stop. |
Definition at line 100 of file cmodel.c.
References AngleVectors(), mapTile_t::box_headnode, DotProduct, trace_s::endpos, trace_s::fraction, mapTile_t::idx, trace_s::mapTile, trace_s::plane, qfalse, qtrue, right, TR_BoxTrace(), VectorAdd, VectorCopy, VectorInterpolation, VectorNegate, VectorNotEmpty, and VectorSubtract.
Referenced by CL_ClipMoveToLEs(), CM_EntCompleteBoxTrace(), CM_EntTestLine(), CM_EntTestLineDM(), and SV_ClipMoveToEntities().
static qboolean CM_LineMissesModel | ( | const vec3_t | start, | |
const vec3_t | stop, | |||
const cBspModel_t * | model | |||
) | [static] |
A quick test if the trace might hit the inline model.
[in] | start | The position to start the trace. |
[in] | stop | The position where the trace ends. |
[in] | model | The entity to check |
Definition at line 67 of file cmodel.c.
References CM_CalculateBoundingBox(), qfalse, and qtrue.
Referenced by CM_EntTestLine(), and CM_EntTestLineDM().