aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-08-06 11:57:49 +0000
committertaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-08-06 11:57:49 +0000
commit6409f4374b1fc7297f60b7129c05fd9bda483a3f (patch)
tree4f1ce3121b242a230a1a59dd05f99df1aea1bbad
parent51e2e4ef2277f6518f9cf7a46c89b068034788d2 (diff)
Shader stuff
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@214 84d2e878-0bd5-11dd-ad15-13eda11d74c5
-rw-r--r--data/shaders/lighting.frag6
-rw-r--r--data/shaders/lighting.vert2
2 files changed, 4 insertions, 4 deletions
diff --git a/data/shaders/lighting.frag b/data/shaders/lighting.frag
index d4cb035..6e3fe65 100644
--- a/data/shaders/lighting.frag
+++ b/data/shaders/lighting.frag
@@ -63,9 +63,9 @@ void main() {
float falloff, spot;
float diff_fac, spec_fac;
- falloff = 1/ ( gl_LightSource[0].constantAttenuation
- + gl_LightSource[0].linearAttenuation * light0dist
- + gl_LightSource[0].quadraticAttenuation * light0dist * light0dist );
+ falloff = 1.0 / ( gl_LightSource[0].constantAttenuation
+ + gl_LightSource[0].linearAttenuation * light0dist
+ + gl_LightSource[0].quadraticAttenuation * light0dist * light0dist );
spot = max(dot(normalize(-light0vc), gl_LightSource[0].spotDirection), 0.0);
spot = pow(spot, gl_LightSource[0].spotExponent);
diff --git a/data/shaders/lighting.vert b/data/shaders/lighting.vert
index 99e9b37..af80574 100644
--- a/data/shaders/lighting.vert
+++ b/data/shaders/lighting.vert
@@ -39,7 +39,7 @@ void main() {
light0dist = length(vert_to_light);
light0vc = normalize(vert_to_light);
vert_to_eye = v4conv3(-vert);
- light0half = normalize(vert_to_eye + vert_to_light);
+ light0half = normalize(normalize(vert_to_eye) + light0vc);
/* Diffuse "background glow" - this can be normalised only once, here, since 'position'
* is really 'direction' and is the same for all vertices. */