diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/include/ICameraSceneNode.h | 414 |
1 files changed, 207 insertions, 207 deletions
diff --git a/libraries/irrlicht-1.8/include/ICameraSceneNode.h b/libraries/irrlicht-1.8/include/ICameraSceneNode.h index a71eb95..dfc1b7a 100644 --- a/libraries/irrlicht-1.8/include/ICameraSceneNode.h +++ b/libraries/irrlicht-1.8/include/ICameraSceneNode.h | |||
@@ -1,207 +1,207 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __I_CAMERA_SCENE_NODE_H_INCLUDED__ | 5 | #ifndef __I_CAMERA_SCENE_NODE_H_INCLUDED__ |
6 | #define __I_CAMERA_SCENE_NODE_H_INCLUDED__ | 6 | #define __I_CAMERA_SCENE_NODE_H_INCLUDED__ |
7 | 7 | ||
8 | #include "ISceneNode.h" | 8 | #include "ISceneNode.h" |
9 | #include "IEventReceiver.h" | 9 | #include "IEventReceiver.h" |
10 | 10 | ||
11 | namespace irr | 11 | namespace irr |
12 | { | 12 | { |
13 | namespace scene | 13 | namespace scene |
14 | { | 14 | { |
15 | struct SViewFrustum; | 15 | struct SViewFrustum; |
16 | 16 | ||
17 | //! Scene Node which is a (controlable) camera. | 17 | //! Scene Node which is a (controlable) camera. |
18 | /** The whole scene will be rendered from the cameras point of view. | 18 | /** The whole scene will be rendered from the cameras point of view. |
19 | Because the ICameraScenNode is a SceneNode, it can be attached to any | 19 | Because the ICameraScenNode is a SceneNode, it can be attached to any |
20 | other scene node, and will follow its parents movement, rotation and so | 20 | other scene node, and will follow its parents movement, rotation and so |
21 | on. | 21 | on. |
22 | */ | 22 | */ |
23 | class ICameraSceneNode : public ISceneNode, public IEventReceiver | 23 | class ICameraSceneNode : public ISceneNode, public IEventReceiver |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | 26 | ||
27 | //! Constructor | 27 | //! Constructor |
28 | ICameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, | 28 | ICameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, |
29 | const core::vector3df& position = core::vector3df(0,0,0), | 29 | const core::vector3df& position = core::vector3df(0,0,0), |
30 | const core::vector3df& rotation = core::vector3df(0,0,0), | 30 | const core::vector3df& rotation = core::vector3df(0,0,0), |
31 | const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f)) | 31 | const core::vector3df& scale = core::vector3df(1.0f,1.0f,1.0f)) |
32 | : ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {} | 32 | : ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {} |
33 | 33 | ||
34 | //! Sets the projection matrix of the camera. | 34 | //! Sets the projection matrix of the camera. |
35 | /** The core::matrix4 class has some methods to build a | 35 | /** The core::matrix4 class has some methods to build a |
36 | projection matrix. e.g: | 36 | projection matrix. e.g: |
37 | core::matrix4::buildProjectionMatrixPerspectiveFovLH. | 37 | core::matrix4::buildProjectionMatrixPerspectiveFovLH. |
38 | Note that the matrix will only stay as set by this method until | 38 | Note that the matrix will only stay as set by this method until |
39 | one of the following Methods are called: setNearValue, | 39 | one of the following Methods are called: setNearValue, |
40 | setFarValue, setAspectRatio, setFOV. | 40 | setFarValue, setAspectRatio, setFOV. |
41 | \param projection The new projection matrix of the camera. | 41 | \param projection The new projection matrix of the camera. |
42 | \param isOrthogonal Set this to true if the matrix is an | 42 | \param isOrthogonal Set this to true if the matrix is an |
43 | orthogonal one (e.g. from matrix4::buildProjectionMatrixOrtho). | 43 | orthogonal one (e.g. from matrix4::buildProjectionMatrixOrtho). |
44 | */ | 44 | */ |
45 | virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal=false) =0; | 45 | virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal=false) =0; |
46 | 46 | ||
47 | //! Gets the current projection matrix of the camera. | 47 | //! Gets the current projection matrix of the camera. |
48 | /** \return The current projection matrix of the camera. */ | 48 | /** \return The current projection matrix of the camera. */ |
49 | virtual const core::matrix4& getProjectionMatrix() const =0; | 49 | virtual const core::matrix4& getProjectionMatrix() const =0; |
50 | 50 | ||
51 | //! Gets the current view matrix of the camera. | 51 | //! Gets the current view matrix of the camera. |
52 | /** \return The current view matrix of the camera. */ | 52 | /** \return The current view matrix of the camera. */ |
53 | virtual const core::matrix4& getViewMatrix() const =0; | 53 | virtual const core::matrix4& getViewMatrix() const =0; |
54 | 54 | ||
55 | //! Sets a custom view matrix affector. | 55 | //! Sets a custom view matrix affector. |
56 | /** The matrix passed here, will be multiplied with the view | 56 | /** The matrix passed here, will be multiplied with the view |
57 | matrix when it gets updated. This allows for custom camera | 57 | matrix when it gets updated. This allows for custom camera |
58 | setups like, for example, a reflection camera. | 58 | setups like, for example, a reflection camera. |
59 | \param affector The affector matrix. */ | 59 | \param affector The affector matrix. */ |
60 | virtual void setViewMatrixAffector(const core::matrix4& affector) =0; | 60 | virtual void setViewMatrixAffector(const core::matrix4& affector) =0; |
61 | 61 | ||
62 | //! Get the custom view matrix affector. | 62 | //! Get the custom view matrix affector. |
63 | /** \return The affector matrix. */ | 63 | /** \return The affector matrix. */ |
64 | virtual const core::matrix4& getViewMatrixAffector() const =0; | 64 | virtual const core::matrix4& getViewMatrixAffector() const =0; |
65 | 65 | ||
66 | //! It is possible to send mouse and key events to the camera. | 66 | //! It is possible to send mouse and key events to the camera. |
67 | /** Most cameras may ignore this input, but camera scene nodes | 67 | /** Most cameras may ignore this input, but camera scene nodes |
68 | which are created for example with | 68 | which are created for example with |
69 | ISceneManager::addCameraSceneNodeMaya or | 69 | ISceneManager::addCameraSceneNodeMaya or |
70 | ISceneManager::addCameraSceneNodeFPS, may want to get | 70 | ISceneManager::addCameraSceneNodeFPS, may want to get |
71 | this input for changing their position, look at target or | 71 | this input for changing their position, look at target or |
72 | whatever. */ | 72 | whatever. */ |
73 | virtual bool OnEvent(const SEvent& event) =0; | 73 | virtual bool OnEvent(const SEvent& event) =0; |
74 | 74 | ||
75 | //! Sets the look at target of the camera | 75 | //! Sets the look at target of the camera |
76 | /** If the camera's target and rotation are bound ( @see | 76 | /** If the camera's target and rotation are bound ( @see |
77 | bindTargetAndRotation() ) then calling this will also change | 77 | bindTargetAndRotation() ) then calling this will also change |
78 | the camera's scene node rotation to match the target. | 78 | the camera's scene node rotation to match the target. |
79 | Note that setTarget uses the current absolute position | 79 | Note that setTarget uses the current absolute position |
80 | internally, so if you changed setPosition since last rendering you must | 80 | internally, so if you changed setPosition since last rendering you must |
81 | call updateAbsolutePosition before using this function. | 81 | call updateAbsolutePosition before using this function. |
82 | \param pos Look at target of the camera, in world co-ordinates. */ | 82 | \param pos Look at target of the camera, in world co-ordinates. */ |
83 | virtual void setTarget(const core::vector3df& pos) =0; | 83 | virtual void setTarget(const core::vector3df& pos) =0; |
84 | 84 | ||
85 | //! Sets the rotation of the node. | 85 | //! Sets the rotation of the node. |
86 | /** This only modifies the relative rotation of the node. | 86 | /** This only modifies the relative rotation of the node. |
87 | If the camera's target and rotation are bound ( @see | 87 | If the camera's target and rotation are bound ( @see |
88 | bindTargetAndRotation() ) then calling this will also change | 88 | bindTargetAndRotation() ) then calling this will also change |
89 | the camera's target to match the rotation. | 89 | the camera's target to match the rotation. |
90 | \param rotation New rotation of the node in degrees. */ | 90 | \param rotation New rotation of the node in degrees. */ |
91 | virtual void setRotation(const core::vector3df& rotation) =0; | 91 | virtual void setRotation(const core::vector3df& rotation) =0; |
92 | 92 | ||
93 | //! Gets the current look at target of the camera | 93 | //! Gets the current look at target of the camera |
94 | /** \return The current look at target of the camera, in world co-ordinates */ | 94 | /** \return The current look at target of the camera, in world co-ordinates */ |
95 | virtual const core::vector3df& getTarget() const =0; | 95 | virtual const core::vector3df& getTarget() const =0; |
96 | 96 | ||
97 | //! Sets the up vector of the camera. | 97 | //! Sets the up vector of the camera. |
98 | /** \param pos: New upvector of the camera. */ | 98 | /** \param pos: New upvector of the camera. */ |
99 | virtual void setUpVector(const core::vector3df& pos) =0; | 99 | virtual void setUpVector(const core::vector3df& pos) =0; |
100 | 100 | ||
101 | //! Gets the up vector of the camera. | 101 | //! Gets the up vector of the camera. |
102 | /** \return The up vector of the camera, in world space. */ | 102 | /** \return The up vector of the camera, in world space. */ |
103 | virtual const core::vector3df& getUpVector() const =0; | 103 | virtual const core::vector3df& getUpVector() const =0; |
104 | 104 | ||
105 | //! Gets the value of the near plane of the camera. | 105 | //! Gets the value of the near plane of the camera. |
106 | /** \return The value of the near plane of the camera. */ | 106 | /** \return The value of the near plane of the camera. */ |
107 | virtual f32 getNearValue() const =0; | 107 | virtual f32 getNearValue() const =0; |
108 | 108 | ||
109 | //! Gets the value of the far plane of the camera. | 109 | //! Gets the value of the far plane of the camera. |
110 | /** \return The value of the far plane of the camera. */ | 110 | /** \return The value of the far plane of the camera. */ |
111 | virtual f32 getFarValue() const =0; | 111 | virtual f32 getFarValue() const =0; |
112 | 112 | ||
113 | //! Gets the aspect ratio of the camera. | 113 | //! Gets the aspect ratio of the camera. |
114 | /** \return The aspect ratio of the camera. */ | 114 | /** \return The aspect ratio of the camera. */ |
115 | virtual f32 getAspectRatio() const =0; | 115 | virtual f32 getAspectRatio() const =0; |
116 | 116 | ||
117 | //! Gets the field of view of the camera. | 117 | //! Gets the field of view of the camera. |
118 | /** \return The field of view of the camera in radians. */ | 118 | /** \return The field of view of the camera in radians. */ |
119 | virtual f32 getFOV() const =0; | 119 | virtual f32 getFOV() const =0; |
120 | 120 | ||
121 | //! Sets the value of the near clipping plane. (default: 1.0f) | 121 | //! Sets the value of the near clipping plane. (default: 1.0f) |
122 | /** \param zn: New z near value. */ | 122 | /** \param zn: New z near value. */ |
123 | virtual void setNearValue(f32 zn) =0; | 123 | virtual void setNearValue(f32 zn) =0; |
124 | 124 | ||
125 | //! Sets the value of the far clipping plane (default: 2000.0f) | 125 | //! Sets the value of the far clipping plane (default: 2000.0f) |
126 | /** \param zf: New z far value. */ | 126 | /** \param zf: New z far value. */ |
127 | virtual void setFarValue(f32 zf) =0; | 127 | virtual void setFarValue(f32 zf) =0; |
128 | 128 | ||
129 | //! Sets the aspect ratio (default: 4.0f / 3.0f) | 129 | //! Sets the aspect ratio (default: 4.0f / 3.0f) |
130 | /** \param aspect: New aspect ratio. */ | 130 | /** \param aspect: New aspect ratio. */ |
131 | virtual void setAspectRatio(f32 aspect) =0; | 131 | virtual void setAspectRatio(f32 aspect) =0; |
132 | 132 | ||
133 | //! Sets the field of view (Default: PI / 2.5f) | 133 | //! Sets the field of view (Default: PI / 2.5f) |
134 | /** \param fovy: New field of view in radians. */ | 134 | /** \param fovy: New field of view in radians. */ |
135 | virtual void setFOV(f32 fovy) =0; | 135 | virtual void setFOV(f32 fovy) =0; |
136 | 136 | ||
137 | //! Get the view frustum. | 137 | //! Get the view frustum. |
138 | /** Needed sometimes by bspTree or LOD render nodes. | 138 | /** Needed sometimes by bspTree or LOD render nodes. |
139 | \return The current view frustum. */ | 139 | \return The current view frustum. */ |
140 | virtual const SViewFrustum* getViewFrustum() const =0; | 140 | virtual const SViewFrustum* getViewFrustum() const =0; |
141 | 141 | ||
142 | //! Disables or enables the camera to get key or mouse inputs. | 142 | //! Disables or enables the camera to get key or mouse inputs. |
143 | /** If this is set to true, the camera will respond to key | 143 | /** If this is set to true, the camera will respond to key |
144 | inputs otherwise not. */ | 144 | inputs otherwise not. */ |
145 | virtual void setInputReceiverEnabled(bool enabled) =0; | 145 | virtual void setInputReceiverEnabled(bool enabled) =0; |
146 | 146 | ||
147 | //! Checks if the input receiver of the camera is currently enabled. | 147 | //! Checks if the input receiver of the camera is currently enabled. |
148 | virtual bool isInputReceiverEnabled() const =0; | 148 | virtual bool isInputReceiverEnabled() const =0; |
149 | 149 | ||
150 | //! Checks if a camera is orthogonal. | 150 | //! Checks if a camera is orthogonal. |
151 | virtual bool isOrthogonal() const | 151 | virtual bool isOrthogonal() const |
152 | { | 152 | { |
153 | _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; | 153 | _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; |
154 | return IsOrthogonal; | 154 | return IsOrthogonal; |
155 | } | 155 | } |
156 | 156 | ||
157 | //! Binds the camera scene node's rotation to its target position and vice vera, or unbinds them. | 157 | //! Binds the camera scene node's rotation to its target position and vice vera, or unbinds them. |
158 | /** When bound, calling setRotation() will update the camera's | 158 | /** When bound, calling setRotation() will update the camera's |
159 | target position to be along its +Z axis, and likewise calling | 159 | target position to be along its +Z axis, and likewise calling |
160 | setTarget() will update its rotation so that its +Z axis will | 160 | setTarget() will update its rotation so that its +Z axis will |
161 | point at the target point. FPS camera use this binding by | 161 | point at the target point. FPS camera use this binding by |
162 | default; other cameras do not. | 162 | default; other cameras do not. |
163 | \param bound True to bind the camera's scene node rotation | 163 | \param bound True to bind the camera's scene node rotation |
164 | and targetting, false to unbind them. | 164 | and targetting, false to unbind them. |
165 | @see getTargetAndRotationBinding() */ | 165 | @see getTargetAndRotationBinding() */ |
166 | virtual void bindTargetAndRotation(bool bound) =0; | 166 | virtual void bindTargetAndRotation(bool bound) =0; |
167 | 167 | ||
168 | //! Queries if the camera scene node's rotation and its target position are bound together. | 168 | //! Queries if the camera scene node's rotation and its target position are bound together. |
169 | /** @see bindTargetAndRotation() */ | 169 | /** @see bindTargetAndRotation() */ |
170 | virtual bool getTargetAndRotationBinding(void) const =0; | 170 | virtual bool getTargetAndRotationBinding(void) const =0; |
171 | 171 | ||
172 | //! Writes attributes of the camera node | 172 | //! Writes attributes of the camera node |
173 | virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const | 173 | virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const |
174 | { | 174 | { |
175 | ISceneNode::serializeAttributes(out, options); | 175 | ISceneNode::serializeAttributes(out, options); |
176 | 176 | ||
177 | if (!out) | 177 | if (!out) |
178 | return; | 178 | return; |
179 | out->addBool ("IsOrthogonal", IsOrthogonal ); | 179 | out->addBool ("IsOrthogonal", IsOrthogonal ); |
180 | } | 180 | } |
181 | 181 | ||
182 | //! Reads attributes of the camera node | 182 | //! Reads attributes of the camera node |
183 | virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) | 183 | virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) |
184 | { | 184 | { |
185 | ISceneNode::deserializeAttributes(in, options); | 185 | ISceneNode::deserializeAttributes(in, options); |
186 | if (!in) | 186 | if (!in) |
187 | return; | 187 | return; |
188 | 188 | ||
189 | if ( in->findAttribute("IsOrthogonal") ) | 189 | if ( in->findAttribute("IsOrthogonal") ) |
190 | IsOrthogonal = in->getAttributeAsBool("IsOrthogonal"); | 190 | IsOrthogonal = in->getAttributeAsBool("IsOrthogonal"); |
191 | } | 191 | } |
192 | 192 | ||
193 | protected: | 193 | protected: |
194 | 194 | ||
195 | void cloneMembers(ICameraSceneNode* toCopyFrom) | 195 | void cloneMembers(ICameraSceneNode* toCopyFrom) |
196 | { | 196 | { |
197 | IsOrthogonal = toCopyFrom->IsOrthogonal; | 197 | IsOrthogonal = toCopyFrom->IsOrthogonal; |
198 | } | 198 | } |
199 | 199 | ||
200 | bool IsOrthogonal; | 200 | bool IsOrthogonal; |
201 | }; | 201 | }; |
202 | 202 | ||
203 | } // end namespace scene | 203 | } // end namespace scene |
204 | } // end namespace irr | 204 | } // end namespace irr |
205 | 205 | ||
206 | #endif | 206 | #endif |
207 | 207 | ||