Saga3D API Documentation  1.0-RC4
saga::scene::IAnimatedMeshSceneNode Class Referenceabstract

Scene node capable of displaying an animated mesh. More...

#include <IAnimatedMeshSceneNode.h>

Inheritance diagram for saga::scene::IAnimatedMeshSceneNode:
saga::scene::IMeshSceneNode saga::scene::ISceneNode saga::IEventReceiver

Public Member Functions

 IAnimatedMeshSceneNode (const std::shared_ptr< IMesh > &mesh, const std::shared_ptr< ISceneNode > &parent, const std::shared_ptr< ISceneManager > mgr, const glm::vec3 &position=glm::vec3(0, 0, 0), const glm::vec3 &rotation=glm::vec3(0, 0, 0), const glm::vec3 &scale=glm::vec3(1.0f, 1.0f, 1.0f))
 Constructor. More...
 
virtual ~IAnimatedMeshSceneNode ()
 Destructor. More...
 
virtual void setCurrentFrame (float frame)=0
 Sets the current frame number. More...
 
virtual bool setFrameLoop (std::int32_t begin, std::int32_t end)=0
 Sets the frame numbers between the animation is looped. More...
 
virtual void setAnimationSpeed (float framesPerSecond)=0
 Sets the speed with which the animation is played. More...
 
virtual float getAnimationSpeed () const =0
 Gets the speed with which the animation is played. More...
 
virtual std::uint32_t getBoneCount () const =0
 Get a pointer to a joint in the mesh (if the mesh is a bone based mesh). More...
 
virtual float getFrameNumber () const =0
 Returns the currently displayed frame number. More...
 
virtual std::int32_t getStartFrame () const =0
 Returns the current start frame number. More...
 
virtual std::int32_t getEndFrame () const =0
 Returns the current end frame number. More...
 
virtual void setLoopMode (bool playAnimationLooped)=0
 Sets looping mode which is on by default. More...
 
virtual bool getLoopMode () const =0
 returns the current loop mode More...
 
virtual void setAnimationEndCallback (IAnimationEndCallBack *callback=0)=0
 Sets a callback interface which will be called if an animation playback has ended. More...
 
- Public Member Functions inherited from saga::scene::IMeshSceneNode
 IMeshSceneNode (const std::shared_ptr< IMesh > &mesh, const std::shared_ptr< ISceneNode > &parent, const std::shared_ptr< ISceneManager > &mgr, const glm::vec3 &position=glm::vec3(0, 0, 0), const glm::vec3 &rotation=glm::vec3(0, 0, 0), const glm::vec3 &scale=glm::vec3(1, 1, 1))
 Constructor. More...
 
 ~IMeshSceneNode ()
 
virtual void setPipeline (video::PipelineHandle pipeline) override
 
virtual void onRegisterSceneNode (video::RenderPassHandle pass) override
 This method is called just before the rendering process of the whole scene. More...
 
virtual void onUnregisterSceneNode (video::RenderPassHandle pass) override
 
virtual const core::aabbox3d< float > & getBoundingBox () const override
 returns the axis aligned bounding box of this node More...
 
virtual E_SCENE_NODE_TYPE getType () const override
 Returns type of the scene node. More...
 
virtual void setMesh (const std::shared_ptr< IMesh > &mesh)
 Sets a new mesh. More...
 
virtual const std::shared_ptr< IMesh > & getMesh () const
 Returns the current mesh. More...
 
- Public Member Functions inherited from saga::scene::ISceneNode
 ISceneNode (const std::shared_ptr< ISceneNode > &parent, const std::shared_ptr< ISceneManager > &mgr, const glm::vec3 &position=glm::vec3(0, 0, 0), const glm::vec3 &rotation=glm::vec3(0, 0, 0), const glm::vec3 &scale=glm::vec3(1.0f, 1.0f, 1.0f))
 Constructor. More...
 
virtual void onEvent (const SDL_Event &event) override
 Called when an SDL event is fired. More...
 
virtual ~ISceneNode ()
 Destructor. More...
 
void setID (const ID id)
 
const auto getID () const
 
void setOnRender (std::function< void()> func)
 
void onRender ()
 
bool hasDrawCommands () const
 
void setDrawCommands (video::DrawCommandList &&list)
 
const auto & getDrawCommands () const
 
auto getTexture (int slot) const
 
auto & getTextures ()
 
void setTexture (int slot, video::TextureHandle texture)
 
auto getPipeline () const
 
virtual void onAnimate (const float time)
 onAnimate() is called just before rendering the whole scene. More...
 
virtual const std::string & getName () const
 Returns the name of the node. More...
 
virtual void setName (const std::string &name)
 Sets the name of the node. More...
 
