summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-09-17 00:19:19 -0500
committerDave Parks <davep@lindenlab.com>2011-09-17 00:19:19 -0500
commit4f99ace06944a704e46cc3014607f3a5a4ef246b (patch)
tree187224a72f78f260acd80ab732d49940c7e2afc8 /indra/newview
parent8a1baaea6c0462b645499e8e7b88345e46b92621 (diff)
SH-2243 work in progress -- put back ambient lighting when atmospheric shaders disabled.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl3
-rw-r--r--indra/newview/llviewerdisplay.cpp12
-rw-r--r--indra/newview/llviewerwindow.cpp11
-rw-r--r--indra/newview/pipeline.cpp24
7 files changed, 21 insertions, 37 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
index 15781bc92d..b07c1fda9b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
@@ -105,7 +105,7 @@ void main()
vec4 frag_pos = projection_matrix * pos;
gl_Position = frag_pos;
-
+ GL
vary_position = pos.xyz;
vary_normal = norm;
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
index bf6ed5988e..265d548ce9 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.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);
@@ -36,7 +37,7 @@ vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularCo
vec4 col;
col.a = color.a;
- col.rgb = baseCol.rgb; //need ambient?
+ col.rgb = baseCol.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);
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);
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
index 9aa583afa1..ed0249330e 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
@@ -24,10 +24,11 @@
*/
uniform vec3 light_diffuse[8];
+uniform vec4 light_ambient;
vec3 atmosAmbient(vec3 light)
{
- return light; //need ambient?
+ return light + light_ambient.rgb;
}
vec3 atmosAffectDirectionalLight(float lightIntensity)
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 22f4db56dd..4f3127805f 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -522,14 +522,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
// Slam lighting parameters back to our defaults.
// Note that these are not the same as GL defaults...
- if (!LLGLSLShader::sNoFixedFunction)
- {
- stop_glerror();
- F32 one[4] = {1.f, 1.f, 1.f, 1.f};
- glLightModelfv (GL_LIGHT_MODEL_AMBIENT,one);
- stop_glerror();
- }
-
+ stop_glerror();
+ gGL.setAmbientLightColor(LLColor4::white);
+ stop_glerror();
+
/////////////////////////////////////
//
// Render
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index cd9dc461d5..cfdbfd3f03 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1712,10 +1712,8 @@ void LLViewerWindow::initGLDefaults()
gGL.setSceneBlendType(LLRender::BT_ALPHA);
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
- F32 ambient[4] = {0.f,0.f,0.f,0.f };
- F32 diffuse[4] = {1.f,1.f,1.f,1.f };
- glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,ambient);
- glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,diffuse);
+ glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,LLColor4::black.mV);
+ glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,LLColor4::white.mV);
glPixelStorei(GL_PACK_ALIGNMENT,1);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
@@ -1725,10 +1723,7 @@ void LLViewerWindow::initGLDefaults()
// lights for objects
glShadeModel( GL_SMOOTH );
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);
- }
+ gGL.setAmbientLightColor(LLColor4::black);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index ebad1f77c4..db614388f4 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -5057,7 +5057,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
if (!LLGLSLShader::sNoFixedFunction)
{
LLColor4 ambient = gSky.getTotalAmbientColor();
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient.mV);
+ gGL.setAmbientLightColor(ambient);
}
// Light 0 = Sun or Moon (All objects)
@@ -5285,12 +5285,8 @@ void LLPipeline::enableLights(U32 mask)
mLightMask = mask;
stop_glerror();
- if (!LLGLSLShader::sNoFixedFunction)
- {
- LLColor4 ambient = gSky.getTotalAmbientColor();
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient.mV);
- }
-
+ LLColor4 ambient = gSky.getTotalAmbientColor();
+ gGL.setAmbientLightColor(ambient);
}
}
@@ -5342,10 +5338,10 @@ void LLPipeline::enableLightsPreview()
if (!LLGLSLShader::sNoFixedFunction)
{
glEnable(GL_LIGHTING);
- LLColor4 ambient = gSavedSettings.getColor4("PreviewAmbientColor");
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient.mV);
}
+ LLColor4 ambient = gSavedSettings.getColor4("PreviewAmbientColor");
+ gGL.setAmbientLightColor(ambient);
LLColor4 diffuse0 = gSavedSettings.getColor4("PreviewDiffuse0");
LLColor4 specular0 = gSavedSettings.getColor4("PreviewSpecular0");
@@ -5403,10 +5399,7 @@ void LLPipeline::enableLightsAvatarEdit(const LLColor4& color)
setupAvatarLights(TRUE);
enableLights(mask);
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT,color.mV);
- }
+ gGL.setAmbientLightColor(color);
}
void LLPipeline::enableLightsFullbright(const LLColor4& color)
@@ -5415,10 +5408,7 @@ void LLPipeline::enableLightsFullbright(const LLColor4& color)
U32 mask = 0x1000; // Non-0 mask, set ambient
enableLights(mask);
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT,color.mV);
- }
+ gGL.setAmbientLightColor(color);
}
void LLPipeline::disableLights()