From e9cdd0bfe8fe7f3bec0e6db7fba43e11f729af8a Mon Sep 17 00:00:00 2001
From: "Graham Madarasz (Graham)" <graham@lindenlab.com>
Date: Thu, 11 Jul 2013 16:39:39 -0700
Subject: [PATCH] NORSPEC-291 WIP fix avatar disappearing

---
 .../shaders/class1/deferred/materialV.glsl       |  9 +++++----
 .../shaders/class2/deferred/softenLightF.glsl    |  8 --------
 indra/newview/lldrawpoolavatar.cpp               | 16 ++++++++--------
 3 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
index e44a6fcec83..393d1e69da7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl
@@ -43,10 +43,10 @@ uniform mat4 modelview_projection_matrix;
 uniform mat4 modelview_matrix;
 #endif
 
-#endif
-
 VARYING vec3 vary_position;
 
+#endif
+
 uniform mat4 texture_matrix0;
 
 ATTRIBUTE vec3 position;
@@ -84,14 +84,15 @@ void main()
 	mat = modelview_matrix * mat;
 
 	vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
-	vary_position = pos;
 
+#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
+	vary_position = pos;
+#endif
 
 	gl_Position = projection_matrix*vec4(pos,1.0);
 
 #else
 	//transform vertex
-	vary_position = (modelview_projection_matrix * vec4(position.xyz, 1.0)).xyz;
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
 
 #endif
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 4464358b1ec..08aaa2237d1 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -133,13 +133,6 @@ vec4 getPosition(vec2 pos_screen)
 	return getPosition_d(pos_screen, depth);
 }
 
-#ifdef WATER_FOG
-vec3 getPositionEye();
-vec3 getSunlitColor();
-vec3 getAmblitColor();
-vec3 getAdditiveColor();
-vec3 getAtmosAttenuation();
-#else
 vec3 getPositionEye()
 {
 	return vary_PositionEye;
@@ -160,7 +153,6 @@ vec3 getAtmosAttenuation()
 {
 	return vary_AtmosAttenuation;
 }
-#endif
 
 void setPositionEye(vec3 v)
 {
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 3815548dba2..86776b7e423 100755
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -299,10 +299,10 @@ void LLDrawPoolAvatar::beginDeferredRiggedMaterialAlpha(S32 pass)
 
 	sVertexProgram = &gDeferredMaterialProgram[pass];
 
-	if (LLPipeline::sUnderWaterRender)
-	{
-		sVertexProgram = &(gDeferredMaterialWaterProgram[pass]);
-	}
+	//if (LLPipeline::sUnderWaterRender)
+	//{
+	//	sVertexProgram = &(gDeferredMaterialWaterProgram[pass]);
+	//}
 
 	gPipeline.bindDeferredShader(*sVertexProgram);
 	sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
@@ -1099,10 +1099,10 @@ void LLDrawPoolAvatar::beginDeferredRiggedMaterial(S32 pass)
 	}
 	sVertexProgram = &gDeferredMaterialProgram[pass+LLMaterial::SHADER_COUNT];
 
-	if (LLPipeline::sUnderWaterRender)
-	{
-		sVertexProgram = &(gDeferredMaterialWaterProgram[pass]);
-	}
+	//if (LLPipeline::sUnderWaterRender)
+	//{
+	//	sVertexProgram = &(gDeferredMaterialWaterProgram[pass]);
+	//}
 
 	sVertexProgram->bind();
 	normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::BUMP_MAP);
-- 
GitLab