[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); |
---|
[7954] | 40 | |
---|
| 41 | virtual void varChangeHandler( std::list<int> & id ); |
---|
[6456] | 42 | |
---|
[6766] | 43 | private: |
---|
| 44 | bool posToGridPoint(float x, float z, unsigned int& row, unsigned int& column); |
---|
[6695] | 45 | |
---|
[6455] | 46 | private: |
---|
| 47 | Grid* grid; //!< The water-surface-model to render with |
---|
[6518] | 48 | float** velocities; //!< Velocities. |
---|
| 49 | float viscosity; //!< Viscosity (bigger more like honey, smaller more like water). |
---|
| 50 | float cohesion; //!< Cohesion. |
---|
| 51 | |
---|
[7125] | 52 | Material waterMaterial; |
---|
[6467] | 53 | Shader* waterShader; |
---|
[7954] | 54 | |
---|
[6458] | 55 | float height; //!< The hight of the Water |
---|
[7954] | 56 | int height_handle; //!< Handle to notify about changes of height |
---|
[4261] | 57 | |
---|
[7954] | 58 | unsigned int resX, resY; //!< Grid resolution |
---|
| 59 | int resX_handle; //!< Handle to notify about changes of resX |
---|
| 60 | int resY_handle; //!< Handle to notify about changes of resY |
---|
| 61 | float sizeX, sizeY; //!< waters size |
---|
| 62 | int sizeX_handle; //!< Handle to notify about changes of sizeX |
---|
| 63 | int sizeY_handle; //!< Handle to notify about changes of sizeY |
---|
[6457] | 64 | |
---|
| 65 | float phase; |
---|
[3411] | 66 | }; |
---|
| 67 | |
---|
[6455] | 68 | #endif /* _WATER_H */ |
---|
[3411] | 69 | |
---|
| 70 | |
---|
[3484] | 71 | |
---|