not before.
-/* $Id: s_aalinetemp.h,v 1.9 2001/05/10 17:41:41 brianp Exp $ */
+/* $Id: s_aalinetemp.h,v 1.10 2001/05/15 21:30:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLfloat coverage = compute_coveragef(line, ix, iy);
GLdepth z;
GLfloat fog;
+#ifdef DO_RGBA
GLchan red, green, blue, alpha;
- GLint frac, indx, index;
+#else
+ GLint index;
+#endif
GLchan specRed, specGreen, specBlue;
GLfloat tex[MAX_TEXTURE_UNITS][4], lambda[MAX_TEXTURE_UNITS];
red = solve_plane_chan(fx, fy, line->rPlane);
green = solve_plane_chan(fx, fy, line->gPlane);
blue = solve_plane_chan(fx, fy, line->bPlane);
- alpha = (GLchan) (solve_plane_chan(fx, fy, line->aPlane) * coverage);;
-#else
- (void) red;
- (void) green;
- (void) blue;
- (void) alpha;
+ alpha = solve_plane_chan(fx, fy, line->aPlane);
#endif
#ifdef DO_INDEX
- frac = (GLint) (15.0 * coverage);
- indx = (GLint) solve_plane(fx, fy, line->iPlane);
- index = (indx & ~0xf) | frac;
+ index = (GLint) solve_plane(fx, fy, line->iPlane);
#else
- (void) frac;
- (void) indx;
(void) index;
#endif
#ifdef DO_SPEC
#endif
+ PB_COVERAGE(pb, coverage);
+
#if defined(DO_MULTITEX)
#if defined(DO_SPEC)
PB_WRITE_MULTITEX_SPEC_PIXEL(pb, ix, iy, z, fog, red, green, blue, alpha,
PB_WRITE_CI_PIXEL(pb, ix, iy, z, fog, index);
#endif
+ pb->haveCoverage = GL_TRUE;
PB_CHECK_FLUSH(ctx, pb);
}
-/* $Id: s_aatritemp.h,v 1.14 2001/05/15 16:18:13 brianp Exp $ */
+/* $Id: s_aatritemp.h,v 1.15 2001/05/15 21:30:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
#ifdef DO_INDEX
GLfloat iPlane[4]; /* color index */
GLuint index[MAX_WIDTH];
+ GLint icoverageSpan[MAX_WIDTH];
+#else
+ GLfloat coverageSpan[MAX_WIDTH];
#endif
#ifdef DO_SPEC
GLfloat srPlane[4], sgPlane[4], sbPlane[4]; /* spec color */
while (coverage > 0.0F) {
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
+#ifdef DO_INDEX
+ icoverageSpan[count] = compute_coveragei(pMin, pMid, pMax, ix, iy);
+#else
+ coverageSpan[count] = coverage;
+#endif
#ifdef DO_Z
z[count] = (GLdepth) solve_plane(cx, cy, zPlane);
#endif
rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane);
rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane);
- rgba[count][ACOMP] = (GLchan) (solve_plane_chan(cx, cy, aPlane) * coverage);
+ rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane);
#endif
#ifdef DO_INDEX
- {
- GLint frac = compute_coveragei(pMin, pMid, pMax, ix, iy);
- GLint indx = (GLint) solve_plane(cx, cy, iPlane);
- index[count] = (indx & ~0xf) | frac;
- }
+ index[count] = (GLint) solve_plane(cx, cy, iPlane);
#endif
#ifdef DO_SPEC
spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
#ifdef DO_MULTITEX
# ifdef DO_SPEC
_mesa_write_multitexture_span(ctx, n, startX, iy, z, fog,
- (const GLfloat (*)[MAX_WIDTH]) s,
- (const GLfloat (*)[MAX_WIDTH]) t,
- (const GLfloat (*)[MAX_WIDTH]) u,
- (GLfloat (*)[MAX_WIDTH]) lambda,
- rgba, (const GLchan (*)[4]) spec,
- GL_POLYGON);
+ (const GLfloat (*)[MAX_WIDTH]) s,
+ (const GLfloat (*)[MAX_WIDTH]) t,
+ (const GLfloat (*)[MAX_WIDTH]) u,
+ (GLfloat (*)[MAX_WIDTH]) lambda,
+ rgba, (const GLchan (*)[4]) spec,
+ coverageSpan, GL_POLYGON);
# else
_mesa_write_multitexture_span(ctx, n, startX, iy, z, fog,
- (const GLfloat (*)[MAX_WIDTH]) s,
- (const GLfloat (*)[MAX_WIDTH]) t,
- (const GLfloat (*)[MAX_WIDTH]) u,
- lambda, rgba, NULL, GL_POLYGON);
+ (const GLfloat (*)[MAX_WIDTH]) s,
+ (const GLfloat (*)[MAX_WIDTH]) t,
+ (const GLfloat (*)[MAX_WIDTH]) u,
+ lambda, rgba, NULL, coverageSpan,
+ GL_POLYGON);
# endif
#elif defined(DO_TEX)
# ifdef DO_SPEC
_mesa_write_texture_span(ctx, n, startX, iy, z, fog,
- s, t, u, lambda, rgba,
- (const GLchan (*)[4]) spec, GL_POLYGON);
+ s, t, u, lambda, rgba,
+ (const GLchan (*)[4]) spec,
+ coverageSpan, GL_POLYGON);
# else
_mesa_write_texture_span(ctx, n, startX, iy, z, fog,
- s, t, u, lambda,
- rgba, NULL, GL_POLYGON);
+ s, t, u, lambda,
+ rgba, NULL, coverageSpan, GL_POLYGON);
# endif
#elif defined(DO_RGBA)
- _mesa_write_rgba_span(ctx, n, startX, iy, z, fog, rgba, GL_POLYGON);
+ _mesa_write_rgba_span(ctx, n, startX, iy, z, fog, rgba,
+ coverageSpan, GL_POLYGON);
#elif defined(DO_INDEX)
- _mesa_write_index_span(ctx, n, startX, iy, z, fog, index, GL_POLYGON);
+ _mesa_write_index_span(ctx, n, startX, iy, z, fog, index,
+ icoverageSpan, GL_POLYGON);
#endif
}
}
while (coverage > 0.0F) {
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
+#ifdef DO_INDEX
+ icoverageSpan[ix] = compute_coveragei(pMin, pMid, pMax, ix, iy);
+#else
+ coverageSpan[ix] = coverage;
+#endif
#ifdef DO_Z
z[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
#endif
rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane);
rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane);
- rgba[ix][ACOMP] = (GLchan) (solve_plane_chan(cx, cy, aPlane) * coverage);
+ rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane);
#endif
#ifdef DO_INDEX
- {
- GLint frac = compute_coveragei(pMin, pMax, pMid, ix, iy);
- GLint indx = (GLint) solve_plane(cx, cy, iPlane);
- index[ix] = (indx & ~0xf) | frac;
- }
+ index[ix] = (GLint) solve_plane(cx, cy, iPlane);
#endif
#ifdef DO_SPEC
spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
}
# ifdef DO_SPEC
_mesa_write_multitexture_span(ctx, n, left, iy, z + left, fog + left,
- (const GLfloat (*)[MAX_WIDTH]) s,
- (const GLfloat (*)[MAX_WIDTH]) t,
- (const GLfloat (*)[MAX_WIDTH]) u,
- lambda, rgba + left,
- (const GLchan (*)[4]) (spec + left),
- GL_POLYGON);
+ (const GLfloat (*)[MAX_WIDTH]) s,
+ (const GLfloat (*)[MAX_WIDTH]) t,
+ (const GLfloat (*)[MAX_WIDTH]) u,
+ lambda, rgba + left,
+ (const GLchan (*)[4]) (spec + left),
+ coverageSpan + left,
+ GL_POLYGON);
# else
_mesa_write_multitexture_span(ctx, n, left, iy, z + left, fog + left,
- (const GLfloat (*)[MAX_WIDTH]) s,
- (const GLfloat (*)[MAX_WIDTH]) t,
- (const GLfloat (*)[MAX_WIDTH]) u,
- lambda,
- rgba + left, NULL, GL_POLYGON);
+ (const GLfloat (*)[MAX_WIDTH]) s,
+ (const GLfloat (*)[MAX_WIDTH]) t,
+ (const GLfloat (*)[MAX_WIDTH]) u,
+ lambda,
+ rgba + left, NULL, coverageSpan + left,
+ GL_POLYGON);
# endif
#elif defined(DO_TEX)
# ifdef DO_SPEC
_mesa_write_texture_span(ctx, n, left, iy, z + left, fog + left,
- s + left, t + left, u + left,
- lambda + left, rgba + left,
- (const GLchan (*)[4]) (spec + left),
- GL_POLYGON);
+ s + left, t + left, u + left,
+ lambda + left, rgba + left,
+ (const GLchan (*)[4]) (spec + left),
+ coverageSpan + left,
+ GL_POLYGON);
# else
_mesa_write_texture_span(ctx, n, left, iy, z + left, fog + left,
- s + left, t + left,
- u + left, lambda + left,
- rgba + left, NULL, GL_POLYGON);
+ s + left, t + left,
+ u + left, lambda + left,
+ rgba + left, NULL,
+ coverageSpan + left, GL_POLYGON);
# endif
#elif defined(DO_RGBA)
_mesa_write_rgba_span(ctx, n, left, iy, z + left, fog + left,
- rgba + left, GL_POLYGON);
+ rgba + left, coverageSpan + left, GL_POLYGON);
#elif defined(DO_INDEX)
_mesa_write_index_span(ctx, n, left, iy, z + left, fog + left,
- index + left, GL_POLYGON);
+ index + left, icoverageSpan + left, GL_POLYGON);
#endif
}
}
-/* $Id: s_copypix.c,v 1.16 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: s_copypix.c,v 1.17 2001/05/15 21:30:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
(const GLchan (*)[4])rgba, desty);
}
else {
- _mesa_write_rgba_span( ctx, width, destx, dy, zspan, 0, rgba, GL_BITMAP );
+ _mesa_write_rgba_span( ctx, width, destx, dy, zspan, 0, rgba,
+ NULL, GL_BITMAP );
}
}
(const GLchan (*)[4])rgba, desty);
}
else {
- _mesa_write_rgba_span( ctx, width, destx, dy, zspan, 0, rgba, GL_BITMAP );
+ _mesa_write_rgba_span( ctx, width, destx, dy, zspan, 0, rgba,
+ NULL, GL_BITMAP );
}
}
}
if (zoom) {
- _mesa_write_zoomed_index_span( ctx, width, destx, dy, zspan, 0, indexes, desty );
+ _mesa_write_zoomed_index_span(ctx, width, destx, dy, zspan, 0,
+ indexes, desty );
}
else {
- _mesa_write_index_span(ctx, width, destx, dy, zspan, 0, indexes, GL_BITMAP);
+ _mesa_write_index_span(ctx, width, destx, dy, zspan, 0, indexes,
+ NULL, GL_BITMAP);
}
}
}
else {
_mesa_write_rgba_span( ctx, width, destx, dy, zspan, 0,
- rgba, GL_BITMAP);
+ rgba, NULL, GL_BITMAP);
}
}
else {
if (zoom) {
_mesa_write_zoomed_index_span( ctx, width, destx, dy,
- zspan, 0, indexes, desty );
+ zspan, 0, indexes, desty );
}
else {
_mesa_write_index_span( ctx, width, destx, dy,
- zspan, 0, indexes, GL_BITMAP );
+ zspan, 0, indexes, NULL, GL_BITMAP );
}
}
}
-/* $Id: s_drawpix.c,v 1.17 2001/04/20 19:21:41 brianp Exp $ */
+/* $Id: s_drawpix.c,v 1.18 2001/05/15 21:30:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
type, source, &ctx->Unpack,
ctx->_ImageTransferState);
if (zoom) {
- _mesa_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, 0, indexes, desty);
+ _mesa_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, 0,
+ indexes, desty);
}
else {
- _mesa_write_index_span(ctx, drawWidth, x, y, zspan, 0, indexes, GL_BITMAP);
+ _mesa_write_index_span(ctx, drawWidth, x, y, zspan, 0, indexes,
+ NULL, GL_BITMAP);
}
}
}
GLint i;
for (i = 0; i < width; i++)
zspan[i] = zptr[i];
- _mesa_write_rgba_span( ctx, width, x, y, zspan, 0, rgba, GL_BITMAP );
+ _mesa_write_rgba_span(ctx, width, x, y, zspan, 0, rgba,
+ NULL, GL_BITMAP);
}
}
else if (type==GL_UNSIGNED_INT && ctx->Visual.depthBits == 32
const GLuint *zptr = (const GLuint *)
_mesa_image_address(&ctx->Unpack, pixels, width, height,
GL_DEPTH_COMPONENT, type, 0, row, 0);
- _mesa_write_rgba_span( ctx, width, x, y, zptr, 0, rgba, GL_BITMAP );
+ _mesa_write_rgba_span(ctx, width, x, y, zptr, 0, rgba,
+ NULL, GL_BITMAP);
}
}
else {
if (ctx->Visual.rgbMode) {
if (zoom) {
_mesa_write_zoomed_rgba_span(ctx, width, x, y, zspan, 0,
- (const GLchan (*)[4]) rgba, desty);
+ (const GLchan (*)[4]) rgba, desty);
}
else {
- _mesa_write_rgba_span(ctx, width, x, y, zspan, 0, rgba, GL_BITMAP);
+ _mesa_write_rgba_span(ctx, width, x, y, zspan, 0,
+ rgba, NULL, GL_BITMAP);
}
}
else {
if (zoom) {
_mesa_write_zoomed_index_span(ctx, width, x, y, zspan, 0,
- ispan, GL_BITMAP);
+ ispan, GL_BITMAP);
}
else {
_mesa_write_index_span(ctx, width, x, y, zspan, 0,
- ispan, GL_BITMAP);
+ ispan, NULL, GL_BITMAP);
}
}
}
if (quickDraw) {
- (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y,
- (CONST GLchan (*)[4]) rgba, NULL);
+ (*swrast->Driver.WriteRGBASpan)(ctx, width, x, y,
+ (CONST GLchan (*)[4]) rgba, NULL);
}
else if (zoom) {
- _mesa_write_zoomed_rgba_span( ctx, width, x, y, zspan, 0,
- (CONST GLchan (*)[4]) rgba, desty );
+ _mesa_write_zoomed_rgba_span(ctx, width, x, y, zspan, 0,
+ (CONST GLchan (*)[4]) rgba, desty);
}
else {
- _mesa_write_rgba_span( ctx, (GLuint) width, x, y, zspan, 0,
- rgba, GL_BITMAP);
+ _mesa_write_rgba_span(ctx, (GLuint) width, x, y, zspan, 0,
+ rgba, NULL, GL_BITMAP);
}
}
}
-/* $Id: s_pointtemp.h,v 1.6 2001/05/09 17:31:46 brianp Exp $ */
+/* $Id: s_pointtemp.h,v 1.7 2001/05/15 21:30:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLfloat rmax = radius + 0.7071F;
const GLfloat rmin2 = MAX2(0.0, rmin * rmin);
const GLfloat rmax2 = rmax * rmax;
- const GLfloat cscale = 256.0F / (rmax2 - rmin2);
+ const GLfloat cscale = 1.0F / (rmax2 - rmin2);
const GLint xmin = (GLint) (vert->win[0] - radius);
const GLint xmax = (GLint) (vert->win[0] + radius);
const GLint ymin = (GLint) (vert->win[1] - radius);
alpha = vert->color[3];
#endif
if (dist2 >= rmin2) {
- GLint coverage = (GLint) (256.0F - (dist2 - rmin2) * cscale);
-#if FLAGS & RGBA
- /* coverage is in [0,256] */
- alpha = (alpha * coverage) >> 8;
-#else
- /* 4 fractional index bits */
- index = (index & ~0xf) | (coverage >> 4); /* XXX verify */
-#endif
+ /* compute partial coverage */
+ PB_COVERAGE(PB, 1.0F - (dist2 - rmin2) * cscale);
}
+ else {
+ /* full coverage */
+ PB_COVERAGE(PB, 1.0F);
+ }
+
#endif /* SMOOTH */
#if ((FLAGS & (ATTENUATE | RGBA)) == (ATTENUATE | RGBA))
#endif
}
}
+
+#if FLAGS & SMOOTH
+ PB->haveCoverage = GL_TRUE;
+#endif
+
PB_CHECK_FLUSH(ctx,PB);
}
-/* $Id: s_span.c,v 1.13 2001/05/03 22:13:32 brianp Exp $ */
+/* $Id: s_span.c,v 1.14 2001/05/15 21:30:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
-
/*
* Apply the current polygon stipple pattern to a span of pixels.
*/
-static void stipple_polygon_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLubyte mask[] )
+static void
+stipple_polygon_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ GLubyte mask[] )
{
const GLuint highbit = 0x80000000;
GLuint i, m, stipple;
* as a special case:
* 0 = all pixels clipped
*/
-static GLuint clip_span( GLcontext *ctx,
- GLint n, GLint x, GLint y, GLubyte mask[] )
+static GLuint
+clip_span( GLcontext *ctx, GLint n, GLint x, GLint y, GLubyte mask[] )
{
/* Clip to top and bottom */
if (y < 0 || y >= ctx->DrawBuffer->Height) {
/*
* Draw to more than one color buffer (or none).
*/
-static void multi_write_index_span( GLcontext *ctx, GLuint n,
- GLint x, GLint y, const GLuint indexes[],
- const GLubyte mask[] )
+static void
+multi_write_index_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLuint indexes[], const GLubyte mask[] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint bufferBit;
* index - array of [n] color indexes
* primitive - either GL_POINT, GL_LINE, GL_POLYGON, or GL_BITMAP
*/
-void _mesa_write_index_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfloat fog[],
- GLuint indexIn[], GLenum primitive )
+void
+_mesa_write_index_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ GLuint indexIn[], const GLint coverage[],
+ GLenum primitive )
{
const GLuint modBits = FOG_BIT | BLEND_BIT | MASKING_BIT | LOGIC_OP_BIT;
GLubyte mask[MAX_WIDTH];
_mesa_depth_fog_ci_pixels( ctx, n, z, index );
}
+ /* Antialias coverage application */
+ if (coverage) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ ASSERT(coverage[i] < 16);
+ index[i] = (index[i] & ~0xf) | coverage[i];
+ }
+ }
+
if (swrast->_RasterMask & MULTI_DRAW_BIT) {
/* draw to zero or two or more buffers */
multi_write_index_span( ctx, n, x, y, index, mask );
-void _mesa_write_monoindex_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth z[],
- const GLfloat fog[],
- GLuint index, GLenum primitive )
+void
+_mesa_write_monoindex_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ GLuint index, const GLint coverage[],
+ GLenum primitive )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLubyte mask[MAX_WIDTH];
if (ctx->Fog.Enabled
|| ctx->Color.IndexLogicOpEnabled
- || ctx->Color.IndexMask != 0xffffffff) {
+ || ctx->Color.IndexMask != 0xffffffff
+ || coverage) {
/* different index per pixel */
GLuint indexes[MAX_WIDTH];
for (i = 0; i < n; i++) {
_mesa_depth_fog_ci_pixels( ctx, n, z, indexes );
}
+ /* Antialias coverage application */
+ if (coverage) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ ASSERT(coverage[i] < 16);
+ indexes[i] = (indexes[i] & ~0xf) | coverage[i];
+ }
+ }
+
if (swrast->_RasterMask & MULTI_DRAW_BIT) {
/* draw to zero or two or more buffers */
multi_write_index_span( ctx, n, x, y, indexes, mask );
/*
* Draw to more than one RGBA color buffer (or none).
*/
-static void multi_write_rgba_span( GLcontext *ctx, GLuint n,
- GLint x, GLint y, CONST GLchan rgba[][4],
- const GLubyte mask[] )
+static void
+multi_write_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ CONST GLchan rgba[][4], const GLubyte mask[] )
{
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask);
GLuint bufferBit;
-void _mesa_write_rgba_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfloat *fog,
- GLchan rgbaIn[][4],
- GLenum primitive )
+void
+_mesa_write_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ GLchan rgbaIn[][4], const GLfloat coverage[],
+ GLenum primitive )
{
const GLuint modBits = FOG_BIT | BLEND_BIT | MASKING_BIT |
LOGIC_OP_BIT | TEXTURE_BIT;
_mesa_depth_fog_rgba_pixels( ctx, n, z, rgba );
}
+ /* Antialias coverage application */
+ if (coverage) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]);
+ }
+ }
+
if (swrast->_RasterMask & MULTI_DRAW_BIT) {
multi_write_rgba_span( ctx, n, x, y, (const GLchan (*)[4]) rgba, mask );
}
* r, g, b, a - the color of the pixels
* primitive - either GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP.
*/
-void _mesa_write_monocolor_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfloat fog[],
- const GLchan color[4],
- GLenum primitive )
+void
+_mesa_write_monocolor_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ const GLchan color[4], const GLfloat coverage[],
+ GLenum primitive )
{
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask);
GLuint i;
}
if (ctx->Color.ColorLogicOpEnabled || colorMask != 0xffffffff ||
- (swrast->_RasterMask & (BLEND_BIT | FOG_BIT))) {
+ (swrast->_RasterMask & (BLEND_BIT | FOG_BIT)) || coverage) {
/* assign same color to each pixel */
for (i = 0; i < n; i++) {
if (mask[i]) {
_mesa_depth_fog_rgba_pixels( ctx, n, z, rgba );
}
+ /* Antialias coverage application */
+ if (coverage) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]);
+ }
+ }
+
if (swrast->_RasterMask & MULTI_DRAW_BIT) {
multi_write_rgba_span( ctx, n, x, y,
(const GLchan (*)[4]) rgba, mask );
* Add specular color to base color. This is used only when
* GL_LIGHT_MODEL_COLOR_CONTROL = GL_SEPARATE_SPECULAR_COLOR.
*/
-static void add_colors(GLuint n, GLchan rgba[][4], CONST GLchan specular[][4] )
+static void
+add_colors(GLuint n, GLchan rgba[][4], CONST GLchan specular[][4] )
{
GLuint i;
for (i = 0; i < n; i++) {
* rgba - array of [n] color components
* primitive - either GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP.
*/
-void _mesa_write_texture_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfloat fog[],
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], GLfloat lambda[],
- GLchan rgbaIn[][4], CONST GLchan spec[][4],
- GLenum primitive )
+void
+_mesa_write_texture_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], GLfloat lambda[],
+ GLchan rgbaIn[][4], CONST GLchan spec[][4],
+ const GLfloat coverage[], GLenum primitive )
{
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask);
GLubyte mask[MAX_WIDTH];
/* Add base and specular colors */
if (spec &&
(ctx->Fog.ColorSumEnabled ||
- (ctx->Light.Enabled && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)))
- add_colors( n, rgba, spec ); /* rgba = rgba + spec */
+ (ctx->Light.Enabled &&
+ ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)))
+ add_colors( n, rgba, spec ); /* rgba = rgba + spec */
/* Per-pixel fog */
if (ctx->Fog.Enabled) {
_mesa_depth_fog_rgba_pixels( ctx, n, z, rgba );
}
+ /* Antialias coverage application */
+ if (coverage) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]);
+ }
+ }
+
if (swrast->_RasterMask & MULTI_DRAW_BIT) {
multi_write_rgba_span( ctx, n, x, y, (const GLchan (*)[4]) rgba, mask );
}
* As above but perform multiple stages of texture application.
*/
void
-_mesa_write_multitexture_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth z[],
- const GLfloat fog[],
- CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
- CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
- CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH],
- GLfloat lambda[][MAX_WIDTH],
- GLchan rgbaIn[MAX_TEXTURE_UNITS][4],
- CONST GLchan spec[MAX_TEXTURE_UNITS][4],
- GLenum primitive )
+_mesa_write_multitexture_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
+ CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
+ CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH],
+ GLfloat lambda[][MAX_WIDTH],
+ GLchan rgbaIn[MAX_TEXTURE_UNITS][4],
+ CONST GLchan spec[MAX_TEXTURE_UNITS][4],
+ const GLfloat coverage[],
+ GLenum primitive )
{
GLubyte mask[MAX_WIDTH];
GLboolean write_all = GL_TRUE;
_mesa_depth_fog_rgba_pixels( ctx, n, z, rgba );
}
+ /* Antialias coverage application */
+ if (coverage) {
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]);
+ }
+ }
+
if (swrast->_RasterMask & MULTI_DRAW_BIT) {
multi_write_rgba_span( ctx, n, x, y, (const GLchan (*)[4]) rgba, mask );
}
* Read RGBA pixels from frame buffer. Clipping will be done to prevent
* reading ouside the buffer's boundaries.
*/
-void _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
- GLuint n, GLint x, GLint y,
- GLchan rgba[][4] )
+void
+_mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
+ GLuint n, GLint x, GLint y, GLchan rgba[][4] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= buffer->Height
* Read CI pixels from frame buffer. Clipping will be done to prevent
* reading ouside the buffer's boundaries.
*/
-void _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
- GLuint n, GLint x, GLint y, GLuint indx[] )
+void
+_mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
+ GLuint n, GLint x, GLint y, GLuint indx[] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= buffer->Height
-/* $Id: s_span.h,v 1.5 2001/05/03 22:13:32 brianp Exp $ */
+/* $Id: s_span.h,v 1.6 2001/05/15 21:30:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
*/
-
-
-
#ifndef S_SPAN_H
#define S_SPAN_H
#include "swrast.h"
-extern void _mesa_write_index_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfloat fog[],
- GLuint index[], GLenum primitive );
+extern void
+_mesa_write_index_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ GLuint index[], const GLint coverage[],
+ GLenum primitive );
-extern void _mesa_write_monoindex_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth z[],
- const GLfloat fog[],
- GLuint index, GLenum primitive );
+extern void
+_mesa_write_monoindex_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ GLuint index, const GLint coverage[],
+ GLenum primitive );
-extern void _mesa_write_rgba_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y, const GLdepth z[],
- const GLfloat fog[],
- GLchan rgba[][4], GLenum primitive );
+extern void
+_mesa_write_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ GLchan rgba[][4], const GLfloat coverage[],
+ GLenum primitive );
-extern void _mesa_write_monocolor_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth z[],
- const GLfloat fog[],
- const GLchan color[4],
- GLenum primitive );
+extern void
+_mesa_write_monocolor_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ const GLchan color[4], const GLfloat coverage[],
+ GLenum primitive );
-extern void _mesa_write_texture_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth z[],
- const GLfloat fog[],
- const GLfloat s[], const GLfloat t[],
- const GLfloat u[], GLfloat lambda[],
- GLchan rgba[][4], CONST GLchan spec[][4],
- GLenum primitive );
+extern void
+_mesa_write_texture_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ const GLfloat s[], const GLfloat t[],
+ const GLfloat u[], GLfloat lambda[],
+ GLchan rgba[][4], CONST GLchan spec[][4],
+ const GLfloat coverage[], GLenum primitive );
extern void
-_mesa_write_multitexture_span( GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth z[],
- const GLfloat fog[],
- CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
- CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
- CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH],
- GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH],
- GLchan rgba[][4],
- CONST GLchan spec[][4],
- GLenum primitive );
+_mesa_write_multitexture_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth z[], const GLfloat fog[],
+ CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
+ CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
+ CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH],
+ GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH],
+ GLchan rgba[][4], CONST GLchan spec[][4],
+ const GLfloat coverage[], GLenum primitive );
-extern void _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
- GLuint n, GLint x, GLint y,
- GLchan rgba[][4] );
+extern void
+_mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
+ GLuint n, GLint x, GLint y, GLchan rgba[][4] );
-extern void _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
- GLuint n, GLint x, GLint y, GLuint indx[] );
+extern void
+_mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
+ GLuint n, GLint x, GLint y, GLuint indx[] );
#endif
-/* $Id: s_triangle.c,v 1.26 2001/05/14 16:23:04 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.27 2001/05/15 21:30:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
span.fog += span.fogStep; \
} \
_mesa_write_monoindex_span(ctx, span.count, span.x, span.y, \
- zSpan, fogSpan, v0->index, GL_POLYGON );
+ zSpan, fogSpan, v0->index, NULL, GL_POLYGON );
#include "s_tritemp.h"
}
span.fog += span.fogStep; \
} \
_mesa_write_index_span(ctx, span.count, span.x, span.y, \
- zSpan, fogSpan, indexSpan, GL_POLYGON);
+ zSpan, fogSpan, indexSpan, NULL, GL_POLYGON);
#include "s_tritemp.h"
}
fogSpan[i] = span.fog; \
span.fog += span.fogStep; \
} \
- _mesa_write_monocolor_span(ctx, span.count, span.x, span.y, \
- zSpan, fogSpan, v2->color, GL_POLYGON );
+ _mesa_write_monocolor_span(ctx, span.count, span.x, span.y, zSpan, \
+ fogSpan, v2->color, NULL, GL_POLYGON );
#include "s_tritemp.h"
} \
_mesa_write_rgba_span(ctx, span.count, span.x, span.y, \
(CONST GLdepth *) zSpan, \
- fogSpan, rgbaSpan, GL_POLYGON);
+ fogSpan, rgbaSpan, NULL, GL_POLYGON);
#include "s_tritemp.h"
break;
}
_mesa_write_rgba_span(ctx, span->count, span->x, span->y,
- zspan, fogspan, rgba, GL_POLYGON);
+ zspan, fogspan, rgba, NULL, GL_POLYGON);
#undef SPAN1
#undef SPAN2
} \
} \
_mesa_write_rgba_span( ctx, n, LEFT, Y, zspan, \
- fogspan, rgba, GL_POLYGON); \
- span.red = span.green = span.blue = span.alpha = 0; \
+ fogspan, rgba, NULL, GL_POLYGON); \
+ span.red = span.green = span.blue = span.alpha = 0; \
} \
} \
abort(); \
} \
} \
- _mesa_write_rgba_span( ctx, n, LEFT, Y, zspan, \
- fogspan, \
- rgba, GL_POLYGON ); \
+ _mesa_write_rgba_span(ctx, n, LEFT, Y, zspan, \
+ fogspan, rgba, NULL, \
+ GL_POLYGON); \
} \
}
(const GLfloat (*)[MAX_WIDTH]) mrTex,
(GLfloat (*)[MAX_WIDTH]) mLambda,
rgba, (CONST GLchan (*)[4]) spec,
- GL_POLYGON );
+ NULL, GL_POLYGON );
}
else {
_mesa_write_multitexture_span(ctx, span->count, span->x, span->y,
(const GLfloat (*)[MAX_WIDTH]) mtTex,
(const GLfloat (*)[MAX_WIDTH]) mrTex,
(GLfloat (*)[MAX_WIDTH]) mLambda,
- rgba, NULL, GL_POLYGON);
+ rgba, NULL, NULL, GL_POLYGON);
}
}
else {
_mesa_write_texture_span(ctx, span->count, span->x, span->y,
z, fogPtr, sTex, tTex, rTex, lambda,
rgba, (CONST GLchan (*)[4]) spec,
- GL_POLYGON);
+ NULL, GL_POLYGON);
}
else {
_mesa_write_texture_span(ctx, span->count, span->x, span->y,
z, fogPtr, sTex, tTex, rTex, lambda,
- rgba, NULL, GL_POLYGON);
+ rgba, NULL, NULL, GL_POLYGON);
}
}
}
} \
_mesa_write_texture_span(ctx, span.count, span.x, span.y, \
zSpan, fogSpan, sSpan, tSpan, uSpan, \
- NULL, rgbaSpan, NULL, GL_POLYGON );
+ NULL, rgbaSpan, NULL, NULL, GL_POLYGON );
#include "s_tritemp.h"
}
-/* $Id: s_zoom.c,v 1.5 2001/05/03 22:13:32 brianp Exp $ */
+/* $Id: s_zoom.c,v 1.6 2001/05/15 21:30:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* write the span */
for (r=r0; r<r1; r++) {
_mesa_write_rgba_span( ctx, m, x+skipcol, r, zdepth,
- (fog ? zfog : 0),
- zrgba, GL_BITMAP );
+ (fog ? zfog : 0), zrgba, NULL, GL_BITMAP );
}
}
/* write the span */
for (r=r0; r<r1; r++) {
_mesa_write_rgba_span( ctx, m, x+skipcol, r, zdepth,
- (fog ? zfog : 0), zrgba, GL_BITMAP );
+ (fog ? zfog : 0), zrgba, NULL, GL_BITMAP );
}
}
/* write the span */
for (r=r0; r<r1; r++) {
_mesa_write_index_span( ctx, m, x+skipcol, r, zdepth,
- (fog ? zfog : 0), zindexes, GL_BITMAP );
+ (fog ? zfog : 0), zindexes, NULL, GL_BITMAP );
}
}