Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 20, 2006, 2:34:28 PM (19 years ago)
Author:
stefalie
Message:

water: one bug left

Location:
branches/water/src/world_entities/environments
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/water/src/world_entities/environments/mapped_water.cc

    r8628 r8630  
    234234  // to our texture map size, then render the current scene our camera
    235235  // is looking at to the already allocated texture unit.  Since this
    236   // is a reflection of the top of the water surface we use clipping 
     236  // is a reflection of the top of the water surface we use clipping
    237237  // planes to only render the top of the world as a reflection.  If
    238238  // we are below the water we don't flip the reflection but just use
     
    318318  if(pos.y > waterPos.y)
    319319  {
    320     double plane[4] = {0, -1, 0, waterPos.y}; 
     320    double plane[4] = {0, -1, 0, waterPos.y};
    321321    glClipPlane(GL_CLIP_PLANE0, plane);
    322 
    323322  }
    324323  // If the camera is below the water, only render the data above the water
     
    326325  {
    327326    glCullFace(GL_FRONT);
    328     double plane[4] = {0, 1, 0, -waterPos.y}; 
     327    double plane[4] = {0, 1, 0, -waterPos.y};
    329328    glClipPlane(GL_CLIP_PLANE0, plane);
    330329  }
  • branches/water/src/world_entities/environments/mapped_water.h

    r8628 r8630  
    2626class MappedWater : public WorldEntity
    2727{
    28   public:
    29     MappedWater(const TiXmlElement* root = NULL);
    30     virtual ~MappedWater();
     28public:
     29  MappedWater(const TiXmlElement* root = NULL);
     30  virtual ~MappedWater();
    3131
    32     void loadParams(const TiXmlElement* root);
     32  void loadParams(const TiXmlElement* root);
    3333
    34     void draw() const;
    35     void tick(float dt);
     34  void draw() const;
     35  void tick(float dt);
    3636
    37     // function to prepare renderpaths for creation of refleaction and reflaction textures
    38     void activateReflection();
    39     void deactivateReflection();
    40     void activateRefraction();
    41     void deactivateRefraction();
     37  // function to prepare renderpaths for creation of refleaction and reflaction textures
     38  void activateReflection();
     39  void deactivateReflection();
     40  void activateRefraction();
     41  void deactivateRefraction();
    4242
    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; };
     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; };
    5151
    52   private:
    53     void initParams();
    54     void initTextures();
    55     void initShaders();
     52private:
     53  void initParams();
     54  void initTextures();
     55  void initShaders();
    5656
    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
     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
    6262
    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;
     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;
    6969
    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
     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
    7474};
    7575
Note: See TracChangeset for help on using the changeset viewer.