From d1baa05439c7157eeca42ec191d5375821725bdd Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 6 Feb 2001 04:06:34 +0000 Subject: Use a lookup table to compute exponents in tnl fogging code. Slightly clean up the shine table lookup macro. --- src/mesa/main/light.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/mesa/main/light.h') diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h index f737abf4e4..b39aa002d8 100644 --- a/src/mesa/main/light.h +++ b/src/mesa/main/light.h @@ -1,4 +1,4 @@ -/* $Id: light.h,v 1.8 2000/12/26 05:09:29 keithw Exp $ */ +/* $Id: light.h,v 1.9 2001/02/06 04:06:35 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -82,13 +82,12 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ); #define GET_SHINE_TAB_ENTRY( table, dp, result ) \ do { \ struct gl_shine_tab *_tab = table; \ - if (dp>1.0) \ + float f = (dp * (SHINE_TABLE_SIZE-1)); \ + int k = (int) f; \ + if (k > SHINE_TABLE_SIZE-2) \ result = pow( dp, _tab->shininess ); \ - else { \ - float f = (dp * (SHINE_TABLE_SIZE-1)); \ - int k = (int) f; \ + else \ result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \ - } \ } while (0) -- cgit v1.2.3