Merge branch 'mesa_7_7_branch'
[mesa.git] / src / mesa / main / points.c
index c6b032460e81f5fe54189b8a9fd9986430850ea2..e743a2e6bdb9c17c4181864d9bf626460ef42849 100644 (file)
@@ -5,9 +5,9 @@
 
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.1
+ * Version:  7.1
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2007  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"),
@@ -32,7 +32,6 @@
 #include "context.h"
 #include "macros.h"
 #include "points.h"
-#include "texstate.h"
 #include "mtypes.h"
 
 
@@ -65,45 +64,42 @@ _mesa_PointSize( GLfloat size )
 
 #if _HAVE_FULL_GL
 
-/*
- * Added by GL_NV_point_sprite
- */
+
 void GLAPIENTRY
-_mesa_PointParameteriNV( GLenum pname, GLint param )
+_mesa_PointParameteri( GLenum pname, GLint param )
 {
-   const GLfloat value = (GLfloat) param;
-   _mesa_PointParameterfvEXT(pname, &value);
+   GLfloat p[3];
+   p[0] = (GLfloat) param;
+   p[1] = p[2] = 0.0F;
+   _mesa_PointParameterfv(pname, p);
 }
 
 
-/*
- * Added by GL_NV_point_sprite
- */
 void GLAPIENTRY
-_mesa_PointParameterivNV( GLenum pname, const GLint *params )
+_mesa_PointParameteriv( GLenum pname, const GLint *params )
 {
-   const GLfloat value = (GLfloat) params[0];
-   _mesa_PointParameterfvEXT(pname, &value);
+   GLfloat p[3];
+   p[0] = (GLfloat) params[0];
+   if (pname == GL_DISTANCE_ATTENUATION_EXT) {
+      p[1] = (GLfloat) params[1];
+      p[2] = (GLfloat) params[2];
+   }
+   _mesa_PointParameterfv(pname, p);
 }
 
 
-
-/*
- * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
- */
 void GLAPIENTRY
-_mesa_PointParameterfEXT( GLenum pname, GLfloat param)
+_mesa_PointParameterf( GLenum pname, GLfloat param)
 {
-   _mesa_PointParameterfvEXT(pname, &param);
+   GLfloat p[3];
+   p[0] = param;
+   p[1] = p[2] = 0.0F;
+   _mesa_PointParameterfv(pname, p);
 }
 
 
-
-/*
- * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
- */
 void GLAPIENTRY
-_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
+_mesa_PointParameterfv( GLenum pname, const GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -115,6 +111,14 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
               return;
            FLUSH_VERTICES(ctx, _NEW_POINT);
             COPY_3V(ctx->Point.Params, params);
+            ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
+                                      ctx->Point.Params[1] != 0.0 ||
+                                      ctx->Point.Params[2] != 0.0);
+
+            if (ctx->Point._Attenuated)
+               ctx->_TriangleCaps |= DD_POINT_ATTEN;
+            else
+               ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
          }
          else {
             _mesa_error(ctx, GL_INVALID_ENUM,
@@ -200,6 +204,11 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
          }
          break;
       case GL_POINT_SPRITE_COORD_ORIGIN:
+        /* This is not completely correct.  GL_POINT_SPRITE_COORD_ORIGIN was
+         * added to point sprites when the extension was merged into OpenGL
+         * 2.0.  It is expected that an implementation supporting OpenGL 1.4
+         * and GL_ARB_point_sprite will generate an error here.
+         */
          if (ctx->Extensions.ARB_point_sprite) {
             GLenum value = (GLenum) params[0];
             if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
@@ -231,26 +240,6 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
 
 
 
-/**
- * Update derived point-related state.
- */
-void
-_mesa_update_point(GLcontext *ctx)
-{
-   /* clamp to user-specified limits now, clamp to ctx->Const.Min/Max
-    * limits during rasterization.
-    */
-   ctx->Point._Size = CLAMP(ctx->Point.Size,
-                           ctx->Point.MinSize,
-                           ctx->Point.MaxSize);
-
-   ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
-                             ctx->Point.Params[1] != 0.0 ||
-                             ctx->Point.Params[2] != 0.0);
-}
-
-
-
 /**
  * Initialize the context point state.
  *
@@ -266,7 +255,6 @@ _mesa_init_point(GLcontext *ctx)
 
    ctx->Point.SmoothFlag = GL_FALSE;
    ctx->Point.Size = 1.0;
-   ctx->Point._Size = 1.0;
    ctx->Point.Params[0] = 1.0;
    ctx->Point.Params[1] = 0.0;
    ctx->Point.Params[2] = 0.0;
@@ -278,7 +266,7 @@ _mesa_init_point(GLcontext *ctx)
    ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */
    ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */
    ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */
-   for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
+   for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
       ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */
    }
 }