4 #include <OgreEntity.h>
5 #include <OgreSceneManager.h>
6 #include "OgreHardwarePixelBuffer.h"
8 #include "engine/component.h"
9 #include "engine/system.h"
10 #include "engine/touchable.h"
11 #include "scripting/luabind.h"
12 #include "engine/typedefs.h"
14 #include "general/perlin_noise.h"
15 #include "ogre/scene_node_system.h"
16 #include "microbe_stage/compound_registry.h"
20 static const CompoundId NULL_COMPOUND = 0;
22 class CompoundCloudSystem;
37 std::vector< std::vector<float> >
density;
38 std::vector< std::vector<float> > oldDens;
60 void initialize(CompoundId Id,
float red,
float green,
float blue);
121 static luabind::scope
149 void update(
int renderTime,
int logicTime)
override;
152 struct Implementation;
153 std::unique_ptr<Implementation> m_impl;
155 Ogre::Entity* compoundCloudsPlane;
163 int offsetX, offsetY;
167 std::vector< std::vector<float> > xVelocity;
168 std::vector< std::vector<float> > yVelocity;
170 void CreateVelocityField();
171 void diffuse(
float diffRate, std::vector< std::vector<float> >& oldDens,
const std::vector< std::vector<float> >& density,
int dt);
172 void advect(std::vector< std::vector<float> >& oldDens, std::vector< std::vector<float> >& density,
int dt);
175 void initializeFile(std::string compoundName);
177 void writeToFile(std::vector< std::vector<float> >& density, std::string compoundName, Ogre::ColourValue color);
Definition: perlin_noise.h:15
Moves the compound clouds.
Definition: compound_cloud_system.h:110
~CompoundCloudSystem()
Destructor.
Definition: compound_cloud_system.cpp:180
void load(const StorageContainer &storage) override
Loads the component.
Definition: compound_cloud_system.cpp:71
int amountAvailable(int x, int y, float rate)
Rate should be less than one.
Definition: compound_cloud_system.cpp:124
int takeCompound(int x, int y, float rate)
Rate should be less than one.
Definition: compound_cloud_system.cpp:108
Base class for components.
Definition: component.h:31
A system handles one specific part of the game.
Definition: system.h:23
StorageContainer storage() const override
Serializes the component.
Definition: compound_cloud_system.cpp:86
void shutdown() override
Shuts the system down.
Definition: compound_cloud_system.cpp:203
static luabind::scope luaBindings()
Lua bindings.
Definition: compound_cloud_system.cpp:41
CompoundCloudSystem()
Constructor.
Definition: compound_cloud_system.cpp:164
Ogre::ColourValue color
The 3x3 grid of density tiles around the player for seamless movement.
Definition: compound_cloud_system.h:51
std::vector< std::vector< float > > density
The 2D array that contains the current compound clouds and those from last frame. ...
Definition: compound_cloud_system.h:37
A component for a Ogre scene nodes.
Definition: scene_node_system.h:34
Definition: bullet_ogre_conversion.h:6
void update(int renderTime, int logicTime) override
Updates the system.
Definition: compound_cloud_system.cpp:211
static luabind::scope luaBindings()
Lua bindings.
Definition: compound_cloud_system.cpp:145
GameState * gameState() const
Returns the system's game state.
Definition: system.cpp:183
void init(GameState *gameState) override
Initializes the system.
Definition: compound_cloud_system.cpp:185
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
CompoundId m_compoundId
The compound id.
Definition: compound_cloud_system.h:56
Compound clouds that flow in the environment.
Definition: compound_cloud_system.h:27
A key-value storage for serialization.
Definition: serialization.h:36
int width
The size of the compound cloud grid.
Definition: compound_cloud_system.h:32