This class describes a specific pose of an associated model. More...
#include "AnimPose.hpp"
Classes | |
struct | MeshInfoT |
The instances of this struct parallel and augment the CafuModelT::MeshT instances in the related CafuModelT . More... | |
struct | TraceResultT |
This class describes the result of tracing a ray or a bounding box against the model. More... | |
Public Member Functions | |
AnimPoseT (const CafuModelT &Model, IntrusivePtrT< AnimExpressionT > AnimExpr) | |
The constructor. More... | |
~AnimPoseT () | |
The destructor. More... | |
IntrusivePtrT< AnimExpressionT > | GetAnimExpr () const |
Returns the current anim expression of this pose. More... | |
void | SetAnimExpr (IntrusivePtrT< AnimExpressionT > AnimExpr) |
Sets a new anim expression to use for this pose. More... | |
void | SetSuperPose (const AnimPoseT *SuperPose) |
This method assigns a pose of a parent or "super" model that should be used when rendering this model. More... | |
void | SetNeedsRecache () |
Call this if something in the related model has changed. More... | |
void | Draw (int SkinNr, float LodDist) const |
This method renders the model in this pose. More... | |
bool | GetGuiPlane (unsigned int GFNr, Vector3fT &Origin, Vector3fT &AxisX, Vector3fT &AxisY) const |
Returns the origin, x-axis and y-axis vectors for the given Gui fixture. More... | |
bool | TraceRay (int SkinNr, const Vector3fT &RayOrigin, const Vector3fT &RayDir, TraceResultT &Result) const |
Traces a ray against this model in this pose, and returns whether it was hit. More... | |
unsigned int | FindClosestVertex (unsigned int MeshNr, unsigned int TriNr, const Vector3fT &P) const |
Considers the given triangle in the given mesh, and returns the vertex that the given point P is closest to in this pose. More... | |
const ArrayT< MatrixT > & | GetJointMatrices () const |
Returns the set of transformation matrices (one per joint) at the given sequence and frame number. More... | |
const MatrixT * | GetJointMatrix (const std::string &JointName) const |
Returns the transformation matrix for the joint with the given name, or NULL if there is no such joint. More... | |
const ArrayT< MeshInfoT > & | GetMeshInfos () const |
Returns the mesh infos with additional data for each mesh in this pose. More... | |
const ArrayT< MatSys::MeshT > & | GetDrawMeshes () const |
Returns the MatSys meshes for the model in this pose. More... | |
const BoundingBox3fT & | GetBB () const |
Returns the bounding-box for the model in this pose. More... | |
This class describes a specific pose of an associated model.
A pose is defined (or "configured") by an AnimExpressionT instance whose application to the model yields all data that is relevant for further actions on the model in that pose, such as rendering, tracing rays, collision detection, etc.
The data that is derived from the anim expression is cached within the pose instance. It comprises:
CafuModelT
instance). As a consequence, AnimPoseT instances should be shared whenever there are multiple users (such as "static detail model" entity instances) that all show the same model in the same pose. AnimPoseT::AnimPoseT | ( | const CafuModelT & | Model, |
IntrusivePtrT< AnimExpressionT > | AnimExpr | ||
) |
The constructor.
AnimPoseT::~AnimPoseT | ( | ) |
The destructor.
void AnimPoseT::Draw | ( | int | SkinNr, |
float | LodDist | ||
) | const |
This method renders the model in this pose.
The current MatSys model-view matrix determines the position and orientation.
SkinNr | The skin to render the model with, -1 for the default skin. |
LodDist | The distance to the camera for reducing the level-of-detail. |
unsigned int AnimPoseT::FindClosestVertex | ( | unsigned int | MeshNr, |
unsigned int | TriNr, | ||
const Vector3fT & | P | ||
) | const |
Considers the given triangle in the given mesh, and returns the vertex that the given point P is closest to in this pose.
The returned number is the index of the vertex in the mesh, not the (0, 1 or 2) index in the triangle.
|
inline |
Returns the current anim expression of this pose.
const BoundingBox3fT & AnimPoseT::GetBB | ( | ) | const |
Returns the bounding-box for the model in this pose.
const ArrayT< MatSys::MeshT > & AnimPoseT::GetDrawMeshes | ( | ) | const |
Returns the MatSys meshes for the model in this pose.
bool AnimPoseT::GetGuiPlane | ( | unsigned int | GFNr, |
Vector3fT & | Origin, | ||
Vector3fT & | AxisX, | ||
Vector3fT & | AxisY | ||
) | const |
Returns the origin, x-axis and y-axis vectors for the given Gui fixture.
The return value indicates whether the vectors could successfully be returned in the reference parameters (the method can fail if e.g. the model has no such Gui fixture or the Gui fixture is improperly specified).
Returns the set of transformation matrices (one per joint) at the given sequence and frame number.
const MatrixT * AnimPoseT::GetJointMatrix | ( | const std::string & | JointName | ) | const |
Returns the transformation matrix for the joint with the given name, or NULL
if there is no such joint.
const ArrayT< AnimPoseT::MeshInfoT > & AnimPoseT::GetMeshInfos | ( | ) | const |
Returns the mesh infos with additional data for each mesh in this pose.
void AnimPoseT::SetAnimExpr | ( | IntrusivePtrT< AnimExpressionT > | AnimExpr | ) |
Sets a new anim expression to use for this pose.
AnimExpr | The new anim expression to use for this pose. |
|
inline |
Call this if something in the related model has changed.
void AnimPoseT::SetSuperPose | ( | const AnimPoseT * | SuperPose | ) |
This method assigns a pose of a parent or "super" model that should be used when rendering this model.
For example, a player model can act as the super model for a weapon, so that the skeleton of the weapon is copied from the player model in order to align the weapon with the hands of the player.
SuperPose | The super model pose that should be used when rendering this model. |
bool AnimPoseT::TraceRay | ( | int | SkinNr, |
const Vector3fT & | RayOrigin, | ||
const Vector3fT & | RayDir, | ||
TraceResultT & | Result | ||
) | const |
Traces a ray against this model in this pose, and returns whether it was hit.
The ray for the trace is defined by RayOrigin + RayDir*Fraction, where Fraction is a scalar >= 0.
SkinNr | The skin to use for the trace, use -1 for the default skin. |
RayOrigin | The point in model space where the ray starts. |
RayDir | A unit vector in model space that describes the direction the ray extends to. |
Result | If the model was hit, this struct contains additional details of the hit. |