Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
ICameraSceneNode.hpp
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 nirtcpp/nirtcpp.hpp
4
5#ifndef NIRT_I_CAMERA_SCENE_NODE_HPP_INCLUDED
6#define NIRT_I_CAMERA_SCENE_NODE_HPP_INCLUDED
7
8#include <nirtcpp/core/engine/ISceneNode.hpp>
9#include <nirtcpp/core/engine/IEventReceiver.hpp>
10
11namespace nirt
12{
13namespace scene
14{
15 class 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) override =0;
76
78
85 virtual void setTarget(const core::vector3df& pos) =0;
86
88
93 virtual void setRotation(const core::vector3df& rotation) override =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
126 virtual void setNearValue(f32 zn) =0;
127
129
131 virtual void setFarValue(f32 zf) =0;
132
134
136 virtual void setAspectRatio(f32 aspect) =0;
137
139
141 virtual void setFOV(f32 fovy) =0;
142
144
145 virtual const SViewFrustum* getViewFrustum() const =0;
146
148
150 virtual void setInputReceiverEnabled(bool enabled) =0;
151
153 virtual bool isInputReceiverEnabled() const =0;
154
156 virtual bool isOrthogonal() const
157 {
158 return IsOrthogonal;
159 }
160
162
170 virtual void bindTargetAndRotation(bool bound) =0;
171
173
176 virtual void updateMatrices() = 0;
177
179
180 virtual bool getTargetAndRotationBinding(void) const =0;
181
183 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const override
184 {
186
187 if (!out)
188 return;
189 out->addBool("IsOrthogonal", IsOrthogonal);
190 }
191
194 {
196 if (!in)
197 return;
198
199 if ( in->findAttribute("IsOrthogonal") )
200 IsOrthogonal = in->getAttributeAsBool("IsOrthogonal");
201 }
202
203 protected:
204
205 void cloneMembers(const ICameraSceneNode* toCopyFrom)
206 {
207 IsOrthogonal = toCopyFrom->IsOrthogonal;
208 }
209
210 bool IsOrthogonal;
211 };
212
213} // end namespace scene
214} // end namespace nirt
215
216#endif
Interface of an object which can receive events.
Definition IEventReceiver.hpp:484
SEvents hold information about an event. See nirt::IEventReceiver for details on event handling.
Definition IEventReceiver.hpp:282
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Definition matrix4.hpp:49
Provides a generic interface for attributes and their values and the possibility to serialize them.
Definition IAttributes.hpp:42
virtual s32 findAttribute(const c8 *attributeName) const =0
Returns attribute index from name, -1 if not found.
virtual bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound=false) const =0
virtual void addBool(const c8 *attributeName, bool value)=0
Adds an attribute as bool.
struct holding data describing options
Definition IAttributeExchangingObject.hpp:35
Scene Node which is a (controllable) camera.
Definition ICameraSceneNode.hpp:24
virtual bool isOrthogonal() const
Checks if a camera is orthogonal.
Definition ICameraSceneNode.hpp:156
virtual bool isInputReceiverEnabled() const =0
Checks if the input receiver of the camera is currently enabled.
virtual const core::vector3df & getTarget() const =0
Gets the current look at target of the camera.
virtual void setRotation(const core::vector3df &rotation) override=0
Sets the rotation of the node.
virtual void setFarValue(f32 zf)=0
Sets the value of the far clipping plane (default: 2000.0f)
virtual void setNearValue(f32 zn)=0
Sets the value of the near clipping plane. (default: 1.0f)
virtual void updateMatrices()=0
Updates the view matrix and frustum without uploading the matrix to the driver.
virtual void setViewMatrixAffector(const core::matrix4 &affector)=0
Sets a custom view matrix affector.
virtual bool OnEvent(const SEvent &event) override=0
It is possible to send mouse and key events to the camera.
virtual const core::matrix4 & getViewMatrix() const =0
Gets the current view matrix of the camera.
virtual const SViewFrustum * getViewFrustum() const =0
Get the view frustum.
virtual bool getTargetAndRotationBinding(void) const =0
Queries if the camera scene node's rotation and its target position are bound together.
virtual void setAspectRatio(f32 aspect)=0
Sets the aspect ratio (default: 4.0f / 3.0f)
virtual void setTarget(const core::vector3df &pos)=0
Sets the look at target of the camera.
virtual const core::matrix4 & getViewMatrixAffector() const =0
Get the custom view matrix affector.
virtual const core::vector3df & getUpVector() const =0
Gets the up vector of the camera.
virtual f32 getNearValue() const =0
Gets the value of the near plane of the camera.
virtual void setProjectionMatrix(const core::matrix4 &projection, bool isOrthogonal=false)=0
Sets the projection matrix 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.
Definition ICameraSceneNode.hpp:28
virtual const core::matrix4 & getProjectionMatrix() const =0
Gets the current projection matrix of the camera.
virtual f32 getFOV() const =0
Gets the field of view of the camera.
virtual void setUpVector(const core::vector3df &pos)=0
Sets the up vector of the camera.
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0) override
Reads attributes of the camera node.
Definition ICameraSceneNode.hpp:193
virtual void bindTargetAndRotation(bool bound)=0
Binds the camera scene node's rotation to its target position and vice versa, or unbinds them.
virtual void setFOV(f32 fovy)=0
Sets the field of view (Default: PI / 2.5f)
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const override
Writes attributes of the camera node.
Definition ICameraSceneNode.hpp:183
virtual f32 getFarValue() const =0
Gets the value of the far plane of the camera.
virtual void setInputReceiverEnabled(bool enabled)=0
Disables or enables the camera to get key or mouse inputs.
virtual f32 getAspectRatio() const =0
Gets the aspect ratio of the camera.
The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.
Definition ISceneManager.hpp:160
Scene node interface.
Definition ISceneNode.hpp:43
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0) override
Reads attributes of the scene node.
Definition ISceneNode.hpp:750
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const override
Writes attributes of the scene node.
Definition ISceneNode.hpp:724
Defines the view frustum. That's the space visible by the camera.
Definition SViewFrustum.hpp:26
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
float f32
32 bit floating point variable.
Definition irrTypes.hpp:110

Nirtcpp    @cppfx.xyz

Utxcpp    utx::print