Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7814 in orxonox.OLD for branches/water


Ignore:
Timestamp:
May 24, 2006, 4:39:32 PM (19 years ago)
Author:
stefalie
Message:

branches/water: textures works now, but its at the wrong place

Location:
branches/water/src
Files:
7 edited

Legend:

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

    r7785 r7814  
    497497      LightManager::getInstance()->draw();
    498498      // draw everything to be included in the reflection
    499       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    500         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     499      this->drawEntityList(State::getObjectManager()->getReflectionList());
     500//       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
     501//         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
    501502
    502503      // clean up from reflection rendering
  • branches/water/src/util/object_manager.cc

    r7785 r7814  
    6565      delete this->objectLists[i].front();
    6666
    67   // delete reflectin list
    68   while( !this->reflectionList.empty())
    69     delete this->reflectionList.front();
     67  // delete reflection list
     68  this->reflectionList.clear();
    7069}
    7170
  • branches/water/src/world_entities/environments/mapped_water.cc

    r7796 r7814  
    3434    this->loadParams(root);
    3535
    36   //! HACK FIXME HACK FIXME HACK FIXME HACK FIXME
    3736  //! todo: rename texture to reflection texture
    3837  // set up refleciton texture
    39   //mat.setDiffuseMap(&this->texture, 0);
     38  // FIXME mat.setDiffuseMap(this->texture, 0); doesnt work,
    4039  mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 0);
    41 /*  mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 1);
    42   mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 2);
    43   mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 3);
    44   mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 4);*/
    4540  // load refraction texture
    4641  //mat.setDiffuseMap(&this->refractionTexture, 1);
     
    7166  glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTexture);
    7267
     68  //gluBuild2DMipmaps(GL_TEXTURE_2D, channels, this->textureSize, this->textureSize, type,  GL_UNSIGNED_INT, pTexture);
     69
    7370  // Set the texture quality
    7471  glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
     
    8077  delete [] pTexture;
    8178
    82   //  shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
     79
     80  //shader = new Shader( "/home/stefalie/svn/orxonox/data/trunk/shaders/water.vert", "/home/stefalie/svn/orxonox/data/trunk/shaders/mapped_water.frag");
     81  shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
    8382}
    8483
     
    101100  glTranslatef(0,this->waterHeight,0);
    102101
     102  //HACK
     103  glTranslatef(550,0,100);
    103104  //glEnable(GL_LIGHTING);
    104105
     
    111112  // HACK
    112113
    113   //glDisable(GL_BLEND);
     114  glDisable(GL_BLEND);
    114115  //glActiveTexture(GL_TEXTURE0);
    115116  //glBindTexture(GL_TEXTURE_2D, this->texture);
     
    118119  glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));
    119120
    120   // Shader init
     121
     122/*  // Shader init
    121123  //this->shader->activateShader();
    122124  GLint uniform;
     
    162164  uniform = glGetUniformLocationARB(shader->getProgram(), "cameraPos");
    163165  glUniform4fARB(uniform, vPosition.x, vPosition.y, vPosition.z, 1.0f);
    164 
     166*/
    165167  glBegin(GL_QUADS);
    166   glNormal3f(0,1,0);
    167   glMultiTexCoord2f(GL_TEXTURE0, 0,0);
    168   glMultiTexCoord2f(GL_TEXTURE1, 0,0);
    169   glMultiTexCoord2f(GL_TEXTURE2, 0,0);
    170   glMultiTexCoord2f(GL_TEXTURE3, 0,0);
    171   glMultiTexCoord2f(GL_TEXTURE4, 0,0);
    172   glVertex3f(0,0,0);
    173 
    174   glMultiTexCoord2f(GL_TEXTURE0, 1,0);
    175   glMultiTexCoord2f(GL_TEXTURE1, 1,0);
    176   glMultiTexCoord2f(GL_TEXTURE2, 1,0);
    177   glMultiTexCoord2f(GL_TEXTURE3, 1,0);
    178   glMultiTexCoord2f(GL_TEXTURE4, 1,0);
    179   glVertex3f(100,0,0);
    180 
    181   glMultiTexCoord2f(GL_TEXTURE0, 1,1);
    182   glMultiTexCoord2f(GL_TEXTURE1, 1,1);
    183   glMultiTexCoord2f(GL_TEXTURE2, 1,1);
    184   glMultiTexCoord2f(GL_TEXTURE3, 1,1);
    185   glMultiTexCoord2f(GL_TEXTURE4, 1,1);
    186   glVertex3f(100,0,-100);
    187 
    188   glMultiTexCoord2f(GL_TEXTURE0, 0,1);
    189   glMultiTexCoord2f(GL_TEXTURE1, 0,1);
    190   glMultiTexCoord2f(GL_TEXTURE2, 0,1);
    191   glMultiTexCoord2f(GL_TEXTURE3, 0,1);
    192   glMultiTexCoord2f(GL_TEXTURE4, 0,1);
    193   glVertex3f(0,0,-100);
     168  glNormal3f(0, 1, 0);
     169  glMultiTexCoord2f(GL_TEXTURE0, 0, 0);
     170  glMultiTexCoord2f(GL_TEXTURE1, 0, 0);
     171  glMultiTexCoord2f(GL_TEXTURE2, 0, 0);
     172  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);
     173  glMultiTexCoord2f(GL_TEXTURE4, 0, 0);
     174  glVertex3f(-500, 0, 500);
     175
     176  glMultiTexCoord2f(GL_TEXTURE0, 1, 0);
     177  glMultiTexCoord2f(GL_TEXTURE1, 1, 0);
     178  glMultiTexCoord2f(GL_TEXTURE2, 1, 0);
     179  glMultiTexCoord2f(GL_TEXTURE3, 1, 0);
     180  glMultiTexCoord2f(GL_TEXTURE4, 1, 0);
     181  glVertex3f(500, 0, 500);
     182
     183  glMultiTexCoord2f(GL_TEXTURE0, 1, 1);
     184  glMultiTexCoord2f(GL_TEXTURE1, 1, 1);
     185  glMultiTexCoord2f(GL_TEXTURE2, 1, 1);
     186  glMultiTexCoord2f(GL_TEXTURE3, 1, 1);
     187  glMultiTexCoord2f(GL_TEXTURE4, 1, 1);
     188  glVertex3f(500, 0, -500);
     189
     190  glMultiTexCoord2f(GL_TEXTURE0, 0, 1);
     191  glMultiTexCoord2f(GL_TEXTURE1, 0, 1);
     192  glMultiTexCoord2f(GL_TEXTURE2, 0, 1);
     193  glMultiTexCoord2f(GL_TEXTURE3, 0, 1);
     194  glMultiTexCoord2f(GL_TEXTURE4, 0, 1);
     195  glVertex3f(-500, 0, -500);
    194196  glEnd();
    195197  //this->shader->deactivateShader();
     
    210212{
    211213  glPushAttrib(GL_VIEWPORT_BIT);
    212   //   glPushMatrix();
     214 
    213215
    214216  //glLoadIdentity();
    215217  glViewport(0,0, textureSize, textureSize);
    216218
    217 
     219  glPushMatrix();
    218220  // Clear the color and depth bits, reset the matrix and position our camera.
    219221
     
    227229  //{
    228230  // Translate the world, then flip it upside down
    229   //   glTranslatef(0.0f, waterHeight*2.0f, 0.0f);
    230   //  glScalef(1.0, -1.0, 1.0);
     231  glTranslatef(0.0f, this->waterHeight*2.0f, 0.0f);
     232  glScalef(1.0, -1.0, 1.0);
    231233
    232234  // Since the world is updside down we need to change the culling to FRONT
    233   //glCullFace(GL_FRONT);
     235  glCullFace(GL_FRONT);
    234236
    235237  // Set our plane equation and turn clipping on
    236   // double plane[4] = {0.0, 1.0, 0.0, -waterHeight};
    237   //   glEnable(GL_CLIP_PLANE0);
    238   // glClipPlane(GL_CLIP_PLANE0, plane);
     238  double plane[4] = {0.0, 1.0, 0.0, -waterHeight};
     239  //glEnable(GL_CLIP_PLANE0);
     240  //glClipPlane(GL_CLIP_PLANE0, plane);
    239241
    240242  // Render the world upside down and clipped (only render the top flipped).
     
    265267{
    266268//  glBindTexture(GL_TEXTURE_2D, texture.getTexture()); //is done by mat.select();
    267   glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));
     269  //glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));
    268270
    269271  //mat.setDiffuseMap(&texture, 0);
    270   // mat.select();
     272  mat.select();
    271273  glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
    272 
     274  //glDisable(GL_CLIP_PLANE0);
     275
     276  glPopMatrix();
    273277
    274278  glPopAttrib();
    275   //   glPopMatrix();
     279 
    276280}
    277281
  • branches/water/src/world_entities/skybox.cc

    r7328 r7814  
    7474  this->setClassID(CL_SKYBOX, "SkyBox");
    7575  this->toList(OM_ENVIRON_NOTICK);
     76  this->toReflectionList();
    7677  //this->size = 100.0;
    7778  this->textureSize = 1024.0f;
  • branches/water/src/world_entities/terrain.cc

    r7221 r7814  
    106106  this->setClassID(CL_TERRAIN, "Terrain");
    107107  this->toList(OM_ENVIRON_NOTICK);
     108  this->toReflectionList();
    108109
    109110  this->objectList = 0;
  • branches/water/src/world_entities/world_entity.cc

    r7779 r7814  
    242242}
    243243
    244 
     244void WorldEntity::toReflectionList()
     245{
     246  State::getObjectManager()->toReflectionList( this );
     247}
     248
     249void removeFromReflectionList()
     250{
     251/// TODO
     252///  State::getObject
     253}
    245254
    246255/**
  • branches/water/src/world_entities/world_entity.h

    r7779 r7814  
    7373
    7474  void toList(OM_LIST list);
    75 
     75  void toReflectionList();
     76  void removeFromReflectionList();
    7677
    7778  /** @returns a Reference to the objectListNumber to set. */
Note: See TracChangeset for help on using the changeset viewer.