diff options
Diffstat (limited to 'src/mesa/swrast/s_pointtemp.h')
-rw-r--r-- | src/mesa/swrast/s_pointtemp.h | 67 |
1 files changed, 42 insertions, 25 deletions
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h index b0c110f3007..4ce261009c0 100644 --- a/src/mesa/swrast/s_pointtemp.h +++ b/src/mesa/swrast/s_pointtemp.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.3 + * Version: 6.5 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2005 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"), @@ -153,28 +153,44 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) span->arrayMask |= SPAN_TEXTURE; #endif + /* Compute point size if not known to be one */ #if FLAGS & ATTENUATE - if (vert->pointSize >= ctx->Point.Threshold) { - size = MIN2(vert->pointSize, ctx->Point.MaxSize); + /* first, clamp attenuated size to the user-specifed range */ + size = CLAMP(vert->pointSize, ctx->Point.MinSize, ctx->Point.MaxSize); #if (FLAGS & RGBA) && (FLAGS & SMOOTH) - alphaAtten = 1.0F; -#endif + /* only if multisampling, compute the fade factor */ + if (ctx->Multisample.Enabled) { + if (vert->pointSize >= ctx->Point.Threshold) { + alphaAtten = 1.0F; + } + else { + GLfloat dsize = vert->pointSize / ctx->Point.Threshold; + alphaAtten = dsize * dsize; + } } else { -#if (FLAGS & RGBA) && (FLAGS & SMOOTH) - GLfloat dsize = vert->pointSize / ctx->Point.Threshold; - alphaAtten = dsize * dsize; -#endif - size = MAX2(ctx->Point.Threshold, ctx->Point.MinSize); + alphaAtten = 1.0; } +#endif #elif FLAGS & (LARGE | SMOOTH | SPRITE) - size = ctx->Point._Size; + /* constant, non-attenuated size */ + size = ctx->Point._Size; /* this is already clamped */ #endif + #if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) - /* - * Multi-pixel points - */ + /*** + *** Multi-pixel points + ***/ + + /* do final clamping now */ + if (ctx->Point.SmoothFlag) { + size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA); + } + else { + size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); + } + {{ GLint x, y; const GLfloat radius = 0.5F * size; @@ -312,20 +328,21 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) if (ctx->Texture.Unit[u]._ReallyEnabled) { if (ctx->Point.CoordReplace[u]) { GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size; - GLfloat t; + GLfloat t, r; if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) t = 0.5F + (y + 0.5F - vert->win[1]) / size; else /* GL_UPPER_LEFT */ t = 0.5F - (y + 0.5F - vert->win[1]) / size; - span->array->texcoords[u][count][0] = s; - span->array->texcoords[u][count][1] = t; - span->array->texcoords[u][count][3] = 1.0F; if (ctx->Point.SpriteRMode == GL_ZERO) - span->array->texcoords[u][count][2] = 0.0F; + r = 0.0F; else if (ctx->Point.SpriteRMode == GL_S) - span->array->texcoords[u][count][2] = vert->texcoord[u][0]; + r = vert->texcoord[u][0]; else /* GL_R */ - span->array->texcoords[u][count][2] = vert->texcoord[u][2]; + r = vert->texcoord[u][2]; + span->array->texcoords[u][count][0] = s; + span->array->texcoords[u][count][1] = t; + span->array->texcoords[u][count][2] = r; + span->array->texcoords[u][count][3] = 1.0F; } else { COPY_4V(span->array->texcoords[u][count], vert->texcoord[u]); @@ -345,9 +362,9 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) #else /* LARGE | ATTENUATE | SMOOTH | SPRITE */ - /* - * Single-pixel points - */ + /*** + *** Single-pixel points + ***/ {{ GLuint count; |