- Timestamp:
- Jun 1, 2006, 6:36:53 PM (19 years ago)
- Location:
- branches/water/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/water/src/lib/graphics/importer/material.cc
r8089 r8095 397 397 assert(textureNumber < this->textures.size()); 398 398 399 glActiveTexture(0); 399 // HACK 400 glActiveTexture(textureNumber); 400 401 glEnable(GL_TEXTURE_2D); 401 402 glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture()); -
branches/water/src/story_entities/game_world.cc
r8089 r8095 538 538 this->renderPassReflection(); 539 539 // redner the refraction texture 540 //this->renderPassRefraction();540 this->renderPassRefraction(); 541 541 // render all 542 542 this->renderPassAll(); -
branches/water/src/world_entities/environments/mapped_water.cc
r8090 r8095 40 40 // set up refleciton texture 41 41 //mat.setDiffuseMap(this->texture, 0); 42 mat.setDiffuseMap("pictures/ dudvmap.bmp", GL_TEXTURE_2D, 0);42 mat.setDiffuseMap("pictures/refl.jpg", GL_TEXTURE_2D, 0); 43 43 // load refraction texture 44 mat.setDiffuseMap("pictures/ error_texture.png", GL_TEXTURE_2D, 1);44 mat.setDiffuseMap("pictures/refr.jpg", GL_TEXTURE_2D, 1); 45 45 // load normal map 46 //mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);46 mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2); 47 47 // load dudv map 48 //mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);48 mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3); 49 49 // set up depth texture 50 50 //mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 4); … … 94 94 /// initialization of the shaders 95 95 // load shader files 96 /*shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");96 shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag"); 97 97 98 98 this->shader->activateShader(); … … 106 106 Shader::Uniform(shader, "dudvMap").set(3); 107 107 // Set the variable "depthMap" to correspond to the fifth texture unit 108 Shader::Uniform(shader, "depthMap").set(4);108 //Shader::Uniform(shader, "depthMap").set(4); 109 109 // Give the variable "waterColor" a blue color 110 110 Shader::Uniform(shader, "waterColor").set(0.1f, 0.2f, 0.4f, 1.0f); … … 114 114 cam_uni = new Shader::Uniform(shader, "cameraPos"); 115 115 116 this->shader->deactivateShader(); */116 this->shader->deactivateShader(); 117 117 } 118 118 … … 140 140 mat.select(); 141 141 142 ///this->shader->activateShader();142 this->shader->activateShader(); 143 143 144 144 // reset the camera uniform to the current cam position 145 145 Vector pos = State::getCameraNode()->getAbsCoor(); 146 ///cam_uni->set(pos.x, pos.y, pos.z, 1.0f);146 cam_uni->set(pos.x, pos.y, pos.z, 1.0f); 147 147 148 148 glBegin(GL_QUADS); 149 149 // The back left vertice for the water 150 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0);//g_WaterUV); // Reflection texture 151 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0);//refrUV - move); // Refraction texture 150 // glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0);//g_WaterUV); // Reflection texture 151 // glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0);//refrUV - move); // Refraction texture 152 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, g_WaterUV); // Reflection texture 153 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, refrUV - move); // Refraction texture 152 154 glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2); // Normal map texture 153 155 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 156 158 157 159 // The front left vertice for the water 158 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1);//0.0f); // Reflection texture 159 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1);//0.0f - move); // Refraction texture 160 // glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1);//0.0f); // Reflection texture 161 // glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1);//0.0f - move); // Refraction texture 162 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f); // Reflection texture 163 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f - move); // Refraction texture 160 164 glMultiTexCoord2f(GL_TEXTURE2, 0.0f, 0.0f + move2); // Normal map texture 161 165 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 164 168 165 169 // The front right vertice for the water 166 glMultiTexCoord2f(GL_TEXTURE0, 1,1); //g_WaterUV, 0.0f); // Reflection texture 167 glMultiTexCoord2f(GL_TEXTURE1, 1,1);//refrUV, 0.0f - move); // Refraction texture 170 // glMultiTexCoord2f(GL_TEXTURE0, 1,1); //g_WaterUV, 0.0f); // Reflection texture 171 // glMultiTexCoord2f(GL_TEXTURE1, 1,1);//refrUV, 0.0f - move); // Refraction texture 172 glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, 0.0f); // Reflection texture 173 glMultiTexCoord2f(GL_TEXTURE1, refrUV, 0.0f - move); // Refraction texture 168 174 glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2); // Normal map texture 169 175 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 172 178 173 179 // The back right vertice for the water 174 glMultiTexCoord2f(GL_TEXTURE0, 1,0);//g_WaterUV, g_WaterUV); // Reflection texture 175 glMultiTexCoord2f(GL_TEXTURE1, 1,0);//refrUV, refrUV - move); // Refraction texture 180 // glMultiTexCoord2f(GL_TEXTURE0, 1,0);//g_WaterUV, g_WaterUV); // Reflection texture 181 // glMultiTexCoord2f(GL_TEXTURE1, 1,0);//refrUV, refrUV - move); // Refraction texture 182 glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, g_WaterUV); // Reflection texture 183 glMultiTexCoord2f(GL_TEXTURE1, refrUV, refrUV - move); // Refraction texture 176 184 glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2); // Normal map texture 177 185 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 180 188 glEnd(); 181 189 182 ///this->shader->deactivateShader();190 this->shader->deactivateShader(); 183 191 184 192 mat.unselect(); … … 293 301 294 302 mat.select(); 295 //mat.renderToTexture(1, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);303 mat.renderToTexture(1, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize); 296 304 //glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, textureSize, textureSize, 0); 297 305 //mat.renderToTexture(0, GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, textureSize, textureSize, 0);
Note: See TracChangeset
for help on using the changeset viewer.