Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8484 in orxonox.OLD for branches/water/src


Ignore:
Timestamp:
Jun 15, 2006, 5:26:56 PM (18 years ago)
Author:
stefalie
Message:

water: some more cleanup

Location:
branches/water/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/water/src/lib/graphics/importer/material.cc

    r8376 r8484  
    352352  assert(textureNumber < this->textures.size());
    353353
    354   // HACK
    355   glActiveTexture(textureNumber);
    356    glEnable(GL_TEXTURE_2D);
    357    glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture());
     354  glEnable(GL_TEXTURE_2D);
     355  glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture());
    358356  glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
    359357
  • branches/water/src/world_entities/environments/mapped_water.cc

    r8483 r8484  
    109109
    110110  /// initialization of the shaders
     111  this->initShaders();
     112
     113  /// fog, doesnt work the way i want it to work
     114  /*this->fog = new FogEffect();
     115  fog->setFogColor(0.1f, 0.2f, 0.4f);
     116  fog->setFogRange(0.0f, 500.0f);
     117  fog->setFogDensity(0.03f);*/
     118}
     119
     120/**
     121 * @brief deltes shader and the uniform used by the camera
     122 */
     123MappedWater::~MappedWater()
     124{
     125  delete shader;
     126  delete cam_uni;
     127  //delete fog;
     128}
     129
     130/**
     131 * @brief initialization of the shaders
     132 */
     133void MappedWater::initShaders()
     134{
    111135  // load shader files
    112136  shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
     
    131155
    132156  this->shader->deactivateShader();
    133 
    134   /// fog, doesnt work the way i want it to work
    135   /*this->fog = new FogEffect();
    136   fog->setFogColor(0.1f, 0.2f, 0.4f);
    137   fog->setFogRange(0.0f, 500.0f);
    138   fog->setFogDensity(0.03f);*/
    139 }
    140 
    141 /**
    142  * @brief deltes shader and the uniform used by the camera
    143  */
    144 MappedWater::~MappedWater()
    145 {
    146   delete shader;
    147   delete cam_uni;
    148   //delete fog;
    149157}
    150158
     
    299307  glCullFace(GL_BACK);
    300308
    301   glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));
    302 
    303309  // Create the texture and store it on the video card
    304   glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     310  mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
    305311
    306312  glPopMatrix();
     
    356362  glCullFace(GL_BACK);
    357363
    358   glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1));
    359 
    360364  // Create the texture and store it on the video card
    361   glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
     365  mat.renderToTexture(1, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
    362366
    363367  glPopMatrix();
  • branches/water/src/world_entities/environments/mapped_water.h

    r8483 r8484  
    4848
    4949  private:
     50    void initShaders();
     51
     52  private:
    5053    Vector              waterPos;                   //!< position of the water
    5154    float               xWidth, zWidth;             //!< size of the water quad
Note: See TracChangeset for help on using the changeset viewer.