mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
cleanup
This commit is contained in:
parent
d17f22f536
commit
769c472ceb
9 changed files with 28 additions and 203 deletions
|
@ -12,18 +12,6 @@ namespace irr
|
||||||
{
|
{
|
||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
enum E_JOINT_UPDATE_ON_RENDER
|
|
||||||
{
|
|
||||||
//! do nothing
|
|
||||||
EJUOR_NONE = 0,
|
|
||||||
|
|
||||||
//! get joints positions from the mesh (for attached nodes, etc)
|
|
||||||
EJUOR_READ,
|
|
||||||
|
|
||||||
//! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() )
|
|
||||||
EJUOR_CONTROL
|
|
||||||
};
|
|
||||||
|
|
||||||
class IAnimatedMeshSceneNode;
|
class IAnimatedMeshSceneNode;
|
||||||
|
|
||||||
//! Callback interface for catching events of ended animations.
|
//! Callback interface for catching events of ended animations.
|
||||||
|
@ -141,13 +129,8 @@ public:
|
||||||
//! Returns the current mesh
|
//! Returns the current mesh
|
||||||
virtual IAnimatedMesh *getMesh(void) = 0;
|
virtual IAnimatedMesh *getMesh(void) = 0;
|
||||||
|
|
||||||
//! Set how the joints should be updated on render
|
|
||||||
virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode) = 0;
|
|
||||||
|
|
||||||
//! Sets the transition time in seconds
|
//! Sets the transition time in seconds
|
||||||
/** Note: This needs to enable joints, and setJointmode set to
|
/** Note: You must call animateJoints(), or the mesh will not animate. */
|
||||||
EJUOR_CONTROL. You must call animateJoints(), or the mesh will
|
|
||||||
not animate. */
|
|
||||||
virtual void setTransitionTime(f32 Time) = 0;
|
virtual void setTransitionTime(f32 Time) = 0;
|
||||||
|
|
||||||
//! animates the joints in the mesh based on the current frame.
|
//! animates the joints in the mesh based on the current frame.
|
||||||
|
|
|
@ -11,60 +11,17 @@ namespace irr
|
||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
|
|
||||||
//! Enumeration for different bone animation modes
|
|
||||||
enum E_BONE_ANIMATION_MODE
|
|
||||||
{
|
|
||||||
//! The bone is usually animated, unless it's parent is not animated
|
|
||||||
EBAM_AUTOMATIC = 0,
|
|
||||||
|
|
||||||
//! The bone is animated by the skin, if it's parent is not animated then animation will resume from this bone onward
|
|
||||||
EBAM_ANIMATED,
|
|
||||||
|
|
||||||
//! The bone is not animated by the skin
|
|
||||||
EBAM_UNANIMATED,
|
|
||||||
|
|
||||||
//! Not an animation mode, just here to count the available modes
|
|
||||||
EBAM_COUNT
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
enum E_BONE_SKINNING_SPACE
|
|
||||||
{
|
|
||||||
//! local skinning, standard
|
|
||||||
EBSS_LOCAL = 0,
|
|
||||||
|
|
||||||
//! global skinning
|
|
||||||
EBSS_GLOBAL,
|
|
||||||
|
|
||||||
EBSS_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Names for bone animation modes
|
|
||||||
const c8 *const BoneAnimationModeNames[] = {
|
|
||||||
"automatic",
|
|
||||||
"animated",
|
|
||||||
"unanimated",
|
|
||||||
0,
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Interface for bones used for skeletal animation.
|
//! Interface for bones used for skeletal animation.
|
||||||
/** Used with SkinnedMesh and IAnimatedMeshSceneNode. */
|
/** Used with SkinnedMesh and IAnimatedMeshSceneNode. */
|
||||||
class IBoneSceneNode : public ISceneNode
|
class IBoneSceneNode : public ISceneNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id = -1) :
|
IBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id = -1) :
|
||||||
ISceneNode(parent, mgr, id), positionHint(-1), scaleHint(-1), rotationHint(-1) {}
|
ISceneNode(parent, mgr, id) {}
|
||||||
|
|
||||||
//! Get the index of the bone
|
//! Get the index of the bone
|
||||||
virtual u32 getBoneIndex() const = 0;
|
virtual u32 getBoneIndex() const = 0;
|
||||||
|
|
||||||
//! Sets the animation mode of the bone.
|
|
||||||
/** \return True if successful. (Unused) */
|
|
||||||
virtual bool setAnimationMode(E_BONE_ANIMATION_MODE mode) = 0;
|
|
||||||
|
|
||||||
//! Gets the current animation mode of the bone
|
|
||||||
virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0;
|
|
||||||
|
|
||||||
//! Get the axis aligned bounding box of this node
|
//! Get the axis aligned bounding box of this node
|
||||||
const core::aabbox3d<f32> &getBoundingBox() const override = 0;
|
const core::aabbox3d<f32> &getBoundingBox() const override = 0;
|
||||||
|
|
||||||
|
@ -78,18 +35,8 @@ public:
|
||||||
/** Does nothing as bones are not visible. */
|
/** Does nothing as bones are not visible. */
|
||||||
void render() override {}
|
void render() override {}
|
||||||
|
|
||||||
//! How the relative transformation of the bone is used
|
|
||||||
virtual void setSkinningSpace(E_BONE_SKINNING_SPACE space) = 0;
|
|
||||||
|
|
||||||
//! How the relative transformation of the bone is used
|
|
||||||
virtual E_BONE_SKINNING_SPACE getSkinningSpace() const = 0;
|
|
||||||
|
|
||||||
//! Updates the absolute position based on the relative and the parents position
|
//! Updates the absolute position based on the relative and the parents position
|
||||||
virtual void updateAbsolutePositionOfAllChildren() = 0;
|
virtual void updateAbsolutePositionOfAllChildren() = 0;
|
||||||
|
|
||||||
s32 positionHint;
|
|
||||||
s32 scaleHint;
|
|
||||||
s32 rotationHint;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace scene
|
} // end namespace scene
|
||||||
|
|
|
@ -309,7 +309,7 @@ public:
|
||||||
//! Joints
|
//! Joints
|
||||||
struct SJoint
|
struct SJoint
|
||||||
{
|
{
|
||||||
SJoint() : GlobalSkinningSpace(false) {}
|
SJoint() {}
|
||||||
|
|
||||||
//! The name of this joint
|
//! The name of this joint
|
||||||
std::optional<std::string> Name;
|
std::optional<std::string> Name;
|
||||||
|
@ -344,8 +344,6 @@ public:
|
||||||
private:
|
private:
|
||||||
//! Internal members used by SkinnedMesh
|
//! Internal members used by SkinnedMesh
|
||||||
friend class SkinnedMesh;
|
friend class SkinnedMesh;
|
||||||
|
|
||||||
bool GlobalSkinningSpace;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<SJoint *> &getAllJoints() const {
|
const std::vector<SJoint *> &getAllJoints() const {
|
||||||
|
|
|
@ -34,7 +34,7 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh *mesh,
|
||||||
StartFrame(0), EndFrame(0), FramesPerSecond(0.025f),
|
StartFrame(0), EndFrame(0), FramesPerSecond(0.025f),
|
||||||
CurrentFrameNr(0.f), LastTimeMs(0),
|
CurrentFrameNr(0.f), LastTimeMs(0),
|
||||||
TransitionTime(0), Transiting(0.f), TransitingBlend(0.f),
|
TransitionTime(0), Transiting(0.f), TransitingBlend(0.f),
|
||||||
JointMode(EJUOR_NONE), JointsUsed(false),
|
JointsUsed(false),
|
||||||
Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(false),
|
Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(false),
|
||||||
LoopCallBack(0), PassCount(0)
|
LoopCallBack(0), PassCount(0)
|
||||||
{
|
{
|
||||||
|
@ -163,28 +163,14 @@ IMesh *CAnimatedMeshSceneNode::getMeshForCurrentFrame()
|
||||||
|
|
||||||
SkinnedMesh *skinnedMesh = static_cast<SkinnedMesh *>(Mesh);
|
SkinnedMesh *skinnedMesh = static_cast<SkinnedMesh *>(Mesh);
|
||||||
|
|
||||||
if (JointMode == EJUOR_CONTROL) // write to mesh
|
|
||||||
skinnedMesh->transferJointsToMesh(JointChildSceneNodes);
|
|
||||||
else
|
|
||||||
skinnedMesh->animateMesh(getFrameNr());
|
skinnedMesh->animateMesh(getFrameNr());
|
||||||
|
|
||||||
|
// skinnedMesh->transferJointsToMesh(JointChildSceneNodes);
|
||||||
|
|
||||||
// Update the skinned mesh for the current joint transforms.
|
// Update the skinned mesh for the current joint transforms.
|
||||||
skinnedMesh->skinMesh();
|
skinnedMesh->skinMesh();
|
||||||
|
|
||||||
if (JointMode == EJUOR_READ) { // read from mesh
|
|
||||||
skinnedMesh->recoverJointsFromMesh(JointChildSceneNodes);
|
|
||||||
|
|
||||||
//---slow---
|
|
||||||
for (u32 n = 0; n < JointChildSceneNodes.size(); ++n)
|
|
||||||
if (JointChildSceneNodes[n]->getParent() == this) {
|
|
||||||
JointChildSceneNodes[n]->updateAbsolutePositionOfAllChildren(); // temp, should be an option
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JointMode == EJUOR_CONTROL) {
|
|
||||||
// For meshes other than EJUOR_CONTROL, this is done by calling animateMesh()
|
|
||||||
skinnedMesh->updateBoundingBox();
|
skinnedMesh->updateBoundingBox();
|
||||||
}
|
|
||||||
|
|
||||||
return skinnedMesh;
|
return skinnedMesh;
|
||||||
}
|
}
|
||||||
|
@ -556,14 +542,7 @@ void CAnimatedMeshSceneNode::updateAbsolutePosition()
|
||||||
IAnimatedMeshSceneNode::updateAbsolutePosition();
|
IAnimatedMeshSceneNode::updateAbsolutePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set)
|
//! Sets the transition time in seconds (note: This needs to enable joints)
|
||||||
void CAnimatedMeshSceneNode::setJointMode(E_JOINT_UPDATE_ON_RENDER mode)
|
|
||||||
{
|
|
||||||
checkJoints();
|
|
||||||
JointMode = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2)
|
|
||||||
//! you must call animateJoints(), or the mesh will not animate
|
//! you must call animateJoints(), or the mesh will not animate
|
||||||
void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
|
void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
|
||||||
{
|
{
|
||||||
|
@ -571,10 +550,6 @@ void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
|
||||||
if (TransitionTime == ttime)
|
if (TransitionTime == ttime)
|
||||||
return;
|
return;
|
||||||
TransitionTime = ttime;
|
TransitionTime = ttime;
|
||||||
if (ttime != 0)
|
|
||||||
setJointMode(EJUOR_CONTROL);
|
|
||||||
else
|
|
||||||
setJointMode(EJUOR_NONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected)
|
//! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected)
|
||||||
|
@ -651,8 +626,6 @@ void CAnimatedMeshSceneNode::animateJoints(bool CalculateAbsolutePositions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
*/
|
|
||||||
void CAnimatedMeshSceneNode::checkJoints()
|
void CAnimatedMeshSceneNode::checkJoints()
|
||||||
{
|
{
|
||||||
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
|
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
|
||||||
|
@ -668,12 +641,9 @@ void CAnimatedMeshSceneNode::checkJoints()
|
||||||
((SkinnedMesh *)Mesh)->recoverJointsFromMesh(JointChildSceneNodes);
|
((SkinnedMesh *)Mesh)->recoverJointsFromMesh(JointChildSceneNodes);
|
||||||
|
|
||||||
JointsUsed = true;
|
JointsUsed = true;
|
||||||
JointMode = EJUOR_READ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
*/
|
|
||||||
void CAnimatedMeshSceneNode::beginTransition()
|
void CAnimatedMeshSceneNode::beginTransition()
|
||||||
{
|
{
|
||||||
if (!JointsUsed)
|
if (!JointsUsed)
|
||||||
|
@ -695,8 +665,6 @@ void CAnimatedMeshSceneNode::beginTransition()
|
||||||
TransitingBlend = 0.f;
|
TransitingBlend = 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
*/
|
|
||||||
ISceneNode *CAnimatedMeshSceneNode::clone(ISceneNode *newParent, ISceneManager *newManager)
|
ISceneNode *CAnimatedMeshSceneNode::clone(ISceneNode *newParent, ISceneManager *newManager)
|
||||||
{
|
{
|
||||||
if (!newParent)
|
if (!newParent)
|
||||||
|
@ -722,7 +690,6 @@ ISceneNode *CAnimatedMeshSceneNode::clone(ISceneNode *newParent, ISceneManager *
|
||||||
newNode->EndFrame = EndFrame;
|
newNode->EndFrame = EndFrame;
|
||||||
newNode->FramesPerSecond = FramesPerSecond;
|
newNode->FramesPerSecond = FramesPerSecond;
|
||||||
newNode->CurrentFrameNr = CurrentFrameNr;
|
newNode->CurrentFrameNr = CurrentFrameNr;
|
||||||
newNode->JointMode = JointMode;
|
|
||||||
newNode->JointsUsed = JointsUsed;
|
newNode->JointsUsed = JointsUsed;
|
||||||
newNode->TransitionTime = TransitionTime;
|
newNode->TransitionTime = TransitionTime;
|
||||||
newNode->Transiting = Transiting;
|
newNode->Transiting = Transiting;
|
||||||
|
|
|
@ -117,9 +117,6 @@ public:
|
||||||
//! updates the absolute position based on the relative and the parents position
|
//! updates the absolute position based on the relative and the parents position
|
||||||
void updateAbsolutePosition() override;
|
void updateAbsolutePosition() override;
|
||||||
|
|
||||||
//! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set)
|
|
||||||
void setJointMode(E_JOINT_UPDATE_ON_RENDER mode) override;
|
|
||||||
|
|
||||||
//! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2)
|
//! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2)
|
||||||
//! you must call animateJoints(), or the mesh will not animate
|
//! you must call animateJoints(), or the mesh will not animate
|
||||||
void setTransitionTime(f32 Time) override;
|
void setTransitionTime(f32 Time) override;
|
||||||
|
@ -158,8 +155,6 @@ private:
|
||||||
f32 Transiting; // is mesh transiting (plus cache of TransitionTime)
|
f32 Transiting; // is mesh transiting (plus cache of TransitionTime)
|
||||||
f32 TransitingBlend; // 0-1, calculated on buildFrameNr
|
f32 TransitingBlend; // 0-1, calculated on buildFrameNr
|
||||||
|
|
||||||
// 0-unused, 1-get joints only, 2-set joints only, 3-move and set
|
|
||||||
E_JOINT_UPDATE_ON_RENDER JointMode;
|
|
||||||
bool JointsUsed;
|
bool JointsUsed;
|
||||||
|
|
||||||
bool Looping;
|
bool Looping;
|
||||||
|
|
|
@ -11,49 +11,6 @@ namespace irr
|
||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
|
|
||||||
//! constructor
|
|
||||||
CBoneSceneNode::CBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id,
|
|
||||||
u32 boneIndex, const std::optional<std::string> &boneName) :
|
|
||||||
IBoneSceneNode(parent, mgr, id),
|
|
||||||
BoneIndex(boneIndex),
|
|
||||||
AnimationMode(EBAM_AUTOMATIC), SkinningSpace(EBSS_LOCAL)
|
|
||||||
{
|
|
||||||
setName(boneName);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns the index of the bone
|
|
||||||
u32 CBoneSceneNode::getBoneIndex() const
|
|
||||||
{
|
|
||||||
return BoneIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets the animation mode of the bone. Returns true if successful.
|
|
||||||
bool CBoneSceneNode::setAnimationMode(E_BONE_ANIMATION_MODE mode)
|
|
||||||
{
|
|
||||||
AnimationMode = mode;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Gets the current animation mode of the bone
|
|
||||||
E_BONE_ANIMATION_MODE CBoneSceneNode::getAnimationMode() const
|
|
||||||
{
|
|
||||||
return AnimationMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! returns the axis aligned bounding box of this node
|
|
||||||
const core::aabbox3d<f32> &CBoneSceneNode::getBoundingBox() const
|
|
||||||
{
|
|
||||||
return Box;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
//! Returns the relative transformation of the scene node.
|
|
||||||
core::matrix4 CBoneSceneNode::getRelativeTransformation() const
|
|
||||||
{
|
|
||||||
return core::matrix4(); // RelativeTransformation;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void CBoneSceneNode::OnAnimate(u32 timeMs)
|
void CBoneSceneNode::OnAnimate(u32 timeMs)
|
||||||
{
|
{
|
||||||
if (IsVisible) {
|
if (IsVisible) {
|
||||||
|
|
|
@ -21,49 +21,36 @@ public:
|
||||||
//! constructor
|
//! constructor
|
||||||
CBoneSceneNode(ISceneNode *parent, ISceneManager *mgr,
|
CBoneSceneNode(ISceneNode *parent, ISceneManager *mgr,
|
||||||
s32 id = -1, u32 boneIndex = 0,
|
s32 id = -1, u32 boneIndex = 0,
|
||||||
const std::optional<std::string> &boneName = std::nullopt);
|
const std::optional<std::string> &boneName = std::nullopt) :
|
||||||
|
IBoneSceneNode(parent, mgr, id),
|
||||||
|
BoneIndex(boneIndex)
|
||||||
|
{
|
||||||
|
setName(boneName);
|
||||||
|
}
|
||||||
|
|
||||||
//! Returns the index of the bone
|
//! Returns the index of the bone
|
||||||
u32 getBoneIndex() const override;
|
u32 getBoneIndex() const override
|
||||||
|
{
|
||||||
//! Sets the animation mode of the bone. Returns true if successful.
|
return BoneIndex;
|
||||||
bool setAnimationMode(E_BONE_ANIMATION_MODE mode) override;
|
}
|
||||||
|
|
||||||
//! Gets the current animation mode of the bone
|
|
||||||
E_BONE_ANIMATION_MODE getAnimationMode() const override;
|
|
||||||
|
|
||||||
//! returns the axis aligned bounding box of this node
|
//! returns the axis aligned bounding box of this node
|
||||||
const core::aabbox3d<f32> &getBoundingBox() const override;
|
const core::aabbox3d<f32> &getBoundingBox() const override
|
||||||
|
{
|
||||||
/*
|
return Box;
|
||||||
//! Returns the relative transformation of the scene node.
|
}
|
||||||
//core::matrix4 getRelativeTransformation() const override;
|
|
||||||
*/
|
|
||||||
|
|
||||||
void OnAnimate(u32 timeMs) override;
|
void OnAnimate(u32 timeMs) override;
|
||||||
|
|
||||||
void updateAbsolutePositionOfAllChildren() override;
|
void updateAbsolutePositionOfAllChildren() override;
|
||||||
|
|
||||||
//! How the relative transformation of the bone is used
|
|
||||||
void setSkinningSpace(E_BONE_SKINNING_SPACE space) override
|
|
||||||
{
|
|
||||||
SkinningSpace = space;
|
|
||||||
}
|
|
||||||
|
|
||||||
E_BONE_SKINNING_SPACE getSkinningSpace() const override
|
|
||||||
{
|
|
||||||
return SkinningSpace;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node);
|
void helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node);
|
||||||
|
|
||||||
u32 BoneIndex;
|
const u32 BoneIndex;
|
||||||
|
|
||||||
core::aabbox3d<f32> Box{-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f};
|
// Bogus box; bone scene nodes are not rendered anyways.
|
||||||
|
static constexpr core::aabbox3d<f32> Box = {{0, 0, 0}};
|
||||||
E_BONE_ANIMATION_MODE AnimationMode;
|
|
||||||
E_BONE_SKINNING_SPACE SkinningSpace;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace scene
|
} // end namespace scene
|
||||||
|
|
|
@ -74,9 +74,7 @@ void SkinnedMesh::animateMesh(f32 frame)
|
||||||
SkinnedLastFrame = false;
|
SkinnedLastFrame = false;
|
||||||
|
|
||||||
for (auto *joint : AllJoints) {
|
for (auto *joint : AllJoints) {
|
||||||
// The joints can be animated here with no input from their
|
// The joints can be animated here with no input from their parents
|
||||||
// parents, but for setAnimationMode extra checks are needed
|
|
||||||
// to their parents
|
|
||||||
joint->keys.updateTransform(frame,
|
joint->keys.updateTransform(frame,
|
||||||
joint->Animatedposition,
|
joint->Animatedposition,
|
||||||
joint->Animatedrotation,
|
joint->Animatedrotation,
|
||||||
|
@ -102,8 +100,6 @@ void SkinnedMesh::buildAllLocalAnimatedMatrices()
|
||||||
// Could be faster:
|
// Could be faster:
|
||||||
|
|
||||||
if (!joint->keys.empty()) {
|
if (!joint->keys.empty()) {
|
||||||
joint->GlobalSkinningSpace = false;
|
|
||||||
|
|
||||||
// IRR_TEST_BROKEN_QUATERNION_USE: TODO - switched to getMatrix_transposed instead of getMatrix for downward compatibility.
|
// IRR_TEST_BROKEN_QUATERNION_USE: TODO - switched to getMatrix_transposed instead of getMatrix for downward compatibility.
|
||||||
// Not tested so far if this was correct or wrong before quaternion fix!
|
// Not tested so far if this was correct or wrong before quaternion fix!
|
||||||
// Note that using getMatrix_transposed inverts the rotation.
|
// Note that using getMatrix_transposed inverts the rotation.
|
||||||
|
@ -164,7 +160,7 @@ void SkinnedMesh::buildAllGlobalAnimatedMatrices(SJoint *joint, SJoint *parentJo
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Find global matrix...
|
// Find global matrix...
|
||||||
if (!parentJoint || joint->GlobalSkinningSpace)
|
if (!parentJoint)
|
||||||
joint->GlobalAnimatedMatrix = joint->LocalAnimatedMatrix;
|
joint->GlobalAnimatedMatrix = joint->LocalAnimatedMatrix;
|
||||||
else
|
else
|
||||||
joint->GlobalAnimatedMatrix = parentJoint->GlobalAnimatedMatrix * joint->LocalAnimatedMatrix;
|
joint->GlobalAnimatedMatrix = parentJoint->GlobalAnimatedMatrix * joint->LocalAnimatedMatrix;
|
||||||
|
@ -706,8 +702,6 @@ void SkinnedMesh::transferJointsToMesh(const std::vector<IBoneSceneNode *> &join
|
||||||
joint->LocalAnimatedMatrix.setRotationDegrees(node->getRotation());
|
joint->LocalAnimatedMatrix.setRotationDegrees(node->getRotation());
|
||||||
joint->LocalAnimatedMatrix.setTranslation(node->getPosition());
|
joint->LocalAnimatedMatrix.setTranslation(node->getPosition());
|
||||||
joint->LocalAnimatedMatrix *= core::matrix4().setScale(node->getScale());
|
joint->LocalAnimatedMatrix *= core::matrix4().setScale(node->getScale());
|
||||||
|
|
||||||
joint->GlobalSkinningSpace = (node->getSkinningSpace() == EBSS_GLOBAL);
|
|
||||||
}
|
}
|
||||||
// Make sure we recalc the next frame
|
// Make sure we recalc the next frame
|
||||||
LastAnimatedFrame = -1;
|
LastAnimatedFrame = -1;
|
||||||
|
|
|
@ -1398,12 +1398,9 @@ void GenericCAO::updateBones(f32 dtime)
|
||||||
{
|
{
|
||||||
if (!m_animated_meshnode)
|
if (!m_animated_meshnode)
|
||||||
return;
|
return;
|
||||||
if (m_bone_override.empty()) {
|
if (m_bone_override.empty())
|
||||||
m_animated_meshnode->setJointMode(scene::EJUOR_NONE);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
m_animated_meshnode->setJointMode(scene::EJUOR_CONTROL); // To write positions to the mesh on render
|
|
||||||
for (auto &it : m_bone_override) {
|
for (auto &it : m_bone_override) {
|
||||||
std::string bone_name = it.first;
|
std::string bone_name = it.first;
|
||||||
scene::IBoneSceneNode* bone = m_animated_meshnode->getJointNode(bone_name.c_str());
|
scene::IBoneSceneNode* bone = m_animated_meshnode->getJointNode(bone_name.c_str());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue