Cafu Engine
cf::ClipSys::ClipModelT Class Reference

A clip model represents an object in the world against which clipping queries can be performed. More...

#include "ClipModel.hpp"

Public Member Functions

 ClipModelT (const ClipWorldT &ClipWorld_, const CollisionModelT *CollisionModel_=NULL)
 The constructor for creating a clip model. More...
 
 ~ClipModelT ()
 The destructor. More...
 
void Register ()
 Registers this clip model with the clip world. More...
 
void Unregister ()
 Unregisters this clip model from the clip world. More...
 
const CollisionModelTGetCollisionModel () const
 Returns the collision model of this clip model. More...
 
void SetCollisionModel (const CollisionModelT *CollisionModel_)
 Sets the given collision model for use with (as the basis of) this clip model. More...
 
const Vector3dTGetOrigin () const
 Returns the origin of this clip model. More...
 
void SetOrigin (const Vector3dT &NewOrigin)
 Sets a new origin for this clip model. More...
 
const math::Matrix3x3T< double > & GetOrientation () const
 Returns the orientation (axes, rotation matrix) for this clip model. More...
 
void SetOrientation (const math::Matrix3x3T< double > &NewOrientation)
 Sets a new orientation (axes, rotation matrix) for this clip model. More...
 
cf::GameSys::ComponentBaseTGetOwner () const
 Returns the user data associated with this clip model. More...
 
void SetOwner (GameSys::ComponentBaseT *Owner)
 Sets the user data associated with this clip model. More...
 
const BoundingBox3dTGetAbsoluteBB () const
 Returns the bounding box of this clip model in absolute world coordinates. More...
 
unsigned long GetContents () const
 Returns the contents of this clip model, which is the forwarded contents of the underlying collision model. More...
 
void TraceConvexSolid (const TraceSolidT &TraceSolid, const Vector3dT &Start, const Vector3dT &Ray, unsigned long ClipMask, TraceResultT &Result) const
 Traces the given convex solid from Start along Ray (up to the input value of Result.Fraction) through the clip model, and reports the first collision, if any. More...
 
unsigned long GetContents (const Vector3dT &Point, double BoxRadius, unsigned long ContMask) const
 Determines the volume contents of the model at the given point / in the given box. More...
 

Friends

class ClipWorldT
 

Detailed Description

A clip model represents an object in the world against which clipping queries can be performed.

Normally, clip models are inserted into a ClipWorldT instance and are then used via the clip world.

Constructor & Destructor Documentation

ClipModelT::ClipModelT ( const ClipWorldT ClipWorld_,
const CollisionModelT CollisionModel_ = NULL 
)

The constructor for creating a clip model.

ClipModelT::~ClipModelT ( )

The destructor.

Member Function Documentation

const BoundingBox3dT & ClipModelT::GetAbsoluteBB ( ) const

Returns the bounding box of this clip model in absolute world coordinates.

Note that the clip model must be registered (linked) with the clip world when this method is called.

const CollisionModelT* cf::ClipSys::ClipModelT::GetCollisionModel ( ) const
inline

Returns the collision model of this clip model.

unsigned long ClipModelT::GetContents ( ) const

Returns the contents of this clip model, which is the forwarded contents of the underlying collision model.

unsigned long ClipModelT::GetContents ( const Vector3dT Point,
double  BoxRadius,
unsigned long  ContMask 
) const

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

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

Parameters
PointThe point in world 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 clip model.
const math::Matrix3x3T<double>& cf::ClipSys::ClipModelT::GetOrientation ( ) const
inline

Returns the orientation (axes, rotation matrix) for this clip model.

const Vector3dT& cf::ClipSys::ClipModelT::GetOrigin ( ) const
inline

Returns the origin of this clip model.

cf::GameSys::ComponentBaseT* cf::ClipSys::ClipModelT::GetOwner ( ) const
inline

Returns the user data associated with this clip model.

This is usually the pointer to the entity that "owns" this clip model, i.e. this clip model is a member of this entity.

void ClipModelT::Register ( )

Registers this clip model with the clip world.

void ClipModelT::SetCollisionModel ( const CollisionModelT CollisionModel_)

Sets the given collision model for use with (as the basis of) this clip model.

Unregisters from the clip world first.

void ClipModelT::SetOrientation ( const math::Matrix3x3T< double > &  NewOrientation)

Sets a new orientation (axes, rotation matrix) for this clip model.

Unregisters the model from the clip world before updating the orientation, but does not re-register it! It is up to the user to call Register() again to re-register to model in the clip world.

void ClipModelT::SetOrigin ( const Vector3dT NewOrigin)

Sets a new origin for this clip model.

Unregisters the model from the clip world before updating the origin, but does not re-register it! It is up to the user to call Register() again to re-register to model in the clip world.

void cf::ClipSys::ClipModelT::SetOwner ( GameSys::ComponentBaseT Owner)
inline

Sets the user data associated with this clip model.

Parameters
OwnerThe component that created and is responsible for this clip model.
See Also
GetOwner()
void ClipModelT::TraceConvexSolid ( const TraceSolidT TraceSolid,
const Vector3dT Start,
const Vector3dT Ray,
unsigned long  ClipMask,
TraceResultT Result 
) const

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

Parameters
TraceSolidThe convex solid to trace through the model.
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.
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
void ClipModelT::Unregister ( )

Unregisters this clip model from the clip world.


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