Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
SkeletalAnimation.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
12class SkeletonPose;
13
15class JPH_EXPORT SkeletalAnimation : public RefTarget<SkeletalAnimation>
16{
18
19public:
22 {
24
25 public:
27 void FromMatrix(Mat44Arg inMatrix);
28
30 inline Mat44 ToMatrix() const { return Mat44::sRotationTranslation(mRotation, mTranslation); }
31
32 Quat mRotation = Quat::sIdentity();
33 Vec3 mTranslation = Vec3::sZero();
34 };
35
37 class Keyframe : public JointState
38 {
40
41 public:
42 float mTime = 0.0f;
43 };
44
46
56
58
60 float GetDuration() const;
61
63 void ScaleJoints(float inScale);
64
66 void Sample(float inTime, SkeletonPose &ioPose) const;
67
69 const AnimatedJointVector & GetAnimatedJoints() const { return mAnimatedJoints; }
70 AnimatedJointVector & GetAnimatedJoints() { return mAnimatedJoints; }
71
72private:
73 AnimatedJointVector mAnimatedJoints;
74 bool mIsLooping = true;
75};
76
#define JPH_EXPORT
Definition Core.h:236
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
std::basic_string< char, std::char_traits< char >, STLAllocator< char > > String
Definition STLAllocator.h:107
#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(linkage, class_name)
Definition SerializableObject.h:80
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 sRotationTranslation(QuatArg inR, Vec3Arg inT)
Get matrix that rotates and translates.
Definition Mat44.inl:149
Definition Quat.h:33
static JPH_INLINE Quat sIdentity()
Definition Quat.h:103
Definition Reference.h:35
Contains the animation for a single joint.
Definition SkeletalAnimation.h:49
KeyframeVector mKeyframes
List of keyframes over time.
Definition SkeletalAnimation.h:54
String mJointName
Name of the joint.
Definition SkeletalAnimation.h:53
Contains the current state of a joint, a local space transformation relative to its parent joint.
Definition SkeletalAnimation.h:22
Mat44 ToMatrix() const
Convert to matrix representation.
Definition SkeletalAnimation.h:30
Contains the state of a single joint at a particular time.
Definition SkeletalAnimation.h:38
Resource for a skinned animation.
Definition SkeletalAnimation.h:16
AnimatedJointVector & GetAnimatedJoints()
Definition SkeletalAnimation.h:70
const AnimatedJointVector & GetAnimatedJoints() const
Get joint samples.
Definition SkeletalAnimation.h:69
Instance of a skeleton, contains the pose the current skeleton is in.
Definition SkeletonPose.h:18
Definition Vec3.h:17
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107