arsa  2.7
ICameraSceneNode.h
Go to the documentation of this file.
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 __I_CAMERA_SCENE_NODE_H_INCLUDED__
6 #define __I_CAMERA_SCENE_NODE_H_INCLUDED__
7 
8 #include "ISceneNode.h"
9 #include "IEventReceiver.h"
10 
11 namespace irr
12 {
13 namespace scene
14 {
15  struct SViewFrustum;
16 
18 
24  {
25  public:
26 
29  const core::vector3df& position = 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))
32  : ISceneNode(parent, mgr, id, position, rotation, scale), IsOrthogonal(false) {}
33 
35 
47  virtual void setProjectionMatrix(const core::matrix4& projection, bool isOrthogonal=false) =0;
48 
50 
51  virtual const core::matrix4& getProjectionMatrix() const =0;
52 
54 
55  virtual const core::matrix4& getViewMatrix() const =0;
56 
58 
62  virtual void setViewMatrixAffector(const core::matrix4& affector) =0;
63 
65 
66  virtual const core::matrix4& getViewMatrixAffector() const =0;
67 
69 
75  virtual bool OnEvent(const SEvent& event) =0;
76 
78 
85  virtual void setTarget(const core::vector3df& pos) =0;
86 
88 
93  virtual void setRotation(const core::vector3df& rotation) =0;
94 
96 
97  virtual const core::vector3df& getTarget() const =0;
98 
100 
101  virtual void setUpVector(const core::vector3df& pos) =0;
102 
104 
105  virtual const core::vector3df& getUpVector() const =0;
106 
108 
109  virtual f32 getNearValue() const =0;
110 
112 
113  virtual f32 getFarValue() const =0;
114 
116 
117  virtual f32 getAspectRatio() const =0;
118 
120 
121  virtual f32 getFOV() const =0;
122 
124 
125  virtual void setNearValue(f32 zn) =0;
126 
128 
129  virtual void setFarValue(f32 zf) =0;
130 
132 
133  virtual void setAspectRatio(f32 aspect) =0;
134 
136 
137  virtual void setFOV(f32 fovy) =0;
138 
140 
141  virtual const SViewFrustum* getViewFrustum() const =0;
142 
144 
146  virtual void setInputReceiverEnabled(bool enabled) =0;
147 
149  virtual bool isInputReceiverEnabled() const =0;
150 
152  virtual bool isOrthogonal() const
153  {
154  return IsOrthogonal;
155  }
156 
158 
166  virtual void bindTargetAndRotation(bool bound) =0;
167 
169  virtual void updateMatrices() = 0;
170 
172 
173  virtual bool getTargetAndRotationBinding(void) const =0;
174 
177  {
178  ISceneNode::serializeAttributes(out, options);
179 
180  if (!out)
181  return;
182  out->addBool("IsOrthogonal", IsOrthogonal);
183  }
184 
187  {
189  if (!in)
190  return;
191 
192  if ( in->findAttribute("IsOrthogonal") )
193  IsOrthogonal = in->getAttributeAsBool("IsOrthogonal");
194  }
195 
196  protected:
197 
198  void cloneMembers(const ICameraSceneNode* toCopyFrom)
199  {
200  IsOrthogonal = toCopyFrom->IsOrthogonal;
201  }
202 
204  };
205 
206 } // end namespace scene
207 } // end namespace irr
208 
209 #endif
210 
GLenum GLenum GLenum GLenum GLenum scale
GLuint id
Scene Node which is a (controllable) camera.
Provides a generic interface for attributes and their values and the possibility to serialize them.
Definition: IAttributes.h:41
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0) _IRR_OVERRIDE_
Reads attributes of the scene node.
Definition: ISceneNode.h:725
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const _IRR_OVERRIDE_
Writes attributes of the scene node.
Definition: ISceneNode.h:700
virtual const core::vector3df & getTarget() const =0
Gets the current look at target of the camera.
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
virtual bool OnEvent(const SEvent &event)=0
It is possible to send mouse and key events to the camera.
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0) _IRR_OVERRIDE_
Reads attributes of the camera node.
virtual void setFarValue(f32 zf)=0
Sets the value of the far clipping plane (default: 2000.0f)
virtual f32 getFOV() const =0
Gets the field of view of the camera.
Scene node interface.
Definition: ISceneNode.h:40
virtual bool getTargetAndRotationBinding(void) const =0
Queries if the camera scene node's rotation and its target position are bound together.
virtual const core::matrix4 & getProjectionMatrix() const =0
Gets the current projection matrix of the camera.
struct holding data describing options
virtual const core::vector3df & getUpVector() const =0
Gets the up vector of the camera.
virtual void setFOV(f32 fovy)=0
Sets the field of view (Default: PI / 2.5f)
virtual void addBool(const c8 *attributeName, bool value)=0
Adds an attribute as bool.
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
virtual f32 getFarValue() const =0
Gets the value of the far plane of the camera.
ICameraSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id, const core::vector3df &position=core::vector3df(0, 0, 0), const core::vector3df &rotation=core::vector3df(0, 0, 0), const core::vector3df &scale=core::vector3df(1.0f, 1.0f, 1.0f))
Constructor.
virtual void bindTargetAndRotation(bool bound)=0
Binds the camera scene node's rotation to its target position and vice versa, or unbinds them.
virtual const SViewFrustum * getViewFrustum() const =0
Get the view frustum.
Defines the view frustum. That's the space visible by the camera.
Definition: SViewFrustum.h:25
virtual const core::matrix4 & getViewMatrixAffector() const =0
Get the custom view matrix affector.
virtual void setViewMatrixAffector(const core::matrix4 &affector)=0
Sets a custom view matrix affector.
Interface of an object which can receive events.
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
virtual const core::matrix4 & getViewMatrix() const =0
Gets the current view matrix of the camera.
virtual void setNearValue(f32 zn)=0
Sets the value of the near clipping plane. (default: 1.0f)
struct _cl_event * event
GLfloat f
virtual void setProjectionMatrix(const core::matrix4 &projection, bool isOrthogonal=false)=0
Sets the projection matrix of the camera.
virtual void setUpVector(const core::vector3df &pos)=0
Sets the up vector of the camera.
virtual void setTarget(const core::vector3df &pos)=0
Sets the look at target of the camera.
GLenum GLenum GLsizei const GLuint GLboolean enabled
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Definition: matrix4.h:45
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const _IRR_OVERRIDE_
Writes attributes of the camera node.
virtual void setAspectRatio(f32 aspect)=0
Sets the aspect ratio (default: 4.0f / 3.0f)
virtual void updateMatrices()=0
Updates the matrices without uploading them to the driver.
The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.
#define _IRR_OVERRIDE_
Defines an override macro, to protect virtual functions from typos and other mismatches.
Definition: irrTypes.h:216
virtual void setRotation(const core::vector3df &rotation)=0
Sets the rotation of the node.
void cloneMembers(const ICameraSceneNode *toCopyFrom)
virtual f32 getAspectRatio() const =0
Gets the aspect ratio of the camera.
virtual bool isOrthogonal() const
Checks if a camera is orthogonal.
virtual void setInputReceiverEnabled(bool enabled)=0
Disables or enables the camera to get key or mouse inputs.
#define const
Definition: zconf.h:217
virtual bool isInputReceiverEnabled() const =0
Checks if the input receiver of the camera is currently enabled.
GLuint in
virtual f32 getNearValue() const =0
Gets the value of the near plane of the camera.