1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
2
// This file is part of the "Irrlicht Engine".
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
5
#ifndef __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
6
#define __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__
8
#include "ISceneNodeAnimatorCameraFPS.h"
10
#include "position2d.h"
24
//! Special scene node animator for FPS cameras
25
class CSceneNodeAnimatorCameraFPS : public ISceneNodeAnimatorCameraFPS
30
CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl,
31
f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, f32 jumpSpeed=0.f,
32
SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false,
36
virtual ~CSceneNodeAnimatorCameraFPS();
38
//! Animates the scene node, currently only works on cameras
39
virtual void animateNode(ISceneNode* node, u32 timeMs);
42
virtual bool OnEvent(const SEvent& event);
44
//! Returns the speed of movement in units per second
45
virtual f32 getMoveSpeed() const;
47
//! Sets the speed of movement in units per second
48
virtual void setMoveSpeed(f32 moveSpeed);
50
//! Returns the rotation speed
51
virtual f32 getRotateSpeed() const;
53
//! Set the rotation speed
54
virtual void setRotateSpeed(f32 rotateSpeed);
56
//! Sets the keyboard mapping for this animator
57
//! \param keymap: an array of keyboard mappings, see SKeyMap
58
//! \param count: the size of the keyboard map array
59
virtual void setKeyMap(SKeyMap *map, u32 count);
61
//! Sets whether vertical movement should be allowed.
62
virtual void setVerticalMovement(bool allow);
64
//! Sets whether the Y axis of the mouse should be inverted.
65
/** If enabled then moving the mouse down will cause
66
the camera to look up. It is disabled by default. */
67
virtual void setInvertMouse(bool invert);
69
//! This animator will receive events when attached to the active camera
70
virtual bool isEventReceiverEnabled() const
75
//! Returns the type of this animator
76
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const
78
return ESNAT_CAMERA_FPS;
81
//! Creates a clone of this animator.
82
/** Please note that you will have to drop
83
(IReferenceCounted::drop()) the returned pointer once you're
85
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
90
SCamKeyMap(s32 a, EKEY_CODE k) : action(a), keycode(k) {}
96
//! Sets the keyboard mapping for this animator
97
/** Helper function for the clone method.
98
\param keymap the new keymap array */
99
void setKeyMap(const core::array<SCamKeyMap>& keymap);
104
gui::ICursorControl *CursorControl;
106
f32 MaxVerticalAngle;
111
// -1.0f for inverted mouse, defaults to 1.0f
114
s32 LastAnimationTime;
116
core::array<SCamKeyMap> KeyMap;
117
core::position2d<f32> CenterCursor, CursorPos;
122
bool NoVerticalMovement;
125
} // end namespace scene
126
} // end namespace irr
128
#endif // __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__