// Copyright (C) 2002-2006 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 "IAnimatedMeshMD2.h" namespace Irrlicht { namespace Scene { /// /// Scene node capable of displaying an animated mesh and its shadow. /// The shadow is optional: If a shadow should be displayed too, just invoke /// the IAnimatedMeshSceneNode::createShadowVolumeSceneNode(). /// public __gc class IAnimatedMeshSceneNode : public ISceneNode { public: /// /// Creates a scene node from a native C++ scene node. Don't use this, its better to create /// scene nodes using the SceneManager with its addSceneNode() methods. /// IAnimatedMeshSceneNode(irr::scene::IAnimatedMeshSceneNode* realSceneNode); /// /// Sets or gets the current frame number. /// From now on the animation is played from this 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. __property void set_CurrentFrame(int frame); /// /// Sets or gets the current frame number. /// From now on the animation is played from this frame. /// __property int get_CurrentFrame(); /// /// Sets the frame numbers between the animation is looped. /// The default is 0 - MaximalFrameCount of the mesh. /// /// Start frame number of the loop. /// End frame number of the loop. /// Returns true if successful, false if not. bool SetFrameLoop(int begin, int end); /// /// Sets the speed with witch the animation is played. /// /// Frames per second played. __property void set_AnimationSpeed(float framesPerSecond); /// /// Creates shadow volume scene node as child of this node /// and returns a pointer to it. The shadow can be rendered using the ZPass /// or the zfail method. ZPass is a little bit faster because the shadow volume /// creation is easier, but with this method there occur ugly looking artifacs /// when the camera is inside the shadow volume. These error do not occur /// with the ZFail method. /// /// Id of the shadow scene node. This id can be used to identify /// the node later. /// If set to true, the shadow will use the zfail method, /// if not, zpass is used. Default: true /// Value used by the shadow volume algorithm to scale the /// shadow volume. Default: 10000 /// Returns pointer to the created shadow scene node. /// ISceneNode* AddShadowVolumeSceneNode(int id, bool zfailmethod, float infinity); /// /// Creates shadow volume scene node as child of this node /// and returns a pointer to it. The shadow can be rendered using the ZPass /// or the zfail method. ZPass is a little bit faster because the shadow volume /// creation is easier, but with this method there occur ugly looking artifacs /// when the camera is inside the shadow volume. These error do not occur /// with the ZFail method. /// Returns pointer to the created shadow scene node. /// ISceneNode* AddShadowVolumeSceneNode(); /// /// Returns a pointer to a child node, wich has the same transformation as /// the corrsesponding joint, if the mesh in this scene node is a ms3d mesh. /// Otherwise 0 is returned. With this method it is possible to /// attach scene nodes to joints more easily. In this way, it is /// for example possible to attach a weapon to the left hand of an /// animated model. This example shows how: /// \code /// ISceneNode* hand = /// yourMS3DAnimatedMeshSceneNode->getMS3DJointNode("LeftHand"); /// hand->addChild(weaponSceneNode); /// \endcode /// Please note that the SceneNode returned by this method may not exist /// before this call and is created by it. /// /// Name of the joint. /// Returns a pointer to the scene node which represents the joint /// with the specified name. Returns 0 if the contained mesh is not an /// ms3d mesh or the name of the joint could not be found. ISceneNode* GetMS3DJointNode(System::String* jointName); /// /// Starts a default MD2 animation. /// With this method it is easily possible to start a Run, Attack, /// Die or whatever animation, if the mesh contained in this scene /// node is a md2 mesh. Otherwise, nothing happenes. /// /// An MD2 animation type, which should be played, for /// example EMAT_STAND for the standing animation. /// Returns true if successful, and false if not, for example /// if the mesh in the scene node is not a md2 mesh. bool SetMD2Animation(MD2AnimationType anim); /// /// Starts a special MD2 animation. /// With this method it is easily possible to start a Run, Attack, /// Die or whatever animation, if the mesh contained in this scene /// node is a md2 mesh. Otherwise, nothing happenes. This method uses /// a character string to identify the animation. If the animation is a /// standard md2 animation, you might want to start this animation /// with the MD2_ANIMATION_TYPE enumeraition instead. /// /// Name of the animation which should be played. /// Returns true if successful, and false if not, for example /// if the mesh in the scene node is not a md2 mesh, or no animation /// with this name could be found. bool SetMD2Animation(System::String* animationName); protected: inline irr::scene::IAnimatedMeshSceneNode* getAnimatedMeshSceneNode() { return (irr::scene::IAnimatedMeshSceneNode*)SceneNode; } }; } }