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 CollisionModelT * | GetCollisionModel () 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 Vector3dT & | GetOrigin () 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::ComponentBaseT * | GetOwner () 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 BoundingBox3dT & | GetAbsoluteBB () 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 |
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.
ClipModelT::ClipModelT | ( | const ClipWorldT & | ClipWorld_, |
const CollisionModelT * | CollisionModel_ = NULL |
||
) |
The constructor for creating a clip model.
ClipModelT::~ClipModelT | ( | ) |
The destructor.
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.
|
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.
Point | The point in world space at which the volume contents of this model is to be determined. |
BoxRadius | When nonzero, this is the radius of an imaginary box around Point. |
ContMask | Only 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. |
|
inline |
Returns the orientation (axes, rotation matrix) for this clip model.
|
inline |
Returns the origin of this clip model.
|
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.
|
inline |
Sets the user data associated with this clip model.
Owner | The component that created and is responsible for this clip model. |
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.
TraceSolid | The convex solid to trace through the model. |
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. |
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). |
void ClipModelT::Unregister | ( | ) |
Unregisters this clip model from the clip world.