Changeset 8617 in orxonox.OLD for branches/water/src/world_entities/environments/mapped_water.cc
- Timestamp:
- Jun 20, 2006, 12:58:02 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/water/src/world_entities/environments/mapped_water.cc
r8587 r8617 31 31 this->setClassID(CL_MAPPED_WATER, "MappedWater"); 32 32 this->toList(OM_ENVIRON); 33 34 // the NormalMapScale will be overwritten if its also set in the oxw file 35 this->setNormalMapScale(0.25f); 33 36 34 37 if (root != NULL) … … 57 60 58 61 // set the size of the refraction and reflection textures 59 62 60 63 61 64 // initialization of the texture coords, speeds etc... 65 // normalUV wont change anymore 66 this->normalUV = this->waterUV * this->kNormalMapScale; 67 // move and move2 are used for the reflection and refraction, the values are changed in tick() 62 68 this->move = 0.0f; 63 this->kNormalMapScale = 0.25f; 69 this->move2 = this->move * this->kNormalMapScale; 70 64 71 65 72 //unsigned int channels = 32; … … 174 181 LoadParam(root, "wateruv", this, MappedWater, setWaterUV); 175 182 LoadParam(root, "waterflow", this, MappedWater, setWaterFlow); 183 LoadParam(root, "normalmapscale", this, MappedWater, setNormalMapScale); 176 184 } 177 185 … … 198 206 glBegin(GL_QUADS); 199 207 // The back left vertice for the water 200 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, g_WaterUV); // Reflection texture201 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, refrUV - move); // Refraction texture208 glMultiTexCoord2f(GL_TEXTURE0, 0.0f, waterUV); // Reflection texture 209 glMultiTexCoord2f(GL_TEXTURE1, 0.0f, waterUV - move); // Refraction texture 202 210 glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2); // Normal map texture 203 211 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 212 220 213 221 // The front right vertice for the water 214 glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, 0.0f); // Reflection texture215 glMultiTexCoord2f(GL_TEXTURE1, refrUV, 0.0f - move); // Refraction texture222 glMultiTexCoord2f(GL_TEXTURE0, waterUV, 0.0f); // Reflection texture 223 glMultiTexCoord2f(GL_TEXTURE1, waterUV, 0.0f - move); // Refraction texture 216 224 glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2); // Normal map texture 217 225 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 219 227 220 228 // The back right vertice for the water 221 glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, g_WaterUV); // Reflection texture222 glMultiTexCoord2f(GL_TEXTURE1, refrUV, refrUV - move); // Refraction texture229 glMultiTexCoord2f(GL_TEXTURE0, waterUV, waterUV); // Reflection texture 230 glMultiTexCoord2f(GL_TEXTURE1, waterUV, waterUV - move); // Refraction texture 223 231 glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2); // Normal map texture 224 232 glMultiTexCoord2f(GL_TEXTURE3, 0, 0); // DUDV map texture … … 230 238 mat.unselect(); 231 239 232 /*if(pos.y < this->waterPos.y)233 {234 // draw some fog235 this->fog->activate();236 }237 else238 {239 this->fog->deactivate();240 }*/241 242 240 glPopMatrix(); 243 241 } … … 249 247 { 250 248 // makes the water flow 251 // TODO change it so that the waterflow doesnt depend on the frame rate 252 this->move += this->g_WaterFlow; 249 this->move += this->waterFlow * dt; 253 250 this->move2 = this->move * this->kNormalMapScale; 254 this->refrUV = this->g_WaterUV;255 this->normalUV = this->g_WaterUV * this->kNormalMapScale;256 251 } 257 252
Note: See TracChangeset
for help on using the changeset viewer.