diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/lldrawpoolwater.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/lldrawpoolwater.cpp')
-rw-r--r-- | linden/indra/newview/lldrawpoolwater.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/linden/indra/newview/lldrawpoolwater.cpp b/linden/indra/newview/lldrawpoolwater.cpp index ed0077a..922a5d8 100644 --- a/linden/indra/newview/lldrawpoolwater.cpp +++ b/linden/indra/newview/lldrawpoolwater.cpp | |||
@@ -59,6 +59,7 @@ static float sTime; | |||
59 | 59 | ||
60 | BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE; | 60 | BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE; |
61 | BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE; | 61 | BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE; |
62 | BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE; | ||
62 | LLColor4 LLDrawPoolWater::sWaterFogColor = LLColor4(0.2f, 0.5f, 0.5f, 0.f); | 63 | LLColor4 LLDrawPoolWater::sWaterFogColor = LLColor4(0.2f, 0.5f, 0.5f, 0.f); |
63 | LLVector3 LLDrawPoolWater::sLightDir; | 64 | LLVector3 LLDrawPoolWater::sLightDir; |
64 | 65 | ||
@@ -74,8 +75,7 @@ LLDrawPoolWater::LLDrawPoolWater() : | |||
74 | mHBTex[1]->setClamp(TRUE, TRUE); | 75 | mHBTex[1]->setClamp(TRUE, TRUE); |
75 | 76 | ||
76 | mWaterImagep = gImageList.getImage(WATER_TEST); | 77 | mWaterImagep = gImageList.getImage(WATER_TEST); |
77 | //mWaterNormp = gImageList.getImage(LLUUID(gViewerArt.getString("water_normal.tga"))); | 78 | mWaterNormp = gImageList.getImage(DEFAULT_WATER_NORMAL); |
78 | mWaterNormp = gImageList.getImage(LLWaterParamManager::instance()->getNormalMapID()); | ||
79 | 79 | ||
80 | restoreGL(); | 80 | restoreGL(); |
81 | } | 81 | } |
@@ -99,7 +99,7 @@ LLDrawPool *LLDrawPoolWater::instancePool() | |||
99 | 99 | ||
100 | void LLDrawPoolWater::prerender() | 100 | void LLDrawPoolWater::prerender() |
101 | { | 101 | { |
102 | mVertexShaderLevel = (gGLManager.mHasCubeMap && gFeatureManagerp->isFeatureAvailable("RenderCubeMap")) ? | 102 | mVertexShaderLevel = (gGLManager.mHasCubeMap && LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap")) ? |
103 | LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_WATER) : 0; | 103 | LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_WATER) : 0; |
104 | 104 | ||
105 | // got rid of modulation by light color since it got a little too | 105 | // got rid of modulation by light color since it got a little too |
@@ -111,7 +111,7 @@ void LLDrawPoolWater::prerender() | |||
111 | 111 | ||
112 | S32 LLDrawPoolWater::getNumPasses() | 112 | S32 LLDrawPoolWater::getNumPasses() |
113 | { | 113 | { |
114 | if (gCamera->getOrigin().mV[2] < 1024.f) | 114 | if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f) |
115 | { | 115 | { |
116 | return 1; | 116 | return 1; |
117 | } | 117 | } |
@@ -176,11 +176,11 @@ void LLDrawPoolWater::render(S32 pass) | |||
176 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); | 176 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
177 | glEnable(GL_TEXTURE_2D); // Texture unit 1 | 177 | glEnable(GL_TEXTURE_2D); // Texture unit 1 |
178 | 178 | ||
179 | LLVector3 camera_up = gCamera->getUpAxis(); | 179 | LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); |
180 | F32 up_dot = camera_up * LLVector3::z_axis; | 180 | F32 up_dot = camera_up * LLVector3::z_axis; |
181 | 181 | ||
182 | LLColor4 water_color; | 182 | LLColor4 water_color; |
183 | if (gCamera->cameraUnderWater()) | 183 | if (LLViewerCamera::getInstance()->cameraUnderWater()) |
184 | { | 184 | { |
185 | water_color.setVec(1.f, 1.f, 1.f, 0.4f); | 185 | water_color.setVec(1.f, 1.f, 1.f, 0.4f); |
186 | } | 186 | } |
@@ -260,7 +260,7 @@ void LLDrawPoolWater::render(S32 pass) | |||
260 | 260 | ||
261 | glMatrixMode(GL_TEXTURE); | 261 | glMatrixMode(GL_TEXTURE); |
262 | glLoadIdentity(); | 262 | glLoadIdentity(); |
263 | LLMatrix4 camera_mat = gCamera->getModelview(); | 263 | LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); |
264 | LLMatrix4 camera_rot(camera_mat.getMat3()); | 264 | LLMatrix4 camera_rot(camera_mat.getMat3()); |
265 | camera_rot.invert(); | 265 | camera_rot.invert(); |
266 | 266 | ||
@@ -404,7 +404,7 @@ void LLDrawPoolWater::shade() | |||
404 | 404 | ||
405 | LLGLSLShader* shader; | 405 | LLGLSLShader* shader; |
406 | 406 | ||
407 | F32 eyedepth = gCamera->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight(); | 407 | F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - gAgent.getRegion()->getWaterHeight(); |
408 | 408 | ||
409 | if (eyedepth < 0.f && LLPipeline::sWaterReflections) | 409 | if (eyedepth < 0.f && LLPipeline::sWaterReflections) |
410 | { | 410 | { |
@@ -487,7 +487,7 @@ void LLDrawPoolWater::shade() | |||
487 | //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); | 487 | //shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix); |
488 | shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); | 488 | shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth); |
489 | shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); | 489 | shader->uniform1f(LLShaderMgr::WATER_TIME, sTime); |
490 | shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, gCamera->getOrigin().mV); | 490 | shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV); |
491 | shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); | 491 | shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); |
492 | shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); | 492 | shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); |
493 | shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV); | 493 | shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV); |
@@ -507,9 +507,9 @@ void LLDrawPoolWater::shade() | |||
507 | shader->uniform1f("sunAngle2", 0.1f + 0.2f*sunAngle); | 507 | shader->uniform1f("sunAngle2", 0.1f + 0.2f*sunAngle); |
508 | 508 | ||
509 | LLColor4 water_color; | 509 | LLColor4 water_color; |
510 | LLVector3 camera_up = gCamera->getUpAxis(); | 510 | LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); |
511 | F32 up_dot = camera_up * LLVector3::z_axis; | 511 | F32 up_dot = camera_up * LLVector3::z_axis; |
512 | if (gCamera->cameraUnderWater()) | 512 | if (LLViewerCamera::getInstance()->cameraUnderWater()) |
513 | { | 513 | { |
514 | water_color.setVec(1.f, 1.f, 1.f, 0.4f); | 514 | water_color.setVec(1.f, 1.f, 1.f, 0.4f); |
515 | shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow()); | 515 | shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow()); |
@@ -546,6 +546,7 @@ void LLDrawPoolWater::shade() | |||
546 | 546 | ||
547 | if (water->getUseTexture()) | 547 | if (water->getUseTexture()) |
548 | { | 548 | { |
549 | sNeedsDistortionUpdate = TRUE; | ||
549 | face->renderIndexed(); | 550 | face->renderIndexed(); |
550 | } | 551 | } |
551 | else | 552 | else |
@@ -557,6 +558,7 @@ void LLDrawPoolWater::shade() | |||
557 | } | 558 | } |
558 | else | 559 | else |
559 | { | 560 | { |
561 | sNeedsDistortionUpdate = TRUE; | ||
560 | face->renderIndexed(); | 562 | face->renderIndexed(); |
561 | } | 563 | } |
562 | } | 564 | } |