124 std::vector<SkeletalLocalPoseTransform>& localPose,
125 float deltaTime) = 0;
137 virtual const char* GetTypeName()
const override;
138 virtual void GatherProperties(std::vector<Property>& outProps)
override;
140 virtual void Create()
override;
141 virtual void Destroy()
override;
144 virtual void Tick(
float deltaTime)
override;
145 virtual void EditorTick(
float deltaTime)
override;
147 virtual bool IsStaticMesh3D()
const override;
148 virtual bool IsSkeletalMesh3D()
const override;
153 void PlayAnimation(
const char* animName,
bool loop,
float speed = 1.0f,
float weight = 1.0f, int32_t priority = -1);
159 void PlayAnimationMasked(
const char* animName, int32_t slot,
BoneMaskAsset* mask,
160 bool loop,
float speed = 1.0f,
float weight = 1.0f);
165 void PlayAnimationAdditive(
const char* animName, int32_t slot,
BoneMaskAsset* mask,
166 bool loop,
float speed = 1.0f,
float weight = 1.0f);
171 void SetSlotWeight(int32_t slot,
float weight);
175 void FadeSlotWeight(int32_t slot,
float targetWeight,
float seconds);
176 void QueueAnimation(
const char* animName,
bool loop,
const char* targetAnim =
nullptr,
float speed = 1.0f,
float weight = 1.0f, int32_t priority = -1);
177 void StopAnimation(
const char* animName,
bool cancelQueued =
false);
178 void StopAllAnimations(
bool cancelQueued =
false);
179 void CancelQueuedAnimation(
const char* animName);
180 void CancelAllQueuedAnimations();
181 bool IsAnimationPlaying(
const char* animName);
182 void ResetAnimation();
183 float GetAnimationSpeed()
const;
184 void SetAnimationSpeed(
float speed);
186 void SetAnimationPaused(
bool paused);
187 bool IsAnimationPaused()
const;
189 void SetInheritPose(
bool inherit);
190 bool IsInheritPoseEnabled()
const;
192 void SetBoundsRadiusOverride(
float radius);
193 float GetBoundsRadiusOverride()
const;
195 bool HasAnimatedThisFrame()
const;
198 std::vector<ActiveAnimation>& GetActiveAnimations();
200 QueuedAnimation* FindQueuedAnimation(
const char* animName,
const char* dependName =
nullptr);
201 std::vector<QueuedAnimation>& GetQueuedAnimations();
203 glm::mat4 GetBoneTransform(
const std::string& name)
const;
204 glm::vec3 GetBonePosition(
const std::string& name)
const;
205 glm::quat GetBoneRotationQuat(
const std::string& name)
const;
206 glm::vec3 GetBoneRotationEuler(
const std::string& name)
const;
207 glm::vec3 GetBoneScale(
const std::string& name)
const;
209 glm::mat4 GetBoneTransform(int32_t index)
const;
210 glm::vec3 GetBonePosition(int32_t boneIndex)
const;
211 glm::quat GetBoneRotationQuat(int32_t boneIndex)
const;
212 glm::vec3 GetBoneRotationEuler(int32_t boneIndex)
const;
213 glm::vec3 GetBoneScale(int32_t boneIndex)
const;
215 void SetBoneTransform(int32_t boneIndex,
const glm::mat4& transform);
216 void SetBonePosition(int32_t boneIndex, glm::vec3 position);
217 void SetBoneRotation(int32_t boneIndex, glm::vec3 rotation);
218 void SetBoneScale(int32_t boneIndex, glm::vec2 scale);
220 uint32_t GetNumBones()
const;
226 glm::mat4 GetBoneWorldMatrix(int32_t boneIndex)
const;
231 int32_t FindSocketIndex(
const std::string& name)
const;
232 uint32_t GetNumSockets()
const;
233 std::string GetSocketName(uint32_t index)
const;
234 glm::mat4 GetSocketTransform(
const std::string& name)
const;
235 glm::vec3 GetSocketPosition(
const std::string& name)
const;
236 glm::quat GetSocketRotationQuat(
const std::string& name)
const;
237 glm::vec3 GetSocketRotationEuler(
const std::string& name)
const;
241 float GetAnimationTime(
const char* animName)
const;
242 float GetAnimationNormalizedTime(
const char* animName);
243 void SetAnimationTime(
const char* animName,
float seconds);
244 void SetAnimationNormalizedTime(
const char* animName,
float normalizedTime);
245 float GetAnimationDurationSeconds(
const char* animName);
249 int32_t AddAnimationNotify(
const char* animName,
float normalizedTime,
const ScriptFunc& callback);
250 void RemoveAnimationNotify(int32_t handle);
251 void ClearAnimationNotifies(
const char* animName =
nullptr);
256 Vertex* GetSkinnedVertices();
257 uint32_t GetNumSkinnedVertices();
259 virtual Material* GetMaterial()
override;
260 virtual void Render()
override;
269 uint32_t GetNumMaterialSlots()
const;
270 Material* GetMaterialSlot(uint32_t slot)
const;
271 void SetMaterialSlot(uint32_t slot,
Material* material);
272 int32_t FindMaterialSlot(
const std::string& sectionName)
const;
274 void UpdateAnimation(
float deltaTime,
bool updateBones);
276 virtual Bounds GetLocalBounds()
const override;
277 virtual AABB GetLocalAABB()
const override;
279 int32_t FindBoneIndex(
const std::string& name)
const;
283 void SetScriptAnimEventHandler(
const ScriptFunc& func);
295 static bool HandlePropChange(
Datum* datum, uint32_t index,
const void* newValue);
297 void TickCommon(
float deltaTime);
299 glm::vec3 InterpolateScale(
float time,
const Channel& channel);
300 glm::quat InterpolateRotation(
float time,
const Channel& channel);
301 glm::vec3 InterpolatePosition(
float time,
const Channel& channel);
302 void DetectTriggeredAnimEvents(
306 float animationSpeed,
307 std::vector<AnimEvent>& outEvents);
309 uint32_t FindScaleIndex(
float time,
const Channel& channel);
310 uint32_t FindRotationIndex(
float time,
const Channel& channel);
311 uint32_t FindPositionIndex(
float time,
const Channel& channel);
313 void UpdateAttachedChildren(
float deltaTime);
314 void CpuSkinVertices();
319 void DetectTriggeredNotifies(
const ActiveAnimation& active,
float prevTime,
float curTime,
float durationSeconds);
320 void DispatchPendingNotifies();
321 void WarnIfNotifiesCantFire();
330 std::vector<SkeletalAnimationRef>& GetAnimationAssetsMutable();
334 const Animation* FindAnimation(
const char* animName);
335 void InvalidateAnimationBindings();
348 bool mAnimBindingsValid =
false;
358 int32_t mNextNotifyHandle = 1;
359 bool mWarnedNotifyUpdateMode =
false;
361 float mAnimationSpeed = 1.0f;
364 float mBoundsRadiusOverride = 0.0f;
#define POLYPHASE_API
Definition PolyphaseAPI.h:31
AnimationUpdateMode
Definition SkeletalMesh3d.h:21
@ AlwaysUpdateTimeAndBones
void(* AnimEventHandlerFP)(const AnimEvent &animEvent)
Definition SkeletalMesh3d.h:82
BoneInfluenceMode
Definition SkeletalMesh3d.h:14
AnimLayerMode
Definition SkeletalMesh3d.h:36
Definition BoneMaskAsset.h:19
Definition SkeletalMesh3d.h:117
virtual ~ISkeletalPoseModifier()=default
virtual void ModifySkeletalPose(class SkeletalMesh3D *component, class SkeletalMesh *mesh, std::vector< SkeletalLocalPoseTransform > &localPose, float deltaTime)=0
Definition ScriptFunc.h:10
Definition SkeletalAnimationAsset.h:26
Definition SkeletalMesh3d.h:129
std::vector< ActiveAnimation > mActiveAnimations
Definition SkeletalMesh3d.h:362
bool mInheritPose
Definition SkeletalMesh3d.h:367
std::vector< Vertex > mSkinnedVertices
Definition SkeletalMesh3d.h:340
ScriptableFP< AnimEventHandlerFP > mAnimEventHandler
Definition SkeletalMesh3d.h:350
std::vector< glm::mat4 > mBoneMatrices
Definition SkeletalMesh3d.h:338
BoneInfluenceMode mBoneInfluenceMode
Definition SkeletalMesh3d.h:370
std::vector< Animation > mBoundExternalAnims
Definition SkeletalMesh3d.h:347
std::string mDefaultAnimation
Definition SkeletalMesh3d.h:360
bool mHasAnimatedThisFrame
Definition SkeletalMesh3d.h:368
bool mRevertToBindPose
Definition SkeletalMesh3d.h:366
std::vector< QueuedAnimation > mQueuedAnimations
Definition SkeletalMesh3d.h:363
SkeletalMeshCompResource mResource
Definition SkeletalMesh3d.h:374
std::vector< SkeletalAnimationRef > mAnimationAssets
Definition SkeletalMesh3d.h:342
std::vector< ScriptFunc > mPendingNotifies
Definition SkeletalMesh3d.h:357
AnimationUpdateMode mAnimationUpdateMode
Definition SkeletalMesh3d.h:371
std::vector< ISkeletalPoseModifier * > mPoseModifiers
Definition SkeletalMesh3d.h:339
SkeletalMeshRef mSkeletalMesh
Definition SkeletalMesh3d.h:337
std::vector< MaterialRef > mSectionMaterialOverrides
Definition SkeletalMesh3d.h:341
const std::vector< SkeletalAnimationRef > & GetAnimationAssets() const
Definition SkeletalMesh3d.h:329
DECLARE_NODE(SkeletalMesh3D, Mesh3D)
bool mAnimationPaused
Definition SkeletalMesh3d.h:365
std::vector< AnimationNotify > mAnimationNotifies
Definition SkeletalMesh3d.h:356
Definition SkeletalMesh.h:114
Definition EngineTypes.h:213
Definition SkeletalMesh3d.h:49
AssetRef mBoneMask
Definition SkeletalMesh3d.h:60
bool mLoop
Definition SkeletalMesh3d.h:55
float mWeightFadeRate
Definition SkeletalMesh3d.h:66
float mSpeed
Definition SkeletalMesh3d.h:52
int32_t mSlot
Definition SkeletalMesh3d.h:54
std::string mName
Definition SkeletalMesh3d.h:50
float mWeightTarget
Definition SkeletalMesh3d.h:65
float mTime
Definition SkeletalMesh3d.h:51
float mWeight
Definition SkeletalMesh3d.h:53
AnimLayerMode mLayerMode
Definition SkeletalMesh3d.h:68
Definition SkeletalMesh.h:60
Definition SkeletalMesh3d.h:90
int32_t mHandle
Definition SkeletalMesh3d.h:94
ScriptFunc mCallback
Definition SkeletalMesh3d.h:93
std::string mAnimName
Definition SkeletalMesh3d.h:91
float mNormalizedTime
Definition SkeletalMesh3d.h:92
Definition SkeletalMesh.h:77
Definition EngineTypes.h:204
Definition SkeletalMesh.h:69
Definition SkeletalMesh3d.h:72
bool mLoop
Definition SkeletalMesh3d.h:78
float mTime
Definition SkeletalMesh3d.h:75
std::string mName
Definition SkeletalMesh3d.h:73
std::string mDependentAnim
Definition SkeletalMesh3d.h:74
float mWeight
Definition SkeletalMesh3d.h:77
float mSpeed
Definition SkeletalMesh3d.h:76
int32_t mSlot
Definition SkeletalMesh3d.h:79
Definition ScriptFunc.h:43
Definition GraphicsTypes.h:238