The clip world manages all the clip models that exist in a world (their "union"). More...
#include "ClipWorld.hpp"
Public Member Functions | |
ClipWorldT (const CollisionModelT *WorldCollMdl_) | |
The constructor. More... | |
~ClipWorldT () | |
The destructor. More... | |
void | TraceConvexSolid (const TraceSolidT &TraceSolid, const Vector3dT &Start, const Vector3dT &Ray, unsigned long ClipMask, const ClipModelT *Ignore, TraceResultT &Result, ClipModelT **HitClipModel=NULL) const |
Traces the given convex solid from Start along Ray (up to the input value of Result.Fraction) through the clip world, and reports the first collision, if any. More... | |
void | GetClipModelsFromBB (ArrayT< ClipModelT * > &ClipModels, unsigned long ContentMask, const BoundingBox3dT &BB) const |
Determines the set of clip models that touch a given bounding-box and meet a given contents mask. More... | |
void | Trace (const TraceSolidT &TraceSolid, const Vector3dT &Start, const Vector3dT &Ray, unsigned long ClipMask, const ClipModelT *Ignore, ArrayT< WorldTraceResultT > &Results) const |
Traces the given convex solid through the clip world. More... | |
Friends | |
class | ClipModelT |
The clip world manages all the clip models that exist in a world (their "union").
This is done in a very efficient manner, even if clip models change (i.e. move, rotate, morph (update geometry) etc.) over time.
ClipWorldT::ClipWorldT | ( | const CollisionModelT * | WorldCollMdl_ | ) |
The constructor.
ClipWorldT::~ClipWorldT | ( | ) |
The destructor.
void ClipWorldT::GetClipModelsFromBB | ( | ArrayT< ClipModelT * > & | ClipModels, |
unsigned long | ContentMask, | ||
const BoundingBox3dT & | BB | ||
) | const |
Determines the set of clip models that touch a given bounding-box and meet a given contents mask.
ClipModels | The method returns the found clip models by appending them to this list. Note: The list is always exclusive the "world" clip model! |
ContentMask | The content filter mask; only clip models that meet this content mask are returned. |
BB | The bounding-box to be queried for clip models. |
void ClipWorldT::Trace | ( | const TraceSolidT & | TraceSolid, |
const Vector3dT & | Start, | ||
const Vector3dT & | Ray, | ||
unsigned long | ClipMask, | ||
const ClipModelT * | Ignore, | ||
ArrayT< WorldTraceResultT > & | Results | ||
) | const |
Traces the given convex solid through the clip world.
The method considers the clip world and all clip models therein, reporting the first collision with each, if any, in the order as they were encountered along the trace (ordered by increasing Fraction
). This method is intended as a future replacement for the other Trace...() methods. For now, see there for further details.
void ClipWorldT::TraceConvexSolid | ( | const TraceSolidT & | TraceSolid, |
const Vector3dT & | Start, | ||
const Vector3dT & | Ray, | ||
unsigned long | ClipMask, | ||
const ClipModelT * | Ignore, | ||
TraceResultT & | Result, | ||
ClipModelT ** | HitClipModel = NULL |
||
) | const |
Traces the given convex solid from Start along Ray (up to the input value of Result.Fraction) through the clip world, and reports the first collision, if any.
TraceSolid | The convex solid to trace through the world. |
Start | The start point in world space where the trace begins. |
Ray | The ray along which the trace is performed. Note that with F being the input value of Result.Fraction, the endpoint is at Start+Ray*F. |
ClipMask | Only surfaces whose clip flags match this mask participate in the test. This is for optimization, because it allows the implementation to cull surfaces that are not of interest early. |
Ignore | A clip model that is to be ignored during the trace, even if the content mask matches. This is normally used to "hide" the clip model from which the trace emanates in order to prevent it colliding with itself. |
Result | The start value of Fraction is input via this reference, and the result of the trace returned. Using an input/output parameter for returning the result, rather than a true return type, suggests itself because it makes cascaded calls to this function natural (i.e. from (possibly many) super-objects and to (possibly many) sub-objects). |
HitClipModel | A pointer to the clip model instance with which the reported collision occurred, or NULL if there was no collision. |