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...
 
Skeletonskeleton ()
 
void weightsComputed (bool _flag)
 Set whether weights are computed.
 
bool weightsComputed () const
 Check whether weights were computed.
 
Skinning

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

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.
 
- Public Member Functions inherited from BaseSkin
 BaseSkin (int _skeletonId)
 
int skeletonId ()
 
- Public Member Functions inherited from PerObjectData
 PerObjectData ()
 You have to provide your own constructor for your object.
 
virtual PerObjectDatacopyPerObjectData ()
 Copy Function. More...
 

Private Attributes

Skeletonskeleton_
 
MeshT * mesh_
 
int objectId_
 
AnimationHandle lastAnimationHandle_
 
Blending::Method lastmethod_
 
bool weightsComputed_
 

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.

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.

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.


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