diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl | 10 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl | 27 |
2 files changed, 19 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index e8cbf318a1..057c0a1ec9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -37,11 +37,11 @@ out vec4 frag_color; uniform sampler2DRect depthMap; -#if INDEX_MODE != INDEXED +#if !INDEX_MODE || INDEX_MODE_NO_COLOR uniform sampler2D diffuseMap; #endif -#if INDEX_MODE == INDEXED +#if INDEX_MODE vec4 diffuseLookup(vec2 texcoord); #endif @@ -61,7 +61,7 @@ VARYING vec2 vary_texcoord2; VARYING vec3 vary_norm; VARYING mat3 vary_rotation; -#if INDEX_MODE != NON_INDEXED_NO_COLOR +#if !INDEX_MODE_NO_COLOR VARYING vec4 vertex_color; #endif @@ -124,13 +124,13 @@ void main() vec4 pos = vec4(vary_position, 1.0); -#if INDEX_MODE == INDEXED +#if INDEX_MODE vec4 diff= diffuseLookup(vary_texcoord0.xy); #else vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy); #endif -#if INDEX_MODE == NON_INDEXED_NO_COLOR +#if INDEX_MODE_NO_COLOR float vertex_color_alpha = 1.0; #else float vertex_color_alpha = vertex_color.a; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index e6b63657e6..7506123a94 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -34,7 +34,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -#if INDEX_MODE == INDEXED +#if INDEX_MODE void passTextureIndex(); #endif ATTRIBUTE vec3 normal; @@ -53,7 +53,7 @@ mat4 getSkinnedTransform(); vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); -float calcDirectionalLight(vec3 n, vec3 l); +vec3 calcDirectionalLight(vec3 n, vec3 l); vec3 atmosAmbient(vec3 light); vec3 atmosAffectDirectionalLight(float lightIntensity); @@ -66,7 +66,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_pointlight_col; -#if INDEX_MODE != NON_INDEXED_NO_COLOR +#if !INDEX_MODE_NO_COLOR VARYING vec4 vertex_color; #endif @@ -86,13 +86,13 @@ uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; -float calcDirectionalLight(vec3 n, vec3 l) +vec3 calcDirectionalLight(vec3 n, vec3 l) { float a = max(dot(n,l),0.0); - return a; + return vec3(a,a,a); } -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) { //get light vector vec3 lv = lp.xyz-v; @@ -119,14 +119,13 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa da *= max(dot(n, lv), 0.0); } - return da; + return vec3(da,da,da); } void main() { vec4 pos; vec3 norm; - //transform vertex #if HAS_SKIN mat4 trans = getObjectSkinnedTransform(); @@ -159,9 +158,10 @@ void main() pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); #endif + vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy; vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy; -#if INDEX_MODE == INDEXED +#if INDEX_MODE passTextureIndex(); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; #else @@ -190,13 +190,14 @@ void main() col.rgb = vec3(0,0,0); // Add windlight lights - col.rgb = atmosAmbient(vec3(0.)); + col.rgb = atmosAmbient(col.rgb); vary_ambient = col.rgb*diffuse_color.rgb; - vary_directional.rgb = atmosAffectDirectionalLight(1); + + vary_directional.rgb = atmosAffectDirectionalLight(1.0f); col.rgb = col.rgb*diffuse_color.rgb; -#if INDEX_MODE != NON_INDEXED_NO_COLOR +#if !INDEX_MODE_NO_COLOR vertex_color = col; #endif @@ -208,5 +209,5 @@ void main() pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); #endif - + } |