aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lldrawpoolwater.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/lldrawpoolwater.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/lldrawpoolwater.cpp71
1 files changed, 56 insertions, 15 deletions
diff --git a/linden/indra/newview/lldrawpoolwater.cpp b/linden/indra/newview/lldrawpoolwater.cpp
index 5914ffc..ce3425d 100644
--- a/linden/indra/newview/lldrawpoolwater.cpp
+++ b/linden/indra/newview/lldrawpoolwater.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -58,6 +59,8 @@ const LLUUID WATER_TEST("2bfd3884-7e27-69b9-ba3a-3e673f680004");
58 59
59static float sTime; 60static float sTime;
60 61
62BOOL deferred_render = FALSE;
63
61BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE; 64BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE;
62BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE; 65BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE;
63BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE; 66BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE;
@@ -69,14 +72,16 @@ LLDrawPoolWater::LLDrawPoolWater() :
69{ 72{
70 mHBTex[0] = gImageList.getImage(gSunTextureID, TRUE, TRUE); 73 mHBTex[0] = gImageList.getImage(gSunTextureID, TRUE, TRUE);
71 gGL.getTexUnit(0)->bind(mHBTex[0].get()); 74 gGL.getTexUnit(0)->bind(mHBTex[0].get());
72 mHBTex[0]->setClamp(TRUE, TRUE); 75 mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP);
73 76
74 mHBTex[1] = gImageList.getImage(gMoonTextureID, TRUE, TRUE); 77 mHBTex[1] = gImageList.getImage(gMoonTextureID, TRUE, TRUE);
75 gGL.getTexUnit(0)->bind(mHBTex[1].get()); 78 gGL.getTexUnit(0)->bind(mHBTex[1].get());
76 mHBTex[1]->setClamp(TRUE, TRUE); 79 mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
77 80
78 mWaterImagep = gImageList.getImage(WATER_TEST); 81 mWaterImagep = gImageList.getImage(WATER_TEST);
82 mWaterImagep->setNoDelete() ;
79 mWaterNormp = gImageList.getImage(DEFAULT_WATER_NORMAL); 83 mWaterNormp = gImageList.getImage(DEFAULT_WATER_NORMAL);
84 mWaterNormp->setNoDelete() ;
80 85
81 restoreGL(); 86 restoreGL();
82} 87}
@@ -120,6 +125,18 @@ S32 LLDrawPoolWater::getNumPasses()
120 return 0; 125 return 0;
121} 126}
122 127
128void LLDrawPoolWater::beginPostDeferredPass(S32 pass)
129{
130 beginRenderPass(pass);
131 deferred_render = TRUE;
132}
133
134void LLDrawPoolWater::endPostDeferredPass(S32 pass)
135{
136 endRenderPass(pass);
137 deferred_render = FALSE;
138}
139
123void LLDrawPoolWater::render(S32 pass) 140void LLDrawPoolWater::render(S32 pass)
124{ 141{
125 LLFastTimer ftm(LLFastTimer::FTM_RENDER_WATER); 142 LLFastTimer ftm(LLFastTimer::FTM_RENDER_WATER);
@@ -270,10 +287,7 @@ void LLDrawPoolWater::render(S32 pass)
270 287
271 gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); 288 gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
272 289
273 if (gSky.mVOSkyp->getCubeMap()) 290 gSky.mVOSkyp->getCubeMap()->disable();
274 {
275 gSky.mVOSkyp->getCubeMap()->disable();
276 }
277 291
278 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); 292 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
279 gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); 293 gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
@@ -374,7 +388,11 @@ void LLDrawPoolWater::shade()
374 388
375 F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight(); 389 F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight();
376 390
377 if (eyedepth < 0.f && LLPipeline::sWaterReflections) 391 if (deferred_render)
392 {
393 shader = &gDeferredWaterProgram;
394 }
395 else if (eyedepth < 0.f && LLPipeline::sWaterReflections)
378 { 396 {
379 shader = &gUnderWaterProgram; 397 shader = &gUnderWaterProgram;
380 } 398 }
@@ -407,21 +425,36 @@ void LLDrawPoolWater::shade()
407 425
408 mWaterNormp->addTextureStats(1024.f*1024.f); 426 mWaterNormp->addTextureStats(1024.f*1024.f);
409 gGL.getTexUnit(bumpTex)->bind(mWaterNormp.get()); 427 gGL.getTexUnit(bumpTex)->bind(mWaterNormp.get());
410 mWaterNormp->setMipFilterNearest (mWaterNormp->getMipFilterNearest(), 428 if (gSavedSettings.getBOOL("RenderWaterMipNormal"))
411 !gSavedSettings.getBOOL("RenderWaterMipNormal")); 429 {
430 mWaterNormp->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
431 }
432 else
433 {
434 mWaterNormp->setFilteringOption(LLTexUnit::TFO_POINT);
435 }
412 436
413 S32 screentex = shader->enableTexture(LLViewerShaderMgr::WATER_SCREENTEX); 437 S32 screentex = shader->enableTexture(LLViewerShaderMgr::WATER_SCREENTEX);
414 stop_glerror(); 438
439 if (deferred_render)
440 {
441 gPipeline.bindDeferredShader(*shader);
442 }
443 else
444 {
445 shader->bind();
446 }
415 447
416 shader->bind();
417
418 if (screentex > -1) 448 if (screentex > -1)
419 { 449 {
420 shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); 450 shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV);
421 shader->uniform1f(LLViewerShaderMgr::WATER_FOGDENSITY, 451 shader->uniform1f(LLViewerShaderMgr::WATER_FOGDENSITY,
422 param_mgr->getFogDensity()); 452 param_mgr->getFogDensity());
453 gPipeline.mWaterDis.bindTexture(0, screentex);
423 } 454 }
424 455
456 stop_glerror();
457
425 gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis); 458 gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis);
426 459
427 if (mVertexShaderLevel == 1) 460 if (mVertexShaderLevel == 1)
@@ -533,7 +566,15 @@ void LLDrawPoolWater::shade()
533 shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); 566 shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
534 shader->disableTexture(LLViewerShaderMgr::WATER_REFTEX); 567 shader->disableTexture(LLViewerShaderMgr::WATER_REFTEX);
535 shader->disableTexture(LLViewerShaderMgr::WATER_SCREENDEPTH); 568 shader->disableTexture(LLViewerShaderMgr::WATER_SCREENDEPTH);
536 shader->unbind(); 569
570 if (deferred_render)
571 {
572 gPipeline.unbindDeferredShader(*shader);
573 }
574 else
575 {
576 shader->unbind();
577 }
537 578
538 gGL.getTexUnit(0)->activate(); 579 gGL.getTexUnit(0)->activate();
539 gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); 580 gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);