summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-01-28 18:50:10 -0800
committerTofu Linden <tofu.linden@lindenlab.com>2010-01-28 18:50:10 -0800
commitf773b6ef9669bab6765678f8b07831144dd44a5e (patch)
treed1b9c206912f0db30465b36cff20a15556430b7d /indra
parentc413a0e096f8897ddc4ee5b5a627e6bf6cce39bb (diff)
cheaply resurrect the difference between spotlight and omnidirectional, as far as the shader is concerned.
not complete.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl4
-rw-r--r--indra/newview/pipeline.cpp6
2 files changed, 7 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
index 0f03e336be..b2d6d23b1e 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
@@ -33,7 +33,7 @@ float calcPointLight(vec3 v, vec3 n, vec4 lp, float la)
}
-float calcPointLight2(vec3 v, vec3 n, vec4 lp, vec3 ln, float la)
+float calcPointLight2(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_omnidirectional)
{
//get light vector
vec3 lv = lp.xyz-v;
@@ -48,7 +48,7 @@ float calcPointLight2(vec3 v, vec3 n, vec4 lp, vec3 ln, float la)
float da = clamp(1.0/(la * d), 0.0, 1.0);
//angular attenuation
- da *= calcDirectionalLight(-ln, lv) * calcDirectionalLight(n, lv);
+ da *= clamp(dot(-ln, lv)+is_omnidirectional, 0.0, 1.0) * calcDirectionalLight(n, lv);
return da;
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 71f9ce7eb2..6cd8b94405 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4592,7 +4592,6 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
glLightfv(gllight, GL_POSITION, light_pos_gl.mV);
glLightfv(gllight, GL_DIFFUSE, light_color.mV);
glLightfv(gllight, GL_AMBIENT, LLColor4::black.mV);
- glLightfv(gllight, GL_SPECULAR, LLColor4::black.mV);
glLightf (gllight, GL_CONSTANT_ATTENUATION, 0.0f);
glLightf (gllight, GL_LINEAR_ATTENUATION, atten);
glLightf (gllight, GL_QUADRATIC_ATTENUATION, quad);
@@ -4606,11 +4605,16 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
glLightfv(gllight, GL_SPOT_DIRECTION, at_axis.mV);
glLightf (gllight, GL_SPOT_EXPONENT, 1.0f); // 1.0 = good old dot product
glLightf (gllight, GL_SPOT_CUTOFF, 90.0f); // hemisphere
+ glLightfv(gllight, GL_SPECULAR, LLColor4::black.mV);
}
else // omnidirectional (point) light
{
glLightf (gllight, GL_SPOT_EXPONENT, 0.0f);
glLightf (gllight, GL_SPOT_CUTOFF, 180.0f);
+
+ // we use specular.w = 1.0 as a cheap hack for the shaders to know that this is omnidirectional rather than a spotlight
+ const float specular = {0.f, 0.f, 0.f, 1.f},
+ glLightfv(gllight, GL_SPECULAR, LLColor4::black.mV);
}
cur_light++;
if (cur_light >= 8)