-/* $Id: s_aalinetemp.h,v 1.16 2002/02/02 17:24:11 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 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"),
return;
line->span.end++;
- line->span.coverage[i] = coverage;
- line->span.xArray[i] = ix;
- line->span.yArray[i] = iy;
+ line->span.array->coverage[i] = coverage;
+ line->span.array->x[i] = ix;
+ line->span.array->y[i] = iy;
/*
* Compute Z, color, texture coords, fog for the fragment by
* solving the plane equations at (ix,iy).
*/
#ifdef DO_Z
- line->span.zArray[i] = (GLdepth) solve_plane(fx, fy, line->zPlane);
+ line->span.array->z[i] = (GLdepth) IROUND(solve_plane(fx, fy, line->zPlane));
#endif
#ifdef DO_FOG
- line->span.fogArray[i] = solve_plane(fx, fy, line->fPlane);
+ line->span.array->fog[i] = solve_plane(fx, fy, line->fPlane);
#endif
#ifdef DO_RGBA
- line->span.color.rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane);
- line->span.color.rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane);
- line->span.color.rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane);
- line->span.color.rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane);
+ line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane);
+ line->span.array->rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane);
+ line->span.array->rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane);
+ line->span.array->rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane);
#endif
#ifdef DO_INDEX
- line->span.color.index[i] = (GLint) solve_plane(fx, fy, line->iPlane);
+ line->span.array->index[i] = (GLint) solve_plane(fx, fy, line->iPlane);
#endif
#ifdef DO_SPEC
- line->span.specArray[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane);
- line->span.specArray[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane);
- line->span.specArray[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane);
+ line->span.array->spec[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane);
+ line->span.array->spec[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane);
+ line->span.array->spec[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane);
#endif
#ifdef DO_TEX
{
const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[0]);
- line->span.texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ;
- line->span.texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ;
- line->span.texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ;
- line->span.lambda[0][i] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ,
+ line->span.array->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ;
+ line->span.array->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ;
+ line->span.array->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ;
+ line->span.array->lambda[0][i] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ,
line->texWidth[0], line->texHeight[0]);
}
#elif defined(DO_MULTITEX)
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[unit]);
- line->span.texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ;
- line->span.texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ;
- line->span.texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ;
- line->span.lambda[unit][i] = compute_lambda(line->sPlane[unit],
+ line->span.array->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ;
+ line->span.array->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ;
+ line->span.array->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ;
+ line->span.array->lambda[unit][i] = compute_lambda(line->sPlane[unit],
line->tPlane[unit], invQ,
line->texWidth[unit], line->texHeight[unit]);
}
#endif
if (line->span.end == MAX_WIDTH) {
-#ifdef DO_TEX
- _mesa_write_texture_span(ctx, &line->span, GL_LINE);
+#if defined(DO_TEX) || defined(DO_MULTITEX)
+ _swrast_write_texture_span(ctx, &(line->span));
#elif defined(DO_RGBA)
- _mesa_write_rgba_span(ctx, &line->span, GL_LINE);
+ _swrast_write_rgba_span(ctx, &(line->span));
#else
- _mesa_write_index_span(ctx, &line->span, GL_LINE);
+ _swrast_write_index_span(ctx, &(line->span));
#endif
+ line->span.end = 0; /* reset counter */
}
}
line.y1 = v1->win[1];
line.dx = line.x1 - line.x0;
line.dy = line.y1 - line.y0;
- line.len = (GLfloat) sqrt(line.dx * line.dx + line.dy * line.dy);
+ line.len = SQRTF(line.dx * line.dx + line.dy * line.dy);
line.halfWidth = 0.5F * ctx->Line.Width;
if (line.len == 0.0 || IS_INF_OR_NAN(line.len))
return;
- INIT_SPAN(line.span);
- line.span.arrayMask |= (SPAN_XY | SPAN_COVERAGE);
+ INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE);
line.xAdj = line.dx / line.len * line.halfWidth;
line.yAdj = line.dy / line.len * line.halfWidth;
#ifdef DO_TEX
{
const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current;
- const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel];
+ const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel];
const GLfloat invW0 = v0->win[3];
const GLfloat invW1 = v1->win[3];
const GLfloat s0 = v0->texcoord[0][0] * invW0;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
- const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel];
+ const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel];
const GLfloat invW0 = v0->win[3];
const GLfloat invW1 = v1->win[3];
const GLfloat s0 = v0->texcoord[u][0] * invW0;
segment(ctx, &line, NAME(plot), 0.0, 1.0);
}
-#ifdef DO_TEX
- _mesa_write_texture_span(ctx, &line.span, GL_LINE);
+#if defined(DO_TEX) || defined(DO_MULTITEX)
+ _swrast_write_texture_span(ctx, &(line.span));
#elif defined(DO_RGBA)
- _mesa_write_rgba_span(ctx, &line.span, GL_LINE);
+ _swrast_write_rgba_span(ctx, &(line.span));
#else
- _mesa_write_index_span(ctx, &line.span, GL_LINE);
+ _swrast_write_index_span(ctx, &(line.span));
#endif
}