summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1
diff options
context:
space:
mode:
authorGeenz <geenz@geenzo.com>2013-04-11 14:57:11 -0400
committerGeenz <geenz@geenzo.com>2013-04-11 14:57:11 -0400
commitcfc375777871ec3d04b9969793379d0cd78a012e (patch)
tree851d39612b82e18f82fe47961e4e9fbf70713ff4 /indra/newview/app_settings/shaders/class1
parent84475635b9c3db8d42f2f0a256d34c08274f53ed (diff)
First pass on alpha blended materials
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl27
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl2
2 files changed, 27 insertions, 2 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 4ef69824a1..55dda06b46 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -25,6 +25,10 @@
#extension GL_ARB_texture_rectangle : enable
+#define INDEXED 1
+#define NON_INDEXED 2
+#define NON_INDEXED_NO_COLOR 3
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
@@ -33,7 +37,13 @@ out vec4 frag_color;
uniform sampler2DRect depthMap;
+#if INDEX_MODE != INDEXED
+uniform sampler2D diffuseMap;
+#endif
+
+#if INDEX_MODE == INDEXED
vec4 diffuseLookup(vec2 texcoord);
+#endif
uniform vec2 screen_res;
@@ -46,7 +56,10 @@ VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_pointlight_col;
+#if INDEX_MODE != NON_INDEXED_NO_COLOR
VARYING vec4 vertex_color;
+#endif
+
VARYING vec2 vary_texcoord0;
VARYING vec3 vary_norm;
@@ -103,11 +116,21 @@ void main()
vec4 pos = vec4(vary_position, 1.0);
- vec4 diff= diffuseLookup(vary_texcoord0.xy);
+#if INDEX_MODE == INDEXED
+ vec4 diff = diffuseLookup(vary_texcoord0.xy);
+#else
+ vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
+#endif
+
+#if INDEX_MODE == NON_INDEXED_NO_COLOR
+ float vertex_color_alpha = 1.0;
+#else
+ float vertex_color_alpha = vertex_color.a;
+#endif
vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col;
- vec4 col = vec4(vary_ambient + dlight, vertex_color.a);
+ vec4 col = vec4(vary_ambient + dlight, vertex_color_alpha);
vec4 color = diff * col;
color.rgb = atmosLighting(color.rgb);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl
index 5f395801e5..c8ddefac26 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl
@@ -47,6 +47,7 @@ VARYING vec3 vary_directional;
VARYING vec3 vary_fragcoord;
VARYING vec3 vary_pointlight_col;
VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_norm;
uniform float near_clip;
@@ -112,6 +113,7 @@ void main()
norm.y = dot(trans[1].xyz, normal);
norm.z = dot(trans[2].xyz, normal);
norm = normalize(norm);
+ vary_norm = norm;
vec4 frag_pos = projection_matrix * pos;
gl_Position = frag_pos;