Commit b2ea2b3f authored by Rogerborg's avatar Rogerborg

Fix Maya and FPS cameras so that they only animate if they are:

1) The active camera.
2) Receiving input.

This allows example 09.Meshviewer (with two cameras) to work as expected.  Replace the magic numbers in that example with enumerated values.

This patch also exposes ISceneNode::SceneManager through a public getSceneManager() API.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1974 dfc29bdd-3216-0410-991c-e03cc46cb475
parent dfc9db6c
This diff is collapsed.
......@@ -676,6 +676,10 @@ namespace scene
return 0; // to be implemented by derived classes
}
//! Retrieve the scene manager for this node.
/** \return The node's scene manager. */
virtual ISceneManager* getSceneManager(void) const { return SceneManager; }
protected:
//! A clone function for the ISceneNode members.
......
......@@ -115,6 +115,14 @@ void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
firstUpdate = false;
}
// If the camera isn't the active camera, and receiving input, then don't process it.
if(!camera->isInputReceiverEnabled())
return;
scene::ISceneManager * smgr = camera->getSceneManager();
if(smgr && smgr->getActiveCamera() != camera)
return;
// get time
f32 timeDiff = (f32) ( timeMs - LastAnimationTime );
LastAnimationTime = timeMs;
......
......@@ -6,6 +6,7 @@
#include "ICursorControl.h"
#include "ICameraSceneNode.h"
#include "SViewFrustum.h"
#include "ISceneManager.h"
namespace irr
{
......@@ -95,6 +96,14 @@ void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs)
ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node);
// If the camera isn't the active camera, and receiving input, then don't process it.
if(!camera->isInputReceiverEnabled())
return;
scene::ISceneManager * smgr = camera->getSceneManager();
if(smgr && smgr->getActiveCamera() != camera)
return;
if (OldCamera != camera)
{
OldTarget = camera->getTarget();
......
Test suite pass at GMT Wed Dec 17 23:49:16 2008
Test suite pass at GMT Thu Dec 18 15:24:34 2008
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