virtual const core::aabbox3d< float > getTransformedBoundingBox () const
 Get the axis aligned, transformed and animated absolute bounding box of this node. More...
 
virtual void getTransformedBoundingBoxEdges (std::vector< glm::vec3 > &edges) const
 
virtual const glm::mat4 & getAbsoluteTransformation () const
 Get the absolute transformation of the node. Is recalculated every onAnimate()-call. More...
 
virtual glm::mat4 getRelativeTransformation () const
 Returns the relative transformation of the scene node. More...
 
virtual bool isVisible () const
 Returns whether the node should be visible (if all of its parents are visible). More...
 
virtual bool isTrulyVisible () const
 Check whether the node is truly visible, taking into accounts its parents' visibility. More...
 
virtual void setVisible (bool isVisible)
 Sets if the node should be visible or not. More...
 
virtual void addChild (const std::shared_ptr< ISceneNode > &child)
 Adds a child to this scene node. More...
 
virtual bool removeChild (const std::shared_ptr< ISceneNode > &child)
 
virtual void removeAll ()
 Removes all children of this scene node. More...
 
virtual void remove ()
 Removes this scene node from the scene. More...
 
virtual void addAnimator (const std::shared_ptr< ISceneNodeAnimator > &animator)
 Adds an animator which should animate this node. More...
 
const auto & getAnimators () const
 Get a list of all scene node animators. More...
 
virtual void removeAnimator (const std::shared_ptr< ISceneNodeAnimator > &animator)
 Removes an animator from this scene node. More...
 
virtual void removeAnimators ()
 Removes all animators from this scene node. More...
 
virtual const glm::vec3 & getScale () const
 Gets the scale of the scene node relative to its parent. More...
 
virtual void setScale (const glm::vec3 &scale)
 Sets the relative scale of the scene node. More...
 
virtual const glm::vec3 & getRotation () const
 Gets the rotation of the node relative to its parent. More...
 
virtual void setRotation (const glm::vec3 &rotation)
 Sets the rotation of the node relative to its parent. More...
 
virtual const glm::vec3 & getPosition () const
 Gets the position of the node relative to its parent. More...
 
virtual void setPosition (const glm::vec3 &newpos)
 Sets the position of the node relative to its parent. More...
 
virtual glm::vec3 getAbsolutePosition () const
 Gets the absolute position of the node in world coordinates. More...
 
const std::vector< std::shared_ptr< ISceneNode > > & getChildren () const
 Returns a const reference to the list of all children. More...
 
virtual void setParent (const std::shared_ptr< ISceneNode > &newParent)
 Changes the parent of the scene node. More...
 
virtual void updateAbsolutePosition ()
 Returns the triangle selector attached to this scene node. More...
 
const std::shared_ptr< ISceneNode > & getParent () const
 Returns the parent of this scene node. More...
 
virtual std::shared_ptr< ISceneNodeclone (const std::shared_ptr< ISceneNode > &newParent=0)
 Creates a clone of this scene node and its children. More...
 
virtual const std::shared_ptr< ISceneManager > & getSceneManager () const
 Retrieve the scene manager for this node. More...
 
- Public Member Functions inherited from saga::IEventReceiver
virtual ~IEventReceiver ()
 Destructor. More...
 

Additional Inherited Members

- Protected Attributes inherited from saga::scene::IMeshSceneNode
std::shared_ptr< IMeshMesh = nullptr
 
core::aabbox3d< float > Box
 
- Protected Attributes inherited from saga::scene::ISceneNode
ID NodeID = INVALID_ID
 A clone function for the ISceneNode members. More...
 
std::string Name
 Name of the scene node. More...
 
glm::mat4 AbsoluteTransformation
 Absolute transformation of the node. More...
 
glm::vec3 RelativeTranslation
 Relative translation of the scene node. More...
 
glm::vec3 RelativeRotation
 Relative rotation of the scene node. More...
 
glm::vec3 RelativeScale
 Relative scale of the scene node. More...
 
std::shared_ptr< ISceneNodeParent = nullptr
 Pointer to the parent. More...
 
std::vector< std::shared_ptr< ISceneNode > > Children
 List of all children of this node. More...
 
std::array< video::STexture::HandleType, video::MAX_NODE_TEXTURESTextures = { video::NULL_GPU_RESOURCE_HANDLE }
 Texture list. More...
 
std::vector< std::shared_ptr< ISceneNodeAnimator > > Animators
 List of all animator nodes. More...
 
std::shared_ptr< ISceneManagerSceneManager = nullptr
 Pointer to the scene manager. More...
 
std::function< void()> OnRenderCallback = nullptr
 Custom hook into rendering process of the scene node. More...
 
video::DrawCommandList DrawCommands
 
video::PipelineHandle Pipeline = video::NULL_GPU_RESOURCE_HANDLE
 
bool IsVisible = true
 Is the node visible? More...
 

Detailed Description

Scene node capable of displaying an animated mesh.

Definition at line 31 of file IAnimatedMeshSceneNode.h.

Constructor & Destructor Documentation

◆ IAnimatedMeshSceneNode()

saga::scene::IAnimatedMeshSceneNode::IAnimatedMeshSceneNode ( const std::shared_ptr< IMesh > &  mesh,
const std::shared_ptr< ISceneNode > &  parent,
const std::shared_ptr< ISceneManager mgr,
const glm::vec3 &  position = glm::vec3(0,0,0),
const glm::vec3 &  rotation = glm::vec3(0,0,0),
const glm::vec3 &  scale = glm::vec3(1.0f, 1.0f, 1.0f) 
)
inline

Constructor.

Definition at line 36 of file IAnimatedMeshSceneNode.h.

◆ ~IAnimatedMeshSceneNode()

virtual saga::scene::IAnimatedMeshSceneNode::~IAnimatedMeshSceneNode ( )
inlinevirtual

Destructor.

Definition at line 46 of file IAnimatedMeshSceneNode.h.

Member Function Documentation

◆ getAnimationSpeed()

virtual float saga::scene::IAnimatedMeshSceneNode::getAnimationSpeed ( ) const
pure virtual

Gets the speed with which the animation is played.

Returns
Frames per second played.

◆ getBoneCount()

virtual std::uint32_t saga::scene::IAnimatedMeshSceneNode::getBoneCount ( ) const
pure virtual

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:

ISceneNode* hand =
yourAnimatedMeshSceneNode->getJointNode("LeftHand");
hand->addChild(weaponSceneNode);

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.

Parameters
jointNameName of the joint.
Returns
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. same as getJointNode(const char* jointName), but based on id Gets joint count.
Amount of joints in the mesh.

◆ getEndFrame()

virtual std::int32_t saga::scene::IAnimatedMeshSceneNode::getEndFrame ( ) const
pure virtual

Returns the current end frame number.

◆ getFrameNumber()

virtual float saga::scene::IAnimatedMeshSceneNode::getFrameNumber ( ) const
pure virtual

Returns the currently displayed frame number.

◆ getLoopMode()

virtual bool saga::scene::IAnimatedMeshSceneNode::getLoopMode ( ) const
pure virtual

returns the current loop mode

When true the animations are played looped

◆ getStartFrame()

virtual std::int32_t saga::scene::IAnimatedMeshSceneNode::getStartFrame ( ) const
pure virtual

Returns the current start frame number.

◆ setAnimationEndCallback()

virtual void saga::scene::IAnimatedMeshSceneNode::setAnimationEndCallback ( IAnimationEndCallBack callback = 0)
pure virtual

Sets a callback interface which will be called if an animation playback has ended.

Set this to 0 to disable the callback again. Please note that this will only be called when in non looped mode, see IAnimatedMeshSceneNode::setLoopMode().

◆ setAnimationSpeed()

virtual void saga::scene::IAnimatedMeshSceneNode::setAnimationSpeed ( float  framesPerSecond)
pure virtual

Sets the speed with which the animation is played.

Parameters
framesPerSecondFrames per second played.

◆ setCurrentFrame()

virtual void saga::scene::IAnimatedMeshSceneNode::setCurrentFrame ( float  frame)
pure virtual

Sets the current frame number.

From now on the animation is played from this frame.

Parameters
frameNumber 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.

◆ setFrameLoop()

virtual bool saga::scene::IAnimatedMeshSceneNode::setFrameLoop ( std::int32_t  begin,
std::int32_t  end 
)
pure virtual

Sets the frame numbers between the animation is looped.

The default is 0 to getFrameCount()-1 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.

Parameters
beginStart frame number of the loop.
endEnd frame number of the loop.
Returns
True if successful, false if not.

◆ setLoopMode()

virtual void saga::scene::IAnimatedMeshSceneNode::setLoopMode ( bool  playAnimationLooped)
pure virtual

Sets looping mode which is on by default.

If set to false, animations will not be played looped.


The documentation for this class was generated from the following file:
saga::scene::ISceneNode::ISceneNode
ISceneNode(const std::shared_ptr< ISceneNode > &parent, const std::shared_ptr< ISceneManager > &mgr, const glm::vec3 &position=glm::vec3(0, 0, 0), const glm::vec3 &rotation=glm::vec3(0, 0, 0), const glm::vec3 &scale=glm::vec3(1.0f, 1.0f, 1.0f))
Constructor.
Definition: ISceneNode.h:46