Cafu Engine
cf::ClipSys::ClipWorldT Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

ClipWorldT::ClipWorldT ( const CollisionModelT WorldCollMdl_)

The constructor.

ClipWorldT::~ClipWorldT ( )

The destructor.

Member Function Documentation

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.

Note
The return list is always exclusive the world, that is, the world clip model is never mentioned in the list, even if it meets all criteria otherwise.
Parameters
ClipModelsThe method returns the found clip models by appending them to this list. Note: The list is always exclusive the "world" clip model!
ContentMaskThe content filter mask; only clip models that meet this content mask are returned.
BBThe 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.

Parameters
TraceSolidThe convex solid to trace through the world.
StartThe start point in world space where the trace begins.
RayThe 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.
ClipMaskOnly 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.
IgnoreA 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.
ResultThe 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).
HitClipModelA pointer to the clip model instance with which the reported collision occurred, or NULL if there was no collision.
See Also
TraceResultT

The documentation for this class was generated from the following files: