| [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" | 
|---|
| [3411] | 14 |  | 
|---|
| [5405] | 15 | /* FORWARD DECLARATION */ | 
|---|
| [5511] | 16 | class Material; | 
|---|
| [6455] | 17 | class Grid; | 
|---|
| [6467] | 18 | class Shader; | 
|---|
| [3419] | 19 |  | 
|---|
| [6455] | 20 | //! A Class to handle a WaterEffects | 
|---|
|  | 21 | class Water : public WorldEntity | 
|---|
| [3411] | 22 | { | 
|---|
| [3416] | 23 | public: | 
|---|
| [6455] | 24 | Water(const TiXmlElement* root = NULL); | 
|---|
|  | 25 | ~Water(); | 
|---|
| [4010] | 26 |  | 
|---|
| [6455] | 27 | void loadParams(const TiXmlElement* root); | 
|---|
| [3419] | 28 |  | 
|---|
| [6455] | 29 | void setResolution(unsigned int resX, unsigned int resY); | 
|---|
|  | 30 | void setSize(float sizeX, float sizeY); | 
|---|
| [6458] | 31 | void setHeight(float height); | 
|---|
| [6455] | 32 | void rebuildGrid(); | 
|---|
| [4680] | 33 |  | 
|---|
| [6766] | 34 | void wave(float x, float y, float z, float force); | 
|---|
|  | 35 | inline void wave(Vector pos, float force) { this->wave(pos.x, pos.y, pos.z, force); }; | 
|---|
|  | 36 |  | 
|---|
| [6457] | 37 | void draw() const; | 
|---|
| [6456] | 38 | void tick(float dt); | 
|---|
|  | 39 |  | 
|---|
| [6695] | 40 | virtual int writeBytes(const byte* data, int length, int sender); | 
|---|
|  | 41 | virtual int readBytes(byte* data, int maxLength, int * reciever); | 
|---|
|  | 42 |  | 
|---|
|  | 43 | int writeState( const byte * data, int length, int sender ); | 
|---|
|  | 44 | int readState( byte * data, int maxLength ); | 
|---|
|  | 45 |  | 
|---|
| [6766] | 46 | private: | 
|---|
|  | 47 | bool posToGridPoint(float x, float z, unsigned int& row, unsigned int& column); | 
|---|
| [6695] | 48 |  | 
|---|
| [6455] | 49 | private: | 
|---|
|  | 50 | Grid*           grid;            //!< The water-surface-model to render with | 
|---|
| [6518] | 51 | float**         velocities;      //!< Velocities. | 
|---|
|  | 52 | float           viscosity;       //!< Viscosity (bigger more like honey, smaller more like water). | 
|---|
|  | 53 | float           cohesion;        //!< Cohesion. | 
|---|
|  | 54 |  | 
|---|
| [6457] | 55 | Material*       waterMaterial; | 
|---|
| [6467] | 56 | Shader*         waterShader; | 
|---|
| [6458] | 57 | float           height;          //!< The hight of the Water | 
|---|
| [4261] | 58 |  | 
|---|
| [6455] | 59 | unsigned int    resX, resY; | 
|---|
|  | 60 | float           sizeX, sizeY; | 
|---|
| [6457] | 61 |  | 
|---|
|  | 62 | float phase; | 
|---|
| [3411] | 63 | }; | 
|---|
|  | 64 |  | 
|---|
| [6455] | 65 | #endif  /* _WATER_H */ | 
|---|
| [3411] | 66 |  | 
|---|
|  | 67 |  | 
|---|
| [3484] | 68 |  | 
|---|