mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Make animation blending and bone overrides interact favorably
This commit is contained in:
parent
455f7a4cae
commit
307ab111d0
2 changed files with 16 additions and 9 deletions
|
@ -181,6 +181,10 @@ void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
|
|||
// anything is rendered so that the transformations of children are up to date
|
||||
animateJoints();
|
||||
|
||||
// Copy old transforms *before* bone overrides have been applied.
|
||||
// TODO if there are no bone overrides or no animation blending, this is unnecessary.
|
||||
copyOldTransforms();
|
||||
|
||||
OnAnimateCallback(timeMs / 1000.0f);
|
||||
|
||||
IAnimatedMeshSceneNode::OnAnimate(timeMs);
|
||||
|
@ -610,13 +614,8 @@ void CAnimatedMeshSceneNode::checkJoints()
|
|||
}
|
||||
}
|
||||
|
||||
void CAnimatedMeshSceneNode::beginTransition()
|
||||
void CAnimatedMeshSceneNode::copyOldTransforms()
|
||||
{
|
||||
if (!JointsUsed)
|
||||
return;
|
||||
|
||||
if (TransitionTime != 0) {
|
||||
// Copy the transforms of animated joints
|
||||
for (u32 i = 0; i < PerJoint.SceneNodes.size(); ++i) {
|
||||
if (!PerJoint.SceneNodes[i]->Matrix) {
|
||||
PerJoint.PreTransSaves[i] = PerJoint.SceneNodes[i]->getTransform();
|
||||
|
@ -624,7 +623,14 @@ void CAnimatedMeshSceneNode::beginTransition()
|
|||
PerJoint.PreTransSaves[i] = std::nullopt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAnimatedMeshSceneNode::beginTransition()
|
||||
{
|
||||
if (!JointsUsed)
|
||||
return;
|
||||
|
||||
if (TransitionTime != 0) {
|
||||
Transiting = core::reciprocal((f32)TransitionTime);
|
||||
}
|
||||
TransitingBlend = 0.f;
|
||||
|
|
|
@ -148,6 +148,7 @@ private:
|
|||
|
||||
void buildFrameNr(u32 timeMs);
|
||||
void checkJoints();
|
||||
void copyOldTransforms();
|
||||
void beginTransition();
|
||||
|
||||
core::array<video::SMaterial> Materials;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue