Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 8, 2006, 4:34:29 PM (19 years ago)
Author:
stefalie
Message:

water: yahoooo :-)

File:
1 edited

Legend:

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

    r8263 r8268  
    125125  Shader::Uniform(shader, "dudvMap").set(3);
    126126  // Set the variable "depthMap" to correspond to the fifth texture unit
    127   //Shader::Uniform(shader, "depthMap").set(4);
     127  Shader::Uniform(shader, "depthMap").set(2);
    128128  // Give the variable "waterColor" a blue color
    129129  Shader::Uniform(shader, "waterColor").set(0.1f, 0.2f, 0.4f, 1.0f);
     
    173173  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2);     // Normal map texture
    174174  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                       // DUDV map texture
    175   glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                       // Depth texture
     175  //glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                       // Depth texture
    176176  glVertex3f(0.0f, waterHeight, 0.0f);
    177177
     
    183183  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, 0.0f + move2);          // Normal map texture
    184184  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
    185   glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                        // Depth texture
     185  //glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                        // Depth texture
    186186  glVertex3f(0.0f, waterHeight, 1000.0f);
    187187
     
    193193  glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2);      // Normal map texture
    194194  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
    195   glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                        // Depth texture
     195  //glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                        // Depth texture
    196196  glVertex3f(1000.0f, waterHeight, 1000.0f);
    197197
     
    203203  glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2);  // Normal map texture
    204204  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
    205   glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                        // Depth texture
     205  //glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                        // Depth texture
    206206  glVertex3f(1000.0f, waterHeight, 0.0f);
    207207  glEnd();
     
    269269void MappedWater::deactivateReflection()
    270270{
    271   //glDisable(GL_CLIP_PLANE0);
     271  glDisable(GL_CLIP_PLANE0);
    272272  glCullFace(GL_BACK);
    273273
     
    288288
    289289void MappedWater::activateRefraction()
    290 { 
     290{/*
    291291  // save viewport matrix and change the viewport size
    292292  glPushAttrib(GL_VIEWPORT_BIT);
     
    299299  // In order to line up the reflection nicely with the world we have to translate
    300300  // the world to the position of our reflected surface, multiplied by two.
    301   //glEnable(GL_CLIP_PLANE0);
     301  glEnable(GL_CLIP_PLANE0);
    302302  Vector pos = State::getCameraNode()->getAbsCoor();
    303303  //pos.debug();
     
    314314    // Set our plane equation and turn clipping on
    315315    double plane[4] = {0.0, 1.0, 0.0, -waterHeight};
    316     //glClipPlane(GL_CLIP_PLANE0, plane);
     316    glClipPlane(GL_CLIP_PLANE0, plane);
    317317  }
    318318  else
     
    321321    // but just render it clipped so only the top is drawn.
    322322    double plane[4] = {0.0, 1.0, 0.0, waterHeight};
    323     //glClipPlane(GL_CLIP_PLANE0, plane);
    324   }
    325 
    326 /*
     323    glClipPlane(GL_CLIP_PLANE0, plane);
     324  }
     325*/
     326
    327327  // To create the refraction and depth textures we do the same thing
    328328  // we did for the reflection texture, except we don't need to turn
     
    343343
    344344  // If the camera is above water, render the data below the water
    345   glEnable(GL_CLIP_PLANE1);
     345  glEnable(GL_CLIP_PLANE0);
    346346  Vector pos = State::getCameraNode()->getAbsCoor();
    347347  if(pos.y > waterHeight)
     
    358358    glClipPlane(GL_CLIP_PLANE0, plane);
    359359  }
    360   PRINTF(0)("test");*/
    361360}
    362361
    363362void MappedWater::deactivateRefraction()
    364363{
    365   //glDisable(GL_CLIP_PLANE0);
     364  glDisable(GL_CLIP_PLANE0);
    366365  glCullFace(GL_BACK);
    367366
Note: See TracChangeset for help on using the changeset viewer.