Header file clean-up:
[mesa.git] / src / mesa / main / points.c
index 493a96c0e98a126fb9ce2fcd5d9e61430f3ad2ef..f162da4b5bf6f9718b4afcfc239558363f662966 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: points.c,v 1.30 2001/03/12 00:48:38 gareth Exp $ */
+/* $Id: points.c,v 1.34 2002/10/24 23:57:21 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  4.1
  *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2002  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"),
@@ -25,9 +25,6 @@
  */
 
 
-#ifdef PC_HEADER
-#include "all.h"
-#else
 #include "glheader.h"
 #include "context.h"
 #include "macros.h"
@@ -35,7 +32,6 @@
 #include "points.h"
 #include "texstate.h"
 #include "mtypes.h"
-#endif
 
 
 
@@ -70,6 +66,32 @@ _mesa_PointSize( GLfloat size )
 
 
 
+/*
+ * Added by GL_NV_point_sprite
+ */
+void
+_mesa_PointParameteriNV( GLenum pname, GLint param )
+{
+   const GLfloat value = (GLfloat) param;
+   _mesa_PointParameterfvEXT(pname, &value);
+}
+
+
+/*
+ * Added by GL_NV_point_sprite
+ */
+void
+_mesa_PointParameterivNV( GLenum pname, const GLint *params )
+{
+   const GLfloat value = (GLfloat) params[0];
+   _mesa_PointParameterfvEXT(pname, &value);
+}
+
+
+
+/*
+ * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
+ */
 void
 _mesa_PointParameterfEXT( GLenum pname, GLfloat param)
 {
@@ -77,6 +99,10 @@ _mesa_PointParameterfEXT( GLenum pname, GLfloat param)
 }
 
 
+
+/*
+ * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
+ */
 void
 _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
 {
@@ -85,7 +111,7 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
 
    switch (pname) {
       case GL_DISTANCE_ATTENUATION_EXT:
-         {
+         if (ctx->Extensions.EXT_point_parameters) {
             const GLboolean tmp = ctx->Point._Attenuated;
             if (TEST_EQ_3V(ctx->Point.Params, params))
               return;
@@ -102,44 +128,92 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
                                      params[2] != 0.0);
 
             if (tmp != ctx->Point._Attenuated) {
-               ctx->_Enabled ^= ENABLE_POINT_ATTEN;
                ctx->_TriangleCaps ^= DD_POINT_ATTEN;
               ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN;
             }
          }
+         else {
+            _mesa_error(ctx, GL_INVALID_ENUM,
+                        "glPointParameterf[v]{EXT,ARB}(pname)");
+            return;
+         }
          break;
       case GL_POINT_SIZE_MIN_EXT:
-         if (*params < 0.0F) {
-            _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
+         if (ctx->Extensions.EXT_point_parameters) {
+            if (params[0] < 0.0F) {
+               _mesa_error( ctx, GL_INVALID_VALUE,
+                            "glPointParameterf[v]{EXT,ARB}(param)" );
+               return;
+            }
+            if (ctx->Point.MinSize == params[0])
+               return;
+            FLUSH_VERTICES(ctx, _NEW_POINT);
+            ctx->Point.MinSize = params[0];
+         }
+         else {
+            _mesa_error(ctx, GL_INVALID_ENUM,
+                        "glPointParameterf[v]{EXT,ARB}(pname)");
             return;
          }
-         if (ctx->Point.MinSize == *params)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_POINT);
-         ctx->Point.MinSize = *params;
          break;
       case GL_POINT_SIZE_MAX_EXT:
-         if (*params < 0.0F) {
-            _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
+         if (ctx->Extensions.EXT_point_parameters) {
+            if (params[0] < 0.0F) {
+               _mesa_error( ctx, GL_INVALID_VALUE,
+                            "glPointParameterf[v]{EXT,ARB}(param)" );
+               return;
+            }
+            if (ctx->Point.MaxSize == params[0])
+               return;
+            FLUSH_VERTICES(ctx, _NEW_POINT);
+            ctx->Point.MaxSize = params[0];
+         }
+         else {
+            _mesa_error(ctx, GL_INVALID_ENUM,
+                        "glPointParameterf[v]{EXT,ARB}(pname)");
             return;
          }
-         if (ctx->Point.MaxSize == *params)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_POINT);
-         ctx->Point.MaxSize = *params;
          break;
       case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
-         if (*params < 0.0F) {
-            _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
+         if (ctx->Extensions.EXT_point_parameters) {
+            if (params[0] < 0.0F) {
+               _mesa_error( ctx, GL_INVALID_VALUE,
+                            "glPointParameterf[v]{EXT,ARB}(param)" );
+               return;
+            }
+            if (ctx->Point.Threshold == params[0])
+               return;
+            FLUSH_VERTICES(ctx, _NEW_POINT);
+            ctx->Point.Threshold = params[0];
+         }
+         else {
+            _mesa_error(ctx, GL_INVALID_ENUM,
+                        "glPointParameterf[v]{EXT,ARB}(pname)");
+            return;
+         }
+         break;
+      case GL_POINT_SPRITE_R_MODE_NV:
+         if (ctx->Extensions.NV_point_sprite) {
+            GLenum value = (GLenum) params[0];
+            if (value != GL_ZERO && value != GL_S && value != GL_R) {
+               _mesa_error(ctx, GL_INVALID_VALUE,
+                           "glPointParameterf[v]{EXT,ARB}(param)");
+               return;
+            }
+            if (ctx->Point.SpriteRMode == value)
+               return;
+            FLUSH_VERTICES(ctx, _NEW_POINT);
+            ctx->Point.SpriteRMode = value;
+         }
+         else {
+            _mesa_error(ctx, GL_INVALID_ENUM,
+                        "glPointParameterf[v]{EXT,ARB}(pname)");
             return;
          }
-         if (ctx->Point.Threshold == *params)
-           return;
-        FLUSH_VERTICES(ctx, _NEW_POINT);
-         ctx->Point.Threshold = *params;
          break;
       default:
-         _mesa_error( ctx, GL_INVALID_ENUM, "glPointParameterfvEXT" );
+         _mesa_error( ctx, GL_INVALID_ENUM,
+                      "glPointParameterf[v]{EXT,ARB}(pname)" );
          return;
    }