diff options
author | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-06-02 23:45:50 +0000 |
---|---|---|
committer | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-06-02 23:45:50 +0000 |
commit | 0af3ca0db832ce3dca5b606d1b9564d3a9878431 (patch) | |
tree | 124047de509e3474abcd2a9a44698426c35946eb /src | |
parent | 70b33bdff4d5bceb3d9faa36a7370690323ddd02 (diff) |
Make shader lighting attenuation agree with fixed function version
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@63 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src')
-rw-r--r-- | src/render.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/render.c b/src/render.c index a03fe7f..eed7920 100644 --- a/src/render.c +++ b/src/render.c @@ -505,13 +505,20 @@ static void render_setup_lighting(Game *game) { specular[1] = 1.0; specular[2] = 1.0; specular[3] = 1.0; + ambient[0] = 0.0; + ambient[1] = 0.0; + ambient[2] = 0.0; + ambient[3] = 1.0; glLightfv(GL_LIGHT0, GL_POSITION, pos); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); glLightfv(GL_LIGHT0, GL_SPECULAR, specular); + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, dir); glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 45.0); glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, 20.0); + glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.0); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05); + glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.02); glEnable(GL_LIGHT0); pos[0] = -1.0; @@ -526,9 +533,14 @@ static void render_setup_lighting(Game *game) { specular[1] = 0.01; specular[2] = 0.01; specular[3] = 1.0; + ambient[0] = 0.0; + ambient[1] = 0.0; + ambient[2] = 0.0; + ambient[3] = 1.0; glLightfv(GL_LIGHT1, GL_POSITION, pos); glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse); glLightfv(GL_LIGHT1, GL_SPECULAR, specular); + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); glEnable(GL_LIGHT1); } |