| [4597] | 1 | /*! |
|---|
| [6455] | 2 | * @file water.h |
|---|
| [5357] | 3 | * Definition of the SkyBox, that handles the Display of an atmosphere for orxonox. |
|---|
| 4 | * |
|---|
| 5 | * A SkyBox is always centered at the current working Camera, and will only obey the cameras |
|---|
| 6 | * movment but not its rotation. |
|---|
| [3416] | 7 | */ |
|---|
| 8 | |
|---|
| [6455] | 9 | #ifndef _WATER_H |
|---|
| 10 | #define _WATER_H |
|---|
| [3416] | 11 | |
|---|
| [3419] | 12 | /* INCLUDES */ |
|---|
| [3502] | 13 | #include "world_entity.h" |
|---|
| [7125] | 14 | #include "material.h" |
|---|
| [3411] | 15 | |
|---|
| [7125] | 16 | |
|---|
| [5405] | 17 | /* FORWARD DECLARATION */ |
|---|
| [6455] | 18 | class Grid; |
|---|
| [6467] | 19 | class Shader; |
|---|
| [3419] | 20 | |
|---|
| [6455] | 21 | //! A Class to handle a WaterEffects |
|---|
| 22 | class Water : public WorldEntity |
|---|
| [3411] | 23 | { |
|---|
| [3416] | 24 | public: |
|---|
| [6455] | 25 | Water(const TiXmlElement* root = NULL); |
|---|
| [6981] | 26 | virtual ~Water(); |
|---|
| [4010] | 27 | |
|---|
| [6455] | 28 | void loadParams(const TiXmlElement* root); |
|---|
| [3419] | 29 | |
|---|
| [6455] | 30 | void setResolution(unsigned int resX, unsigned int resY); |
|---|
| 31 | void setSize(float sizeX, float sizeY); |
|---|
| [6458] | 32 | void setHeight(float height); |
|---|
| [6455] | 33 | void rebuildGrid(); |
|---|
| [4680] | 34 | |
|---|
| [6766] | 35 | void wave(float x, float y, float z, float force); |
|---|
| 36 | inline void wave(Vector pos, float force) { this->wave(pos.x, pos.y, pos.z, force); }; |
|---|
| 37 | |
|---|
| [6457] | 38 | void draw() const; |
|---|
| [6456] | 39 | void tick(float dt); |
|---|
| 40 | |
|---|
| [6695] | 41 | virtual int writeBytes(const byte* data, int length, int sender); |
|---|
| 42 | virtual int readBytes(byte* data, int maxLength, int * reciever); |
|---|
| 43 | |
|---|
| 44 | int writeState( const byte * data, int length, int sender ); |
|---|
| 45 | int readState( byte * data, int maxLength ); |
|---|
| 46 | |
|---|
| [6766] | 47 | private: |
|---|
| 48 | bool posToGridPoint(float x, float z, unsigned int& row, unsigned int& column); |
|---|
| [6695] | 49 | |
|---|
| [6455] | 50 | private: |
|---|
| 51 | Grid* grid; //!< The water-surface-model to render with |
|---|
| [6518] | 52 | float** velocities; //!< Velocities. |
|---|
| 53 | float viscosity; //!< Viscosity (bigger more like honey, smaller more like water). |
|---|
| 54 | float cohesion; //!< Cohesion. |
|---|
| 55 | |
|---|
| [7125] | 56 | Material waterMaterial; |
|---|
| [6467] | 57 | Shader* waterShader; |
|---|
| [6458] | 58 | float height; //!< The hight of the Water |
|---|
| [4261] | 59 | |
|---|
| [6455] | 60 | unsigned int resX, resY; |
|---|
| 61 | float sizeX, sizeY; |
|---|
| [6457] | 62 | |
|---|
| 63 | float phase; |
|---|
| [3411] | 64 | }; |
|---|
| 65 | |
|---|
| [6455] | 66 | #endif /* _WATER_H */ |
|---|
| [3411] | 67 | |
|---|
| 68 | |
|---|
| [3484] | 69 | |
|---|