mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Fix and clean up skeletal animation (#15722)
* Fix attachments lagging behind their parents (#14818) * Fix animation blending (#14817) * Bring back cool guy as another .x smoke test * Add .x mesh loader unittest * Do bounding box & matrix calculation at proper point in time * Remove obsolete `SAnimatedMesh`
This commit is contained in:
parent
0bb87eb1ff
commit
fde6384a09
40 changed files with 856 additions and 1388 deletions
42
irr/include/Transform.h
Normal file
42
irr/include/Transform.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include "irrMath.h"
|
||||
#include <matrix4.h>
|
||||
#include <vector3d.h>
|
||||
#include <quaternion.h>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace core
|
||||
{
|
||||
|
||||
struct Transform {
|
||||
vector3df translation;
|
||||
quaternion rotation;
|
||||
vector3df scale{1};
|
||||
|
||||
Transform interpolate(Transform to, f32 time) const
|
||||
{
|
||||
core::quaternion interpolated_rotation;
|
||||
interpolated_rotation.slerp(rotation, to.rotation, time);
|
||||
return {
|
||||
to.translation.getInterpolated(translation, time),
|
||||
interpolated_rotation,
|
||||
to.scale.getInterpolated(scale, time),
|
||||
};
|
||||
}
|
||||
|
||||
matrix4 buildMatrix() const
|
||||
{
|
||||
matrix4 T;
|
||||
T.setTranslation(translation);
|
||||
matrix4 R;
|
||||
rotation.getMatrix_transposed(R);
|
||||
matrix4 S;
|
||||
S.setScale(scale);
|
||||
return T * R * S;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace core
|
||||
} // end namespace irr
|
Loading…
Add table
Add a link
Reference in a new issue