summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/alphaF.glsl11
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/alphaV.glsl11
-rwxr-xr-xindra/newview/llviewershadermgr.cpp3
3 files changed, 22 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 075699c591..52858f45f4 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -77,7 +77,10 @@ VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec2 vary_texcoord0;
VARYING vec3 vary_norm;
+
+#ifdef USE_VERTEX_COLOR
VARYING vec4 vertex_color;
+#endif
vec3 vary_PositionEye;
vec3 vary_SunlitColor;
@@ -476,13 +479,17 @@ void main()
#else
vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
#endif
+
+#ifdef USE_VERTEX_COLOR
+ float final_alpha = diff.a * vertex_color.a;
diff.rgb *= vertex_color.rgb;
+#else
+ float final_alpha = diff.a;
+#endif
vec4 gamma_diff = diff;
diff.rgb = srgb_to_linear(diff.rgb);
- float final_alpha = diff.a * vertex_color.a;
-
vec3 norm = vary_norm;
calcAtmospherics(pos.xyz, 1.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index 3696234af6..60d414f2ff 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -41,7 +41,10 @@ void passTextureIndex();
ATTRIBUTE vec3 normal;
+#ifdef USE_VERTEX_COLOR
ATTRIBUTE vec4 diffuse_color;
+#endif
+
ATTRIBUTE vec2 texcoord0;
#ifdef HAS_SKIN
@@ -54,7 +57,11 @@ mat4 getSkinnedTransform();
VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
+
+#ifdef USE_VERTEX_COLOR
VARYING vec4 vertex_color;
+#endif
+
VARYING vec2 vary_texcoord0;
VARYING vec3 vary_norm;
@@ -112,8 +119,10 @@ void main()
vary_norm = norm;
vary_position = pos.xyz;
+#ifdef USE_VERTEX_COLOR
vertex_color = diffuse_color;
-
+#endif
+
#ifdef HAS_SKIN
vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
#else
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index aa3d2f8349..f17e88f312 100755
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -1274,6 +1274,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
gDeferredSkinnedAlphaProgram.addPermutation("USE_DIFFUSE_TEX", "1");
gDeferredSkinnedAlphaProgram.addPermutation("HAS_SKIN", "1");
+ gDeferredSkinnedAlphaProgram.addPermutation("USE_VERTEX_COLOR", "1");
gDeferredSkinnedAlphaProgram.addPermutation("HAS_SHADOW", mVertexShaderLevel[SHADER_DEFERRED] > 1 ? "1" : "0");
success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL);
@@ -1528,6 +1529,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAlphaProgram.addPermutation("USE_INDEXED_TEX", "1");
gDeferredAlphaProgram.addPermutation("HAS_SHADOW", mVertexShaderLevel[SHADER_DEFERRED] > 1 ? "1" : "0");
+ gDeferredAlphaProgram.addPermutation("USE_VERTEX_COLOR", "1");
gDeferredAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredAlphaProgram.createShader(NULL, NULL);
@@ -1559,6 +1561,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaWaterProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAlphaWaterProgram.addPermutation("USE_INDEXED_TEX", "1");
gDeferredAlphaWaterProgram.addPermutation("WATER_FOG", "1");
+ gDeferredAlphaWaterProgram.addPermutation("USE_VERTEX_COLOR", "1");
gDeferredAlphaWaterProgram.addPermutation("HAS_SHADOW", mVertexShaderLevel[SHADER_DEFERRED] > 1 ? "1" : "0");
gDeferredAlphaWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];