Cafu Engine
cf::ClipSys::CollisionModelT Class Referenceabstract

This is the base class for collision models, defining their common interface. More...

#include "CollisionModel_base.hpp"

Inheritance diagram for cf::ClipSys::CollisionModelT:

Public Member Functions

virtual ~CollisionModelT ()
 The (virtual) destructor. More...
 
virtual BoundingBox3dT GetBoundingBox () const =0
 Returns the bounding box of this collision model. More...
 
virtual unsigned long GetContents () const =0
 Returns the contents of this collision model. More...
 
virtual void SaveToFile (std::ostream &OutFile, SceneGraph::aux::PoolT &Pool) const =0
 Saves the model to OutFile. More...
 
virtual void TraceConvexSolid (const TraceSolidT &TraceSolid, const Vector3dT &Start, const Vector3dT &Ray, unsigned long ClipMask, TraceResultT &Result) const =0
 Traces the given TraceSolidT instance from Start along Ray (up to the input value of Result.Fraction) through the collision model, and reports the first collision, if any. More...
 
virtual unsigned long GetContents (const Vector3dT &Point, double BoxRadius, unsigned long ContMask) const =0
 Determines the volume contents of the model at the given point / in the given box. More...
 
virtual btCollisionShape * GetBulletAdapter () const =0
 Returns an adapter class for using CollisionModelT instances also as Bullet btCollisionShape instances. More...
 

Detailed Description

This is the base class for collision models, defining their common interface.

Constructor & Destructor Documentation

virtual cf::ClipSys::CollisionModelT::~CollisionModelT ( )
inlinevirtual

The (virtual) destructor.

Member Function Documentation

virtual BoundingBox3dT cf::ClipSys::CollisionModelT::GetBoundingBox ( ) const
pure virtual

Returns the bounding box of this collision model.

Implemented in cf::ClipSys::CollisionModelStaticT, and cf::ClipSys::CollisionModelAnimT.

virtual btCollisionShape* cf::ClipSys::CollisionModelT::GetBulletAdapter ( ) const
pure virtual

Returns an adapter class for using CollisionModelT instances also as Bullet btCollisionShape instances.

Implemented in cf::ClipSys::CollisionModelStaticT, and cf::ClipSys::CollisionModelAnimT.

virtual unsigned long cf::ClipSys::CollisionModelT::GetContents ( ) const
pure virtual

Returns the contents of this collision model.

Implemented in cf::ClipSys::CollisionModelStaticT, and cf::ClipSys::CollisionModelAnimT.

virtual unsigned long cf::ClipSys::CollisionModelT::GetContents ( const Vector3dT Point,
double  BoxRadius,
unsigned long  ContMask 
) const
pure virtual

Determines the volume contents of the model at the given point / in the given box.

The function considers all brush volumes in the collision model that contain the given point or intersect the given box, and returns their combined ("or'ed") contents.

Parameters
PointThe point in model space at which the volume contents of this model is to be determined.
BoxRadiusWhen nonzero, this is the radius of an imaginary box around Point.
ContMaskOnly volumes whose contents matches this mask participate in the test. This is for optimization, because it allows the implementation to cull volumes that are not of interest early.
Returns
the combined volume content flags of the intersected volumes in the collision model.

Implemented in cf::ClipSys::CollisionModelStaticT, and cf::ClipSys::CollisionModelAnimT.

virtual void cf::ClipSys::CollisionModelT::SaveToFile ( std::ostream &  OutFile,
SceneGraph::aux::PoolT Pool 
) const
pure virtual

Saves the model to OutFile.

TODO: Review serialization/deser. of class hierarchies (e.g. compare to cf::SceneGraph)! Right now this is fixed and works for CollisionModelStaticTs only!!!

Implemented in cf::ClipSys::CollisionModelStaticT, and cf::ClipSys::CollisionModelAnimT.

virtual void cf::ClipSys::CollisionModelT::TraceConvexSolid ( const TraceSolidT TraceSolid,
const Vector3dT Start,
const Vector3dT Ray,
unsigned long  ClipMask,
TraceResultT Result 
) const
pure virtual

Traces the given TraceSolidT instance from Start along Ray (up to the input value of Result.Fraction) through the collision model, and reports the first collision, if any.

Parameters
TraceSolidThe TraceSolidT instance that is traced from Start along Ray.
StartThe start point in model 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.
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).
See Also
TraceResultT

Implemented in cf::ClipSys::CollisionModelStaticT, and cf::ClipSys::CollisionModelAnimT.


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