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