diff options
Diffstat (limited to '')
-rw-r--r-- | ClientHamr/extantz/extantzCamera.h | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/ClientHamr/extantz/extantzCamera.h b/ClientHamr/extantz/extantzCamera.h new file mode 100644 index 0000000..a81eb8a --- /dev/null +++ b/ClientHamr/extantz/extantzCamera.h | |||
@@ -0,0 +1,124 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
2 | // This file is part of the "Irrlicht Engine". | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | ||
4 | |||
5 | #ifndef __EXTANTZ_CAMERA_H_INCLUDED__ | ||
6 | #define __EXTANTZ_CAMERA_H_INCLUDED__ | ||
7 | |||
8 | #include <ISceneNodeAnimator.h> | ||
9 | #include <vector2d.h> | ||
10 | #include <position2d.h> | ||
11 | #include <SKeyMap.h> | ||
12 | #include <irrArray.h> | ||
13 | #include <ICameraSceneNode.h> | ||
14 | |||
15 | |||
16 | |||
17 | namespace irr | ||
18 | { | ||
19 | namespace gui | ||
20 | { | ||
21 | class ICursorControl; | ||
22 | } | ||
23 | |||
24 | namespace scene | ||
25 | { | ||
26 | |||
27 | ICameraSceneNode *addExtantzCamera(ISceneManager* sm, ISceneNode* parent, f32 rotateSpeed, f32 moveSpeed, s32 id, SKeyMap* keyMapArray, s32 keyMapSize, bool noVerticalMovement, f32 jumpSpeed, bool invertMouseY, bool makeActive); | ||
28 | |||
29 | class extantzCamera : public ISceneNodeAnimator | ||
30 | { | ||
31 | public: | ||
32 | |||
33 | //! Constructor | ||
34 | extantzCamera(gui::ICursorControl* cursorControl, f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, f32 jumpSpeed=0.f, SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false, bool invertY=false); | ||
35 | |||
36 | //! Destructor | ||
37 | virtual ~extantzCamera(); | ||
38 | |||
39 | //! Animates the scene node, currently only works on cameras | ||
40 | virtual void animateNode(ISceneNode* node, u32 timeMs); | ||
41 | |||
42 | //! Event receiver | ||
43 | virtual bool OnEvent(const SEvent& event); | ||
44 | |||
45 | //! Returns the speed of movement in units per second | ||
46 | virtual f32 getMoveSpeed() const; | ||
47 | |||
48 | //! Sets the speed of movement in units per second | ||
49 | virtual void setMoveSpeed(f32 moveSpeed); | ||
50 | |||
51 | //! Returns the rotation speed | ||
52 | virtual f32 getRotateSpeed() const; | ||
53 | |||
54 | //! Set the rotation speed | ||
55 | virtual void setRotateSpeed(f32 rotateSpeed); | ||
56 | |||
57 | //! Sets the keyboard mapping for this animator (old style) | ||
58 | //! \param keymap: an array of keyboard mappings, see SKeyMap | ||
59 | //! \param count: the size of the keyboard map array | ||
60 | virtual void setKeyMap(SKeyMap *map, u32 count); | ||
61 | |||
62 | //! Sets the keyboard mapping for this animator | ||
63 | //! \param keymap The new keymap array | ||
64 | virtual void setKeyMap(const core::array<SKeyMap>& keymap); | ||
65 | |||
66 | //! Gets the keyboard mapping for this animator | ||
67 | virtual const core::array<SKeyMap>& getKeyMap() const; | ||
68 | |||
69 | //! Sets whether vertical movement should be allowed. | ||
70 | virtual void setVerticalMovement(bool allow); | ||
71 | |||
72 | //! Sets whether the Y axis of the mouse should be inverted. | ||
73 | /** If enabled then moving the mouse down will cause | ||
74 | the camera to look up. It is disabled by default. */ | ||
75 | virtual void setInvertMouse(bool invert); | ||
76 | |||
77 | //! This animator will receive events when attached to the active camera | ||
78 | virtual bool isEventReceiverEnabled() const | ||
79 | { | ||
80 | return true; | ||
81 | } | ||
82 | |||
83 | //! Returns the type of this animator | ||
84 | virtual ESCENE_NODE_ANIMATOR_TYPE getType() const | ||
85 | { | ||
86 | return ESNAT_CAMERA_FPS; | ||
87 | } | ||
88 | |||
89 | //! Creates a clone of this animator. | ||
90 | /** Please note that you will have to drop | ||
91 | (IReferenceCounted::drop()) the returned pointer once you're | ||
92 | done with it. */ | ||
93 | virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0); | ||
94 | |||
95 | private: | ||
96 | void allKeysUp(); | ||
97 | |||
98 | gui::ICursorControl *CursorControl; | ||
99 | |||
100 | f32 MaxVerticalAngle; | ||
101 | |||
102 | f32 MoveSpeed; | ||
103 | f32 RotateSpeed; | ||
104 | f32 JumpSpeed; | ||
105 | // -1.0f for inverted mouse, defaults to 1.0f | ||
106 | f32 MouseYDirection; | ||
107 | |||
108 | s32 LastAnimationTime; | ||
109 | |||
110 | core::array<SKeyMap> KeyMap; | ||
111 | core::position2d<f32> CenterCursor, CursorPos; | ||
112 | |||
113 | bool CursorKeys[EKA_COUNT]; | ||
114 | |||
115 | bool firstUpdate; | ||
116 | bool firstInput; | ||
117 | bool NoVerticalMovement; | ||
118 | }; | ||
119 | |||
120 | } // end namespace scene | ||
121 | } // end namespace irr | ||
122 | |||
123 | #endif // __EXTANTZ_CAMERA_H_INCLUDED__ | ||
124 | |||