Developer Documentation
SkinT< MeshT > Class Template Reference

General skin class, used to bind skeleton and mesh and deform the mesh. More...

#include <Type-Skeleton/ObjectTypes/Skeleton/SkinT.hh>

Inheritance diagram for SkinT< MeshT >:
BaseSkin PerObjectData

Public Types

typedef MeshT::Point PointT
 
typedef PointT Point
 
typedef PointT::value_type Scalar
 
typedef SkeletonT< PointT > Skeleton
 
typedef JointT< PointT > Joint
 
typedef PoseT< PointT > Pose
 
typedef ACG::Matrix4x4T< Scalar > Matrix
 
typedef ACG::QuaternionT< Scalar > Quaternion
 
typedef ACG::DualQuaternionT< Scalar > DualQuaternion
 
- Public Types inherited from BaseSkin
typedef std::map< unsigned int, double > SkinWeights
 Stores the joint weights per vertex. More...
 

Public Member Functions

 SkinT (SkeletonT< PointT > *_skeleton, MeshT *_mesh, int _objectID)
 constructor More...
 
- Public Member Functions inherited from BaseSkin
 BaseSkin (int _skeletonId)
 Stores the joint weights per vertex. More...
 
 ~BaseSkin ()
 Stores the joint weights per vertex. More...
 
int skeletonId ()
 Holds the associated skeleton. More...
 
- Public Member Functions inherited from PerObjectData
 PerObjectData ()
 You have to provide your own constructor for your object. More...
 
virtual PerObjectDatacopyPerObjectData ()
 Copy Function. More...
 

Skinning

These methods are related to using a mesh as skin with this skeleton.

Skeletonskeleton_
 Attach the given mesh as skin to this skeleton. More...
 
MeshTmesh_
 Attach the given mesh as skin to this skeleton. More...
 
int objectId_
 Attach the given mesh as skin to this skeleton. More...
 
AnimationHandle lastAnimationHandle_
 Attach the given mesh as skin to this skeleton. More...
 
Blending::Method lastmethod_
 Attach the given mesh as skin to this skeleton. More...
 
bool weightsComputed_
 Attach the given mesh as skin to this skeleton. More...
 
void attachSkin ()
 Attach the given mesh as skin to this skeleton. More...
 
void deformSkin ()
 Attach the given mesh as skin to this skeleton. More...
 
void deformSkin (const AnimationHandle &_hAni, Blending::Method _method=Blending::M_LBS)
 Deforms the given skin to the pose defined by the skeleton. More...
 
void releaseSkin ()
 The given mesh will be reset to its default pose and all skin properties are removed. More...
 
Skeletonskeleton ()
 Attach the given mesh as skin to this skeleton. More...
 
void weightsComputed (bool _flag)
 Set whether weights are computed. More...
 
bool weightsComputed () const
 Check whether weights were computed. More...
 

Detailed Description

template<typename MeshT>
class SkinT< MeshT >

General skin class, used to bind skeleton and mesh and deform the mesh.

The mesh is given to the constructor. To prepare the mesh for deformation, call the SkinT::AttachSkin method.

Definition at line 14 of file SkinT.hh.

Member Typedef Documentation

◆ DualQuaternion

template<typename MeshT >
typedef ACG::DualQuaternionT<Scalar> SkinT< MeshT >::DualQuaternion

Definition at line 25 of file SkinT.hh.

◆ Joint

template<typename MeshT >
typedef JointT<PointT> SkinT< MeshT >::Joint

Definition at line 21 of file SkinT.hh.

◆ Matrix

template<typename MeshT >
typedef ACG::Matrix4x4T<Scalar> SkinT< MeshT >::Matrix

Definition at line 23 of file SkinT.hh.

◆ Point

template<typename MeshT >
typedef PointT SkinT< MeshT >::Point

Definition at line 18 of file SkinT.hh.

◆ PointT

template<typename MeshT >
typedef MeshT::Point SkinT< MeshT >::PointT

Definition at line 17 of file SkinT.hh.

◆ Pose

template<typename MeshT >
typedef PoseT<PointT> SkinT< MeshT >::Pose

Definition at line 22 of file SkinT.hh.

◆ Quaternion

template<typename MeshT >
typedef ACG::QuaternionT<Scalar> SkinT< MeshT >::Quaternion

Definition at line 24 of file SkinT.hh.

◆ Scalar

template<typename MeshT >
typedef PointT::value_type SkinT< MeshT >::Scalar

Definition at line 19 of file SkinT.hh.

◆ Skeleton

template<typename MeshT >
typedef SkeletonT<PointT> SkinT< MeshT >::Skeleton

Definition at line 20 of file SkinT.hh.

Constructor & Destructor Documentation

◆ SkinT()

template<typename MeshT >
SkinT< MeshT >::SkinT ( SkeletonT< PointT > *  _skeleton,
MeshT _mesh,
int  _objectID 
)

constructor

Parameters
_skeletonPointer to the skeleton which will be skinned
_meshPointer to the mesh that is the skin
_objectIDObjectId of the Skeleton

Definition at line 61 of file SkinT_impl.hh.

◆ ~SkinT()

template<typename MeshT >
SkinT< MeshT >::~SkinT
virtual

Definition at line 75 of file SkinT_impl.hh.

Member Function Documentation

◆ attachSkin()

template<typename MeshT >
void SkinT< MeshT >::attachSkin
virtual

Attach the given mesh as skin to this skeleton.

The mesh will be equipped with two properties. One holding the original vertex coordinates, a second holding the per vertex weights for the joints. The bone weights are derived from the segment information stored with the bones and in a vertex based mesh property called "Face Segment".

