Comment out __FUNCTION__ usage.
[mesa.git] / src / mesa / main / points.c
1 /* $Id: points.c,v 1.31 2001/03/29 21:16:25 keithw Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
6 *
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28 #ifdef PC_HEADER
29 #include "all.h"
30 #else
31 #include "glheader.h"
32 #include "context.h"
33 #include "macros.h"
34 #include "mmath.h"
35 #include "points.h"
36 #include "texstate.h"
37 #include "mtypes.h"
38 #endif
39
40
41
42 void
43 _mesa_PointSize( GLfloat size )
44 {
45 GET_CURRENT_CONTEXT(ctx);
46 ASSERT_OUTSIDE_BEGIN_END(ctx);
47
48 if (size <= 0.0) {
49 _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" );
50 return;
51 }
52
53 if (ctx->Point.Size == size)
54 return;
55
56 FLUSH_VERTICES(ctx, _NEW_POINT);
57 ctx->Point.Size = size;
58 ctx->Point._Size = CLAMP(size,
59 ctx->Const.MinPointSize,
60 ctx->Const.MaxPointSize);
61
62 if (ctx->Point._Size == 1.0F)
63 ctx->_TriangleCaps &= ~DD_POINT_SIZE;
64 else
65 ctx->_TriangleCaps |= DD_POINT_SIZE;
66
67 if (ctx->Driver.PointSize)
68 (*ctx->Driver.PointSize)(ctx, size);
69 }
70
71
72
73 void
74 _mesa_PointParameterfEXT( GLenum pname, GLfloat param)
75 {
76 _mesa_PointParameterfvEXT(pname, &param);
77 }
78
79
80 void
81 _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
82 {
83 GET_CURRENT_CONTEXT(ctx);
84 ASSERT_OUTSIDE_BEGIN_END(ctx);
85
86 switch (pname) {
87 case GL_DISTANCE_ATTENUATION_EXT:
88 {
89 const GLboolean tmp = ctx->Point._Attenuated;
90 if (TEST_EQ_3V(ctx->Point.Params, params))
91 return;
92
93 FLUSH_VERTICES(ctx, _NEW_POINT);
94 COPY_3V(ctx->Point.Params, params);
95
96 /* Update several derived values now. This likely to be
97 * more efficient than trying to catch this statechange in
98 * state.c.
99 */
100 ctx->Point._Attenuated = (params[0] != 1.0 ||
101 params[1] != 0.0 ||
102 params[2] != 0.0);
103
104 if (tmp != ctx->Point._Attenuated) {
105 ctx->_TriangleCaps ^= DD_POINT_ATTEN;
106 ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN;
107 }
108 }
109 break;
110 case GL_POINT_SIZE_MIN_EXT:
111 if (*params < 0.0F) {
112 _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
113 return;
114 }
115 if (ctx->Point.MinSize == *params)
116 return;
117 FLUSH_VERTICES(ctx, _NEW_POINT);
118 ctx->Point.MinSize = *params;
119 break;
120 case GL_POINT_SIZE_MAX_EXT:
121 if (*params < 0.0F) {
122 _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
123 return;
124 }
125 if (ctx->Point.MaxSize == *params)
126 return;
127 FLUSH_VERTICES(ctx, _NEW_POINT);
128 ctx->Point.MaxSize = *params;
129 break;
130 case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
131 if (*params < 0.0F) {
132 _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
133 return;
134 }
135 if (ctx->Point.Threshold == *params)
136 return;
137 FLUSH_VERTICES(ctx, _NEW_POINT);
138 ctx->Point.Threshold = *params;
139 break;
140 default:
141 _mesa_error( ctx, GL_INVALID_ENUM, "glPointParameterfvEXT" );
142 return;
143 }
144
145 if (ctx->Driver.PointParameterfv)
146 (*ctx->Driver.PointParameterfv)(ctx, pname, params);
147 }