]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CCameraSceneNode.h
Fix some more problems with OSX build file.
[irrlicht.git] / source / Irrlicht / CCameraSceneNode.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __C_CAMERA_SCENE_NODE_H_INCLUDED__\r
6 #define __C_CAMERA_SCENE_NODE_H_INCLUDED__\r
7 \r
8 #include "ICameraSceneNode.h"\r
9 #include "SViewFrustum.h"\r
10 \r
11 namespace irr\r
12 {\r
13 namespace scene\r
14 {\r
15 \r
16         class CCameraSceneNode : public ICameraSceneNode\r
17         {\r
18         public:\r
19 \r
20                 //! constructor\r
21                 CCameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,\r
22                         const core::vector3df& position = core::vector3df(0,0,0),\r
23                         const core::vector3df& lookat = core::vector3df(0,0,100));\r
24 \r
25                 //! Sets the projection matrix of the camera.\r
26                 /** The core::matrix4 class has some methods\r
27                 to build a projection matrix. e.g: core::matrix4::buildProjectionMatrixPerspectiveFovLH.\r
28                 Note that the matrix will only stay as set by this method until one of\r
29                 the following Methods are called: setNearValue, setFarValue, setAspectRatio, setFOV.\r
30                 \param projection The new projection matrix of the camera.\r
31                 \param isOrthogonal Set this to true if the matrix is an orthogonal one (e.g.\r
32                 from matrix4::buildProjectionMatrixOrthoLH(). */\r
33                 virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal = false) _IRR_OVERRIDE_;\r
34 \r
35                 //! Gets the current projection matrix of the camera\r
36                 //! \return Returns the current projection matrix of the camera.\r
37                 virtual const core::matrix4& getProjectionMatrix() const _IRR_OVERRIDE_;\r
38 \r
39                 //! Gets the current view matrix of the camera\r
40                 //! \return Returns the current view matrix of the camera.\r
41                 virtual const core::matrix4& getViewMatrix() const _IRR_OVERRIDE_;\r
42 \r
43                 //! Sets a custom view matrix affector.\r
44                 /** \param affector: The affector matrix. */\r
45                 virtual void setViewMatrixAffector(const core::matrix4& affector) _IRR_OVERRIDE_;\r
46 \r
47                 //! Gets the custom view matrix affector.\r
48                 virtual const core::matrix4& getViewMatrixAffector() const _IRR_OVERRIDE_;\r
49 \r
50                 //! It is possible to send mouse and key events to the camera. Most cameras\r
51                 //! may ignore this input, but camera scene nodes which are created for\r
52                 //! example with scene::ISceneManager::addMayaCameraSceneNode or\r
53                 //! scene::ISceneManager::addMeshViewerCameraSceneNode, may want to get this input\r
54                 //! for changing their position, look at target or whatever.\r
55                 virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_;\r
56 \r
57                 //! Sets the look at target of the camera\r
58                 /** If the camera's target and rotation are bound ( @see bindTargetAndRotation() )\r
59                 then calling this will also change the camera's scene node rotation to match the target.\r
60                 \param pos: Look at target of the camera. */\r
61                 virtual void setTarget(const core::vector3df& pos) _IRR_OVERRIDE_;\r
62 \r
63                 //! Sets the rotation of the node.\r
64                 /** This only modifies the relative rotation of the node.\r
65                 If the camera's target and rotation are bound ( @see bindTargetAndRotation() )\r
66                 then calling this will also change the camera's target to match the rotation.\r
67                 \param rotation New rotation of the node in degrees. */\r
68                 virtual void setRotation(const core::vector3df& rotation) _IRR_OVERRIDE_;\r
69 \r
70                 //! Gets the current look at target of the camera\r
71                 /** \return The current look at target of the camera */\r
72                 virtual const core::vector3df& getTarget() const _IRR_OVERRIDE_;\r
73 \r
74                 //! Sets the up vector of the camera.\r
75                 //! \param pos: New upvector of the camera.\r
76                 virtual void setUpVector(const core::vector3df& pos) _IRR_OVERRIDE_;\r
77 \r
78                 //! Gets the up vector of the camera.\r
79                 //! \return Returns the up vector of the camera.\r
80                 virtual const core::vector3df& getUpVector() const _IRR_OVERRIDE_;\r
81 \r
82                 //! Gets distance from the camera to the near plane.\r
83                 //! \return Value of the near plane of the camera.\r
84                 virtual f32 getNearValue() const _IRR_OVERRIDE_;\r
85 \r
86                 //! Gets the distance from the camera to the far plane.\r
87                 //! \return Value of the far plane of the camera.\r
88                 virtual f32 getFarValue() const _IRR_OVERRIDE_;\r
89 \r
90                 //! Get the aspect ratio of the camera.\r
91                 //! \return The aspect ratio of the camera.\r
92                 virtual f32 getAspectRatio() const _IRR_OVERRIDE_;\r
93 \r
94                 //! Gets the field of view of the camera.\r
95                 //! \return Field of view of the camera\r
96                 virtual f32 getFOV() const _IRR_OVERRIDE_;\r
97 \r
98                 //! Sets the value of the near clipping plane. (default: 1.0f)\r
99                 virtual void setNearValue(f32 zn) _IRR_OVERRIDE_;\r
100 \r
101                 //! Sets the value of the far clipping plane (default: 2000.0f)\r
102                 virtual void setFarValue(f32 zf) _IRR_OVERRIDE_;\r
103 \r
104                 //! Sets the aspect ratio (default: 4.0f / 3.0f)\r
105                 virtual void setAspectRatio(f32 aspect) _IRR_OVERRIDE_;\r
106 \r
107                 //! Sets the field of view (Default: PI / 3.5f)\r
108                 virtual void setFOV(f32 fovy) _IRR_OVERRIDE_;\r
109 \r
110                 //! PreRender event\r
111                 virtual void OnRegisterSceneNode() _IRR_OVERRIDE_;\r
112 \r
113                 //! Render\r
114                 virtual void render() _IRR_OVERRIDE_;\r
115 \r
116                 //! Update\r
117                 virtual void updateMatrices() _IRR_OVERRIDE_;\r
118 \r
119                 //! Returns the axis aligned bounding box of this node\r
120                 virtual const core::aabbox3d<f32>& getBoundingBox() const _IRR_OVERRIDE_;\r
121 \r
122                 //! Returns the view area.\r
123                 virtual const SViewFrustum* getViewFrustum() const _IRR_OVERRIDE_;\r
124 \r
125                 //! Disables or enables the camera to get key or mouse inputs.\r
126                 //! If this is set to true, the camera will respond to key inputs\r
127                 //! otherwise not.\r
128                 virtual void setInputReceiverEnabled(bool enabled) _IRR_OVERRIDE_;\r
129 \r
130                 //! Returns if the input receiver of the camera is currently enabled.\r
131                 virtual bool isInputReceiverEnabled() const _IRR_OVERRIDE_;\r
132 \r
133                 //! Writes attributes of the scene node.\r
134                 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;\r
135 \r
136                 //! Reads attributes of the scene node.\r
137                 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;\r
138 \r
139                 //! Returns type of the scene node\r
140                 virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_CAMERA; }\r
141 \r
142                 //! Binds the camera scene node's rotation to its target position and vice versa, or unbinds them.\r
143                 virtual void bindTargetAndRotation(bool bound) _IRR_OVERRIDE_;\r
144 \r
145                 //! Queries if the camera scene node's rotation and its target position are bound together.\r
146                 virtual bool getTargetAndRotationBinding(void) const _IRR_OVERRIDE_;\r
147 \r
148                 //! Creates a clone of this scene node and its children.\r
149                 virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) _IRR_OVERRIDE_;\r
150 \r
151         protected:\r
152 \r
153                 void recalculateProjectionMatrix();\r
154                 void recalculateViewArea();\r
155 \r
156                 core::aabbox3d<f32> BoundingBox;\r
157 \r
158                 core::vector3df Target;\r
159                 core::vector3df UpVector;\r
160 \r
161                 f32 Fovy;       // Field of view, in radians.\r
162                 f32 Aspect;     // Aspect ratio.\r
163                 f32 ZNear;      // value of the near view-plane.\r
164                 f32 ZFar;       // Z-value of the far view-plane.\r
165 \r
166                 SViewFrustum ViewArea;\r
167                 core::matrix4 Affector;\r
168 \r
169                 bool InputReceiverEnabled;\r
170                 bool TargetAndRotationAreBound;\r
171 \r
172                 bool HasD3DStyleProjectionMatrix;       // true: projection from 0 to w; false: -w to w\r
173         };\r
174 \r
175 } // end namespace\r
176 } // end namespace\r
177 \r
178 #endif\r
179 \r