From 24ae2fb5af52d7128e79a0f63afce9a8db1123eb Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 15 Sep 2011 16:38:31 -0500 Subject: SH-2243 work in progress -- don't use built-in GL light state when shaders are available. --- indra/newview/app_settings/shaders/class1/lighting/lightV.glsl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/app_settings/shaders/class1/lighting/lightV.glsl') diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl index 742cb38d80..79e2207932 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl @@ -24,6 +24,8 @@ */ +uniform vec4 light_position[8]; +uniform vec3 light_diffuse[8]; float calcDirectionalLight(vec3 n, vec3 l); @@ -32,10 +34,10 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) vec4 col; col.a = color.a; - col.rgb = gl_LightModel.ambient.rgb + baseLight.rgb; + col.rgb = baseLight.rgb; //need ambient? - col.rgb += gl_LightSource[0].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[0].position.xyz); - col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); + col.rgb += light_diffuse[0].rgb*calcDirectionalLight(norm, light_position[0].xyz); + col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_position[1].xyz); col.rgb = min(col.rgb*color.rgb, 1.0); -- cgit v1.2.3 From 4f99ace06944a704e46cc3014607f3a5a4ef246b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 17 Sep 2011 00:19:19 -0500 Subject: SH-2243 work in progress -- put back ambient lighting when atmospheric shaders disabled. --- indra/newview/app_settings/shaders/class1/lighting/lightV.glsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class1/lighting/lightV.glsl') diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl index 79e2207932..b886f97743 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl @@ -26,6 +26,7 @@ uniform vec4 light_position[8]; uniform vec3 light_diffuse[8]; +uniform vec4 light_ambient; float calcDirectionalLight(vec3 n, vec3 l); @@ -34,7 +35,7 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) vec4 col; col.a = color.a; - col.rgb = baseLight.rgb; //need ambient? + col.rgb = baseLight.rgb+light_ambient.rgb; col.rgb += light_diffuse[0].rgb*calcDirectionalLight(norm, light_position[0].xyz); col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_position[1].xyz); -- cgit v1.2.3 From 7238714634e72dacc4b09c1c4ee98b16fb0c91fe Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 29 Sep 2011 19:32:56 -0500 Subject: SH-2507 Potential fix for basic shaders causing objects to disappear with some drivers (prune shader tree of unused shaders while we're at it) --- .../app_settings/shaders/class1/lighting/lightV.glsl | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'indra/newview/app_settings/shaders/class1/lighting/lightV.glsl') diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl index b886f97743..8045809b82 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl @@ -24,24 +24,13 @@ */ -uniform vec4 light_position[8]; -uniform vec3 light_diffuse[8]; -uniform vec4 light_ambient; -float calcDirectionalLight(vec3 n, vec3 l); +// All lights, no specular highlights + +vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight); vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) { - vec4 col; - col.a = color.a; - - col.rgb = baseLight.rgb+light_ambient.rgb; - - col.rgb += light_diffuse[0].rgb*calcDirectionalLight(norm, light_position[0].xyz); - col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_position[1].xyz); - - col.rgb = min(col.rgb*color.rgb, 1.0); - - return col; + return sumLights(pos, norm, color, baseLight); } -- cgit v1.2.3