Changeset 7814 in orxonox.OLD for branches/water
- Timestamp:
- May 24, 2006, 4:39:32 PM (19 years ago)
- Location:
- branches/water/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/water/src/story_entities/game_world.cc
r7785 r7814 497 497 LightManager::getInstance()->draw(); 498 498 // 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])); 501 502 502 503 // clean up from reflection rendering -
branches/water/src/util/object_manager.cc
r7785 r7814 65 65 delete this->objectLists[i].front(); 66 66 67 // delete reflectin list 68 while( !this->reflectionList.empty()) 69 delete this->reflectionList.front(); 67 // delete reflection list 68 this->reflectionList.clear(); 70 69 } 71 70 -
branches/water/src/world_entities/environments/mapped_water.cc
r7796 r7814 34 34 this->loadParams(root); 35 35 36 //! HACK FIXME HACK FIXME HACK FIXME HACK FIXME37 36 //! todo: rename texture to reflection texture 38 37 // set up refleciton texture 39 // mat.setDiffuseMap(&this->texture, 0);38 // FIXME mat.setDiffuseMap(this->texture, 0); doesnt work, 40 39 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);*/45 40 // load refraction texture 46 41 //mat.setDiffuseMap(&this->refractionTexture, 1); … … 71 66 glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTexture); 72 67 68 //gluBuild2DMipmaps(GL_TEXTURE_2D, channels, this->textureSize, this->textureSize, type, GL_UNSIGNED_INT, pTexture); 69 73 70 // Set the texture quality 74 71 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); … … 80 77 delete [] pTexture; 81 78 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"); 83 82 } 84 83 … … 101 100 glTranslatef(0,this->waterHeight,0); 102 101 102 //HACK 103 glTranslatef(550,0,100); 103 104 //glEnable(GL_LIGHTING); 104 105 … … 111 112 // HACK 112 113 113 //glDisable(GL_BLEND);114 glDisable(GL_BLEND); 114 115 //glActiveTexture(GL_TEXTURE0); 115 116 //glBindTexture(GL_TEXTURE_2D, this->texture); … … 118 119 glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0)); 119 120 120 // Shader init 121 122 /* // Shader init 121 123 //this->shader->activateShader(); 122 124 GLint uniform; … … 162 164 uniform = glGetUniformLocationARB(shader->getProgram(), "cameraPos"); 163 165 glUniform4fARB(uniform, vPosition.x, vPosition.y, vPosition.z, 1.0f); 164 166 */ 165 167 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); 194 196 glEnd(); 195 197 //this->shader->deactivateShader(); … … 210 212 { 211 213 glPushAttrib(GL_VIEWPORT_BIT); 212 // glPushMatrix();214 213 215 214 216 //glLoadIdentity(); 215 217 glViewport(0,0, textureSize, textureSize); 216 218 217 219 glPushMatrix(); 218 220 // Clear the color and depth bits, reset the matrix and position our camera. 219 221 … … 227 229 //{ 228 230 // 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); 231 233 232 234 // Since the world is updside down we need to change the culling to FRONT 233 //glCullFace(GL_FRONT);235 glCullFace(GL_FRONT); 234 236 235 237 // Set our plane equation and turn clipping on 236 //double plane[4] = {0.0, 1.0, 0.0, -waterHeight};237 // 238 // 238 double plane[4] = {0.0, 1.0, 0.0, -waterHeight}; 239 //glEnable(GL_CLIP_PLANE0); 240 //glClipPlane(GL_CLIP_PLANE0, plane); 239 241 240 242 // Render the world upside down and clipped (only render the top flipped). … … 265 267 { 266 268 // 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)); 268 270 269 271 //mat.setDiffuseMap(&texture, 0); 270 //mat.select();272 mat.select(); 271 273 glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize); 272 274 //glDisable(GL_CLIP_PLANE0); 275 276 glPopMatrix(); 273 277 274 278 glPopAttrib(); 275 // glPopMatrix();279 276 280 } 277 281 -
branches/water/src/world_entities/skybox.cc
r7328 r7814 74 74 this->setClassID(CL_SKYBOX, "SkyBox"); 75 75 this->toList(OM_ENVIRON_NOTICK); 76 this->toReflectionList(); 76 77 //this->size = 100.0; 77 78 this->textureSize = 1024.0f; -
branches/water/src/world_entities/terrain.cc
r7221 r7814 106 106 this->setClassID(CL_TERRAIN, "Terrain"); 107 107 this->toList(OM_ENVIRON_NOTICK); 108 this->toReflectionList(); 108 109 109 110 this->objectList = 0; -
branches/water/src/world_entities/world_entity.cc
r7779 r7814 242 242 } 243 243 244 244 void WorldEntity::toReflectionList() 245 { 246 State::getObjectManager()->toReflectionList( this ); 247 } 248 249 void removeFromReflectionList() 250 { 251 /// TODO 252 /// State::getObject 253 } 245 254 246 255 /** -
branches/water/src/world_entities/world_entity.h
r7779 r7814 73 73 74 74 void toList(OM_LIST list); 75 75 void toReflectionList(); 76 void removeFromReflectionList(); 76 77 77 78 /** @returns a Reference to the objectListNumber to set. */
Note: See TracChangeset
for help on using the changeset viewer.