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