Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8625 was 8622, checked in by stefalie, 18 years ago

water: cleanup… and hey: the mighty reflection is back :-)

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