Thrive
camera_system.h
1 #pragma once
2 
3 #include "engine/component.h"
4 #include "engine/system.h"
5 #include "engine/touchable.h"
6 
7 #include <memory>
8 #include <OgreCommon.h>
9 #include <OgreMath.h>
10 #include <OgreVector3.h>
11 
12 namespace luabind {
13 class scope;
14 }
15 
16 namespace Ogre {
17 class Camera;
18 }
19 
20 namespace thrive {
21 
27  COMPONENT(OgreCamera)
28 
29 public:
30 
31 
35  struct Properties : public Touchable {
36 
40  Ogre::Real farClipDistance = 10000.0f;
41 
45  Ogre::Degree fovY = Ogre::Degree{45.0f};
46 
50  Ogre::Real nearClipDistance = 100.0f;
51 
55  Ogre::PolygonMode polygonMode = Ogre::PM_SOLID;
56 
61  Ogre::Vector3 offset = Ogre::Vector3(0,0,10);
62 
68  bool orthographicalMode = false;
69 
70  };
71 
86  static luabind::scope
87  luaBindings();
88 
96  std::string name
97  );
98 
105 
111  void
112  load(
114  ) override;
115 
122  void
123  zoom(
124  int value
125  );
126 
131  std::string
132  name() const;
133 
140  storage() const override;
141 
145  Ogre::Camera* m_camera = nullptr;
146 
150  Properties
152 
153 private:
154 
158  std::string m_name;
159 
160 };
161 
162 
166 class OgreCameraSystem : public System {
167 
168 public:
169 
178  static luabind::scope
179  luaBindings();
180 
185 
190 
195  void init(GameState* gameState) override;
196 
200  void shutdown() override;
201 
205  void update(int, int) override;
206 
207 private:
208 
209  struct Implementation;
210  std::unique_ptr<Implementation> m_impl;
211 };
212 
213 }
214 
Properties m_properties
Properties.
Definition: camera_system.h:151
std::string name() const
Returns the camera's name.
Definition: camera_system.cpp:92
Helper class for keeping track of changing data.
Definition: touchable.h:18
Properties.
Definition: camera_system.h:35
StorageContainer storage() const override
Serializes the camera.
Definition: camera_system.cpp:98
bool orthographicalMode
Whether the camera is using orthographical projection or perspective.
Definition: camera_system.h:68
Base class for components.
Definition: component.h:31
void update(int, int) override
Updates the system.
Definition: camera_system.cpp:168
Ogre::PolygonMode polygonMode
The level of rendering detail.
Definition: camera_system.h:55
A system handles one specific part of the game.
Definition: system.h:23
~OgreCameraSystem()
Destructor.
Definition: camera_system.cpp:145
void load(const StorageContainer &storage) override
Loads a camera.
Definition: camera_system.cpp:76
OgreCameraComponent()
Default constructor.
Definition: camera_system.cpp:69
Ogre::Camera * m_camera
Pointer to internal camera.
Definition: camera_system.h:145
void shutdown() override
Shuts the system down.
Definition: camera_system.cpp:160
Ogre::Real farClipDistance
Far clip distance.
Definition: camera_system.h:40
Definition: bullet_to_ogre_system.h:5
Definition: bullet_ogre_conversion.h:6
void zoom(int value)
Changes the depth offset of the camera.
GameState * gameState() const
Returns the system's game state.
Definition: system.cpp:183
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
Definition: debug_drawing.h:8
static luabind::scope luaBindings()
Lua bindings.
Definition: camera_system.cpp:36
Ogre::Real nearClipDistance
Near clip distance.
Definition: camera_system.h:50
static luabind::scope luaBindings()
Lua bindings.
Definition: camera_system.cpp:118
Ogre::Degree fovY
The y-dimension field of view.
Definition: camera_system.h:45
A component for a camera.
Definition: camera_system.h:26
Ogre::Vector3 offset
Camera offset Note that this is not automatically taken into account.
Definition: camera_system.h:61
Creates, updates and removes cameras.
Definition: camera_system.h:166
OgreCameraSystem()
Constructor.
Definition: camera_system.cpp:139
void init(GameState *gameState) override
Initializes the system.
Definition: camera_system.cpp:149
A key-value storage for serialization.
Definition: serialization.h:36