Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
SkeletonPose.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
9
11
12#ifdef JPH_DEBUG_RENDERER
13class DebugRenderer;
14#endif // JPH_DEBUG_RENDERER
15
18{
19public:
21
25
28 void SetSkeleton(const Skeleton *inSkeleton);
29 const Skeleton * GetSkeleton() const { return mSkeleton; }
31
33 void SetRootOffset(RVec3Arg inOffset) { mRootOffset = inOffset; }
34 RVec3 GetRootOffset() const { return mRootOffset; }
35
38 uint GetJointCount() const { return (uint)mJoints.size(); }
39 const JointStateVector & GetJoints() const { return mJoints; }
40 JointStateVector & GetJoints() { return mJoints; }
41 const JointState & GetJoint(int inJoint) const { return mJoints[inJoint]; }
42 JointState & GetJoint(int inJoint) { return mJoints[inJoint]; }
44
47 const Mat44Vector & GetJointMatrices() const { return mJointMatrices; }
48 Mat44Vector & GetJointMatrices() { return mJointMatrices; }
49 const Mat44 & GetJointMatrix(int inJoint) const { return mJointMatrices[inJoint]; }
50 Mat44 & GetJointMatrix(int inJoint) { return mJointMatrices[inJoint]; }
52
54 void CalculateJointMatrices();
55
57 void CalculateJointStates();
58
60 void CalculateLocalSpaceJointMatrices(Mat44 *outMatrices) const;
61
62#ifdef JPH_DEBUG_RENDERER
65 {
66 bool mDrawJoints = true;
67 bool mDrawJointOrientations = true;
68 bool mDrawJointNames = false;
69 };
70
72 void Draw(const DrawSettings &inDrawSettings, DebugRenderer *inRenderer, RMat44Arg inOffset = RMat44::sIdentity()) const;
73#endif // JPH_DEBUG_RENDERER
74
75private:
76 RefConst<Skeleton> mSkeleton;
77 RVec3 mRootOffset { RVec3::sZero() };
78 JointStateVector mJoints;
79 Mat44Vector mJointMatrices;
80};
81
#define JPH_EXPORT
Definition: Core.h:214
unsigned int uint
Definition: Core.h:426
#define JPH_NAMESPACE_END
Definition: Core.h:354
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:348
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:29
std::vector< T, STLAllocator< T > > Array
Definition: STLAllocator.h:81
Simple triangle renderer for debugging purposes.
Definition: DebugRenderer.h:30
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition: Mat44.h:13
static JPH_INLINE Mat44 sIdentity()
Identity matrix.
Definition: Mat44.inl:35
Definition: Reference.h:151
Constains the current state of a joint, a local space transformation relative to its parent joint.
Definition: SkeletalAnimation.h:22
Resource that contains the joint hierarchy for a skeleton.
Definition: Skeleton.h:18
Instance of a skeleton, contains the pose the current skeleton is in.
Definition: SkeletonPose.h:18
Mat44 & GetJointMatrix(int inJoint)
Definition: SkeletonPose.h:50
const Mat44Vector & GetJointMatrices() const
Definition: SkeletonPose.h:47
const Skeleton * GetSkeleton() const
Definition: SkeletonPose.h:29
JointStateVector & GetJoints()
Definition: SkeletonPose.h:40
const JointStateVector & GetJoints() const
Definition: SkeletonPose.h:39
void SetRootOffset(RVec3Arg inOffset)
Extra offset applied to the root (and therefore also to all of its children)
Definition: SkeletonPose.h:33
Array< Mat44 > Mat44Vector
Definition: SkeletonPose.h:24
JointState & GetJoint(int inJoint)
Definition: SkeletonPose.h:42
const Mat44 & GetJointMatrix(int inJoint) const
Definition: SkeletonPose.h:49
Array< JointState > JointStateVector
Definition: SkeletonPose.h:23
Mat44Vector & GetJointMatrices()
Definition: SkeletonPose.h:48
RVec3 GetRootOffset() const
Definition: SkeletonPose.h:34
uint GetJointCount() const
Definition: SkeletonPose.h:38
const JointState & GetJoint(int inJoint) const
Definition: SkeletonPose.h:41
Definition: Vec3.h:16
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition: Vec3.inl:107
Draw settings.
Definition: SkeletonPose.h:65