Implements BaseSkin.

Definition at line 99 of file SkinT_impl.hh.

◆ deformSkin() [1/2]

template<typename MeshT >
void SkinT< MeshT >::deformSkin
virtual

Attach the given mesh as skin to this skeleton.

The mesh will be equipped with two properties. One holding the original vertex coordinates, a second holding the per vertex weights for the joints. The bone weights are derived from the segment information stored with the bones and in a vertex based mesh property called "Face Segment".

Implements BaseSkin.

Definition at line 120 of file SkinT_impl.hh.

◆ deformSkin() [2/2]

template<typename MeshT >
void SkinT< MeshT >::deformSkin ( const AnimationHandle _hAni,
Blending::Method  _method = Blending::M_LBS 
)
virtual

Deforms the given skin to the pose defined by the skeleton.

This method will only work properly if the mesh has been prepared to be a skin by a call of SkeletonT::PrepareSkin.

Two algorithms are implemented:

  • Linear Blend Skinning (LBS) or Skeletal Space Deformation (SSD)
  • Spherical Blend Skinning (SBS), Ladislav Kavan and Jiri Zara: Spherical blend skinning, a real-time deformation of articulated models
Linear Blend Skinning
Every vertex will be transformed by every joint with a non-null weight. First of all the vertex is transformed into the coordinate system of the joint, then it is transformed back to the global coordinate system of the pose given by the active frame in the given animation.
Since the mesh is given in the default pose the default pose joints are used to calculate the vertices position relative to the joint. Then they are transformed back into global coordinates using the joints in the current pose.
The global matrices of the default pose and animation are not updated by this method, make sure to update them before deforming the skin or the results will be unexpected.

\[ v_{pose} = M_{pose} \cdot M^{-1}_{default} \cdot v_{default} \]

Parameters
_hAniThe animation frame to be used as target
_methoddeformation method to be used
See also
BaseSkin.hh

Implements BaseSkin.

Definition at line 158 of file SkinT_impl.hh.

◆ releaseSkin()

template<typename MeshT >
void SkinT< MeshT >::releaseSkin
virtual

The given mesh will be reset to its default pose and all skin properties are removed.

Implements BaseSkin.

Definition at line 269 of file SkinT_impl.hh.

◆ skeleton()

template<typename MeshT >
SkinT< MeshT >::Skeleton * SkinT< MeshT >::skeleton

Attach the given mesh as skin to this skeleton.

The mesh will be equipped with two properties. One holding the original vertex coordinates, a second holding the per vertex weights for the joints. The bone weights are derived from the segment information stored with the bones and in a vertex based mesh property called "Face Segment".

Definition at line 83 of file SkinT_impl.hh.

◆ weightsComputed() [1/2]

template<typename MeshT >
bool SkinT< MeshT >::weightsComputed ( ) const
inline

Check whether weights were computed.

Definition at line 55 of file SkinT.hh.

◆ weightsComputed() [2/2]

template<typename MeshT >
void SkinT< MeshT >::weightsComputed ( bool  _flag)
inline

Set whether weights are computed.

Definition at line 52 of file SkinT.hh.

Member Data Documentation

◆ lastAnimationHandle_

template<typename MeshT >
AnimationHandle SkinT< MeshT >::lastAnimationHandle_
private

Attach the given mesh as skin to this skeleton.

The mesh will be equipped with two properties. One holding the original vertex coordinates, a second holding the per vertex weights for the joints. The bone weights are derived from the segment information stored with the bones and in a vertex based mesh property called "Face Segment".

Definition at line 62 of file SkinT.hh.

◆ lastmethod_

template<typename MeshT >
Blending::Method SkinT< MeshT >::lastmethod_
private

Attach the given mesh as skin to this skeleton.

The mesh will be equipped with two properties. One holding the original vertex coordinates, a second holding the per vertex weights for the joints. The bone weights are derived from the segment information stored with the bones and in a vertex based mesh property called "Face Segment".

Definition at line 63 of file SkinT.hh.

◆ mesh_

template<typename MeshT >
MeshT* SkinT< MeshT >::mesh_
private

Attach the given mesh as skin to this skeleton.

The mesh will be equipped with two properties. One holding the original vertex coordinates, a second holding the per vertex weights for the joints. The bone weights are derived from the segment information stored with the bones and in a vertex based mesh property called "Face Segment".

Definition at line 59 of file SkinT.hh.

◆ objectId_

template<typename MeshT >
int SkinT< MeshT >::objectId_
private

Attach the given mesh as skin to this skeleton.

The mesh will be equipped with two properties. One holding the original vertex coordinates, a second holding the per vertex weights for the joints. The bone weights are derived from the segment information stored with the bones and in a vertex based mesh property called "Face Segment".

Definition at line 60 of file SkinT.hh.

◆ skeleton_

template<typename MeshT >
Skeleton* SkinT< MeshT >::skeleton_
private

Attach the given mesh as skin to this skeleton.

The mesh will be equipped with two properties. One holding the original vertex coordinates, a second holding the per vertex weights for the joints. The bone weights are derived from the segment information stored with the bones and in a vertex based mesh property called "Face Segment".

Definition at line 58 of file SkinT.hh.

◆ weightsComputed_

template<typename MeshT >
bool SkinT< MeshT >::weightsComputed_
private

Attach the given mesh as skin to this skeleton.

The mesh will be equipped with two properties. One holding the original vertex coordinates, a second holding the per vertex weights for the joints. The bone weights are derived from the segment information stored with the bones and in a vertex based mesh property called "Face Segment".

Definition at line 66 of file SkinT.hh.


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