diff options
author | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
commit | 2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch) | |
tree | 95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/newview/lldrawpoolwater.cpp | |
parent | Second Life viewer sources 1.20.6 (diff) | |
download | meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2 meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz |
Second Life viewer sources 1.20.7
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lldrawpoolwater.cpp | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/linden/indra/newview/lldrawpoolwater.cpp b/linden/indra/newview/lldrawpoolwater.cpp index 231d0e1..3a98235 100644 --- a/linden/indra/newview/lldrawpoolwater.cpp +++ b/linden/indra/newview/lldrawpoolwater.cpp | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "lldir.h" | 37 | #include "lldir.h" |
38 | #include "llerror.h" | 38 | #include "llerror.h" |
39 | #include "m3math.h" | 39 | #include "m3math.h" |
40 | #include "llrender.h" | ||
40 | 41 | ||
41 | #include "llagent.h" // for gAgent for getRegion for getWaterHeight | 42 | #include "llagent.h" // for gAgent for getRegion for getWaterHeight |
42 | #include "llcubemap.h" | 43 | #include "llcubemap.h" |
@@ -166,7 +167,7 @@ void LLDrawPoolWater::render(S32 pass) | |||
166 | // Set up second pass first | 167 | // Set up second pass first |
167 | mWaterImagep->addTextureStats(1024.f*1024.f); | 168 | mWaterImagep->addTextureStats(1024.f*1024.f); |
168 | mWaterImagep->bind(1); | 169 | mWaterImagep->bind(1); |
169 | glActiveTextureARB(GL_TEXTURE1_ARB); | 170 | gGL.getTexUnit(1)->activate(); |
170 | 171 | ||
171 | glEnable(GL_TEXTURE_2D); // Texture unit 1 | 172 | glEnable(GL_TEXTURE_2D); // Texture unit 1 |
172 | 173 | ||
@@ -198,18 +199,10 @@ void LLDrawPoolWater::render(S32 pass) | |||
198 | glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); | 199 | glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); |
199 | glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); | 200 | glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); |
200 | 201 | ||
201 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); | 202 | gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); |
202 | glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE); | 203 | gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); |
203 | glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE); | ||
204 | 204 | ||
205 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); | 205 | gGL.getTexUnit(0)->activate(); |
206 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); | ||
207 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); | ||
208 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); | ||
209 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB); | ||
210 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); | ||
211 | |||
212 | glActiveTextureARB(GL_TEXTURE0_ARB); | ||
213 | 206 | ||
214 | glClearStencil(1); | 207 | glClearStencil(1); |
215 | glClear(GL_STENCIL_BUFFER_BIT); | 208 | glClear(GL_STENCIL_BUFFER_BIT); |
@@ -230,14 +223,14 @@ void LLDrawPoolWater::render(S32 pass) | |||
230 | } | 223 | } |
231 | 224 | ||
232 | // Now, disable texture coord generation on texture state 1 | 225 | // Now, disable texture coord generation on texture state 1 |
233 | glActiveTextureARB(GL_TEXTURE1_ARB); | 226 | gGL.getTexUnit(1)->activate(); |
234 | glDisable(GL_TEXTURE_2D); // Texture unit 1 | 227 | glDisable(GL_TEXTURE_2D); // Texture unit 1 |
235 | glDisable(GL_TEXTURE_GEN_S); //texture unit 1 | 228 | glDisable(GL_TEXTURE_GEN_S); //texture unit 1 |
236 | glDisable(GL_TEXTURE_GEN_T); //texture unit 1 | 229 | glDisable(GL_TEXTURE_GEN_T); //texture unit 1 |
237 | LLImageGL::unbindTexture(1, GL_TEXTURE_2D); | 230 | LLImageGL::unbindTexture(1, GL_TEXTURE_2D); |
238 | 231 | ||
239 | // Disable texture coordinate and color arrays | 232 | // Disable texture coordinate and color arrays |
240 | glActiveTextureARB(GL_TEXTURE0_ARB); | 233 | gGL.getTexUnit(0)->activate(); |
241 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); | 234 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); |
242 | 235 | ||
243 | stop_glerror(); | 236 | stop_glerror(); |
@@ -258,7 +251,7 @@ void LLDrawPoolWater::render(S32 pass) | |||
258 | glMatrixMode(GL_MODELVIEW); | 251 | glMatrixMode(GL_MODELVIEW); |
259 | LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); | 252 | LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); |
260 | 253 | ||
261 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | 254 | gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); |
262 | 255 | ||
263 | for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); | 256 | for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); |
264 | iter != mDrawFace.end(); iter++) | 257 | iter != mDrawFace.end(); iter++) |
@@ -276,7 +269,7 @@ void LLDrawPoolWater::render(S32 pass) | |||
276 | } | 269 | } |
277 | } | 270 | } |
278 | 271 | ||
279 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | 272 | gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); |
280 | 273 | ||
281 | if (gSky.mVOSkyp->getCubeMap()) | 274 | if (gSky.mVOSkyp->getCubeMap()) |
282 | { | 275 | { |
@@ -298,7 +291,7 @@ void LLDrawPoolWater::render(S32 pass) | |||
298 | renderReflection(refl_face); | 291 | renderReflection(refl_face); |
299 | } | 292 | } |
300 | 293 | ||
301 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | 294 | gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); |
302 | } | 295 | } |
303 | 296 | ||
304 | void LLDrawPoolWater::renderReflection(LLFace* face) | 297 | void LLDrawPoolWater::renderReflection(LLFace* face) |
@@ -331,7 +324,7 @@ void LLDrawPoolWater::renderReflection(LLFace* face) | |||
331 | 324 | ||
332 | void LLDrawPoolWater::shade() | 325 | void LLDrawPoolWater::shade() |
333 | { | 326 | { |
334 | glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); | 327 | gGL.setColorMask(true, true); |
335 | 328 | ||
336 | LLVOSky *voskyp = gSky.mVOSkyp; | 329 | LLVOSky *voskyp = gSky.mVOSkyp; |
337 | 330 | ||
@@ -396,9 +389,9 @@ void LLDrawPoolWater::shade() | |||
396 | 389 | ||
397 | if (reftex > -1) | 390 | if (reftex > -1) |
398 | { | 391 | { |
399 | glActiveTextureARB(GL_TEXTURE0_ARB+reftex); | 392 | gGL.getTexUnit(reftex)->activate(); |
400 | gPipeline.mWaterRef.bindTexture(); | 393 | gPipeline.mWaterRef.bindTexture(); |
401 | glActiveTextureARB(GL_TEXTURE0_ARB); | 394 | gGL.getTexUnit(0)->activate(); |
402 | } | 395 | } |
403 | 396 | ||
404 | //bind normal map | 397 | //bind normal map |
@@ -414,14 +407,8 @@ void LLDrawPoolWater::shade() | |||
414 | 407 | ||
415 | mWaterNormp->addTextureStats(1024.f*1024.f); | 408 | mWaterNormp->addTextureStats(1024.f*1024.f); |
416 | mWaterNormp->bind(bumpTex); | 409 | mWaterNormp->bind(bumpTex); |
417 | if (!gSavedSettings.getBOOL("RenderWaterMipNormal")) | 410 | mWaterNormp->setMipFilterNearest (mWaterNormp->getMipFilterNearest(), |
418 | { | 411 | !gSavedSettings.getBOOL("RenderWaterMipNormal")); |
419 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | ||
420 | } | ||
421 | else | ||
422 | { | ||
423 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); | ||
424 | } | ||
425 | 412 | ||
426 | S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); | 413 | S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX); |
427 | stop_glerror(); | 414 | stop_glerror(); |
@@ -548,9 +535,9 @@ void LLDrawPoolWater::shade() | |||
548 | shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); | 535 | shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH); |
549 | shader->unbind(); | 536 | shader->unbind(); |
550 | 537 | ||
551 | glActiveTextureARB(GL_TEXTURE0_ARB); | 538 | gGL.getTexUnit(0)->activate(); |
552 | glEnable(GL_TEXTURE_2D); | 539 | glEnable(GL_TEXTURE_2D); |
553 | glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE); | 540 | gGL.setColorMask(true, false); |
554 | 541 | ||
555 | } | 542 | } |
556 | 543 | ||