Class that is able to map a low detail (ragdoll) skeleton to a high detail (animation) skeleton and vice versa.
More...
#include <SkeletonMapper.h>
|
class | Chain |
| A joint chain that starts with a 1-on-1 mapped joint and ends with a 1-on-1 mapped joint with intermediate joints that cannot be mapped. More...
|
|
class | Locked |
| Joints that should have their translation locked (fixed) More...
|
|
class | Mapping |
| A joint that maps 1-on-1 to a joint in the other skeleton. More...
|
|
class | Unmapped |
| Joints that could not be mapped from skeleton 1 to 2. More...
|
|
|
void | Initialize (const Skeleton *inSkeleton1, const Mat44 *inNeutralPose1, const Skeleton *inSkeleton2, const Mat44 *inNeutralPose2, const CanMapJoint &inCanMapJoint=sDefaultCanMapJoint) |
|
void | LockTranslations (const Skeleton *inSkeleton2, const bool *inLockedTranslations, const Mat44 *inNeutralPose2) |
|
void | LockAllTranslations (const Skeleton *inSkeleton2, const Mat44 *inNeutralPose2) |
|
void | Map (const Mat44 *inPose1ModelSpace, const Mat44 *inPose2LocalSpace, Mat44 *outPose2ModelSpace) const |
|
void | MapReverse (const Mat44 *inPose2ModelSpace, Mat44 *outPose1ModelSpace) const |
|
int | GetMappedJointIdx (int inJoint1Idx) const |
| Search through the directly mapped joints (mMappings) and find inJoint1Idx, returns the corresponding Joint2Idx or -1 if not found.
|
|
bool | IsJointTranslationLocked (int inJoint2Idx) const |
| Search through the locked translations (mLockedTranslations) and find if joint inJoint2Idx is locked.
|
|
|
const MappingVector & | GetMappings () const |
|
MappingVector & | GetMappings () |
|
const ChainVector & | GetChains () const |
|
ChainVector & | GetChains () |
|
const UnmappedVector & | GetUnmapped () const |
|
UnmappedVector & | GetUnmapped () |
|
const LockedVector & | GetLockedTranslations () const |
|
LockedVector & | GetLockedTranslations () |
|
| RefTarget ()=default |
| Constructor.
|
|
| RefTarget (const RefTarget &) |
|
| ~RefTarget () |
| assert no one is referencing us
|
|
void | SetEmbedded () const |
|
RefTarget & | operator= (const RefTarget &) |
| Assignment operator.
|
|
uint32 | GetRefCount () const |
| Get current refcount of this object.
|
|
void | AddRef () const |
| Add or release a reference to this object.
|
|
void | Release () const |
|
|
atomic< uint32 > | mRefCount |
| Current reference count.
|
|
static constexpr uint32 | cEmbedded |
| A large value that gets added to the refcount to mark the object as embedded.
|
|
Class that is able to map a low detail (ragdoll) skeleton to a high detail (animation) skeleton and vice versa.
◆ CanMapJoint
A function that is called to determine if a joint can be mapped from source to target skeleton.
◆ ChainVector
◆ LockedVector
◆ MappingVector
◆ UnmappedVector
◆ GetChains() [1/2]
◆ GetChains() [2/2]
const ChainVector & SkeletonMapper::GetChains |
( |
| ) |
const |
|
inline |
◆ GetLockedTranslations() [1/2]
◆ GetLockedTranslations() [2/2]
const LockedVector & SkeletonMapper::GetLockedTranslations |
( |
| ) |
const |
|
inline |
◆ GetMappedJointIdx()
int SkeletonMapper::GetMappedJointIdx |
( |
int |
inJoint1Idx | ) |
const |
Search through the directly mapped joints (mMappings) and find inJoint1Idx, returns the corresponding Joint2Idx or -1 if not found.
◆ GetMappings() [1/2]
◆ GetMappings() [2/2]
◆ GetUnmapped() [1/2]
◆ GetUnmapped() [2/2]
◆ Initialize()
Initialize the skeleton mapper. Skeleton 1 should be the (low detail) ragdoll skeleton and skeleton 2 the (high detail) animation skeleton. We assume that each joint in skeleton 1 can be mapped to a joint in skeleton 2 (if not mapping from animation skeleton to ragdoll skeleton will be undefined). Skeleton 2 should have the same hierarchy as skeleton 1 but can contain extra joints between those in skeleton 1 and it can have extra joints at the root and leaves of the skeleton.
- Parameters
-
inSkeleton1 | Source skeleton to map from. |
inNeutralPose1 | Neutral pose of the source skeleton (model space) |
inSkeleton2 | Target skeleton to map to. |
inNeutralPose2 | Neutral pose of the target skeleton (model space), inNeutralPose1 and inNeutralPose2 must match as closely as possible, preferably the position of the mappable joints should be identical. |
inCanMapJoint | Function that checks if joints in skeleton 1 and skeleton 2 are equal. |
◆ IsJointTranslationLocked()
bool SkeletonMapper::IsJointTranslationLocked |
( |
int |
inJoint2Idx | ) |
const |
Search through the locked translations (mLockedTranslations) and find if joint inJoint2Idx is locked.
◆ LockAllTranslations()
void SkeletonMapper::LockAllTranslations |
( |
const Skeleton * |
inSkeleton2, |
|
|
const Mat44 * |
inNeutralPose2 |
|
) |
| |
After Initialize(), this can be called to lock the translation of all joints in skeleton 2 below the first mapped joint to those of the neutral pose. Because constraints are never 100% rigid, there's always a little bit of stretch in the ragdoll when the ragdoll is under stress. Locking the translations of the pose will remove the visual stretch from the ragdoll but will introduce a difference between the physical simulation and the visual representation.
- Parameters
-
inSkeleton2 | Target skeleton to map to. |
inNeutralPose2 | Neutral pose to take reference translations from |
◆ LockTranslations()
void SkeletonMapper::LockTranslations |
( |
const Skeleton * |
inSkeleton2, |
|
|
const bool * |
inLockedTranslations, |
|
|
const Mat44 * |
inNeutralPose2 |
|
) |
| |
This can be called so lock the translation of a specified set of joints in skeleton 2. Because constraints are never 100% rigid, there's always a little bit of stretch in the ragdoll when the ragdoll is under stress. Locking the translations of the pose will remove the visual stretch from the ragdoll but will introduce a difference between the physical simulation and the visual representation.
- Parameters
-
inSkeleton2 | Target skeleton to map to. |
inLockedTranslations | An array of bools the size of inSkeleton2->GetJointCount(), for each joint indicating if the joint is locked. |
inNeutralPose2 | Neutral pose to take reference translations from |
◆ Map()
void SkeletonMapper::Map |
( |
const Mat44 * |
inPose1ModelSpace, |
|
|
const Mat44 * |
inPose2LocalSpace, |
|
|
Mat44 * |
outPose2ModelSpace |
|
) |
| const |
Map a pose. Joints that were directly mappable will be copied in model space from pose 1 to pose 2. Any joints that are only present in skeleton 2 will get their model space transform calculated through the local space transforms of pose 2. Joints that are part of a joint chain between two mapped joints will be reoriented towards the next joint in skeleton 1. This means that it is possible for unmapped joints to have some animation, but very extreme animation poses will show artifacts.
- Parameters
-
inPose1ModelSpace | Pose on skeleton 1 in model space |
inPose2LocalSpace | Pose on skeleton 2 in local space (used for the joints that cannot be mapped) |
outPose2ModelSpace | Model space pose on skeleton 2 (the output of the mapping) |
◆ MapReverse()
void SkeletonMapper::MapReverse |
( |
const Mat44 * |
inPose2ModelSpace, |
|
|
Mat44 * |
outPose1ModelSpace |
|
) |
| const |
Reverse map a pose, this will only use the mappings and not the chains (it assumes that all joints in skeleton 1 are mapped)
- Parameters
-
inPose2ModelSpace | Model space pose on skeleton 2 |
outPose1ModelSpace | When the function returns this will contain the model space pose for skeleton 1 |
◆ sDefaultCanMapJoint()
static bool SkeletonMapper::sDefaultCanMapJoint |
( |
const Skeleton * |
inSkeleton1, |
|
|
int |
inIndex1, |
|
|
const Skeleton * |
inSkeleton2, |
|
|
int |
inIndex2 |
|
) |
| |
|
inlinestatic |
Default function that checks if the names of the joints are equal.
The documentation for this class was generated from the following files: