added Window-isms previously in gl.h
[mesa.git] / src / mesa / main / light.c
index f5a611dd140cfc38d92090fb0fbaafc2f639d52e..a6696b1e1ae9d4b7d08237026624b3b41f2cce99 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: light.c,v 1.9 1999/11/11 01:22:27 brianp Exp $ */
+/* $Id: light.c,v 1.12 2000/01/31 23:33:53 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
  * Version:  3.3
  * 
- * Copyright (C) 1999  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
 #endif
 
 
+/* XXX this is a bit of a hack needed for compilation within XFree86 */
+#ifndef FLT_MIN
+#define FLT_MIN 1e-37
+#endif
+
 
 void
 _mesa_ShadeModel( GLenum mode )
@@ -54,9 +59,12 @@ _mesa_ShadeModel( GLenum mode )
       fprintf(stderr, "glShadeModel %s\n", gl_lookup_enum_by_nr(mode));
 
    if (mode == GL_FLAT || mode == GL_SMOOTH) {
-      if (ctx->Light.ShadeModel!=mode) {
+      if (ctx->Light.ShadeModel != mode) {
          ctx->Light.ShadeModel = mode;
-         ctx->TriangleCaps ^= DD_FLATSHADE;
+         if (ctx->Light.ShadeModel == GL_FLAT)
+            SET_BITS(ctx->TriangleCaps, DD_FLATSHADE);
+         else
+            CLEAR_BITS(ctx->TriangleCaps, DD_FLATSHADE);
          ctx->NewState |= NEW_RASTER_OPS;
          if (ctx->Driver.ShadeModel) 
             (*ctx->Driver.ShadeModel)( ctx, mode );
@@ -377,11 +385,11 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
       case GL_LIGHT_MODEL_COLOR_CONTROL:
          if (params[0] == (GLfloat) GL_SINGLE_COLOR) {
             ctx->Light.Model.ColorControl = GL_SINGLE_COLOR;
-            ctx->TriangleCaps &= ~DD_SEPERATE_SPECULAR;
+            CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR);
          }
          else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) {
             ctx->Light.Model.ColorControl = GL_SEPARATE_SPECULAR_COLOR;
-           ctx->TriangleCaps |= DD_SEPERATE_SPECULAR;
+           SET_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR);
         }
          else {
             gl_error( ctx, GL_INVALID_ENUM, "glLightModel(param)" );
@@ -1157,8 +1165,8 @@ void gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
 
 
 
-
-void gl_reinit_light_attrib( GLcontext *ctx, struct gl_light_attrib *l )
+#if 0
+static void gl_reinit_light_attrib( GLcontext *ctx, struct gl_light_attrib *l )
 {
    GLuint i;
 
@@ -1178,7 +1186,7 @@ void gl_reinit_light_attrib( GLcontext *ctx, struct gl_light_attrib *l )
         insert_at_tail( &l->EnabledList, &l->Light[i] );
    }
 }
-
+#endif
 
 
 /*