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:271
unsigned int uint
Definition Core.h:481
#define JPH_NAMESPACE_END
Definition Core.h:414
#define JPH_NAMESPACE_BEGIN
Definition Core.h:408
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:31
Definition DebugRenderer.h:47
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:163
Contains the current state of a joint, a local space transformation relative to its parent joint.
Definition SkeletalAnimation.h:24
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
JointState & GetJoint(int inJoint)
Definition SkeletonPose.h:42
const Mat44 & GetJointMatrix(int inJoint) const
Definition SkeletonPose.h:49
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:17
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:103
Draw settings.
Definition SkeletonPose.h:65