1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-02 08:15:28 +01:00

Refactor: Remove obsolete IAnimatedMeshSceneNode interface (#16631)

This commit is contained in:
Lars Müller
2025-10-30 17:34:45 +01:00
committed by GitHub
parent 4b41e20000
commit 1ead48c58b
22 changed files with 171 additions and 294 deletions

View File

@@ -5,7 +5,7 @@
#pragma once
#include "CBoneSceneNode.h"
#include "IAnimatedMeshSceneNode.h"
#include "ISceneNode.h"
#include "IAnimatedMesh.h"
#include "SkinnedMesh.h"
@@ -16,20 +16,17 @@
namespace scene
{
class CAnimatedMeshSceneNode : public IAnimatedMeshSceneNode
class AnimatedMeshSceneNode : public ISceneNode
{
public:
//! constructor
CAnimatedMeshSceneNode(IAnimatedMesh *mesh, ISceneNode *parent, ISceneManager *mgr, s32 id,
AnimatedMeshSceneNode(IAnimatedMesh *mesh, ISceneNode *parent, ISceneManager *mgr, s32 id,
const core::vector3df &position = core::vector3df(0, 0, 0),
const core::vector3df &rotation = core::vector3df(0, 0, 0),
const core::vector3df &scale = core::vector3df(1.0f, 1.0f, 1.0f));
//! destructor
virtual ~CAnimatedMeshSceneNode();
//! sets the current frame. from now on the animation is played from this frame.
void setCurrentFrame(f32 frame) override;
virtual ~AnimatedMeshSceneNode();
//! frame
void OnRegisterSceneNode() override;
@@ -43,31 +40,6 @@ public:
//! returns the axis aligned bounding box of this node
const core::aabbox3d<f32> &getBoundingBox() const override;
//! sets the frames between the animation is looped.
//! the default is 0 - MaximalFrameCount of the mesh.
//! NOTE: setMesh will also change this value and set it to the full range of animations of the mesh
bool setFrameLoop(f32 begin, f32 end) override;
//! Sets looping mode which is on by default. If set to false,
//! animations will not be looped.
void setLoopMode(bool playAnimationLooped) override;
//! returns the current loop mode
bool getLoopMode() const override;
void setOnAnimateCallback(
const std::function<void(f32 dtime)> &cb) override
{
OnAnimateCallback = cb;
}
//! sets the speed with which the animation is played
//! NOTE: setMesh will also change this value and set it to the default speed of the mesh
void setAnimationSpeed(f32 framesPerSecond) override;
//! gets the speed with which the animation is played
f32 getAnimationSpeed() const override;
//! returns the material based on the zero based index i. To get the amount
//! of materials used by this scene node, use getMaterialCount().
//! This function is needed for inserting the node into the scene hierarchy on a
@@ -78,68 +50,112 @@ public:
//! returns amount of materials used by this scene node.
u32 getMaterialCount() const override;
//! Returns a pointer to a child node, which has the same transformation as
//! the corresponding joint, if the mesh in this scene node is a skinned mesh.
IBoneSceneNode *getJointNode(const c8 *jointName) override;
//! same as getJointNode(const c8* jointName), but based on id
IBoneSceneNode *getJointNode(u32 jointID) override;
//! Gets joint count.
u32 getJointCount() const override;
//! Removes a child from this scene node.
//! Implemented here, to be able to remove the shadow properly, if there is one,
//! or to remove attached child.
bool removeChild(ISceneNode *child) override;
//! Returns the current displayed frame number.
f32 getFrameNr() const override;
//! Returns the current start frame number.
f32 getStartFrame() const override;
//! Returns the current end frame number.
f32 getEndFrame() const override;
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
referencing this mesh to change too. */
void setReadOnlyMaterials(bool readonly) override;
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
bool isReadOnlyMaterials() const override;
//! Sets a new mesh
void setMesh(IAnimatedMesh *mesh) override;
//! Returns the current mesh
IAnimatedMesh *getMesh(void) override { return Mesh; }
//! Returns type of the scene node
ESCENE_NODE_TYPE getType() const override { return ESNT_ANIMATED_MESH; }
//! updates the absolute position based on the relative and the parents position
void updateAbsolutePosition() override;
//! Sets the transition time in seconds (note: This needs to enable joints)
//! you must call animateJoints(), or the mesh will not animate
void setTransitionTime(f32 Time) override;
void updateJointSceneNodes(const std::vector<SkinnedMesh::SJoint::VariantTransform> &transforms);
//! updates the joint positions of this mesh
void animateJoints() override;
void addJoints();
//! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected)
void setRenderFromIdentity(bool On) override;
//! Creates a clone of this scene node and its children.
/** \param newParent An optional new parent.
\param newManager An optional new scene manager.
\return The newly created clone of this node. */
ISceneNode *clone(ISceneNode *newParent = 0, ISceneManager *newManager = 0) override;
//! Sets the current frame number.
/** From now on the animation is played from this frame.
\param frame: Number of the frame to let the animation be started from.
The frame number must be a valid frame number of the IMesh used by this
scene node. Set IAnimatedMesh::getMesh() for details. */
void setCurrentFrame(f32 frame);
//! Sets the frame numbers between the animation is looped.
/** The default is 0 to getMaxFrameNumber() of the mesh.
Number of played frames is end-start.
It interpolates toward the last frame but stops when it is reached.
It does not interpolate back to start even when looping.
Looping animations should ensure last and first frame-key are identical.
\param begin: Start frame number of the loop.
\param end: End frame number of the loop.
\return True if successful, false if not. */
//! NOTE: setMesh will also change this value and set it to the full range of animations of the mesh
bool setFrameLoop(f32 begin, f32 end);
//! Sets looping mode which is on by default. If set to false,
//! animations will not be looped.
void setLoopMode(bool playAnimationLooped);
//! returns the current loop mode
bool getLoopMode() const;
//! Will be called right after the joints have been animated,
//! but before the transforms have been propagated recursively to children.
void setOnAnimateCallback(
const std::function<void(f32 dtime)> &cb)
{
OnAnimateCallback = cb;
}
//! Sets the speed with which the animation is played.
/** \param framesPerSecond: Frames per second played. */
void setAnimationSpeed(f32 framesPerSecond);
//! Gets the speed with which the animation is played.
/** \return Frames per second played. */
f32 getAnimationSpeed() const;
//! Returns a pointer to a child node (nullptr if not found),
//! which has the same transformation as
//! the corresponding joint, if the mesh in this scene node is a skinned mesh.
//! This can be used to attach children.
IBoneSceneNode *getJointNode(const c8 *jointName);
//! same as getJointNode(const c8* jointName), but based on id
IBoneSceneNode *getJointNode(u32 jointID);
//! Gets joint count.
u32 getJointCount() const;
//! Returns the currently displayed frame number.
f32 getFrameNr() const;
//! Returns the current start frame number.
f32 getStartFrame() const;
//! Returns the current end frame number.
f32 getEndFrame() const;
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
referencing this mesh to change too. */
void setReadOnlyMaterials(bool readonly);
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
bool isReadOnlyMaterials() const;
//! Sets a new mesh
void setMesh(IAnimatedMesh *mesh);
//! Returns the current mesh
IAnimatedMesh *getMesh(void) { return Mesh; }
//! updates the absolute position based on the relative and the parents position
void updateAbsolutePosition() override;
//! Sets the transition time in seconds (note: This needs to enable joints)
//! you must call animateJoints(), or the mesh will not animate
void setTransitionTime(f32 Time);
void updateJointSceneNodes(const std::vector<SkinnedMesh::SJoint::VariantTransform> &transforms);
//! Updates the joint positions of this mesh, taking into accoutn transitions
void animateJoints();
void addJoints();
//! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected)
void setRenderFromIdentity(bool On);
private:
//! Get a static mesh for the current frame of this animated mesh
IMesh *getMeshForCurrentFrame();

View File

@@ -1,133 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#pragma once
#include "ISceneNode.h"
#include "IBoneSceneNode.h"
#include "IAnimatedMesh.h"
namespace scene
{
class IAnimatedMeshSceneNode;
//! Scene node capable of displaying an animated mesh.
class IAnimatedMeshSceneNode : public ISceneNode
{
public:
//! Constructor
IAnimatedMeshSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id,
const core::vector3df &position = core::vector3df(0, 0, 0),
const core::vector3df &rotation = core::vector3df(0, 0, 0),
const core::vector3df &scale = core::vector3df(1.0f, 1.0f, 1.0f)) :
ISceneNode(parent, mgr, id, position, rotation, scale) {}
//! Destructor
virtual ~IAnimatedMeshSceneNode() {}
//! Sets the current frame number.
/** From now on the animation is played from this frame.
\param frame: Number of the frame to let the animation be started from.
The frame number must be a valid frame number of the IMesh used by this
scene node. Set IAnimatedMesh::getMesh() for details. */
virtual void setCurrentFrame(f32 frame) = 0;
//! Sets the frame numbers between the animation is looped.
/** The default is 0 to getMaxFrameNumber() of the mesh.
Number of played frames is end-start.
It interpolates toward the last frame but stops when it is reached.
It does not interpolate back to start even when looping.
Looping animations should ensure last and first frame-key are identical.
\param begin: Start frame number of the loop.
\param end: End frame number of the loop.
\return True if successful, false if not. */
virtual bool setFrameLoop(f32 begin, f32 end) = 0;
//! Sets the speed with which the animation is played.
/** \param framesPerSecond: Frames per second played. */
virtual void setAnimationSpeed(f32 framesPerSecond) = 0;
//! Gets the speed with which the animation is played.
/** \return Frames per second played. */
virtual f32 getAnimationSpeed() const = 0;
//! Get a pointer to a joint in the mesh (if the mesh is a bone based mesh).
/** With this method it is possible to attach scene nodes to
joints for example possible to attach a weapon to the left hand
of an animated model. This example shows how:
\code
ISceneNode* hand =
yourAnimatedMeshSceneNode->getJointNode("LeftHand");
hand->addChild(weaponSceneNode);
\endcode
Please note that the joint returned by this method may not exist
before this call and the joints in the node were created by it.
\param jointName: Name of the joint.
\return Pointer to the scene node which represents the joint
with the specified name. Returns 0 if the contained mesh is not
an skinned mesh or the name of the joint could not be found. */
virtual IBoneSceneNode *getJointNode(const c8 *jointName) = 0;
//! same as getJointNode(const c8* jointName), but based on id
virtual IBoneSceneNode *getJointNode(u32 jointID) = 0;
//! Gets joint count.
/** \return Amount of joints in the mesh. */
virtual u32 getJointCount() const = 0;
//! Returns the currently displayed frame number.
virtual f32 getFrameNr() const = 0;
//! Returns the current start frame number.
virtual f32 getStartFrame() const = 0;
//! Returns the current end frame number.
virtual f32 getEndFrame() const = 0;
//! Sets looping mode which is on by default.
/** If set to false, animations will not be played looped. */
virtual void setLoopMode(bool playAnimationLooped) = 0;
//! returns the current loop mode
/** When true the animations are played looped */
virtual bool getLoopMode() const = 0;
//! Will be called right after the joints have been animated,
//! but before the transforms have been propagated recursively to children.
virtual void setOnAnimateCallback(
const std::function<void(f32 dtime)> &cb) = 0;
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/** In this way it is possible to change the materials a mesh
causing all mesh scene nodes referencing this mesh to change
too. */
virtual void setReadOnlyMaterials(bool readonly) = 0;
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
virtual bool isReadOnlyMaterials() const = 0;
//! Sets a new mesh
virtual void setMesh(IAnimatedMesh *mesh) = 0;
//! Returns the current mesh
virtual IAnimatedMesh *getMesh() = 0;
//! Sets the transition time in seconds
/** Note: You must call animateJoints(), or the mesh will not animate. */
virtual void setTransitionTime(f32 Time) = 0;
//! animates the joints in the mesh based on the current frame.
/** Also takes in to account transitions. */
virtual void animateJoints() = 0;
//! render mesh ignoring its transformation.
/** Culling is unaffected. */
virtual void setRenderFromIdentity(bool On) = 0;
//! Creates a clone of this scene node and its children.
/** \param newParent An optional new parent.
\param newManager An optional new scene manager.
\return The newly created clone of this node. */
virtual ISceneNode *clone(ISceneNode *newParent = 0, ISceneManager *newManager = 0) = 0;
};
} // end namespace scene

View File

@@ -10,7 +10,7 @@ namespace scene
{
//! Interface for bones used for skeletal animation.
/** Used with SkinnedMesh and IAnimatedMeshSceneNode. */
/** Used with SkinnedMesh and AnimatedMeshSceneNode. */
class IBoneSceneNode : public ISceneNode
{
public:

View File

@@ -14,7 +14,7 @@ namespace scene
set/getRotation and set/getScale. Its just a simple scene node that takes a
matrix as relative transformation, making it possible to insert any transformation
anywhere into the scene graph.
This scene node is for example used by the IAnimatedMeshSceneNode for emulating
This scene node is for example used by the AnimatedMeshSceneNode for emulating
joint scene nodes when playing skeletal animations.
*/
class IDummyTransformationSceneNode : public ISceneNode

View File

@@ -71,7 +71,7 @@ enum E_SCENE_NODE_RENDER_PASS
};
class IAnimatedMesh;
class IAnimatedMeshSceneNode;
class AnimatedMeshSceneNode;
class IBillboardSceneNode;
class ICameraSceneNode;
class IDummyTransformationSceneNode;
@@ -133,7 +133,7 @@ public:
\param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed.
\return Pointer to the created scene node.
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
virtual IAnimatedMeshSceneNode *addAnimatedMeshSceneNode(IAnimatedMesh *mesh,
virtual AnimatedMeshSceneNode *addAnimatedMeshSceneNode(IAnimatedMesh *mesh,
ISceneNode *parent = 0, s32 id = -1,
const core::vector3df &position = core::vector3df(0, 0, 0),
const core::vector3df &rotation = core::vector3df(0, 0, 0),

View File

@@ -24,7 +24,7 @@
namespace scene
{
class IAnimatedMeshSceneNode;
class AnimatedMeshSceneNode;
class IBoneSceneNode;
class ISceneManager;
@@ -151,7 +151,7 @@ public:
//! Creates an array of joints from this mesh as children of node
std::vector<IBoneSceneNode *> addJoints(
IAnimatedMeshSceneNode *node, ISceneManager *smgr);
AnimatedMeshSceneNode *node, ISceneManager *smgr);
//! A vertex weight
struct SWeight

View File

@@ -2,8 +2,9 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CAnimatedMeshSceneNode.h"
#include "AnimatedMeshSceneNode.h"
#include "CBoneSceneNode.h"
#include "ISceneNode.h"
#include "IVideoDriver.h"
#include "ISceneManager.h"
#include "S3DVertex.h"
@@ -29,12 +30,12 @@ namespace scene
{
//! constructor
CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh *mesh,
AnimatedMeshSceneNode::AnimatedMeshSceneNode(IAnimatedMesh *mesh,
ISceneNode *parent, ISceneManager *mgr, s32 id,
const core::vector3df &position,
const core::vector3df &rotation,
const core::vector3df &scale) :
IAnimatedMeshSceneNode(parent, mgr, id, position, rotation, scale),
ISceneNode(parent, mgr, id, position, rotation, scale),
Mesh(nullptr),
StartFrame(0), EndFrame(0), FramesPerSecond(0.025f),
CurrentFrameNr(0.f), LastTimeMs(0),
@@ -47,14 +48,14 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh *mesh,
}
//! destructor
CAnimatedMeshSceneNode::~CAnimatedMeshSceneNode()
AnimatedMeshSceneNode::~AnimatedMeshSceneNode()
{
if (Mesh)
Mesh->drop();
}
//! Sets the current frame. From now on the animation is played from this frame.
void CAnimatedMeshSceneNode::setCurrentFrame(f32 frame)
void AnimatedMeshSceneNode::setCurrentFrame(f32 frame)
{
// if you pass an out of range value, we just clamp it
CurrentFrameNr = core::clamp(frame, (f32)StartFrame, (f32)EndFrame);
@@ -63,13 +64,13 @@ void CAnimatedMeshSceneNode::setCurrentFrame(f32 frame)
}
//! Returns the currently displayed frame number.
f32 CAnimatedMeshSceneNode::getFrameNr() const
f32 AnimatedMeshSceneNode::getFrameNr() const
{
return CurrentFrameNr;
}
//! Get CurrentFrameNr and update transiting settings
void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
void AnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
{
if (Transiting != 0.f) {
TransitingBlend += (f32)(timeMs)*Transiting;
@@ -106,7 +107,7 @@ void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
}
}
void CAnimatedMeshSceneNode::OnRegisterSceneNode()
void AnimatedMeshSceneNode::OnRegisterSceneNode()
{
if (IsVisible && Mesh) {
// because this node supports rendering of mixed mode meshes consisting of
@@ -146,7 +147,7 @@ void CAnimatedMeshSceneNode::OnRegisterSceneNode()
}
}
IMesh *CAnimatedMeshSceneNode::getMeshForCurrentFrame()
IMesh *AnimatedMeshSceneNode::getMeshForCurrentFrame()
{
if (Mesh->getMeshType() != EAMT_SKINNED) {
return Mesh;
@@ -164,7 +165,7 @@ IMesh *CAnimatedMeshSceneNode::getMeshForCurrentFrame()
}
//! OnAnimate() is called just before rendering the whole scene.
void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
void AnimatedMeshSceneNode::OnAnimate(u32 timeMs)
{
if (LastTimeMs == 0) { // first frame
LastTimeMs = timeMs;
@@ -186,7 +187,7 @@ void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
if (OnAnimateCallback)
OnAnimateCallback(dtimeMs / 1000.0f);
IAnimatedMeshSceneNode::OnAnimate(timeMs);
ISceneNode::OnAnimate(timeMs);
if (auto *skinnedMesh = dynamic_cast<SkinnedMesh*>(Mesh)) {
for (u16 i = 0; i < PerJoint.SceneNodes.size(); ++i)
@@ -200,7 +201,7 @@ void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
}
//! renders the node.
void CAnimatedMeshSceneNode::render()
void AnimatedMeshSceneNode::render()
{
video::IVideoDriver *driver = SceneManager->getVideoDriver();
@@ -312,20 +313,20 @@ void CAnimatedMeshSceneNode::render()
}
//! Returns the current start frame number.
f32 CAnimatedMeshSceneNode::getStartFrame() const
f32 AnimatedMeshSceneNode::getStartFrame() const
{
return StartFrame;
}
//! Returns the current start frame number.
f32 CAnimatedMeshSceneNode::getEndFrame() const
f32 AnimatedMeshSceneNode::getEndFrame() const
{
return EndFrame;
}
//! sets the frames between the animation is looped.
//! the default is 0 - MaximalFrameCount of the mesh.
bool CAnimatedMeshSceneNode::setFrameLoop(f32 begin, f32 end)
bool AnimatedMeshSceneNode::setFrameLoop(f32 begin, f32 end)
{
const f32 maxFrame = Mesh->getMaxFrameNumber();
if (end < begin) {
@@ -344,24 +345,24 @@ bool CAnimatedMeshSceneNode::setFrameLoop(f32 begin, f32 end)
}
//! sets the speed with witch the animation is played
void CAnimatedMeshSceneNode::setAnimationSpeed(f32 framesPerSecond)
void AnimatedMeshSceneNode::setAnimationSpeed(f32 framesPerSecond)
{
FramesPerSecond = framesPerSecond * 0.001f;
}
f32 CAnimatedMeshSceneNode::getAnimationSpeed() const
f32 AnimatedMeshSceneNode::getAnimationSpeed() const
{
return FramesPerSecond * 1000.f;
}
//! returns the axis aligned bounding box of this node
const core::aabbox3d<f32> &CAnimatedMeshSceneNode::getBoundingBox() const
const core::aabbox3d<f32> &AnimatedMeshSceneNode::getBoundingBox() const
{
return Box;
}
//! returns the material based on the zero based index i.
video::SMaterial &CAnimatedMeshSceneNode::getMaterial(u32 i)
video::SMaterial &AnimatedMeshSceneNode::getMaterial(u32 i)
{
if (i >= Materials.size())
return ISceneNode::getMaterial(i);
@@ -370,14 +371,14 @@ video::SMaterial &CAnimatedMeshSceneNode::getMaterial(u32 i)
}
//! returns amount of materials used by this scene node.
u32 CAnimatedMeshSceneNode::getMaterialCount() const
u32 AnimatedMeshSceneNode::getMaterialCount() const
{
return Materials.size();
}
//! Returns a pointer to a child node, which has the same transformation as
//! the corresponding joint, if the mesh in this scene node is a skinned mesh.
IBoneSceneNode *CAnimatedMeshSceneNode::getJointNode(const c8 *jointName)
IBoneSceneNode *AnimatedMeshSceneNode::getJointNode(const c8 *jointName)
{
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED) {
os::Printer::log("No mesh, or mesh not of skinned mesh type", ELL_WARNING);
@@ -405,7 +406,7 @@ IBoneSceneNode *CAnimatedMeshSceneNode::getJointNode(const c8 *jointName)
//! Returns a pointer to a child node, which has the same transformation as
//! the corresponding joint, if the mesh in this scene node is a skinned mesh.
IBoneSceneNode *CAnimatedMeshSceneNode::getJointNode(u32 jointID)
IBoneSceneNode *AnimatedMeshSceneNode::getJointNode(u32 jointID)
{
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED) {
os::Printer::log("No mesh, or mesh not of skinned mesh type", ELL_WARNING);
@@ -423,7 +424,7 @@ IBoneSceneNode *CAnimatedMeshSceneNode::getJointNode(u32 jointID)
}
//! Gets joint count.
u32 CAnimatedMeshSceneNode::getJointCount() const
u32 AnimatedMeshSceneNode::getJointCount() const
{
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
return 0;
@@ -436,7 +437,7 @@ u32 CAnimatedMeshSceneNode::getJointCount() const
//! Removes a child from this scene node.
//! Implemented here, to be able to remove the shadow properly, if there is one,
//! or to remove attached childs.
bool CAnimatedMeshSceneNode::removeChild(ISceneNode *child)
bool AnimatedMeshSceneNode::removeChild(ISceneNode *child)
{
if (ISceneNode::removeChild(child)) {
if (JointsUsed) { // stop weird bugs caused while changing parents as the joints are being created
@@ -455,31 +456,31 @@ bool CAnimatedMeshSceneNode::removeChild(ISceneNode *child)
//! Sets looping mode which is on by default. If set to false,
//! animations will not be looped.
void CAnimatedMeshSceneNode::setLoopMode(bool playAnimationLooped)
void AnimatedMeshSceneNode::setLoopMode(bool playAnimationLooped)
{
Looping = playAnimationLooped;
}
//! returns the current loop mode
bool CAnimatedMeshSceneNode::getLoopMode() const
bool AnimatedMeshSceneNode::getLoopMode() const
{
return Looping;
}
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
void CAnimatedMeshSceneNode::setReadOnlyMaterials(bool readonly)
void AnimatedMeshSceneNode::setReadOnlyMaterials(bool readonly)
{
ReadOnlyMaterials = readonly;
}
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
bool CAnimatedMeshSceneNode::isReadOnlyMaterials() const
bool AnimatedMeshSceneNode::isReadOnlyMaterials() const
{
return ReadOnlyMaterials;
}
//! Sets a new mesh
void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh *mesh)
void AnimatedMeshSceneNode::setMesh(IAnimatedMesh *mesh)
{
if (!mesh)
return; // won't set null mesh
@@ -520,14 +521,14 @@ void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh *mesh)
}
//! updates the absolute position based on the relative and the parents position
void CAnimatedMeshSceneNode::updateAbsolutePosition()
void AnimatedMeshSceneNode::updateAbsolutePosition()
{
IAnimatedMeshSceneNode::updateAbsolutePosition();
ISceneNode::updateAbsolutePosition();
}
//! Sets the transition time in seconds (note: This needs to enable joints)
//! you must call animateJoints(), or the mesh will not animate
void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
void AnimatedMeshSceneNode::setTransitionTime(f32 time)
{
const u32 ttime = (u32)core::floor32(time * 1000.0f);
if (TransitionTime == ttime)
@@ -536,12 +537,12 @@ void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
}
//! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected)
void CAnimatedMeshSceneNode::setRenderFromIdentity(bool enable)
void AnimatedMeshSceneNode::setRenderFromIdentity(bool enable)
{
RenderFromIdentity = enable;
}
void CAnimatedMeshSceneNode::addJoints()
void AnimatedMeshSceneNode::addJoints()
{
const auto &joints = static_cast<SkinnedMesh*>(Mesh)->getAllJoints();
PerJoint.setN(joints.size());
@@ -561,7 +562,7 @@ void CAnimatedMeshSceneNode::addJoints()
}
}
void CAnimatedMeshSceneNode::updateJointSceneNodes(
void AnimatedMeshSceneNode::updateJointSceneNodes(
const std::vector<SkinnedMesh::SJoint::VariantTransform> &transforms)
{
for (size_t i = 0; i < transforms.size(); ++i) {
@@ -578,7 +579,7 @@ void CAnimatedMeshSceneNode::updateJointSceneNodes(
}
//! updates the joint positions of this mesh
void CAnimatedMeshSceneNode::animateJoints()
void AnimatedMeshSceneNode::animateJoints()
{
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
return;
@@ -603,7 +604,7 @@ void CAnimatedMeshSceneNode::animateJoints()
}
}
void CAnimatedMeshSceneNode::checkJoints()
void AnimatedMeshSceneNode::checkJoints()
{
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
return;
@@ -617,7 +618,7 @@ void CAnimatedMeshSceneNode::checkJoints()
}
}
void CAnimatedMeshSceneNode::copyOldTransforms()
void AnimatedMeshSceneNode::copyOldTransforms()
{
for (u32 i = 0; i < PerJoint.SceneNodes.size(); ++i) {
if (!PerJoint.SceneNodes[i]->Matrix) {
@@ -628,7 +629,7 @@ void CAnimatedMeshSceneNode::copyOldTransforms()
}
}
void CAnimatedMeshSceneNode::beginTransition()
void AnimatedMeshSceneNode::beginTransition()
{
if (!JointsUsed)
return;
@@ -639,15 +640,15 @@ void CAnimatedMeshSceneNode::beginTransition()
TransitingBlend = 0.f;
}
ISceneNode *CAnimatedMeshSceneNode::clone(ISceneNode *newParent, ISceneManager *newManager)
ISceneNode *AnimatedMeshSceneNode::clone(ISceneNode *newParent, ISceneManager *newManager)
{
if (!newParent)
newParent = Parent;
if (!newManager)
newManager = SceneManager;
CAnimatedMeshSceneNode *newNode =
new CAnimatedMeshSceneNode(Mesh, NULL, newManager, ID, RelativeTranslation,
AnimatedMeshSceneNode *newNode =
new AnimatedMeshSceneNode(Mesh, NULL, newManager, ID, RelativeTranslation,
RelativeRotation, RelativeScale);
if (newParent) {

View File

@@ -251,11 +251,10 @@ set(IRRMESHLOADER
add_library(IRRMESHOBJ OBJECT
CMeshSceneNode.h
CAnimatedMeshSceneNode.h
SkinnedMesh.cpp
CMeshSceneNode.cpp
CAnimatedMeshSceneNode.cpp
AnimatedMeshSceneNode.cpp
${IRRMESHLOADER}
)

View File

@@ -12,7 +12,7 @@
#include "IImageLoader.h"
#include "IImageWriter.h"
#include "IMaterialRenderer.h"
#include "IAnimatedMeshSceneNode.h"
#include "AnimatedMeshSceneNode.h"
#include "CMeshManipulator.h"
#include "CColorConverter.h"
#include "IReferenceCounted.h"
@@ -1244,7 +1244,7 @@ void CNullDriver::addOcclusionQuery(scene::ISceneNode *node, const scene::IMesh
else if (node->getType() == scene::ESNT_MESH)
mesh = static_cast<scene::IMeshSceneNode *>(node)->getMesh();
else
mesh = static_cast<scene::IAnimatedMeshSceneNode *>(node)->getMesh();
mesh = static_cast<scene::AnimatedMeshSceneNode *>(node)->getMesh();
if (!mesh)
return;
}

View File

@@ -22,7 +22,7 @@
#include "CB3DMeshFileLoader.h"
#include "CGLTFMeshFileLoader.h"
#include "CBillboardSceneNode.h"
#include "CAnimatedMeshSceneNode.h"
#include "AnimatedMeshSceneNode.h"
#include "CCameraSceneNode.h"
#include "CMeshSceneNode.h"
#include "CDummyTransformationSceneNode.h"
@@ -177,7 +177,7 @@ IMeshSceneNode *CSceneManager::addMeshSceneNode(IMesh *mesh, ISceneNode *parent,
}
//! adds a scene node for rendering an animated mesh model
IAnimatedMeshSceneNode *CSceneManager::addAnimatedMeshSceneNode(IAnimatedMesh *mesh, ISceneNode *parent, s32 id,
AnimatedMeshSceneNode *CSceneManager::addAnimatedMeshSceneNode(IAnimatedMesh *mesh, ISceneNode *parent, s32 id,
const core::vector3df &position, const core::vector3df &rotation,
const core::vector3df &scale, bool alsoAddIfMeshPointerZero)
{
@@ -187,8 +187,8 @@ IAnimatedMeshSceneNode *CSceneManager::addAnimatedMeshSceneNode(IAnimatedMesh *m
if (!parent)
parent = this;
IAnimatedMeshSceneNode *node =
new CAnimatedMeshSceneNode(mesh, parent, this, id, position, rotation, scale);
auto *node =
new AnimatedMeshSceneNode(mesh, parent, this, id, position, rotation, scale);
node->drop();
return node;

View File

@@ -40,7 +40,7 @@ public:
video::IVideoDriver *getVideoDriver() override;
//! adds a scene node for rendering an animated mesh model
virtual IAnimatedMeshSceneNode *addAnimatedMeshSceneNode(IAnimatedMesh *mesh, ISceneNode *parent = 0, s32 id = -1,
virtual AnimatedMeshSceneNode *addAnimatedMeshSceneNode(IAnimatedMesh *mesh, ISceneNode *parent = 0, s32 id = -1,
const core::vector3df &position = core::vector3df(0, 0, 0),
const core::vector3df &rotation = core::vector3df(0, 0, 0),
const core::vector3df &scale = core::vector3df(1.0f, 1.0f, 1.0f),

View File

@@ -3,13 +3,9 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "SkinnedMesh.h"
#include "IBoneSceneNode.h"
#include "CBoneSceneNode.h"
#include "IAnimatedMeshSceneNode.h"
#include "SSkinMeshBuffer.h"
#include "Transform.h"
#include "aabbox3d.h"
#include "irrMath.h"
#include "matrix4.h"
#include "os.h"
#include "vector3d.h"

View File

@@ -18,7 +18,7 @@ struct ItemStack;
namespace scene
{
class IAnimatedMeshSceneNode;
class AnimatedMeshSceneNode;
class ISceneNode;
class ISceneManager;
}
@@ -41,7 +41,7 @@ public:
virtual const v3f getVelocity() const { return v3f(0.0f); } // in BS-space
virtual scene::ISceneNode *getSceneNode() const
{ return NULL; }
virtual scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode() const
virtual scene::AnimatedMeshSceneNode *getAnimatedMeshSceneNode() const
{ return NULL; }
virtual bool isLocalPlayer() const { return false; }

View File

@@ -6,7 +6,7 @@
#include <IBillboardSceneNode.h>
#include <ICameraSceneNode.h>
#include <IMeshManipulator.h>
#include <IAnimatedMeshSceneNode.h>
#include <AnimatedMeshSceneNode.h>
#include <ISceneNode.h>
#include "client/client.h"
#include "client/renderingengine.h"
@@ -400,7 +400,7 @@ scene::ISceneNode *GenericCAO::getSceneNode() const
return NULL;
}
scene::IAnimatedMeshSceneNode *GenericCAO::getAnimatedMeshSceneNode() const
scene::AnimatedMeshSceneNode *GenericCAO::getAnimatedMeshSceneNode() const
{
return m_animated_meshnode;
}
@@ -1437,7 +1437,7 @@ void GenericCAO::updateAttachments()
{
parent->updateAttachments();
scene::ISceneNode *parent_node = parent->getSceneNode();
scene::IAnimatedMeshSceneNode *parent_animated_mesh_node =
scene::AnimatedMeshSceneNode *parent_animated_mesh_node =
parent->getAnimatedMeshSceneNode();
if (parent_animated_mesh_node && !m_attachment_bone.empty()) {
parent_node = parent_animated_mesh_node->getJointNode(m_attachment_bone.c_str());

View File

@@ -14,12 +14,12 @@
#include "itemgroup.h"
#include "client/tile.h"
#include <cassert>
#include <map>
#include <memory>
namespace scene {
class IMeshSceneNode;
class IBillboardSceneNode;
class AnimatedMeshSceneNode;
}
class Client;
@@ -89,7 +89,7 @@ private:
// Visuals
scene::IMeshSceneNode *m_meshnode = nullptr;
scene::IAnimatedMeshSceneNode *m_animated_meshnode = nullptr;
scene::AnimatedMeshSceneNode *m_animated_meshnode = nullptr;
WieldMeshSceneNode *m_wield_meshnode = nullptr;
scene::IBillboardSceneNode *m_spritenode = nullptr;
scene::IDummyTransformationSceneNode *m_matrixnode = nullptr;
@@ -191,7 +191,7 @@ public:
scene::ISceneNode *getSceneNode() const override;
scene::IAnimatedMeshSceneNode *getAnimatedMeshSceneNode() const override;
scene::AnimatedMeshSceneNode *getAnimatedMeshSceneNode() const override;
// m_matrixnode controls the position and rotation of the child node
// for all scene nodes, as a workaround for an Irrlicht problem with

View File

@@ -45,7 +45,7 @@
#include "version.h"
#include "script/scripting_client.h"
#include "hud.h"
#include <IAnimatedMeshSceneNode.h>
#include <AnimatedMeshSceneNode.h>
#include "util/tracy_wrapper.h"
#include "item_visuals_manager.h"
@@ -2226,7 +2226,7 @@ static void pauseNodeAnimation(PausedNodesList &paused, scene::ISceneNode *node)
pauseNodeAnimation(paused, child);
if (node->getType() != scene::ESNT_ANIMATED_MESH)
return;
auto animated_node = static_cast<scene::IAnimatedMeshSceneNode *>(node);
auto animated_node = static_cast<scene::AnimatedMeshSceneNode *>(node);
float speed = animated_node->getAnimationSpeed();
if (!speed)
return;

View File

@@ -6,7 +6,7 @@
#include "game.h"
#include <IAnimatedMeshSceneNode.h>
#include <AnimatedMeshSceneNode.h>
#include <optional>
#include <vector>
#include "camera.h"
@@ -83,7 +83,7 @@ struct ClientEventHandler
void (Game::*handler)(ClientEvent *, CameraOrientation *);
};
using PausedNodesList = std::vector<std::pair<irr_ptr<scene::IAnimatedMeshSceneNode>, float>>;
using PausedNodesList = std::vector<std::pair<irr_ptr<scene::AnimatedMeshSceneNode>, float>>;
/* This is not intended to be a public class. If a public class becomes
* desirable then it may be better to create another 'wrapper' class that

View File

@@ -8,9 +8,7 @@
#include "debug.h"
#include "log.h"
#include <cmath>
#include <iostream>
#include <IAnimatedMesh.h>
#include <IAnimatedMeshSceneNode.h>
#include "S3DVertex.h"
#include <SMesh.h>
#include "CMeshBuffer.h"

View File

@@ -23,7 +23,7 @@
#include <IGUIFont.h>
#include <IGUITabControl.h>
#include <IGUIImage.h>
#include <IAnimatedMeshSceneNode.h>
#include <AnimatedMeshSceneNode.h>
#include "client/renderingengine.h"
#include "client/joystick_controller.h"
#include "log.h"

View File

@@ -5,7 +5,7 @@
#include "guiScene.h"
#include <SViewFrustum.h>
#include <IAnimatedMeshSceneNode.h>
#include <AnimatedMeshSceneNode.h>
#include <IVideoDriver.h>
#include <ISceneManager.h>
#include "porting.h"
@@ -29,7 +29,7 @@ GUIScene::~GUIScene()
m_smgr->drop();
}
scene::IAnimatedMeshSceneNode *GUIScene::setMesh(scene::IAnimatedMesh *mesh)
scene::AnimatedMeshSceneNode *GUIScene::setMesh(scene::IAnimatedMesh *mesh)
{
if (m_mesh) {
m_mesh->remove();

View File

@@ -6,7 +6,7 @@
#include "ICameraSceneNode.h"
#include "StyleSpec.h"
#include <IAnimatedMeshSceneNode.h>
#include <AnimatedMeshSceneNode.h>
#include <IGUIElement.h>
#include <IGUIEnvironment.h>
@@ -19,7 +19,7 @@ public:
~GUIScene();
scene::IAnimatedMeshSceneNode *setMesh(scene::IAnimatedMesh *mesh = nullptr);
scene::AnimatedMeshSceneNode *setMesh(scene::IAnimatedMesh *mesh = nullptr);
void setTexture(u32 idx, video::ITexture *texture);
void setBackgroundColor(const video::SColor &color) noexcept { m_bgcolor = color; };
void setFrameLoop(f32 begin, f32 end);
@@ -49,7 +49,7 @@ private:
video::IVideoDriver *m_driver;
scene::ICameraSceneNode *m_cam;
scene::ISceneNode *m_target = nullptr;
scene::IAnimatedMeshSceneNode *m_mesh = nullptr;
scene::AnimatedMeshSceneNode *m_mesh = nullptr;
f32 m_cam_distance = 50.f;