Commit d9e92b07 authored by hybrid's avatar hybrid

Add FPS getter for Animated Mesh SN, add some values in serialization.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2767 dfc29bdd-3216-0410-991c-e03cc46cb475
parent c8c80280
......@@ -81,10 +81,14 @@ namespace scene
\return True if successful, false if not. */
virtual bool setFrameLoop(s32 begin, s32 end) = 0;
//! Sets the speed with witch the animation is played.
//! 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;
//! Creates shadow volume scene node as child of this node.
/** The shadow can be rendered using the ZPass or the zfail
method. ZPass is a little bit faster because the shadow volume
......
......@@ -26,7 +26,7 @@ namespace scene
public:
//! Finds the collision point of a line and lots of triangles, if there is one.
/** \param ray: Line with witch collisions are tested.
/** \param ray: Line with which collisions are tested.
\param selector: TriangleSelector containing the triangles. It
can be created for example using
ISceneManager::createTriangleSelector() or
......
......@@ -524,6 +524,12 @@ void CAnimatedMeshSceneNode::setAnimationSpeed(f32 framesPerSecond)
}
f32 CAnimatedMeshSceneNode::getAnimationSpeed() const
{
return FramesPerSecond * 1000.f;
}
//! returns the axis aligned bounding box of this node
const core::aabbox3d<f32>& CAnimatedMeshSceneNode::getBoundingBox() const
{
......@@ -768,8 +774,8 @@ void CAnimatedMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttr
out->addBool("Looping", Looping);
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
out->addFloat("FramesPerSecond", FramesPerSecond);
// TODO: write animation names instead of frame begin and ends
out->addInt("StartFrame", StartFrame);
out->addInt("EndFrame", EndFrame);
}
......@@ -784,6 +790,8 @@ void CAnimatedMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAtt
Looping = in->getAttributeAsBool("Looping");
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
FramesPerSecond = in->getAttributeAsFloat("FramesPerSecond");
StartFrame = in->getAttributeAsInt("StartFrame");
EndFrame = in->getAttributeAsInt("EndFrame");
if (newMeshStr != "" && oldMeshStr != newMeshStr)
{
......
......@@ -57,9 +57,12 @@ namespace scene
//! playback has ended. Set this to 0 to disable the callback again.
virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0);
//! sets the speed with witch the animation is played
//! sets the speed with which the animation is played
virtual void setAnimationSpeed(f32 framesPerSecond);
//! gets the speed with which the animation is played
virtual f32 getAnimationSpeed() const;
//! 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 hirachy on a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment