Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 22, 2006, 2:13:18 PM (18 years ago)
Author:
bensch
Message:

merged the water branche back. conflicts resolved in favour of the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/environments/mapped_water.h

    r8037 r8719  
    11/*!
    22 * @file mapped_water.h
    3  *
     3 *  worldentity for flat, cool looking, mapped water
    44*/
     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
    517
    618#ifndef _MAPPED_WATER_H
    719#define _MAPPED_WATER_H
    820
    9 /* INCLUDES */
    1021#include "world_entity.h"
    1122#include "material.h"
    1223#include "shader.h"
    1324
     25
    1426class MappedWater : public WorldEntity
    1527{
    16   public:
    17     MappedWater(const TiXmlElement* root = NULL);
    18     virtual ~MappedWater();
     28public:
     29  MappedWater(const TiXmlElement* root = NULL);
     30  virtual ~MappedWater();
    1931
    20     void loadParams(const TiXmlElement* root);
     32  void loadParams(const TiXmlElement* root);
    2133
     34  void draw() const;
     35  void tick(float dt);
    2236
    23     void activateReflection();
    24     void deactivateReflection();
     37  // function to prepare renderpaths for creation of refleaction and reflaction textures
     38  void activateReflection();
     39  void deactivateReflection();
     40  void activateRefraction();
     41  void deactivateRefraction();
    2542
    26     void activateRefraction();
    27     void deactivateRefraction();
     43  // functions to set parameters for the water, usually they're called through loadparam
     44  void setLightPos(float x, float y, float z) { this->lightPos = Vector(x,y,z); };
     45  void setWaterPos(float x, float y, float z) { this->waterPos = Vector(x,y,z); };
     46  void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; };
     47  void setWaterAngle(float angle) { this->waterAngle = angle; };
     48  void setWaterUV(float uv) { this->waterUV = uv; };
     49  void setWaterFlow(float flow) { this->waterFlow = flow; };
     50  void setNormalMapScale(float scale) { this->kNormalMapScale = scale; };
    2851
    29     void draw() const;
    30     void tick(float dt);
     52private:
     53  void initParams();
     54  void initTextures();
     55  void initShaders();
    3156
    32   private:
    33     void setLightPosition(float x, float y, float z) { this->lightPos = Vector(x,y,z); };
    34     void setHeight(float height);
     57private:
     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
    3562
    36   private:
    37     float               waterHeight;                //!< y-coord of the Water
     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;
    3869
    39     float               move;                       //!< textures coords, speeds, positions for the shaded textures....
    40     float               move2;                      //!<
    41     float               g_WaterUV;                  //!<
    42     float               g_WaterFlow;                //!<
    43     float               refrUV;                     //!<
    44     float               normalUV;                   //!<
    45     float               kNormalMapScale;            //!<
    46 
    47     int                 textureSize;                //!< size of the texture
    48     Vector              lightPos;
    49     Material            mat;
    50     Shader*             shader;
    51     Shader::Uniform*    cam_uni;                        //!< uniform that is used for the camera position
    52 
     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
    5374};
    5475
    55 #endif  /* _MAPPED_WATER_H */
     76#endif
Note: See TracChangeset for help on using the changeset viewer.