Commit 3d78d2a9 authored by teella's avatar teella

implemented createClone in ISceneNodeAnimators


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1631 dfc29bdd-3216-0410-991c-e03cc46cb475
parent d42ce617
...@@ -43,10 +43,7 @@ namespace scene ...@@ -43,10 +43,7 @@ namespace scene
/** Please note that you will have to drop /** Please note that you will have to drop
(IReferenceCounted::drop()) the returned pointer after calling (IReferenceCounted::drop()) the returned pointer after calling
this. */ this. */
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0) virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0) = 0;
{
return 0; // to be implemented by derived classes.
}
//! Returns true if this animator receives events. //! Returns true if this animator receives events.
//! When attached to the an active camera, this animator will be able to respond to events //! When attached to the an active camera, this animator will be able to respond to events
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CSceneNodeAnimatorCameraFPS.h" #include "CSceneNodeAnimatorCameraFPS.h"
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "ISceneManager.h" #include "ISceneManager.h"
#include "Keycodes.h" #include "Keycodes.h"
#include "ICursorControl.h" #include "ICursorControl.h"
#include "ICameraSceneNode.h" #include "ICameraSceneNode.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
//! constructor //! constructor
CSceneNodeAnimatorCameraFPS::CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl, CSceneNodeAnimatorCameraFPS::CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl,
f32 rotateSpeed, f32 moveSpeed, f32 jumpSpeed, f32 rotateSpeed, f32 moveSpeed, f32 jumpSpeed,
SKeyMap* keyMapArray, u32 keyMapSize, bool noVerticalMovement) SKeyMap* keyMapArray, u32 keyMapSize, bool noVerticalMovement)
: CursorControl(cursorControl), MaxVerticalAngle(88.0f), : CursorControl(cursorControl), MaxVerticalAngle(88.0f),
MoveSpeed(moveSpeed/1000.0f), RotateSpeed(rotateSpeed), JumpSpeed(jumpSpeed), MoveSpeed(moveSpeed/1000.0f), RotateSpeed(rotateSpeed), JumpSpeed(jumpSpeed),
LastAnimationTime(0), firstUpdate(true), NoVerticalMovement(noVerticalMovement) LastAnimationTime(0), firstUpdate(true), NoVerticalMovement(noVerticalMovement),
{ KeyMapArray(keyMapArray), KeyMapSize(keyMapSize)
#ifdef _DEBUG {
setDebugName("CCameraSceneNodeAnimatorFPS"); #ifdef _DEBUG
#endif setDebugName("CCameraSceneNodeAnimatorFPS");
#endif
if (CursorControl)
CursorControl->grab(); if (CursorControl)
CursorControl->grab();
allKeysUp();
allKeysUp();
// create key map
if (!keyMapArray || !keyMapSize) // create key map
{ if (!KeyMapArray || !KeyMapSize)
// create default key map {
KeyMap.push_back(SCamKeyMap(0, irr::KEY_UP)); // create default key map
KeyMap.push_back(SCamKeyMap(1, irr::KEY_DOWN)); KeyMap.push_back(SCamKeyMap(0, irr::KEY_UP));
KeyMap.push_back(SCamKeyMap(2, irr::KEY_LEFT)); KeyMap.push_back(SCamKeyMap(1, irr::KEY_DOWN));
KeyMap.push_back(SCamKeyMap(3, irr::KEY_RIGHT)); KeyMap.push_back(SCamKeyMap(2, irr::KEY_LEFT));
KeyMap.push_back(SCamKeyMap(4, irr::KEY_KEY_J)); KeyMap.push_back(SCamKeyMap(3, irr::KEY_RIGHT));
} KeyMap.push_back(SCamKeyMap(4, irr::KEY_KEY_J));
else }
{ else
// create custom key map {
setKeyMap(keyMapArray, keyMapSize); // create custom key map
} setKeyMap(KeyMapArray, KeyMapSize);
} }
}
//! destructor
CSceneNodeAnimatorCameraFPS::~CSceneNodeAnimatorCameraFPS() //! destructor
{ CSceneNodeAnimatorCameraFPS::~CSceneNodeAnimatorCameraFPS()
if (CursorControl) {
CursorControl->drop(); if (CursorControl)
} CursorControl->drop();
}
//! It is possible to send mouse and key events to the camera. Most cameras
//! may ignore this input, but camera scene nodes which are created for //! It is possible to send mouse and key events to the camera. Most cameras
//! example with scene::ISceneManager::addMayaCameraSceneNode or //! may ignore this input, but camera scene nodes which are created for
//! scene::ISceneManager::addFPSCameraSceneNode, may want to get this input //! example with scene::ISceneManager::addMayaCameraSceneNode or
//! for changing their position, look at target or whatever. //! scene::ISceneManager::addFPSCameraSceneNode, may want to get this input
bool CSceneNodeAnimatorCameraFPS::OnEvent(const SEvent& evt) //! for changing their position, look at target or whatever.
{ bool CSceneNodeAnimatorCameraFPS::OnEvent(const SEvent& evt)
switch(evt.EventType) {
{ switch(evt.EventType)
case EET_KEY_INPUT_EVENT: {
for (u32 i=0; i<KeyMap.size(); ++i) case EET_KEY_INPUT_EVENT:
{ for (u32 i=0; i<KeyMap.size(); ++i)
if (KeyMap[i].keycode == evt.KeyInput.Key) {
{ if (KeyMap[i].keycode == evt.KeyInput.Key)
CursorKeys[KeyMap[i].action] = evt.KeyInput.PressedDown; {
return true; CursorKeys[KeyMap[i].action] = evt.KeyInput.PressedDown;
} return true;
} }
break; }
break;
case EET_MOUSE_INPUT_EVENT:
if (evt.MouseInput.Event == EMIE_MOUSE_MOVED) case EET_MOUSE_INPUT_EVENT:
{ if (evt.MouseInput.Event == EMIE_MOUSE_MOVED)
CursorPos = CursorControl->getRelativePosition(); {
return true; CursorPos = CursorControl->getRelativePosition();
} return true;
break; }
break;
default:
break; default:
} break;
}
return false;
} return false;
}
void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
{ void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
if (node->getType() != ESNT_CAMERA) {
return; if (node->getType() != ESNT_CAMERA)
return;
ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node);
ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node);
if (firstUpdate)
{ if (firstUpdate)
if (CursorControl && camera) {
{ if (CursorControl && camera)
CursorControl->setPosition(0.5f, 0.5f); {
CursorPos = CenterCursor = CursorControl->getRelativePosition(); CursorControl->setPosition(0.5f, 0.5f);
} CursorPos = CenterCursor = CursorControl->getRelativePosition();
}
LastAnimationTime = timeMs;
LastAnimationTime = timeMs;
firstUpdate = false;
} firstUpdate = false;
}
// get time
f32 timeDiff = (f32) ( timeMs - LastAnimationTime ); // get time
LastAnimationTime = timeMs; f32 timeDiff = (f32) ( timeMs - LastAnimationTime );
LastAnimationTime = timeMs;
// update position
core::vector3df pos = camera->getPosition(); // update position
core::vector3df pos = camera->getPosition();
// Update rotation
core::vector3df target = (camera->getTarget() - camera->getAbsolutePosition()); // Update rotation
core::vector3df relativeRotation = target.getHorizontalAngle(); core::vector3df target = (camera->getTarget() - camera->getAbsolutePosition());
core::vector3df relativeRotation = target.getHorizontalAngle();
if (CursorControl)
{ if (CursorControl)
if (CursorPos != CenterCursor) {
{ if (CursorPos != CenterCursor)
relativeRotation.Y -= (0.5f - CursorPos.X) * RotateSpeed; {
relativeRotation.X -= (0.5f - CursorPos.Y) * RotateSpeed; relativeRotation.Y -= (0.5f - CursorPos.X) * RotateSpeed;
relativeRotation.X -= (0.5f - CursorPos.Y) * RotateSpeed;
// X < MaxVerticalAngle or X > 360-MaxVerticalAngle
// X < MaxVerticalAngle or X > 360-MaxVerticalAngle
if (relativeRotation.X > MaxVerticalAngle*2 &&
relativeRotation.X < 360.0f-MaxVerticalAngle) if (relativeRotation.X > MaxVerticalAngle*2 &&
{ relativeRotation.X < 360.0f-MaxVerticalAngle)
relativeRotation.X = 360.0f-MaxVerticalAngle; {
} relativeRotation.X = 360.0f-MaxVerticalAngle;
else }
if (relativeRotation.X > MaxVerticalAngle && else
relativeRotation.X < 360.0f-MaxVerticalAngle) if (relativeRotation.X > MaxVerticalAngle &&
{ relativeRotation.X < 360.0f-MaxVerticalAngle)
relativeRotation.X = MaxVerticalAngle; {
} relativeRotation.X = MaxVerticalAngle;
}
// reset cursor position
CursorControl->setPosition(0.5f, 0.5f); // reset cursor position
CenterCursor = CursorControl->getRelativePosition(); CursorControl->setPosition(0.5f, 0.5f);
// needed to avoid problems when the ecent receiver is CenterCursor = CursorControl->getRelativePosition();
// disabled // needed to avoid problems when the ecent receiver is
CursorPos = CenterCursor; // disabled
} CursorPos = CenterCursor;
} }
}
// set target
// set target
target.set(0,0,100);
core::vector3df movedir = target; target.set(0,0,100);
core::vector3df movedir = target;
core::matrix4 mat;
mat.setRotationDegrees(core::vector3df(relativeRotation.X, relativeRotation.Y, 0)); core::matrix4 mat;
mat.transformVect(target); mat.setRotationDegrees(core::vector3df(relativeRotation.X, relativeRotation.Y, 0));
mat.transformVect(target);
if (NoVerticalMovement)
{ if (NoVerticalMovement)
mat.setRotationDegrees(core::vector3df(0, relativeRotation.Y, 0)); {
mat.transformVect(movedir); mat.setRotationDegrees(core::vector3df(0, relativeRotation.Y, 0));
} mat.transformVect(movedir);
else }
{ else
movedir = target; {
} movedir = target;
}
movedir.normalize();
movedir.normalize();
if (CursorKeys[0])
pos += movedir * timeDiff * MoveSpeed; if (CursorKeys[0])
pos += movedir * timeDiff * MoveSpeed;
if (CursorKeys[1])
pos -= movedir * timeDiff * MoveSpeed; if (CursorKeys[1])
pos -= movedir * timeDiff * MoveSpeed;
// strafing
// strafing
core::vector3df strafevect = target;
strafevect = strafevect.crossProduct(camera->getUpVector()); core::vector3df strafevect = target;
strafevect = strafevect.crossProduct(camera->getUpVector());
if (NoVerticalMovement)
strafevect.Y = 0.0f; if (NoVerticalMovement)
strafevect.Y = 0.0f;
strafevect.normalize();
strafevect.normalize();
if (CursorKeys[2])
pos += strafevect * timeDiff * MoveSpeed; if (CursorKeys[2])
pos += strafevect * timeDiff * MoveSpeed;
if (CursorKeys[3])
pos -= strafevect * timeDiff * MoveSpeed; if (CursorKeys[3])
pos -= strafevect * timeDiff * MoveSpeed;
// jumping ( need's a gravity , else it's a fly to the World-UpVector )
if (CursorKeys[4]) // jumping ( need's a gravity , else it's a fly to the World-UpVector )
{ if (CursorKeys[4])
pos += camera->getUpVector() * timeDiff * JumpSpeed; {
} pos += camera->getUpVector() * timeDiff * JumpSpeed;
}
// write translation
camera->setPosition(pos); // write translation
camera->setPosition(pos);
// write right target
// write right target
TargetVector = target;
target += pos; TargetVector = target;
camera->setTarget(target); target += pos;
} camera->setTarget(target);
}
void CSceneNodeAnimatorCameraFPS::allKeysUp()
{ void CSceneNodeAnimatorCameraFPS::allKeysUp()
for (u32 i=0; i<6; ++i) {
CursorKeys[i] = false; for (u32 i=0; i<6; ++i)
} CursorKeys[i] = false;
}
//! Sets the rotation speed
void CSceneNodeAnimatorCameraFPS::setRotateSpeed(f32 speed) //! Sets the rotation speed
{ void CSceneNodeAnimatorCameraFPS::setRotateSpeed(f32 speed)
RotateSpeed = speed; {
} RotateSpeed = speed;
}
//! Sets the movement speed
void CSceneNodeAnimatorCameraFPS::setMoveSpeed(f32 speed) //! Sets the movement speed
{ void CSceneNodeAnimatorCameraFPS::setMoveSpeed(f32 speed)
MoveSpeed = speed; {
} MoveSpeed = speed;
}
//! Gets the rotation speed
f32 CSceneNodeAnimatorCameraFPS::getRotateSpeed() const //! Gets the rotation speed
{ f32 CSceneNodeAnimatorCameraFPS::getRotateSpeed() const
return RotateSpeed; {
} return RotateSpeed;
}
// Gets the movement speed
f32 CSceneNodeAnimatorCameraFPS::getMoveSpeed() const // Gets the movement speed
{ f32 CSceneNodeAnimatorCameraFPS::getMoveSpeed() const
return MoveSpeed; {
} return MoveSpeed;
}
//! Sets the keyboard mapping for this animator
void CSceneNodeAnimatorCameraFPS::setKeyMap(SKeyMap *map, u32 count) //! Sets the keyboard mapping for this animator
{ void CSceneNodeAnimatorCameraFPS::setKeyMap(SKeyMap *map, u32 count)
// clear the keymap {
KeyMap.clear(); // clear the keymap
KeyMap.clear();
// add actions
for (u32 i=0; i<count; ++i) // add actions
{ for (u32 i=0; i<count; ++i)
switch(map[i].Action) {
{ switch(map[i].Action)
case EKA_MOVE_FORWARD: KeyMap.push_back(SCamKeyMap(0, map[i].KeyCode)); {
break; case EKA_MOVE_FORWARD: KeyMap.push_back(SCamKeyMap(0, map[i].KeyCode));
case EKA_MOVE_BACKWARD: KeyMap.push_back(SCamKeyMap(1, map[i].KeyCode)); break;
break; case EKA_MOVE_BACKWARD: KeyMap.push_back(SCamKeyMap(1, map[i].KeyCode));
case EKA_STRAFE_LEFT: KeyMap.push_back(SCamKeyMap(2, map[i].KeyCode)); break;
break; case EKA_STRAFE_LEFT: KeyMap.push_back(SCamKeyMap(2, map[i].KeyCode));
case EKA_STRAFE_RIGHT: KeyMap.push_back(SCamKeyMap(3, map[i].KeyCode)); break;
break; case EKA_STRAFE_RIGHT: KeyMap.push_back(SCamKeyMap(3, map[i].KeyCode));
case EKA_JUMP_UP: KeyMap.push_back(SCamKeyMap(4, map[i].KeyCode)); break;
break; case EKA_JUMP_UP: KeyMap.push_back(SCamKeyMap(4, map[i].KeyCode));
default: break;
break; default:
} break;
} }
} }
}
//! Sets whether vertical movement should be allowed.
void CSceneNodeAnimatorCameraFPS::setVerticalMovement(bool allow) //! Sets whether vertical movement should be allowed.
{ void CSceneNodeAnimatorCameraFPS::setVerticalMovement(bool allow)
NoVerticalMovement = !allow; {
} NoVerticalMovement = !allow;
}
} // namespace scene ISceneNodeAnimator* CSceneNodeAnimatorCameraFPS::createClone(ISceneNode* node, ISceneManager* newManager)
} // namespace irr {
CSceneNodeAnimatorCameraFPS * newAnimator =
new CSceneNodeAnimatorCameraFPS(CursorControl, RotateSpeed, (MoveSpeed * 1000.0f), JumpSpeed,
KeyMapArray, KeyMapSize, NoVerticalMovement);
return newAnimator;
}
} // namespace scene
} // namespace irr
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__ #ifndef __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
#define __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__ #define __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
#include "ISceneNodeAnimatorCameraFPS.h" #include "ISceneNodeAnimatorCameraFPS.h"
#include "vector2d.h" #include "vector2d.h"
#include "SKeyMap.h" #include "SKeyMap.h"
#include "irrArray.h" #include "irrArray.h"
namespace irr namespace irr
{ {
namespace gui namespace gui
{ {
class ICursorControl; class ICursorControl;
} }
namespace scene namespace scene
{ {
//! Special scene node animator for FPS cameras //! Special scene node animator for FPS cameras
class CSceneNodeAnimatorCameraFPS : public ISceneNodeAnimatorCameraFPS class CSceneNodeAnimatorCameraFPS : public ISceneNodeAnimatorCameraFPS
{ {
public: public:
//! Constructor //! Constructor
CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl, CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl,
f32 rotateSpeed = 100.0f, f32 moveSpeed = 500.0f, f32 jumpSpeed=0.f, f32 rotateSpeed = 100.0f, f32 moveSpeed = 500.0f, f32 jumpSpeed=0.f,
SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false); SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false);
//! Destructor //! Destructor
virtual ~CSceneNodeAnimatorCameraFPS(); virtual ~CSceneNodeAnimatorCameraFPS();
//! Animates the scene node, currently only works on cameras //! Animates the scene node, currently only works on cameras
virtual void animateNode(ISceneNode* node, u32 timeMs); virtual void animateNode(ISceneNode* node, u32 timeMs);
//! Event receiver //! Event receiver
virtual bool OnEvent(const SEvent& event); virtual bool OnEvent(const SEvent& event);
//! Returns the speed of movement in units per millisecond //! Returns the speed of movement in units per millisecond
virtual f32 getMoveSpeed() const; virtual f32 getMoveSpeed() const;
//! Sets the speed of movement in units per millisecond //! Sets the speed of movement in units per millisecond
virtual void setMoveSpeed(f32 moveSpeed); virtual void setMoveSpeed(f32 moveSpeed);
//! Returns the rotation speed //! Returns the rotation speed
virtual f32 getRotateSpeed() const; virtual f32 getRotateSpeed() const;
//! Set the rotation speed //! Set the rotation speed
virtual void setRotateSpeed(f32 rotateSpeed); virtual void setRotateSpeed(f32 rotateSpeed);
//! Sets the keyboard mapping for this animator //! Sets the keyboard mapping for this animator
//! \param keymap: an array of keyboard mappings, see SKeyMap //! \param keymap: an array of keyboard mappings, see SKeyMap
//! \param count: the size of the keyboard map array //! \param count: the size of the keyboard map array
virtual void setKeyMap(SKeyMap *map, u32 count); virtual void setKeyMap(SKeyMap *map, u32 count);
//! Sets whether vertical movement should be allowed. //! Sets whether vertical movement should be allowed.
virtual void setVerticalMovement(bool allow); virtual void setVerticalMovement(bool allow);
//! This animator will receive events when attached to the active camera //! This animator will receive events when attached to the active camera
virtual bool isEventReceiverEnabled() const virtual bool isEventReceiverEnabled() const
{ {
return true; return true;
} }
//! Returns the type of this animator //! Returns the type of this animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const virtual ESCENE_NODE_ANIMATOR_TYPE getType() const
{ {
return ESNAT_CAMERA_FPS; return ESNAT_CAMERA_FPS;
} }
private: //! Creates a clone of this animator.
/** Please note that you will have to drop
struct SCamKeyMap (IReferenceCounted::drop()) the returned pointer after calling
{ this. */
SCamKeyMap() {}; virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
SCamKeyMap(s32 a, EKEY_CODE k) : action(a), keycode(k) {}
private:
s32 action;
EKEY_CODE keycode; struct SCamKeyMap
}; {
SCamKeyMap() {};
void allKeysUp(); SCamKeyMap(s32 a, EKEY_CODE k) : action(a), keycode(k) {}
gui::ICursorControl *CursorControl; s32 action;
EKEY_CODE keycode;
f32 MaxVerticalAngle; };
f32 MoveSpeed; void allKeysUp();
f32 RotateSpeed;
f32 JumpSpeed; gui::ICursorControl *CursorControl;
s32 LastAnimationTime; f32 MaxVerticalAngle;
core::vector3df TargetVector; f32 MoveSpeed;
core::array<SCamKeyMap> KeyMap; f32 RotateSpeed;
core::position2d<f32> CenterCursor, CursorPos; f32 JumpSpeed;
bool CursorKeys[6]; s32 LastAnimationTime;
bool firstUpdate; core::vector3df TargetVector;
bool NoVerticalMovement; core::array<SCamKeyMap> KeyMap;
}; core::position2d<f32> CenterCursor, CursorPos;
} // end namespace scene bool CursorKeys[6];
} // end namespace irr
bool firstUpdate;
#endif // __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__ bool NoVerticalMovement;
SKeyMap* KeyMapArray;
u32 KeyMapSize;
};
} // end namespace scene
} // end namespace irr
#endif // __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CSceneNodeAnimatorCameraMaya.h" #include "CSceneNodeAnimatorCameraMaya.h"
#include "ICursorControl.h" #include "ICursorControl.h"
#include "ICameraSceneNode.h" #include "ICameraSceneNode.h"
#include "SViewFrustum.h" #include "SViewFrustum.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
//! constructor //! constructor
CSceneNodeAnimatorCameraMaya::CSceneNodeAnimatorCameraMaya(gui::ICursorControl* cursor, f32 rotate, f32 zoom, f32 translate) CSceneNodeAnimatorCameraMaya::CSceneNodeAnimatorCameraMaya(gui::ICursorControl* cursor, f32 rotate, f32 zoom, f32 translate)
: CursorControl(cursor), Zooming(false), Rotating(false), Moving(false), Translating(false), : CursorControl(cursor), Zooming(false), Rotating(false), Moving(false), Translating(false),
ZoomSpeed(zoom), RotateSpeed(rotate), TranslateSpeed(translate), ZoomSpeed(zoom), RotateSpeed(rotate), TranslateSpeed(translate),
RotateStartX(0.0f), RotateStartY(0.0f), ZoomStartX(0.0f), ZoomStartY(0.0f), RotateStartX(0.0f), RotateStartY(0.0f), ZoomStartX(0.0f), ZoomStartY(0.0f),
TranslateStartX(0.0f), TranslateStartY(0.0f), CurrentZoom(70.0f), RotX(0.0f), RotY(0.0f), TranslateStartX(0.0f), TranslateStartY(0.0f), CurrentZoom(70.0f), RotX(0.0f), RotY(0.0f),
Target(0,0,0), OldTarget(0,0,0), OldCamera(0), MousePos(0.5f, 0.5f) Target(0,0,0), OldTarget(0,0,0), OldCamera(0), MousePos(0.5f, 0.5f)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CSceneNodeAnimatorCameraMaya"); setDebugName("CSceneNodeAnimatorCameraMaya");
#endif #endif
if (CursorControl) if (CursorControl)
{ {
CursorControl->grab(); CursorControl->grab();
MousePos = CursorControl->getRelativePosition(); MousePos = CursorControl->getRelativePosition();
} }
allKeysUp(); allKeysUp();
} }
//! destructor //! destructor
CSceneNodeAnimatorCameraMaya::~CSceneNodeAnimatorCameraMaya() CSceneNodeAnimatorCameraMaya::~CSceneNodeAnimatorCameraMaya()
{ {
if (CursorControl) if (CursorControl)
CursorControl->drop(); CursorControl->drop();
} }
//! It is possible to send mouse and key events to the camera. Most cameras //! It is possible to send mouse and key events to the camera. Most cameras
//! may ignore this input, but camera scene nodes which are created for //! may ignore this input, but camera scene nodes which are created for
//! example with scene::ISceneManager::addMayaCameraSceneNode or //! example with scene::ISceneManager::addMayaCameraSceneNode or
//! scene::ISceneManager::addMeshViewerCameraSceneNode, may want to get this input //! scene::ISceneManager::addMeshViewerCameraSceneNode, may want to get this input
//! for changing their position, look at target or whatever. //! for changing their position, look at target or whatever.
bool CSceneNodeAnimatorCameraMaya::OnEvent(const SEvent& event) bool CSceneNodeAnimatorCameraMaya::OnEvent(const SEvent& event)
{ {
if (event.EventType != EET_MOUSE_INPUT_EVENT) if (event.EventType != EET_MOUSE_INPUT_EVENT)
return false; return false;
switch(event.MouseInput.Event) switch(event.MouseInput.Event)
{ {
case EMIE_LMOUSE_PRESSED_DOWN: case EMIE_LMOUSE_PRESSED_DOWN:
MouseKeys[0] = true; MouseKeys[0] = true;
break; break;
case EMIE_RMOUSE_PRESSED_DOWN: case EMIE_RMOUSE_PRESSED_DOWN:
MouseKeys[2] = true; MouseKeys[2] = true;
break; break;
case EMIE_MMOUSE_PRESSED_DOWN: case EMIE_MMOUSE_PRESSED_DOWN:
MouseKeys[1] = true; MouseKeys[1] = true;
break; break;
case EMIE_LMOUSE_LEFT_UP: case EMIE_LMOUSE_LEFT_UP:
MouseKeys[0] = false; MouseKeys[0] = false;
break; break;
case EMIE_RMOUSE_LEFT_UP: case EMIE_RMOUSE_LEFT_UP:
MouseKeys[2] = false; MouseKeys[2] = false;
break; break;
case EMIE_MMOUSE_LEFT_UP: case EMIE_MMOUSE_LEFT_UP:
MouseKeys[1] = false; MouseKeys[1] = false;
break; break;
case EMIE_MOUSE_MOVED: case EMIE_MOUSE_MOVED:
MousePos = CursorControl->getRelativePosition(); MousePos = CursorControl->getRelativePosition();
break; break;
case EMIE_MOUSE_WHEEL: case EMIE_MOUSE_WHEEL:
case EMIE_COUNT: case EMIE_COUNT:
return false; return false;
} }
return true; return true;
} }
//! OnAnimate() is called just before rendering the whole scene. //! OnAnimate() is called just before rendering the whole scene.
//! nodes may calculate or store animations here, and may do other useful things, //! nodes may calculate or store animations here, and may do other useful things,
//! dependent on what they are. //! dependent on what they are.
void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs) void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs)
{ {
//Alt + LM = Rotate around camera pivot //Alt + LM = Rotate around camera pivot
//Alt + LM + MM = Dolly forth/back in view direction (speed % distance camera pivot - max distance to pivot) //Alt + LM + MM = Dolly forth/back in view direction (speed % distance camera pivot - max distance to pivot)
//Alt + MM = Move on camera plane (Screen center is about the mouse pointer, depending on move speed) //Alt + MM = Move on camera plane (Screen center is about the mouse pointer, depending on move speed)
if (node->getType() != ESNT_CAMERA) if (node->getType() != ESNT_CAMERA)
return; return;
ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node); ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node);
if (OldCamera != camera) if (OldCamera != camera)
{ {
OldTarget = camera->getTarget(); OldTarget = camera->getTarget();
OldCamera = camera; OldCamera = camera;
} }
Target = camera->getTarget(); Target = camera->getTarget();
const SViewFrustum* va = camera->getViewFrustum(); const SViewFrustum* va = camera->getViewFrustum();
f32 nRotX = RotX; f32 nRotX = RotX;
f32 nRotY = RotY; f32 nRotY = RotY;
f32 nZoom = CurrentZoom; f32 nZoom = CurrentZoom;
if ( (isMouseKeyDown(0) && isMouseKeyDown(2)) || isMouseKeyDown(1) ) if ( (isMouseKeyDown(0) && isMouseKeyDown(2)) || isMouseKeyDown(1) )
{ {
if (!Zooming) if (!Zooming)
{ {
ZoomStartX = MousePos.X; ZoomStartX = MousePos.X;
ZoomStartY = MousePos.Y; ZoomStartY = MousePos.Y;
Zooming = true; Zooming = true;
nZoom = CurrentZoom; nZoom = CurrentZoom;
} }
else else
{ {
f32 old = nZoom; f32 old = nZoom;
nZoom += (ZoomStartX - MousePos.X) * ZoomSpeed; nZoom += (ZoomStartX - MousePos.X) * ZoomSpeed;
f32 targetMinDistance = 0.1f; f32 targetMinDistance = 0.1f;
if (nZoom < targetMinDistance) // jox: fixed bug: bounce back when zooming to close if (nZoom < targetMinDistance) // jox: fixed bug: bounce back when zooming to close
nZoom = targetMinDistance; nZoom = targetMinDistance;
if (nZoom < 0) if (nZoom < 0)
nZoom = old; nZoom = old;
} }
} }
else else
{ {
if (Zooming) if (Zooming)
{ {
f32 old = CurrentZoom; f32 old = CurrentZoom;
CurrentZoom = CurrentZoom + (ZoomStartX - MousePos.X ) * ZoomSpeed; CurrentZoom = CurrentZoom + (ZoomStartX - MousePos.X ) * ZoomSpeed;
nZoom = CurrentZoom; nZoom = CurrentZoom;
if (nZoom < 0) if (nZoom < 0)
nZoom = CurrentZoom = old; nZoom = CurrentZoom = old;
} }
Zooming = false; Zooming = false;
} }
// Translation --------------------------------- // Translation ---------------------------------
core::vector3df translate(OldTarget), UpVector(camera->getUpVector()); core::vector3df translate(OldTarget), UpVector(camera->getUpVector());
core::vector3df tvectX = Pos - Target; core::vector3df tvectX = Pos - Target;
tvectX = tvectX.crossProduct(UpVector); tvectX = tvectX.crossProduct(UpVector);
tvectX.normalize(); tvectX.normalize();
core::vector3df tvectY = (va->getFarLeftDown() - va->getFarRightDown()); core::vector3df tvectY = (va->getFarLeftDown() - va->getFarRightDown());
tvectY = tvectY.crossProduct(UpVector.Y > 0 ? Pos - Target : Target - Pos); tvectY = tvectY.crossProduct(UpVector.Y > 0 ? Pos - Target : Target - Pos);
tvectY.normalize(); tvectY.normalize();
if (isMouseKeyDown(2) && !Zooming) if (isMouseKeyDown(2) && !Zooming)
{ {
if (!Translating) if (!Translating)
{ {
TranslateStartX = MousePos.X; TranslateStartX = MousePos.X;
TranslateStartY = MousePos.Y; TranslateStartY = MousePos.Y;
Translating = true; Translating = true;
} }
else else
{ {
translate += tvectX * (TranslateStartX - MousePos.X)*TranslateSpeed + translate += tvectX * (TranslateStartX - MousePos.X)*TranslateSpeed +
tvectY * (TranslateStartY - MousePos.Y)*TranslateSpeed; tvectY * (TranslateStartY - MousePos.Y)*TranslateSpeed;
} }
} }
else else
{ {
if (Translating) if (Translating)
{ {
translate += tvectX * (TranslateStartX - MousePos.X)*TranslateSpeed + translate += tvectX * (TranslateStartX - MousePos.X)*TranslateSpeed +
tvectY * (TranslateStartY - MousePos.Y)*TranslateSpeed; tvectY * (TranslateStartY - MousePos.Y)*TranslateSpeed;
OldTarget = translate; OldTarget = translate;
} }
Translating = false; Translating = false;
} }
// Rotation ------------------------------------ // Rotation ------------------------------------
if (isMouseKeyDown(0) && !Zooming) if (isMouseKeyDown(0) && !Zooming)
{ {
if (!Rotating) if (!Rotating)
{ {
RotateStartX = MousePos.X; RotateStartX = MousePos.X;
RotateStartY = MousePos.Y; RotateStartY = MousePos.Y;
Rotating = true; Rotating = true;
nRotX = RotX; nRotX = RotX;
nRotY = RotY; nRotY = RotY;
} }
else else
{ {
nRotX += (RotateStartX - MousePos.X) * RotateSpeed; nRotX += (RotateStartX - MousePos.X) * RotateSpeed;
nRotY += (RotateStartY - MousePos.Y) * RotateSpeed; nRotY += (RotateStartY - MousePos.Y) * RotateSpeed;
} }
} }
else else
{ {
if (Rotating) if (Rotating)
{ {
RotX = RotX + (RotateStartX - MousePos.X) * RotateSpeed; RotX = RotX + (RotateStartX - MousePos.X) * RotateSpeed;
RotY = RotY + (RotateStartY - MousePos.Y) * RotateSpeed; RotY = RotY + (RotateStartY - MousePos.Y) * RotateSpeed;
nRotX = RotX; nRotX = RotX;
nRotY = RotY; nRotY = RotY;
} }
Rotating = false; Rotating = false;
} }
// Set Pos ------------------------------------ // Set Pos ------------------------------------
Target = translate; Target = translate;
Pos.X = nZoom + Target.X; Pos.X = nZoom + Target.X;
Pos.Y = Target.Y; Pos.Y = Target.Y;
Pos.Z = Target.Z; Pos.Z = Target.Z;
Pos.rotateXYBy(nRotY, Target); Pos.rotateXYBy(nRotY, Target);
Pos.rotateXZBy(-nRotX, Target); Pos.rotateXZBy(-nRotX, Target);
// Rotation Error ---------------------------- // Rotation Error ----------------------------
// jox: fixed bug: jitter when rotating to the top and bottom of y // jox: fixed bug: jitter when rotating to the top and bottom of y
UpVector.set(0,1,0); UpVector.set(0,1,0);
UpVector.rotateXYBy(-nRotY); UpVector.rotateXYBy(-nRotY);
UpVector.rotateXZBy(-nRotX+180.f); UpVector.rotateXZBy(-nRotX+180.f);
camera->setPosition(Pos); camera->setPosition(Pos);
camera->setTarget(Target); camera->setTarget(Target);
camera->setUpVector(UpVector); camera->setUpVector(UpVector);
} }
bool CSceneNodeAnimatorCameraMaya::isMouseKeyDown(s32 key) bool CSceneNodeAnimatorCameraMaya::isMouseKeyDown(s32 key)
{ {
return MouseKeys[key]; return MouseKeys[key];
} }
void CSceneNodeAnimatorCameraMaya::allKeysUp() void CSceneNodeAnimatorCameraMaya::allKeysUp()
{ {
for (s32 i=0; i<3; ++i) for (s32 i=0; i<3; ++i)
MouseKeys[i] = false; MouseKeys[i] = false;
} }
// function added by jox // function added by jox
void CSceneNodeAnimatorCameraMaya::updateAnimationState() void CSceneNodeAnimatorCameraMaya::updateAnimationState()
{ {
core::vector3df pos(Pos - Target); core::vector3df pos(Pos - Target);
// X rotation // X rotation
core::vector2df vec2d(pos.X, pos.Z); core::vector2df vec2d(pos.X, pos.Z);
RotX = (f32)vec2d.getAngle(); RotX = (f32)vec2d.getAngle();
// Y rotation // Y rotation
pos.rotateXZBy(RotX); pos.rotateXZBy(RotX);
vec2d.set(pos.X, pos.Y); vec2d.set(pos.X, pos.Y);
RotY = -(f32)vec2d.getAngle(); RotY = -(f32)vec2d.getAngle();
// Zoom // Zoom
CurrentZoom = (f32)Pos.getDistanceFrom(Target); CurrentZoom = (f32)Pos.getDistanceFrom(Target);
} }
//! Sets the rotation speed //! Sets the rotation speed
void CSceneNodeAnimatorCameraMaya::setRotateSpeed(f32 speed) void CSceneNodeAnimatorCameraMaya::setRotateSpeed(f32 speed)
{ {
RotateSpeed = speed; RotateSpeed = speed;
} }
//! Sets the movement speed //! Sets the movement speed
void CSceneNodeAnimatorCameraMaya::setMoveSpeed(f32 speed) void CSceneNodeAnimatorCameraMaya::setMoveSpeed(f32 speed)
{ {
TranslateSpeed = speed; TranslateSpeed = speed;
} }
//! Sets the zoom speed //! Sets the zoom speed
void CSceneNodeAnimatorCameraMaya::setZoomSpeed(f32 speed) void CSceneNodeAnimatorCameraMaya::setZoomSpeed(f32 speed)
{ {
ZoomSpeed = speed; ZoomSpeed = speed;
} }
//! Gets the rotation speed //! Gets the rotation speed
f32 CSceneNodeAnimatorCameraMaya::getRotateSpeed() const f32 CSceneNodeAnimatorCameraMaya::getRotateSpeed() const
{ {
return RotateSpeed; return RotateSpeed;
} }
// Gets the movement speed // Gets the movement speed
f32 CSceneNodeAnimatorCameraMaya::getMoveSpeed() const f32 CSceneNodeAnimatorCameraMaya::getMoveSpeed() const
{ {
return TranslateSpeed; return TranslateSpeed;
} }
//! Gets the zoom speed //! Gets the zoom speed
f32 CSceneNodeAnimatorCameraMaya::getZoomSpeed() const f32 CSceneNodeAnimatorCameraMaya::getZoomSpeed() const
{ {
return ZoomSpeed; return ZoomSpeed;
} }
ISceneNodeAnimator* CSceneNodeAnimatorCameraMaya::createClone(ISceneNode* node, ISceneManager* newManager)
} // end namespace {
} // end namespace CSceneNodeAnimatorCameraMaya * newAnimator =
new CSceneNodeAnimatorCameraMaya(CursorControl, RotateSpeed, ZoomSpeed, TranslateSpeed);
return newAnimator;
}
} // end namespace
} // end namespace
...@@ -70,6 +70,12 @@ namespace scene ...@@ -70,6 +70,12 @@ namespace scene
return ESNAT_CAMERA_MAYA; return ESNAT_CAMERA_MAYA;
} }
//! Creates a clone of this animator.
/** Please note that you will have to drop
(IReferenceCounted::drop()) the returned pointer after calling
this. */
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
private: private:
void allKeysUp(); void allKeysUp();
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CSceneNodeAnimatorCollisionResponse.h" #include "CSceneNodeAnimatorCollisionResponse.h"
#include "ISceneCollisionManager.h" #include "ISceneCollisionManager.h"
#include "ISceneManager.h" #include "ISceneManager.h"
#include "ICameraSceneNode.h" #include "ICameraSceneNode.h"
#include "os.h" #include "os.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
//! constructor //! constructor
CSceneNodeAnimatorCollisionResponse::CSceneNodeAnimatorCollisionResponse( CSceneNodeAnimatorCollisionResponse::CSceneNodeAnimatorCollisionResponse(
ISceneManager* scenemanager, ISceneManager* scenemanager,
ITriangleSelector* world, ISceneNode* object, ITriangleSelector* world, ISceneNode* object,
const core::vector3df& ellipsoidRadius, const core::vector3df& ellipsoidRadius,
const core::vector3df& gravityPerSecond, const core::vector3df& gravityPerSecond,
const core::vector3df& ellipsoidTranslation, const core::vector3df& ellipsoidTranslation,
f32 slidingSpeed) f32 slidingSpeed)
: Radius(ellipsoidRadius), Gravity(gravityPerSecond / 1000.0f), Translation(ellipsoidTranslation), : Radius(ellipsoidRadius), Gravity(gravityPerSecond / 1000.0f), Translation(ellipsoidTranslation),
World(world), Object(object), SceneManager(scenemanager), World(world), Object(object), SceneManager(scenemanager),
SlidingSpeed(slidingSpeed), Falling(false), IsCamera(false), AnimateCameraTarget(true) SlidingSpeed(slidingSpeed), Falling(false), IsCamera(false), AnimateCameraTarget(true)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CSceneNodeAnimatorCollisionResponse"); setDebugName("CSceneNodeAnimatorCollisionResponse");
#endif #endif
if (World) if (World)
World->grab(); World->grab();
setNode(Object); setNode(Object);
} }
//! destructor //! destructor
CSceneNodeAnimatorCollisionResponse::~CSceneNodeAnimatorCollisionResponse() CSceneNodeAnimatorCollisionResponse::~CSceneNodeAnimatorCollisionResponse()
{ {
if (World) if (World)
World->drop(); World->drop();
} }
//! Returns if the attached scene node is falling, which means that //! Returns if the attached scene node is falling, which means that
//! there is no blocking wall from the scene node in the direction of //! there is no blocking wall from the scene node in the direction of
//! the gravity. //! the gravity.
bool CSceneNodeAnimatorCollisionResponse::isFalling() const bool CSceneNodeAnimatorCollisionResponse::isFalling() const
{ {
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return Falling; return Falling;
} }
//! Sets the radius of the ellipsoid with which collision detection and //! Sets the radius of the ellipsoid with which collision detection and
//! response is done. //! response is done.
void CSceneNodeAnimatorCollisionResponse::setEllipsoidRadius( void CSceneNodeAnimatorCollisionResponse::setEllipsoidRadius(
const core::vector3df& radius) const core::vector3df& radius)
{ {
Radius = radius; Radius = radius;
} }
//! Returns the radius of the ellipsoid with wich the collision detection and //! Returns the radius of the ellipsoid with wich the collision detection and
//! response is done. //! response is done.
core::vector3df CSceneNodeAnimatorCollisionResponse::getEllipsoidRadius() const core::vector3df CSceneNodeAnimatorCollisionResponse::getEllipsoidRadius() const
{ {
return Radius; return Radius;
} }
//! Sets the gravity of the environment. //! Sets the gravity of the environment.
void CSceneNodeAnimatorCollisionResponse::setGravity(const core::vector3df& gravity) void CSceneNodeAnimatorCollisionResponse::setGravity(const core::vector3df& gravity)
{ {
Gravity = gravity; Gravity = gravity;
} }
//! Returns current vector of gravity. //! Returns current vector of gravity.
core::vector3df CSceneNodeAnimatorCollisionResponse::getGravity() const core::vector3df CSceneNodeAnimatorCollisionResponse::getGravity() const
{ {
return Gravity; return Gravity;
} }
//! Sets the translation of the ellipsoid for collision detection. //! Sets the translation of the ellipsoid for collision detection.
void CSceneNodeAnimatorCollisionResponse::setEllipsoidTranslation(const core::vector3df &translation) void CSceneNodeAnimatorCollisionResponse::setEllipsoidTranslation(const core::vector3df &translation)
{ {
Translation = translation; Translation = translation;
} }
//! Returns the translation of the ellipsoid for collision detection. //! Returns the translation of the ellipsoid for collision detection.
core::vector3df CSceneNodeAnimatorCollisionResponse::getEllipsoidTranslation() const core::vector3df CSceneNodeAnimatorCollisionResponse::getEllipsoidTranslation() const
{ {
return Translation; return Translation;
} }
//! Sets a triangle selector holding all triangles of the world with which //! Sets a triangle selector holding all triangles of the world with which
//! the scene node may collide. //! the scene node may collide.
void CSceneNodeAnimatorCollisionResponse::setWorld(ITriangleSelector* newWorld) void CSceneNodeAnimatorCollisionResponse::setWorld(ITriangleSelector* newWorld)
{ {
Falling = false; Falling = false;
LastTime = os::Timer::getTime(); LastTime = os::Timer::getTime();
FallStartTime = LastTime; FallStartTime = LastTime;
if (World) if (World)
World->drop(); World->drop();
World = newWorld; World = newWorld;
if (World) if (World)
World->grab(); World->grab();
} }
//! Returns the current triangle selector containing all triangles for //! Returns the current triangle selector containing all triangles for
//! collision detection. //! collision detection.
ITriangleSelector* CSceneNodeAnimatorCollisionResponse::getWorld() const ITriangleSelector* CSceneNodeAnimatorCollisionResponse::getWorld() const
{ {
return World; return World;
} }
void CSceneNodeAnimatorCollisionResponse::animateNode(ISceneNode* node, u32 timeMs) void CSceneNodeAnimatorCollisionResponse::animateNode(ISceneNode* node, u32 timeMs)
{ {
if (node != Object) if (node != Object)
{ {
setNode(node); setNode(node);
return; return;
} }
if (!World) if (!World)
return; return;
u32 diff = timeMs - LastTime; u32 diff = timeMs - LastTime;
LastTime = timeMs; LastTime = timeMs;
core::vector3df pos = Object->getPosition(); core::vector3df pos = Object->getPosition();
core::vector3df vel = pos - LastPosition; core::vector3df vel = pos - LastPosition;
//g = Gravity * (f32)((timeMs - FallStartTime) * diff); //g = Gravity * (f32)((timeMs - FallStartTime) * diff);
f32 dt = 1.f; f32 dt = 1.f;
if (Falling) if (Falling)
{ {
dt = f32 ( ( timeMs - FallStartTime ) * diff ); dt = f32 ( ( timeMs - FallStartTime ) * diff );
} }
core::vector3df g = Gravity * dt; core::vector3df g = Gravity * dt;
core::triangle3df triangle = RefTriangle; core::triangle3df triangle = RefTriangle;
core::vector3df force = vel + g; core::vector3df force = vel + g;
const core::vector3df nullVector ( 0.f, 0.f, 0.f ); const core::vector3df nullVector ( 0.f, 0.f, 0.f );
if ( force != nullVector ) if ( force != nullVector )
{ {
// TODO: divide SlidingSpeed by frame time // TODO: divide SlidingSpeed by frame time
bool f = false; bool f = false;
pos = SceneManager->getSceneCollisionManager()->getCollisionResultPosition( pos = SceneManager->getSceneCollisionManager()->getCollisionResultPosition(
World, LastPosition-Translation, World, LastPosition-Translation,
Radius, vel, triangle, f, SlidingSpeed, g); Radius, vel, triangle, f, SlidingSpeed, g);
pos += Translation; pos += Translation;
if (f)//triangle == RefTriangle) if (f)//triangle == RefTriangle)
{ {
if (!Falling) if (!Falling)
FallStartTime = timeMs; FallStartTime = timeMs;
Falling = true; Falling = true;
} }
else else
Falling = false; Falling = false;
Object->setPosition(pos); Object->setPosition(pos);
} }
// move camera target // move camera target
if (AnimateCameraTarget && IsCamera) if (AnimateCameraTarget && IsCamera)
{ {
const core::vector3df diff = Object->getPosition() - LastPosition - vel; const core::vector3df diff = Object->getPosition() - LastPosition - vel;
ICameraSceneNode* cam = (ICameraSceneNode*)Object; ICameraSceneNode* cam = (ICameraSceneNode*)Object;
cam->setTarget(cam->getTarget() + diff); cam->setTarget(cam->getTarget() + diff);
} }
LastPosition = Object->getPosition(); LastPosition = Object->getPosition();
} }
void CSceneNodeAnimatorCollisionResponse::setNode(ISceneNode* node) void CSceneNodeAnimatorCollisionResponse::setNode(ISceneNode* node)
{ {
Object = node; Object = node;
if (Object) if (Object)
{ {
LastPosition = Object->getPosition(); LastPosition = Object->getPosition();
IsCamera = (Object->getType() == ESNT_CAMERA); IsCamera = (Object->getType() == ESNT_CAMERA);
} }
LastTime = os::Timer::getTime(); LastTime = os::Timer::getTime();
FallStartTime = LastTime; FallStartTime = LastTime;
} }
//! Writes attributes of the scene node animator. //! Writes attributes of the scene node animator.
void CSceneNodeAnimatorCollisionResponse::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const void CSceneNodeAnimatorCollisionResponse::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{ {
out->addVector3d("Radius", Radius); out->addVector3d("Radius", Radius);
out->addVector3d("Gravity", Gravity); out->addVector3d("Gravity", Gravity);
out->addVector3d("Translation", Translation); out->addVector3d("Translation", Translation);
out->addBool("AnimateCameraTarget", AnimateCameraTarget); out->addBool("AnimateCameraTarget", AnimateCameraTarget);
} }
//! Reads attributes of the scene node animator. //! Reads attributes of the scene node animator.
void CSceneNodeAnimatorCollisionResponse::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) void CSceneNodeAnimatorCollisionResponse::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{ {
Radius = in->getAttributeAsVector3d("Radius"); Radius = in->getAttributeAsVector3d("Radius");
Gravity = in->getAttributeAsVector3d("Gravity"); Gravity = in->getAttributeAsVector3d("Gravity");
Translation = in->getAttributeAsVector3d("Translation"); Translation = in->getAttributeAsVector3d("Translation");
AnimateCameraTarget = in->getAttributeAsBool("AnimateCameraTarget"); AnimateCameraTarget = in->getAttributeAsBool("AnimateCameraTarget");
} }
ISceneNodeAnimator* CSceneNodeAnimatorCollisionResponse::createClone(ISceneNode* node, ISceneManager* newManager)
{
} // end namespace scene if (!newManager) newManager = SceneManager;
} // end namespace irr
CSceneNodeAnimatorCollisionResponse * newAnimator =
new CSceneNodeAnimatorCollisionResponse(newManager, World, Object, Radius, (Gravity * 1000.0f), Translation,
SlidingSpeed);
return newAnimator;
}
} // end namespace scene
} // end namespace irr
...@@ -79,6 +79,12 @@ namespace scene ...@@ -79,6 +79,12 @@ namespace scene
//! Returns type of the scene node animator //! Returns type of the scene node animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_COLLISION_RESPONSE; } virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_COLLISION_RESPONSE; }
//! Creates a clone of this animator.
/** Please note that you will have to drop
(IReferenceCounted::drop()) the returned pointer after calling
this. */
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
private: private:
......
...@@ -40,6 +40,13 @@ void CSceneNodeAnimatorDelete::animateNode(ISceneNode* node, u32 timeMs) ...@@ -40,6 +40,13 @@ void CSceneNodeAnimatorDelete::animateNode(ISceneNode* node, u32 timeMs)
} }
} }
ISceneNodeAnimator* CSceneNodeAnimatorDelete::createClone(ISceneNode* node, ISceneManager* newManager)
{
CSceneNodeAnimatorDelete * newAnimator =
new CSceneNodeAnimatorDelete(SceneManager, DeleteTime);
return newAnimator;
}
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_SCENE_NODE_ANIMATOR_DELETE_H_INCLUDED__ #ifndef __C_SCENE_NODE_ANIMATOR_DELETE_H_INCLUDED__
#define __C_SCENE_NODE_ANIMATOR_DELETE_H_INCLUDED__ #define __C_SCENE_NODE_ANIMATOR_DELETE_H_INCLUDED__
#include "ISceneNode.h" #include "ISceneNode.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
class CSceneNodeAnimatorDelete : public ISceneNodeAnimator class CSceneNodeAnimatorDelete : public ISceneNodeAnimator
{ {
public: public:
//! constructor //! constructor
CSceneNodeAnimatorDelete(ISceneManager* manager, u32 when); CSceneNodeAnimatorDelete(ISceneManager* manager, u32 when);
//! destructor //! destructor
virtual ~CSceneNodeAnimatorDelete(); virtual ~CSceneNodeAnimatorDelete();
//! animates a scene node //! animates a scene node
virtual void animateNode(ISceneNode* node, u32 timeMs); virtual void animateNode(ISceneNode* node, u32 timeMs);
//! Returns type of the scene node animator //! Returns type of the scene node animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const virtual ESCENE_NODE_ANIMATOR_TYPE getType() const
{ {
return ESNAT_DELETION; return ESNAT_DELETION;
} }
private: //! Creates a clone of this animator.
/** Please note that you will have to drop
u32 DeleteTime; (IReferenceCounted::drop()) the returned pointer after calling
ISceneManager* SceneManager; this. */
}; virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
private:
} // end namespace scene
} // end namespace irr u32 DeleteTime;
ISceneManager* SceneManager;
#endif };
} // end namespace scene
} // end namespace irr
#endif
...@@ -70,6 +70,13 @@ void CSceneNodeAnimatorFlyCircle::deserializeAttributes(io::IAttributes* in, io: ...@@ -70,6 +70,13 @@ void CSceneNodeAnimatorFlyCircle::deserializeAttributes(io::IAttributes* in, io:
init(); init();
} }
ISceneNodeAnimator* CSceneNodeAnimatorFlyCircle::createClone(ISceneNode* node, ISceneManager* newManager)
{
CSceneNodeAnimatorFlyCircle * newAnimator =
new CSceneNodeAnimatorFlyCircle(StartTime, Center, Radius, Speed, Direction);
return newAnimator;
}
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
...@@ -31,6 +31,12 @@ namespace scene ...@@ -31,6 +31,12 @@ namespace scene
//! Returns type of the scene node animator //! Returns type of the scene node animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_FLY_CIRCLE; } virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_FLY_CIRCLE; }
//! Creates a clone of this animator.
/** Please note that you will have to drop
(IReferenceCounted::drop()) the returned pointer after calling
this. */
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
private: private:
// do some initial calculations // do some initial calculations
......
...@@ -81,6 +81,13 @@ void CSceneNodeAnimatorFlyStraight::deserializeAttributes(io::IAttributes* in, i ...@@ -81,6 +81,13 @@ void CSceneNodeAnimatorFlyStraight::deserializeAttributes(io::IAttributes* in, i
recalculateImidiateValues(); recalculateImidiateValues();
} }
ISceneNodeAnimator* CSceneNodeAnimatorFlyStraight::createClone(ISceneNode* node, ISceneManager* newManager)
{
CSceneNodeAnimatorFlyStraight * newAnimator =
new CSceneNodeAnimatorFlyStraight(Start, End, TimeForWay, Loop, StartTime);
return newAnimator;
}
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
...@@ -35,6 +35,12 @@ namespace scene ...@@ -35,6 +35,12 @@ namespace scene
//! Returns type of the scene node animator //! Returns type of the scene node animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_FLY_STRAIGHT; } virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_FLY_STRAIGHT; }
//! Creates a clone of this animator.
/** Please note that you will have to drop
(IReferenceCounted::drop()) the returned pointer after calling
this. */
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
private: private:
......
// Copyright (C) 2002-2008 Nikolaus Gebhardt // Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CSceneNodeAnimatorFollowSpline.h" #include "CSceneNodeAnimatorFollowSpline.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
//! constructor //! constructor
CSceneNodeAnimatorFollowSpline::CSceneNodeAnimatorFollowSpline(u32 time, CSceneNodeAnimatorFollowSpline::CSceneNodeAnimatorFollowSpline(u32 time,
const core::array<core::vector3df>& points, f32 speed, const core::array<core::vector3df>& points, f32 speed,
f32 tightness) f32 tightness)
: Points(points), Speed(speed), Tightness(tightness), StartTime(time) : Points(points), Speed(speed), Tightness(tightness), StartTime(time)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CSceneNodeAnimatorFollowSpline"); setDebugName("CSceneNodeAnimatorFollowSpline");
#endif #endif
} }
inline s32 CSceneNodeAnimatorFollowSpline::clamp(s32 idx, s32 size) inline s32 CSceneNodeAnimatorFollowSpline::clamp(s32 idx, s32 size)
{ {
return ( idx<0 ? size+idx : ( idx>=size ? idx-size : idx ) ); return ( idx<0 ? size+idx : ( idx>=size ? idx-size : idx ) );
} }
//! animates a scene node //! animates a scene node
void CSceneNodeAnimatorFollowSpline::animateNode(ISceneNode* node, u32 timeMs) void CSceneNodeAnimatorFollowSpline::animateNode(ISceneNode* node, u32 timeMs)
{ {
const u32 pSize = Points.size(); const u32 pSize = Points.size();
if (pSize==0) if (pSize==0)
return; return;
if (pSize==1) if (pSize==1)
{ {
node->setPosition(Points[0]); node->setPosition(Points[0]);
return; return;
} }
const f32 dt = ( (timeMs-StartTime) * Speed * 0.001f ); const f32 dt = ( (timeMs-StartTime) * Speed * 0.001f );
const f32 u = core::fract ( dt ); const f32 u = core::fract ( dt );
const s32 idx = core::floor32( dt ) % pSize; const s32 idx = core::floor32( dt ) % pSize;
//const f32 u = 0.001f * fmodf( dt, 1000.0f ); //const f32 u = 0.001f * fmodf( dt, 1000.0f );
const core::vector3df& p0 = Points[ clamp( idx - 1, pSize ) ]; const core::vector3df& p0 = Points[ clamp( idx - 1, pSize ) ];
const core::vector3df& p1 = Points[ clamp( idx + 0, pSize ) ]; // starting point const core::vector3df& p1 = Points[ clamp( idx + 0, pSize ) ]; // starting point
const core::vector3df& p2 = Points[ clamp( idx + 1, pSize ) ]; // end point const core::vector3df& p2 = Points[ clamp( idx + 1, pSize ) ]; // end point
const core::vector3df& p3 = Points[ clamp( idx + 2, pSize ) ]; const core::vector3df& p3 = Points[ clamp( idx + 2, pSize ) ];
// hermite polynomials // hermite polynomials
const f32 h1 = 2.0f * u * u * u - 3.0f * u * u + 1.0f; const f32 h1 = 2.0f * u * u * u - 3.0f * u * u + 1.0f;
const f32 h2 = -2.0f * u * u * u + 3.0f * u * u; const f32 h2 = -2.0f * u * u * u + 3.0f * u * u;
const f32 h3 = u * u * u - 2.0f * u * u + u; const f32 h3 = u * u * u - 2.0f * u * u + u;
const f32 h4 = u * u * u - u * u; const f32 h4 = u * u * u - u * u;
// tangents // tangents
const core::vector3df t1 = ( p2 - p0 ) * Tightness; const core::vector3df t1 = ( p2 - p0 ) * Tightness;
const core::vector3df t2 = ( p3 - p1 ) * Tightness; const core::vector3df t2 = ( p3 - p1 ) * Tightness;
// interpolated point // interpolated point
node->setPosition(p1 * h1 + p2 * h2 + t1 * h3 + t2 * h4); node->setPosition(p1 * h1 + p2 * h2 + t1 * h3 + t2 * h4);
} }
//! Writes attributes of the scene node animator. //! Writes attributes of the scene node animator.
void CSceneNodeAnimatorFollowSpline::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const void CSceneNodeAnimatorFollowSpline::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{ {
out->addFloat("Speed", Speed); out->addFloat("Speed", Speed);
out->addFloat("Tightness", Tightness); out->addFloat("Tightness", Tightness);
u32 count = Points.size(); u32 count = Points.size();
if ( options && (options->Flags & io::EARWF_FOR_EDITOR)) if ( options && (options->Flags & io::EARWF_FOR_EDITOR))
{ {
// add one point in addition when serializing for editors // add one point in addition when serializing for editors
// to make it easier to add points quickly // to make it easier to add points quickly
count += 1; count += 1;
} }
for (u32 i=0; i<count; ++i) for (u32 i=0; i<count; ++i)
{ {
core::stringc tname = "Point"; core::stringc tname = "Point";
tname += (int)(i+1); tname += (int)(i+1);
out->addVector3d(tname.c_str(), i<Points.size() ? Points[i] : core::vector3df(0,0,0) ); out->addVector3d(tname.c_str(), i<Points.size() ? Points[i] : core::vector3df(0,0,0) );
} }
} }
//! Reads attributes of the scene node animator. //! Reads attributes of the scene node animator.
void CSceneNodeAnimatorFollowSpline::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) void CSceneNodeAnimatorFollowSpline::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{ {
Speed = in->getAttributeAsFloat("Speed"); Speed = in->getAttributeAsFloat("Speed");
Tightness = in->getAttributeAsFloat("Tightness"); Tightness = in->getAttributeAsFloat("Tightness");
Points.clear(); Points.clear();
for(u32 i=1; true; ++i) for(u32 i=1; true; ++i)
{ {
core::stringc pname = "Point"; core::stringc pname = "Point";
pname += i; pname += i;
if (in->existsAttribute(pname.c_str())) if (in->existsAttribute(pname.c_str()))
Points.push_back(in->getAttributeAsVector3d(pname.c_str())); Points.push_back(in->getAttributeAsVector3d(pname.c_str()));
else else
break; break;
} }
// remove last point if double entry from editor // remove last point if double entry from editor
if ( options && (options->Flags & io::EARWF_FOR_EDITOR) && if ( options && (options->Flags & io::EARWF_FOR_EDITOR) &&
Points.size() > 2 && Points.getLast() == core::vector3df(0,0,0)) Points.size() > 2 && Points.getLast() == core::vector3df(0,0,0))
{ {
Points.erase(Points.size()-1); Points.erase(Points.size()-1);
if (Points.size() > 2 && Points.getLast() == core::vector3df(0,0,0)) if (Points.size() > 2 && Points.getLast() == core::vector3df(0,0,0))
Points.erase(Points.size()-1); Points.erase(Points.size()-1);
} }
} }
ISceneNodeAnimator* CSceneNodeAnimatorFollowSpline::createClone(ISceneNode* node, ISceneManager* newManager)
} // end namespace scene {
} // end namespace irr CSceneNodeAnimatorFollowSpline * newAnimator =
new CSceneNodeAnimatorFollowSpline(StartTime, Points, Speed, Tightness);
return newAnimator;
}
} // end namespace scene
} // end namespace irr
...@@ -34,6 +34,12 @@ namespace scene ...@@ -34,6 +34,12 @@ namespace scene
//! Returns type of the scene node animator //! Returns type of the scene node animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_FOLLOW_SPLINE; } virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_FOLLOW_SPLINE; }
//! Creates a clone of this animator.
/** Please note that you will have to drop
(IReferenceCounted::drop()) the returned pointer after calling
this. */
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
protected: protected:
......
...@@ -56,6 +56,13 @@ void CSceneNodeAnimatorRotation::deserializeAttributes(io::IAttributes* in, io:: ...@@ -56,6 +56,13 @@ void CSceneNodeAnimatorRotation::deserializeAttributes(io::IAttributes* in, io::
Rotation = in->getAttributeAsVector3d("Rotation"); Rotation = in->getAttributeAsVector3d("Rotation");
} }
ISceneNodeAnimator* CSceneNodeAnimatorRotation::createClone(ISceneNode* node, ISceneManager* newManager)
{
CSceneNodeAnimatorRotation * newAnimator =
new CSceneNodeAnimatorRotation(StartTime, Rotation);
return newAnimator;
}
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
...@@ -32,6 +32,12 @@ namespace scene ...@@ -32,6 +32,12 @@ namespace scene
//! Returns type of the scene node animator //! Returns type of the scene node animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_ROTATION; } virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_ROTATION; }
//! Creates a clone of this animator.
/** Please note that you will have to drop
(IReferenceCounted::drop()) the returned pointer after calling
this. */
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
private: private:
......
...@@ -118,6 +118,13 @@ void CSceneNodeAnimatorTexture::deserializeAttributes(io::IAttributes* in, io::S ...@@ -118,6 +118,13 @@ void CSceneNodeAnimatorTexture::deserializeAttributes(io::IAttributes* in, io::S
} }
} }
ISceneNodeAnimator* CSceneNodeAnimatorTexture::createClone(ISceneNode* node, ISceneManager* newManager)
{
CSceneNodeAnimatorTexture * newAnimator =
new CSceneNodeAnimatorTexture(Textures, TimePerFrame, Loop, StartTime);
return newAnimator;
}
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
......
...@@ -34,6 +34,12 @@ namespace scene ...@@ -34,6 +34,12 @@ namespace scene
//! Returns type of the scene node animator //! Returns type of the scene node animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_TEXTURE; } virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_TEXTURE; }
//! Creates a clone of this animator.
/** Please note that you will have to drop
(IReferenceCounted::drop()) the returned pointer after calling
this. */
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
private: private:
......
...@@ -170,6 +170,8 @@ ...@@ -170,6 +170,8 @@
0968406D0D0F1A2300333EFD /* CSTLMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840440D0F1A2300333EFD /* CSTLMeshFileLoader.h */; }; 0968406D0D0F1A2300333EFD /* CSTLMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840440D0F1A2300333EFD /* CSTLMeshFileLoader.h */; };
0968406E0D0F1A2300333EFD /* CSTLMeshWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840450D0F1A2300333EFD /* CSTLMeshWriter.cpp */; }; 0968406E0D0F1A2300333EFD /* CSTLMeshWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840450D0F1A2300333EFD /* CSTLMeshWriter.cpp */; };
0968406F0D0F1A2300333EFD /* CSTLMeshWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840460D0F1A2300333EFD /* CSTLMeshWriter.h */; }; 0968406F0D0F1A2300333EFD /* CSTLMeshWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840460D0F1A2300333EFD /* CSTLMeshWriter.h */; };
096F8E3D0EA2EFBA00907EC5 /* COBJMeshWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096F8E3B0EA2EFBA00907EC5 /* COBJMeshWriter.cpp */; };
096F8E3E0EA2EFBA00907EC5 /* COBJMeshWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 096F8E3C0EA2EFBA00907EC5 /* COBJMeshWriter.h */; };
09C638720D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09C638700D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp */; }; 09C638720D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09C638700D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp */; };
09C638730D4F1A69000B6A18 /* CLWOMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 09C638710D4F1A69000B6A18 /* CLWOMeshFileLoader.h */; }; 09C638730D4F1A69000B6A18 /* CLWOMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 09C638710D4F1A69000B6A18 /* CLWOMeshFileLoader.h */; };
09F460EB0D3223ED00D0A9B0 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09F6492E0D2CE038001E0599 /* main.cpp */; }; 09F460EB0D3223ED00D0A9B0 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09F6492E0D2CE038001E0599 /* main.cpp */; };
...@@ -894,6 +896,8 @@ ...@@ -894,6 +896,8 @@
096840440D0F1A2300333EFD /* CSTLMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSTLMeshFileLoader.h; sourceTree = "<group>"; }; 096840440D0F1A2300333EFD /* CSTLMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSTLMeshFileLoader.h; sourceTree = "<group>"; };
096840450D0F1A2300333EFD /* CSTLMeshWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSTLMeshWriter.cpp; sourceTree = "<group>"; }; 096840450D0F1A2300333EFD /* CSTLMeshWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSTLMeshWriter.cpp; sourceTree = "<group>"; };
096840460D0F1A2300333EFD /* CSTLMeshWriter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSTLMeshWriter.h; sourceTree = "<group>"; }; 096840460D0F1A2300333EFD /* CSTLMeshWriter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSTLMeshWriter.h; sourceTree = "<group>"; };
096F8E3B0EA2EFBA00907EC5 /* COBJMeshWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = COBJMeshWriter.cpp; sourceTree = "<group>"; };
096F8E3C0EA2EFBA00907EC5 /* COBJMeshWriter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = COBJMeshWriter.h; sourceTree = "<group>"; };
09C638700D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CLWOMeshFileLoader.cpp; sourceTree = "<group>"; }; 09C638700D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CLWOMeshFileLoader.cpp; sourceTree = "<group>"; };
09C638710D4F1A69000B6A18 /* CLWOMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CLWOMeshFileLoader.h; sourceTree = "<group>"; }; 09C638710D4F1A69000B6A18 /* CLWOMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CLWOMeshFileLoader.h; sourceTree = "<group>"; };
09F649030D2CDED9001E0599 /* HelloWorld_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 09F649030D2CDED9001E0599 /* HelloWorld_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; };
...@@ -1224,7 +1228,7 @@ ...@@ -1224,7 +1228,7 @@
4C53E18D0A484C2C0014E966 /* uncompr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = uncompr.c; sourceTree = "<group>"; }; 4C53E18D0A484C2C0014E966 /* uncompr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = uncompr.c; sourceTree = "<group>"; };
4C53E1920A484C2C0014E966 /* zutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = zutil.c; sourceTree = "<group>"; }; 4C53E1920A484C2C0014E966 /* zutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = zutil.c; sourceTree = "<group>"; };
4C53E24D0A4850120014E966 /* libIrrlicht.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIrrlicht.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4C53E24D0A4850120014E966 /* libIrrlicht.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIrrlicht.a; sourceTree = BUILT_PRODUCTS_DIR; };
4C53E2520A4850550014E966 /* Quake3Map_dbg.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Quake3Map_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4C53E2520A4850550014E966 /* Quake3Map_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Quake3Map_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; };
4C53E26D0A4850D60014E966 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 4C53E26D0A4850D60014E966 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
4C53E26E0A4850D60014E966 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; 4C53E26E0A4850D60014E966 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "DemoApp-Info.plist"; sourceTree = "<group>"; }; 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "DemoApp-Info.plist"; sourceTree = "<group>"; };
...@@ -1292,7 +1296,7 @@ ...@@ -1292,7 +1296,7 @@
4CA25B9A0A485D9800B4E469 /* MeshViewer_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeshViewer_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4CA25B9A0A485D9800B4E469 /* MeshViewer_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeshViewer_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; };
4CA25B9C0A485D9800B4E469 /* RenderToTexture_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RenderToTexture_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4CA25B9C0A485D9800B4E469 /* RenderToTexture_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RenderToTexture_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; };
4CA25B9E0A485D9800B4E469 /* UserInterface_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UserInterface_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4CA25B9E0A485D9800B4E469 /* UserInterface_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UserInterface_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; };
4CA25BA00A485D9800B4E469 /* PerPixelLighting_dbg.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = PerPixelLighting_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4CA25BA00A485D9800B4E469 /* PerPixelLighting_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PerPixelLighting_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; };
4CA25BA20A485D9800B4E469 /* Demo_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4CA25BA20A485D9800B4E469 /* Demo_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; };
4CA25BA40A485D9800B4E469 /* Movement_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Movement_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4CA25BA40A485D9800B4E469 /* Movement_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Movement_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; };
4CA25BA60A485D9800B4E469 /* Shaders_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Shaders_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4CA25BA60A485D9800B4E469 /* Shaders_dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Shaders_dbg.app; sourceTree = BUILT_PRODUCTS_DIR; };
...@@ -2204,6 +2208,8 @@ ...@@ -2204,6 +2208,8 @@
0910BA8A0D1F70B800D46B04 /* writers */ = { 0910BA8A0D1F70B800D46B04 /* writers */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
096F8E3B0EA2EFBA00907EC5 /* COBJMeshWriter.cpp */,
096F8E3C0EA2EFBA00907EC5 /* COBJMeshWriter.h */,
096840250D0F1A2300333EFD /* CColladaMeshWriter.cpp */, 096840250D0F1A2300333EFD /* CColladaMeshWriter.cpp */,
096840260D0F1A2300333EFD /* CColladaMeshWriter.h */, 096840260D0F1A2300333EFD /* CColladaMeshWriter.h */,
0968402D0D0F1A2300333EFD /* CIrrMeshWriter.cpp */, 0968402D0D0F1A2300333EFD /* CIrrMeshWriter.cpp */,
...@@ -2911,6 +2917,7 @@ ...@@ -2911,6 +2917,7 @@
09C638730D4F1A69000B6A18 /* CLWOMeshFileLoader.h in Headers */, 09C638730D4F1A69000B6A18 /* CLWOMeshFileLoader.h in Headers */,
093973C10E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.h in Headers */, 093973C10E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.h in Headers */,
093973C30E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.h in Headers */, 093973C30E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.h in Headers */,
096F8E3E0EA2EFBA00907EC5 /* COBJMeshWriter.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -3866,6 +3873,7 @@ ...@@ -3866,6 +3873,7 @@
09C638720D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp in Sources */, 09C638720D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp in Sources */,
093973C00E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.cpp in Sources */, 093973C00E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.cpp in Sources */,
093973C20E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.cpp in Sources */, 093973C20E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.cpp in Sources */,
096F8E3D0EA2EFBA00907EC5 /* COBJMeshWriter.cpp in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
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