Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8031 in orxonox.OLD for branches


Ignore:
Timestamp:
May 31, 2006, 3:38:38 PM (18 years ago)
Author:
stefalie
Message:

water: ok, so far

Location:
branches/water/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/water/src/story_entities/game_world.cc

    r8025 r8031  
    514514void GameWorld::renderPassRefraction()
    515515{
    516 /*
     516
    517517    // clear buffer
    518518  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     
    544544      mw->deactivateRefraction();
    545545    }
    546   }*/
     546  }
    547547}
    548548
  • branches/water/src/world_entities/environments/mapped_water.cc

    r8025 r8031  
    4242  mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 0);
    4343  // load refraction texture
    44   mat.setDiffuseMap("pictures/error_texture.png", GL_TEXTURE_2D, 1);
     44  //mat.setDiffuseMap("pictures/error_texture.png", GL_TEXTURE_2D, 1);
    4545  // load normal map
    46   mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
     46  //mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
    4747  // load dudv map
    48   mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);
     48  //mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);
    4949  // set up depth texture
    50   mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 4);
     50  //mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 4);
    5151
    5252
     
    6060  unsigned int* pTextureReflection = new unsigned int [this->textureSize * this->textureSize * channels];
    6161  memset(pTextureReflection, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
    62   unsigned int* pTextureRefraction = new unsigned int [this->textureSize * this->textureSize * channels];
    63   memset(pTextureRefraction, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
     62  //unsigned int* pTextureRefraction = new unsigned int [this->textureSize * this->textureSize * channels];
     63  //memset(pTextureRefraction, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
    6464  // Register the texture with OpenGL and bind it to the texture ID
    6565  mat.select();
     
    7272
    7373  //the same for the refraction
    74   glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1));
    75   glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureRefraction);
     74  //glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1));
     75  //glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureRefraction);
    7676
    7777  // Set the texture quality
     
    8383  // Since we stored the texture space with OpenGL, we can delete the image data
    8484  delete [] pTextureReflection;
    85   delete [] pTextureRefraction;
     85  //delete [] pTextureRefraction;
    8686
    8787
     
    148148  glBegin(GL_QUADS);
    149149  // The back left vertice for the water
    150   glMultiTexCoord2f(GL_TEXTURE0, 0.0f, g_WaterUV);            // Reflection texture
     150  glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0);//g_WaterUV);            // Reflection texture
    151151  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, refrUV - move);        // Refraction texture
    152152  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2);     // Normal map texture
     
    156156
    157157  // The front left vertice for the water
    158   glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f);                  // Reflection texture
     158  glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1);//0.0f);                  // Reflection texture
    159159  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f - move);           // Refraction texture
    160160  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, 0.0f + move2);          // Normal map texture
     
    164164
    165165  // The front right vertice for the water
    166   glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, 0.0f);             // Reflection texture
     166  glMultiTexCoord2f(GL_TEXTURE0, 1,1); //g_WaterUV, 0.0f);             // Reflection texture
    167167  glMultiTexCoord2f(GL_TEXTURE1, refrUV, 0.0f - move);         // Refraction texture
    168168  glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2);      // Normal map texture
     
    172172
    173173  // The back right vertice for the water
    174   glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, g_WaterUV);        // Reflection texture
     174  glMultiTexCoord2f(GL_TEXTURE0, 1,0);//g_WaterUV, g_WaterUV);        // Reflection texture
    175175  glMultiTexCoord2f(GL_TEXTURE1, refrUV, refrUV - move);       // Refraction texture
    176176  glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2);  // Normal map texture
     
    243243
    244244  mat.select();
    245   glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     245  //glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     246  //mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, textureSize, textureSize);
    246247
    247248  glPopMatrix();
     
    250251
    251252void MappedWater::activateRefraction()
    252 {/*
     253{
    253254  // To create the refraction and depth textures we do the same thing
    254255  // we did for the reflection texture, except we don't need to turn
     
    281282    double plane[4] = {0.0, 1.0, 0.0, -waterHeight};
    282283    glClipPlane(GL_CLIP_PLANE0, plane);
    283   }*/
     284  }
    284285}
    285286
    286287void MappedWater::deactivateRefraction()
    287 {/*
     288{
    288289  glDisable(GL_CLIP_PLANE0);
    289290  glCullFace(GL_BACK);
    290291
    291292  mat.select();
     293  mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, textureSize, textureSize);
     294
    292295  // Bind the current scene to our refraction texture
    293296//  glBindTexture(GL_TEXTURE_2D, g_Texture[REFRACTION_ID]);
    294   glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     297//  glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
    295298
    296299  // Bind the current scene to our depth texture
    297300//  glBindTexture(GL_TEXTURE_2D, g_Texture[DEPTH_ID]);
    298   glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, textureSize, textureSize, 0);
     301//  glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, textureSize, textureSize, 0);
    299302
    300303  glPopMatrix();
    301304  glPopAttrib();
    302   */
    303 }
     305}
Note: See TracChangeset for help on using the changeset viewer.