Home | Info | Community | Development | myReactOS | Contact Us
[static]
Definition at line 119 of file s_aalinetemp.h.
{ SWcontext *swrast = SWRAST_CONTEXT(ctx); GLfloat tStart, tEnd; /* segment start, end along line length */ GLboolean inSegment; GLint iLen, i; /* Init the LineInfo struct */ struct LineInfo line; line.x0 = v0->attrib[FRAG_ATTRIB_WPOS][0]; line.y0 = v0->attrib[FRAG_ATTRIB_WPOS][1]; line.x1 = v1->attrib[FRAG_ATTRIB_WPOS][0]; line.y1 = v1->attrib[FRAG_ATTRIB_WPOS][1]; line.dx = line.x1 - line.x0; line.dy = line.y1 - line.y0; line.len = SQRTF(line.dx * line.dx + line.dy * line.dy); line.halfWidth = 0.5F * CLAMP(ctx->Line.Width, ctx->Const.MinLineWidthAA, ctx->Const.MaxLineWidthAA); if (line.len == 0.0 || IS_INF_OR_NAN(line.len)) return; INIT_SPAN(line.span, GL_LINE); line.span.arrayMask = SPAN_XY | SPAN_COVERAGE; line.span.facing = swrast->PointLineFacing; line.xAdj = line.dx / line.len * line.halfWidth; line.yAdj = line.dy / line.len * line.halfWidth; #ifdef DO_Z line.span.arrayMask |= SPAN_Z; compute_plane(line.x0, line.y0, line.x1, line.y1, v0->attrib[FRAG_ATTRIB_WPOS][2], v1->attrib[FRAG_ATTRIB_WPOS][2], line.zPlane); #endif #ifdef DO_RGBA line.span.arrayMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, v0->color[RCOMP], v1->color[RCOMP], line.rPlane); compute_plane(line.x0, line.y0, line.x1, line.y1, v0->color[GCOMP], v1->color[GCOMP], line.gPlane); compute_plane(line.x0, line.y0, line.x1, line.y1, v0->color[BCOMP], v1->color[BCOMP], line.bPlane); compute_plane(line.x0, line.y0, line.x1, line.y1, v0->color[ACOMP], v1->color[ACOMP], line.aPlane); } else { constant_plane(v1->color[RCOMP], line.rPlane); constant_plane(v1->color[GCOMP], line.gPlane); constant_plane(v1->color[BCOMP], line.bPlane); constant_plane(v1->color[ACOMP], line.aPlane); } #endif #ifdef DO_INDEX line.span.arrayMask |= SPAN_INDEX; if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, v0->attrib[FRAG_ATTRIB_CI][0], v1->attrib[FRAG_ATTRIB_CI][0], line.iPlane); } else { constant_plane(v1->attrib[FRAG_ATTRIB_CI][0], line.iPlane); } #endif #if defined(DO_ATTRIBS) { const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3]; const GLfloat invW1 = v1->attrib[FRAG_ATTRIB_WPOS][3]; line.span.arrayMask |= SPAN_LAMBDA; compute_plane(line.x0, line.y0, line.x1, line.y1, invW0, invW1, line.wPlane); ATTRIB_LOOP_BEGIN GLuint c; if (swrast->_InterpMode[attr] == GL_FLAT) { for (c = 0; c < 4; c++) { constant_plane(v1->attrib[attr][c], line.attrPlane[attr][c]); } } else { for (c = 0; c < 4; c++) { const GLfloat a0 = v0->attrib[attr][c] * invW0; const GLfloat a1 = v1->attrib[attr][c] * invW1; compute_plane(line.x0, line.y0, line.x1, line.y1, a0, a1, line.attrPlane[attr][c]); } } line.span.arrayAttribs |= (1 << attr); if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0) { const GLuint u = attr - FRAG_ATTRIB_TEX0; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; line.texWidth[attr] = (GLfloat) texImage->Width; line.texHeight[attr] = (GLfloat) texImage->Height; } ATTRIB_LOOP_END } #endif tStart = tEnd = 0.0; inSegment = GL_FALSE; iLen = (GLint) line.len; if (ctx->Line.StippleFlag) { for (i = 0; i < iLen; i++) { const GLuint bit = (swrast->StippleCounter / ctx->Line.StippleFactor) & 0xf; if ((1 << bit) & ctx->Line.StipplePattern) { /* stipple bit is on */ const GLfloat t = (GLfloat) i / (GLfloat) line.len; if (!inSegment) { /* start new segment */ inSegment = GL_TRUE; tStart = t; } else { /* still in the segment, extend it */ tEnd = t; } } else { /* stipple bit is off */ if (inSegment && (tEnd > tStart)) { /* draw the segment */ segment(ctx, &line, NAME(plot), tStart, tEnd); inSegment = GL_FALSE; } else { /* still between segments, do nothing */ } } swrast->StippleCounter++; } if (inSegment) { /* draw the final segment of the line */ segment(ctx, &line, NAME(plot), tStart, 1.0F); } } else { /* non-stippled */ segment(ctx, &line, NAME(plot), 0.0, 1.0); } #if defined(DO_RGBA) _swrast_write_rgba_span(ctx, &(line.span)); #else _swrast_write_index_span(ctx, &(line.span)); #endif }