diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2000-07-13 19:50:04 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2000-07-13 19:50:04 +0000 |
commit | 1b8d0fdcdeea21ac68c2ee856cb035c58d08eb33 (patch) | |
tree | 7ad5154092bbb9deefc8350d800ce8d93dd476a2 | |
parent | 761c5b23bb2d0f565074eb31df4bbc1aa8471b0d (diff) |
fix divide by zero problem in compute_shine_table()
-rw-r--r-- | src/mesa/main/light.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 136d7af811..f86e7f1840 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,4 +1,4 @@ -/* $Id: light.c,v 1.8.2.8 2000/07/13 12:54:07 keithw Exp $ */ +/* $Id: light.c,v 1.8.2.9 2000/07/13 19:50:04 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1013,7 +1013,10 @@ static void compute_shine_table( struct gl_shine_tab *tab, GLfloat shininess ) scaling for table lookup. (Actually, given f'(x0), it's easy to calculate f(x0), so maybe we only need this) */ - m[i*2+1] = shininess * t / (dp * (SHINE_TABLE_SIZE-1)); + if (dp == 0.0) + m[i*2+1] = pow((i+1) / (GLfloat)(SHINE_TABLE_SIZE-1), shininess); + else + m[i*2+1] = shininess * t / (dp * (SHINE_TABLE_SIZE-1) ); } tab->shininess = shininess; |