Thrive
sky_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 <OgrePlane.h>
9 #include <OgreResourceGroupManager.h>
10 
11 namespace luabind {
12 class scope;
13 }
14 
15 namespace thrive {
16 
22 class SkyPlaneComponent : public Component {
23  COMPONENT(SkyPlane)
24 
25 public:
26 
30  struct Properties : public Touchable {
31 
35  bool enabled = true;
36 
40  Ogre::Plane plane = {1, 1, 1, 1};
41 
45  Ogre::String materialName = "background/blue_01";
46 
50  Ogre::Real scale = 1000;
51 
55  Ogre::Real tiling = 10;
56 
60  bool drawFirst = true;
61 
66  Ogre::Real bow = 0;
67 
71  int xsegments = 1;
72 
76  int ysegments = 1;
77 
81  Ogre::String groupName = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME;
82 
83  };
84 
105  static luabind::scope
106  luaBindings();
107 
108  void
109  load(
111  ) override;
112 
114  storage() const override;
115 
119  Properties
121 
122 };
123 
124 
128 class SkySystem : public System {
129 
130 public:
131 
140  static luabind::scope
141  luaBindings();
142 
146  SkySystem();
147 
151  ~SkySystem();
152 
157  void init(GameState* gameState) override;
158 
162  void shutdown() override;
163 
167  void update(int, int) override;
168 
169 private:
170 
171  struct Implementation;
172  std::unique_ptr<Implementation> m_impl;
173 };
174 
175 }
Helper class for keeping track of changing data.
Definition: touchable.h:18
void update(int, int) override
Updates the sky components.
Definition: sky_system.cpp:138
SkySystem()
Constructor.
Definition: sky_system.cpp:106
~SkySystem()
Destructor.
Definition: sky_system.cpp:112
Ogre::Real tiling
How often to repeat the material across the plane.
Definition: sky_system.h:55
A component for a sky plane.
Definition: sky_system.h:22
bool enabled
Whether this sky plane is enabled.
Definition: sky_system.h:35
StorageContainer storage() const override
Serializes the component.
Definition: sky_system.cpp:65
Ogre::Real scale
The bigger the scale, the bigger the sky plane.
Definition: sky_system.h:50
static luabind::scope luaBindings()
Lua bindings.
Definition: sky_system.cpp:20
Base class for components.
Definition: component.h:31
bool drawFirst
Whether to draw the plane before everything else.
Definition: sky_system.h:60
Properties m_properties
Properties.
Definition: sky_system.h:120
A system handles one specific part of the game.
Definition: system.h:23
Ogre::Plane plane
The sky plane's plane (normal and distance from camera)
Definition: sky_system.h:40
int ysegments
Segments for bowed plane.
Definition: sky_system.h:76
Ogre::String materialName
The material path.
Definition: sky_system.h:45
void init(GameState *gameState) override
Initializes the system.
Definition: sky_system.cpp:116
Definition: bullet_to_ogre_system.h:5
Ogre::Real bow
If zero, the plane will be flat. Above zero, the plane will be slightly curved.
Definition: sky_system.h:66
Definition: bullet_ogre_conversion.h:6
int xsegments
Segments for bowed plane.
Definition: sky_system.h:71
Handles sky planes, boxes and domes.
Definition: sky_system.h:128
void load(const StorageContainer &storage) override
Loads the component.
Definition: sky_system.cpp:47
GameState * gameState() const
Returns the system's game state.
Definition: system.cpp:183
void shutdown() override
Shuts the system down.
Definition: sky_system.cpp:127
Properties.
Definition: sky_system.h:30
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
Ogre::String groupName
The resource group to which to assign the plane mesh.
Definition: sky_system.h:81
static luabind::scope luaBindings()
Lua bindings.
Definition: sky_system.cpp:88
A key-value storage for serialization.
Definition: serialization.h:36