summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2000-05-07 23:18:54 +0000
committerBrian Paul <[email protected]>2000-05-07 23:18:54 +0000
commit0665d482d2bafae09cc36ad05fa58e292cfe4ca8 (patch)
tree6df5c571071ac6a352ff01c4453f06aef7d36090 /src/mesa
parent6698b2294f9a151b777dd4e0d1f1c3e86204617a (diff)
Added point UserSize, cleaned up point drawing code
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/get.c10
-rw-r--r--src/mesa/main/points.c348
2 files changed, 180 insertions, 178 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index c3024365176..6bf9669b662 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.24 2000/05/07 20:41:30 brianp Exp $ */
+/* $Id: get.c,v 1.25 2000/05/07 23:18:54 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -646,7 +646,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = INT_TO_BOOL(ctx->Pixel.MapStoSsize);
break;
case GL_POINT_SIZE:
- *params = FLOAT_TO_BOOL(ctx->Point.Size );
+ *params = FLOAT_TO_BOOL(ctx->Point.UserSize);
break;
case GL_POINT_SIZE_GRANULARITY:
*params = FLOAT_TO_BOOL(ctx->Const.PointSizeGranularity );
@@ -1736,7 +1736,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Pixel.MapStoSsize;
break;
case GL_POINT_SIZE:
- *params = (GLdouble) ctx->Point.Size;
+ *params = (GLdouble) ctx->Point.UserSize;
break;
case GL_POINT_SIZE_GRANULARITY:
*params = (GLdouble) ctx->Const.PointSizeGranularity;
@@ -2824,7 +2824,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Pixel.MapStoSsize;
break;
case GL_POINT_SIZE:
- *params = (GLfloat) ctx->Point.Size;
+ *params = (GLfloat) ctx->Point.UserSize;
break;
case GL_POINT_SIZE_GRANULARITY:
*params = (GLfloat) ctx->Const.PointSizeGranularity;
@@ -3896,7 +3896,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = ctx->Pixel.MapStoSsize;
break;
case GL_POINT_SIZE:
- *params = (GLint) ctx->Point.Size;
+ *params = (GLint) ctx->Point.UserSize;
break;
case GL_POINT_SIZE_GRANULARITY:
*params = (GLint) ctx->Const.PointSizeGranularity;
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index 66b38df3f2e..cffb66c67c0 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -1,4 +1,4 @@
-/* $Id: points.c,v 1.7 2000/03/02 18:34:34 brianp Exp $ */
+/* $Id: points.c,v 1.8 2000/05/07 23:18:54 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -54,10 +54,12 @@ _mesa_PointSize( GLfloat size )
return;
}
- if (ctx->Point.Size != size) {
- ctx->Point.Size = size;
+ if (ctx->Point.UserSize != size) {
+ ctx->Point.UserSize = size;
+ ctx->Point.Size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
ctx->TriangleCaps &= ~DD_POINT_SIZE;
- if (size != 1.0) ctx->TriangleCaps |= DD_POINT_SIZE;
+ if (size != 1.0)
+ ctx->TriangleCaps |= DD_POINT_SIZE;
ctx->NewState |= NEW_RASTER_OPS;
}
}
@@ -146,7 +148,8 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
/*
* CI points with size == 1.0
*/
-static void size1_ci_points( GLcontext *ctx, GLuint first, GLuint last )
+static void
+size1_ci_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
@@ -158,8 +161,8 @@ static void size1_ci_points( GLcontext *ctx, GLuint first, GLuint last )
GLuint i;
win = &VB->Win.data[first][0];
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
+ for (i = first; i <= last; i++) {
+ if (VB->ClipMask[i] == 0) {
pbx[pbcount] = (GLint) win[0];
pby[pbcount] = (GLint) win[1];
pbz[pbcount] = (GLint) (win[2] + ctx->PointZoffset);
@@ -177,14 +180,15 @@ static void size1_ci_points( GLcontext *ctx, GLuint first, GLuint last )
/*
* RGBA points with size == 1.0
*/
-static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
+static void
+size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
GLuint i;
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
+ for (i = first; i <= last; i++) {
+ if (VB->ClipMask[i] == 0) {
GLint x, y, z;
GLint red, green, blue, alpha;
@@ -200,7 +204,7 @@ static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha );
}
}
- PB_CHECK_FLUSH(ctx,PB);
+ PB_CHECK_FLUSH(ctx, PB);
}
@@ -208,23 +212,23 @@ static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
/*
* General CI points.
*/
-static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last )
+static void
+general_ci_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
- GLuint i;
- GLint isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
+ const GLint isize = (GLint) (ctx->Point.Size + 0.5F);
GLint radius = isize >> 1;
+ GLuint i;
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
- GLint x, y, z;
+ for (i = first; i <= last; i++) {
+ if (VB->ClipMask[i] == 0) {
GLint x0, x1, y0, y1;
GLint ix, iy;
- x = (GLint) VB->Win.data[i][0];
- y = (GLint) VB->Win.data[i][1];
- z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLint x = (GLint) VB->Win.data[i][0];
+ GLint y = (GLint) VB->Win.data[i][1];
+ GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
if (isize & 1) {
/* odd size */
@@ -243,8 +247,8 @@ static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last )
PB_SET_INDEX( ctx, PB, VB->IndexPtr->data[i] );
- for (iy=y0;iy<=y1;iy++) {
- for (ix=x0;ix<=x1;ix++) {
+ for (iy = y0; iy <= y1; iy++) {
+ for (ix = x0; ix <= x1; ix++) {
PB_WRITE_PIXEL( PB, ix, iy, z );
}
}
@@ -257,23 +261,23 @@ static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last )
/*
* General RGBA points.
*/
-static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
+static void
+general_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
- GLuint i;
- GLint isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
+ GLint isize = (GLint) (ctx->Point.Size + 0.5F);
GLint radius = isize >> 1;
+ GLuint i;
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
- GLint x, y, z;
+ for (i = first; i <= last; i++) {
+ if (VB->ClipMask[i] == 0) {
GLint x0, x1, y0, y1;
GLint ix, iy;
- x = (GLint) VB->Win.data[i][0];
- y = (GLint) VB->Win.data[i][1];
- z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLint x = (GLint) VB->Win.data[i][0];
+ GLint y = (GLint) VB->Win.data[i][1];
+ GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
if (isize & 1) {
/* odd size */
@@ -296,8 +300,8 @@ static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
VB->ColorPtr->data[i][2],
VB->ColorPtr->data[i][3] );
- for (iy=y0;iy<=y1;iy++) {
- for (ix=x0;ix<=x1;ix++) {
+ for (iy = y0; iy <= y1; iy++) {
+ for (ix = x0; ix <= x1; ix++) {
PB_WRITE_PIXEL( PB, ix, iy, z );
}
}
@@ -312,28 +316,26 @@ static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
/*
* Textured RGBA points.
*/
-static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
+static void
+textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
GLuint i;
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
- GLint x, y, z;
+ for (i = first; i <= last; i++) {
+ if (VB->ClipMask[i] == 0) {
GLint x0, x1, y0, y1;
- GLint ix, iy;
- GLint isize, radius;
+ GLint ix, iy, radius;
GLint red, green, blue, alpha;
GLfloat s, t, u;
- x = (GLint) VB->Win.data[i][0];
- y = (GLint) VB->Win.data[i][1];
- z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLint x = (GLint) VB->Win.data[i][0];
+ GLint y = (GLint) VB->Win.data[i][1];
+ GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLint isize = (GLint) (ctx->Point.Size + 0.5F);
- isize = (GLint)
- (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
- if (isize<1) {
+ if (isize < 1) {
isize = 1;
}
radius = isize >> 1;
@@ -389,12 +391,12 @@ static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
PB_SET_COLOR( red, green, blue, alpha );
*/
- for (iy=y0;iy<=y1;iy++) {
- for (ix=x0;ix<=x1;ix++) {
+ for (iy = y0; iy <= y1; iy++) {
+ for (ix = x0; ix <= x1; ix++) {
PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u );
}
}
- PB_CHECK_FLUSH(ctx,PB);
+ PB_CHECK_FLUSH(ctx, PB);
}
}
}
@@ -403,29 +405,28 @@ static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
/*
* Multitextured RGBA points.
*/
-static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
+static void
+multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
GLuint i;
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
- GLint x, y, z;
+ for (i = first; i <= last; i++) {
+ if (VB->ClipMask[i] == 0) {
GLint x0, x1, y0, y1;
GLint ix, iy;
- GLint isize, radius;
+ GLint radius;
GLint red, green, blue, alpha;
GLfloat s, t, u;
GLfloat s1, t1, u1;
- x = (GLint) VB->Win.data[i][0];
- y = (GLint) VB->Win.data[i][1];
- z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLint x = (GLint) VB->Win.data[i][0];
+ GLint y = (GLint) VB->Win.data[i][1];
+ GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLint isize = (GLint) (ctx->Point.Size + 0.5F);
- isize = (GLint)
- (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
- if (isize<1) {
+ if (isize < 1) {
isize = 1;
}
radius = isize >> 1;
@@ -506,10 +507,11 @@ static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last
for (iy=y0;iy<=y1;iy++) {
for (ix=x0;ix<=x1;ix++) {
- PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u, s1, t1, u1 );
+ PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha,
+ s, t, u, s1, t1, u1 );
}
}
- PB_CHECK_FLUSH(ctx,PB);
+ PB_CHECK_FLUSH(ctx, PB);
}
}
}
@@ -520,35 +522,32 @@ static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last
/*
* Antialiased points with or without texture mapping.
*/
-static void antialiased_rgba_points( GLcontext *ctx,
- GLuint first, GLuint last )
+static void
+antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
+ const GLfloat radius = ctx->Point.Size * 0.5F;
+ const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
+ const GLfloat rmax = radius + 0.7071F;
+ const GLfloat rmin2 = rmin * rmin;
+ const GLfloat rmax2 = rmax * rmax;
+ const GLfloat cscale = 256.0F / (rmax2 - rmin2);
GLuint i;
- GLfloat radius, rmin, rmax, rmin2, rmax2, cscale;
-
- radius = CLAMP( ctx->Point.Size, MIN_POINT_SIZE, MAX_POINT_SIZE ) * 0.5F;
- rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
- rmax = radius + 0.7071F;
- rmin2 = rmin*rmin;
- rmax2 = rmax*rmax;
- cscale = 256.0F / (rmax2-rmin2);
if (ctx->Texture.ReallyEnabled) {
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
- GLint xmin, ymin, xmax, ymax;
- GLint x, y, z;
+ for (i = first; i <= last; i++) {
+ if (VB->ClipMask[i] == 0) {
+ GLint x, y;
GLint red, green, blue, alpha;
GLfloat s, t, u;
GLfloat s1, t1, u1;
- xmin = (GLint) (VB->Win.data[i][0] - radius);
- xmax = (GLint) (VB->Win.data[i][0] + radius);
- ymin = (GLint) (VB->Win.data[i][1] - radius);
- ymax = (GLint) (VB->Win.data[i][1] + radius);
- z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLint xmin = (GLint) (VB->Win.data[i][0] - radius);
+ GLint xmax = (GLint) (VB->Win.data[i][0] + radius);
+ GLint ymin = (GLint) (VB->Win.data[i][1] - radius);
+ GLint ymax = (GLint) (VB->Win.data[i][1] + radius);
+ GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
red = VB->ColorPtr->data[i][0];
green = VB->ColorPtr->data[i][1];
@@ -691,7 +690,8 @@ static void antialiased_rgba_points( GLcontext *ctx,
/*
* Null rasterizer for measuring transformation speed.
*/
-static void null_points( GLcontext *ctx, GLuint first, GLuint last )
+static void
+null_points( GLcontext *ctx, GLuint first, GLuint last )
{
(void) ctx;
(void) first;
@@ -705,8 +705,9 @@ static void null_points( GLcontext *ctx, GLuint first, GLuint last )
/* Calculates the distance attenuation formula of a vector of points in
* eye space coordinates
*/
-static void dist3(GLfloat *out, GLuint first, GLuint last,
- const GLcontext *ctx, const GLvector4f *v)
+static void
+dist3(GLfloat *out, GLuint first, GLuint last,
+ const GLcontext *ctx, const GLvector4f *v)
{
GLuint stride = v->stride;
const GLfloat *p = VEC_ELT(v, GLfloat, first);
@@ -720,8 +721,10 @@ static void dist3(GLfloat *out, GLuint first, GLuint last,
}
}
-static void dist2(GLfloat *out, GLuint first, GLuint last,
- const GLcontext *ctx, const GLvector4f *v)
+
+static void
+dist2(GLfloat *out, GLuint first, GLuint last,
+ const GLcontext *ctx, const GLvector4f *v)
{
GLuint stride = v->stride;
const GLfloat *p = VEC_ELT(v, GLfloat, first);
@@ -749,8 +752,9 @@ static dist_func eye_dist_tab[5] = {
};
-static void clip_dist(GLfloat *out, GLuint first, GLuint last,
- const GLcontext *ctx, GLvector4f *clip)
+static void
+clip_dist(GLfloat *out, GLuint first, GLuint last,
+ const GLcontext *ctx, GLvector4f *clip)
{
/* this is never called */
gl_problem(NULL, "clip_dist() called - dead code!\n");
@@ -781,15 +785,14 @@ static void clip_dist(GLfloat *out, GLuint first, GLuint last,
/*
* Distance Attenuated General CI points.
*/
-static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first,
- GLuint last )
+static void
+dist_atten_general_ci_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
- GLuint i;
- GLfloat psize,dsize;
GLfloat dist[VB_SIZE];
- psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE);
+ const GLfloat psize = ctx->Point.Size;
+ GLuint i;
if (ctx->NeedEyeCoords)
(eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
@@ -798,20 +801,19 @@ static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first,
for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
- GLint x, y, z;
GLint x0, x1, y0, y1;
GLint ix, iy;
GLint isize, radius;
+ GLint x = (GLint) VB->Win.data[i][0];
+ GLint y = (GLint) VB->Win.data[i][1];
+ GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLfloat dsize = psize * dist[i];
- x = (GLint) VB->Win.data[i][0];
- y = (GLint) VB->Win.data[i][1];
- z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
-
- dsize=psize*dist[i];
- if(dsize>=ctx->Point.Threshold) {
- isize=(GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F);
- } else {
- isize=(GLint) (MAX2(ctx->Point.Threshold,ctx->Point.MinSize)+0.5F);
+ if (dsize >= ctx->Point.Threshold) {
+ isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F);
+ }
+ else {
+ isize = (GLint) (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) + 0.5F);
}
radius = isize >> 1;
@@ -845,16 +847,14 @@ static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first,
/*
* Distance Attenuated General RGBA points.
*/
-static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first,
- GLuint last )
+static void
+dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
- GLuint i;
- GLubyte alpha;
- GLfloat psize,dsize;
GLfloat dist[VB_SIZE];
- psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE);
+ const GLfloat psize = ctx->Point.Size;
+ GLuint i;
if (ctx->NeedEyeCoords)
(eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
@@ -863,15 +863,15 @@ static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first,
for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
- GLint x, y, z;
GLint x0, x1, y0, y1;
GLint ix, iy;
GLint isize, radius;
+ GLint x = (GLint) VB->Win.data[i][0];
+ GLint y = (GLint) VB->Win.data[i][1];
+ GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLfloat dsize=psize*dist[i];
+ GLubyte alpha;
- x = (GLint) VB->Win.data[i][0];
- y = (GLint) VB->Win.data[i][1];
- z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
- dsize=psize*dist[i];
if (dsize >= ctx->Point.Threshold) {
isize = (GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F);
alpha = VB->ColorPtr->data[i][3];
@@ -917,15 +917,14 @@ static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first,
/*
* Distance Attenuated Textured RGBA points.
*/
-static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first,
- GLuint last )
+static void
+dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
- GLuint i;
- GLfloat psize,dsize;
GLfloat dist[VB_SIZE];
- psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE);
+ const GLfloat psize = ctx->Point.Size;
+ GLuint i;
if (ctx->NeedEyeCoords)
(eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
@@ -934,7 +933,6 @@ static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first,
for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
- GLint x, y, z;
GLint x0, x1, y0, y1;
GLint ix, iy;
GLint isize, radius;
@@ -942,21 +940,22 @@ static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first,
GLfloat s, t, u;
GLfloat s1, t1, u1;
- x = (GLint) VB->Win.data[i][0];
- y = (GLint) VB->Win.data[i][1];
- z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
+ GLint x = (GLint) VB->Win.data[i][0];
+ GLint y = (GLint) VB->Win.data[i][1];
+ GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
- dsize=psize*dist[i];
- if(dsize>=ctx->Point.Threshold) {
- isize=(GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F);
- alpha=VB->ColorPtr->data[i][3];
- } else {
- isize=(GLint) (MAX2(ctx->Point.Threshold,ctx->Point.MinSize)+0.5F);
- dsize/=ctx->Point.Threshold;
- alpha = (GLint) (VB->ColorPtr->data[i][3]* (dsize*dsize));
+ GLfloat dsize = psize*dist[i];
+ if(dsize >= ctx->Point.Threshold) {
+ isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F);
+ alpha = VB->ColorPtr->data[i][3];
+ }
+ else {
+ isize = (GLint) (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) + 0.5F);
+ dsize /= ctx->Point.Threshold;
+ alpha = (GLint) (VB->ColorPtr->data[i][3] * (dsize * dsize));
}
- if (isize<1) {
+ if (isize < 1) {
isize = 1;
}
radius = isize >> 1;
@@ -1065,16 +1064,14 @@ static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first,
/*
* Distance Attenuated Antialiased points with or without texture mapping.
*/
-static void dist_atten_antialiased_rgba_points( GLcontext *ctx,
- GLuint first, GLuint last )
+static void
+dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = ctx->VB;
struct pixel_buffer *PB = ctx->PB;
- GLuint i;
- GLfloat radius, rmin, rmax, rmin2, rmax2, cscale;
- GLfloat psize,dsize,alphaf;
GLfloat dist[VB_SIZE];
- psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE);
+ const GLfloat psize = ctx->Point.Size;
+ GLuint i;
if (ctx->NeedEyeCoords)
(eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
@@ -1084,20 +1081,22 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx,
if (ctx->Texture.ReallyEnabled) {
for (i=first;i<=last;i++) {
if (VB->ClipMask[i]==0) {
+ GLfloat radius, rmin, rmax, rmin2, rmax2, cscale, alphaf;
GLint xmin, ymin, xmax, ymax;
GLint x, y, z;
GLint red, green, blue, alpha;
GLfloat s, t, u;
GLfloat s1, t1, u1;
+ GLfloat dsize = psize * dist[i];
- dsize=psize*dist[i];
- if(dsize>=ctx->Point.Threshold) {
- radius=(MIN2(dsize,ctx->Point.MaxSize)*0.5F);
- alphaf=1.0;
- } else {
- radius=(MAX2(ctx->Point.Threshold,ctx->Point.MinSize)*0.5F);
- dsize/=ctx->Point.Threshold;
- alphaf=(dsize*dsize);
+ if (dsize >= ctx->Point.Threshold) {
+ radius = MIN2(dsize, ctx->Point.MaxSize) * 0.5F;
+ alphaf = 1.0F;
+ }
+ else {
+ radius = (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) * 0.5F);
+ dsize /= ctx->Point.Threshold;
+ alphaf = (dsize*dsize);
}
rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
rmax = radius + 0.7071F;
@@ -1179,23 +1178,25 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx,
}
}
- for (y=ymin;y<=ymax;y++) {
- for (x=xmin;x<=xmax;x++) {
+ for (y = ymin; y <= ymax; y++) {
+ for (x = xmin; x <= xmax; x++) {
GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
GLfloat dist2 = dx*dx + dy*dy;
- if (dist2<rmax2) {
+ if (dist2 < rmax2) {
alpha = VB->ColorPtr->data[i][3];
- if (dist2>=rmin2) {
- GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
+ if (dist2 >= rmin2) {
+ GLint coverage = (GLint) (256.0F - (dist2 - rmin2) * cscale);
/* coverage is in [0,256] */
alpha = (alpha * coverage) >> 8;
}
alpha = (GLint) (alpha * alphaf);
if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
- PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u, s1, t1, u1 );
+ PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue,
+ alpha, s, t, u, s1, t1, u1 );
} else {
- PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u );
+ PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha,
+ s, t, u );
}
}
}
@@ -1206,26 +1207,28 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx,
}
else {
/* Not texture mapped */
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
+ for (i = first; i <= last; i++) {
+ if (VB->ClipMask[i] == 0) {
+ GLfloat radius, rmin, rmax, rmin2, rmax2, cscale, alphaf;
GLint xmin, ymin, xmax, ymax;
GLint x, y, z;
GLint red, green, blue, alpha;
+ GLfloat dsize = psize * dist[i];
- dsize=psize*dist[i];
- if(dsize>=ctx->Point.Threshold) {
- radius=(MIN2(dsize,ctx->Point.MaxSize)*0.5F);
- alphaf=1.0;
- } else {
- radius=(MAX2(ctx->Point.Threshold,ctx->Point.MinSize)*0.5F);
- dsize/=ctx->Point.Threshold;
- alphaf=(dsize*dsize);
+ if (dsize >= ctx->Point.Threshold) {
+ radius = MIN2(dsize, ctx->Point.MaxSize) * 0.5F;
+ alphaf = 1.0F;
+ }
+ else {
+ radius = (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) * 0.5F);
+ dsize /= ctx->Point.Threshold;
+ alphaf = dsize * dsize;
}
rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
rmax = radius + 0.7071F;
- rmin2 = rmin*rmin;
- rmax2 = rmax*rmax;
- cscale = 256.0F / (rmax2-rmin2);
+ rmin2 = rmin * rmin;
+ rmax2 = rmax * rmax;
+ cscale = 256.0F / (rmax2 - rmin2);
xmin = (GLint) (VB->Win.data[i][0] - radius);
xmax = (GLint) (VB->Win.data[i][0] + radius);
@@ -1237,21 +1240,20 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx,
green = VB->ColorPtr->data[i][1];
blue = VB->ColorPtr->data[i][2];
- for (y=ymin;y<=ymax;y++) {
- for (x=xmin;x<=xmax;x++) {
+ for (y = ymin; y <= ymax; y++) {
+ for (x = xmin; x <= xmax; x++) {
GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
- GLfloat dist2 = dx*dx + dy*dy;
- if (dist2<rmax2) {
+ GLfloat dist2 = dx * dx + dy * dy;
+ if (dist2 < rmax2) {
alpha = VB->ColorPtr->data[i][3];
- if (dist2>=rmin2) {
- GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
+ if (dist2 >= rmin2) {
+ GLint coverage = (GLint) (256.0F - (dist2 - rmin2) * cscale);
/* coverage is in [0,256] */
alpha = (alpha * coverage) >> 8;
}
alpha = (GLint) (alpha * alphaf);
- PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha )
- ;
+ PB_WRITE_RGBA_PIXEL(PB, x, y, z, red, green, blue, alpha);
}
}
}