summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2000-07-07 14:33:49 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2000-07-07 14:33:49 +0000
commitb276a01a3c37029178f20c781e7e398b21d28679 (patch)
tree6edaac239105d7a6d64eec2ebfa82d3af8637239
parenta1a1b9bf8b12615ec8dfb2ad346a278f6c344b74 (diff)
Initialize shine tables from the center of each table element.
Eliminate checks on 'vertex_size' in the shading functions.
-rw-r--r--src/mesa/main/light.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 6537922713..4495ba1f01 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.8.2.4 2000/06/29 04:57:45 brianp Exp $ */
+/* $Id: light.c,v 1.8.2.5 2000/07/07 14:33:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -1003,17 +1003,11 @@ static void compute_shine_table( struct gl_shine_tab *tab, GLfloat shininess )
int i;
GLfloat *m = tab->tab;
- m[0] = 0;
- if (shininess == 0) {
- for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++)
- m[i] = 1;
- } else {
- for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++) {
- double t = pow( i/(GLfloat)SHINE_TABLE_SIZE, shininess );
- m[i] = 0;
- if (t > 1e-20) m[i] = t;
- }
- }
+ for (i = 0 ; i < SHINE_TABLE_SIZE ; i++) {
+ double t = pow( (i+.5)/(GLfloat)(SHINE_TABLE_SIZE-1), shininess );
+ if (t < 1e-20) t = 0;
+ m[i] = (GLfloat) t;
+ }
tab->shininess = shininess;
}
@@ -1026,7 +1020,7 @@ void gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
struct gl_shine_tab *s;
foreach(s, list)
- if ( DISTSQR(s->shininess, shininess) < 1e-4 )
+ if ( s->shininess == shininess )
break;
if (s == list)