Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/water/src/world_entities/environments/mapped_water.h @ 8489

Last change on this file since 8489 was 8484, checked in by stefalie, 18 years ago

water: some more cleanup

File size: 2.4 KB
Line 
1/*!
2 * @file mapped_water.h
3 *
4*/
5/* example input in .oxw file
6<MappedWater>
7  <waterpos>-500,0,-500</waterpos>
8  <watersize>1000,1000</watersize>
9  <wateruv>10</wateruv>
10  <waterflow>0.003</waterflow>
11  <lightpos>100,150,100</lightpos>
12</MappedWater> */
13
14
15
16#ifndef _MAPPED_WATER_H
17#define _MAPPED_WATER_H
18
19#include "world_entity.h"
20#include "material.h"
21#include "shader.h"
22#include "effects/fog_effect.h"
23
24
25class MappedWater : public WorldEntity
26{
27  public:
28    MappedWater(const TiXmlElement* root = NULL);
29    virtual ~MappedWater();
30
31    void loadParams(const TiXmlElement* root);
32
33    void draw() const;
34    void tick(float dt);
35
36    // function to prepare renderpaths for creation of refleaction and reflaction textures
37    void activateReflection();
38    void deactivateReflection();
39    void activateRefraction();
40    void deactivateRefraction();
41
42    // functions to set parameters for the water, usually they're called through loadparam
43    void setLightPosition(float x, float y, float z) { this->lightPos = Vector(x,y,z); };
44    void setWaterPos(float x, float y, float z) { this->waterPos = Vector(x,y,z); };
45    void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; };
46    void setWaterUV(float uv) { this->g_WaterUV = uv; };
47    void setWaterFlow(float flow) { this->g_WaterFlow = flow; };
48
49  private:
50    void initShaders();
51
52  private:
53    Vector              waterPos;                   //!< position of the water
54    float               xWidth, zWidth;             //!< size of the water quad
55    Vector              lightPos;                   //!< position of the light that is used to render the reflection
56
57    float               move;                       //!< textures coords, speeds, positions for the shaded textures....
58    float               move2;                      //!<
59    float               g_WaterUV;                  //!<
60    float               g_WaterFlow;                //!<
61    float               refrUV;                     //!<
62    float               normalUV;                   //!<
63    float               kNormalMapScale;            //!<
64
65    int                 textureSize;                //!< height and width of the texture
66    Material            mat;
67    Shader*             shader;
68    Shader::Uniform*    cam_uni;                    //!< uniform that is used for the camera position
69
70    //FogEffect*          fog;
71
72};
73
74#endif  /* _MAPPED_WATER_H */
Note: See TracBrowser for help on using the repository browser.