From 6409f4374b1fc7297f60b7129c05fd9bda483a3f Mon Sep 17 00:00:00 2001 From: taw27 Date: Wed, 6 Aug 2008 11:57:49 +0000 Subject: Shader stuff git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@214 84d2e878-0bd5-11dd-ad15-13eda11d74c5 --- data/shaders/lighting.frag | 6 +++--- data/shaders/lighting.vert | 2 +- 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. */ -- cgit v1.2.3