📄 s_tritemp.h
字号:
zRow = (DEPTH_TYPE *) zrb->GetPointer(ctx, zrb, FixedToInt(fxLeftEdge), span.y); dZRowOuter = (ctx->DrawBuffer->Width + idxOuter) * sizeof(DEPTH_TYPE);# endif }#endif#ifdef INTERP_RGB if (ctx->Light.ShadeModel == GL_SMOOTH) { rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP]) + span.attrStepX[FRAG_ATTRIB_COL0][0] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][0] * adjy) + FIXED_HALF; gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP]) + span.attrStepX[FRAG_ATTRIB_COL0][1] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][1] * adjy) + FIXED_HALF; bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP]) + span.attrStepX[FRAG_ATTRIB_COL0][2] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][2] * adjy) + FIXED_HALF; fdrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][0]); fdgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][1] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][1]); fdbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][2] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][2]);# ifdef INTERP_ALPHA aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx + span.attrStepY[FRAG_ATTRIB_COL0][3] * adjy) + FIXED_HALF; fdaOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][3] + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]);# endif } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); rLeft = ChanToFixed(v2->color[RCOMP]); gLeft = ChanToFixed(v2->color[GCOMP]); bLeft = ChanToFixed(v2->color[BCOMP]); fdrOuter = fdgOuter = fdbOuter = 0;# ifdef INTERP_ALPHA aLeft = ChanToFixed(v2->color[ACOMP]); fdaOuter = 0;# endif }#endif /* INTERP_RGB */#ifdef INTERP_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { iLeft = (GLfixed)(vLower->attrib[FRAG_ATTRIB_CI][0] * FIXED_SCALE + didx * adjx + didy * adjy) + FIXED_HALF; diOuter = SignedFloatToFixed(didy + dxOuter * didx); } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); iLeft = FloatToFixed(v2->attrib[FRAG_ATTRIB_CI][0]); diOuter = 0; }#endif#ifdef INTERP_INT_TEX { GLfloat s0, t0; s0 = vLower->attrib[FRAG_ATTRIB_TEX0][0] * S_SCALE; sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][0] * adjx + span.attrStepY[FRAG_ATTRIB_TEX0][0] * adjy) + FIXED_HALF; dsOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][0]); t0 = vLower->attrib[FRAG_ATTRIB_TEX0][1] * T_SCALE; tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][1] * adjx + span.attrStepY[FRAG_ATTRIB_TEX0][1] * adjy) + FIXED_HALF; dtOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][1] + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][1]); }#endif#ifdef INTERP_ATTRIBS { const GLuint attr = FRAG_ATTRIB_WPOS; wLeft = vLower->attrib[FRAG_ATTRIB_WPOS][3] + (span.attrStepX[attr][3] * adjx + span.attrStepY[attr][3] * adjy) * (1.0F/FIXED_SCALE); dwOuter = span.attrStepY[attr][3] + dxOuter * span.attrStepX[attr][3]; } ATTRIB_LOOP_BEGIN const GLfloat invW = vLower->attrib[FRAG_ATTRIB_WPOS][3]; if (swrast->_InterpMode[attr] == GL_FLAT) { GLuint c; for (c = 0; c < 4; c++) { attrLeft[attr][c] = v2->attrib[attr][c] * invW; daOuter[attr][c] = 0.0; } } else { GLuint c; for (c = 0; c < 4; c++) { const GLfloat a = vLower->attrib[attr][c] * invW; attrLeft[attr][c] = a + ( span.attrStepX[attr][c] * adjx + span.attrStepY[attr][c] * adjy) * (1.0F/FIXED_SCALE); daOuter[attr][c] = span.attrStepY[attr][c] + dxOuter * span.attrStepX[attr][c]; } } ATTRIB_LOOP_END#endif } /*if setupLeft*/ if (setupRight && eRight->lines>0) { fxRightEdge = eRight->fsx - FIXED_EPSILON; fdxRightEdge = eRight->fdxdy; } if (lines==0) { continue; } /* Rasterize setup */#ifdef PIXEL_ADDRESS dPRowInner = dPRowOuter + sizeof(PIXEL_TYPE);#endif#ifdef INTERP_Z# ifdef DEPTH_TYPE dZRowInner = dZRowOuter + sizeof(DEPTH_TYPE);# endif fdzInner = fdzOuter + span.zStep;#endif#ifdef INTERP_RGB fdrInner = fdrOuter + span.redStep; fdgInner = fdgOuter + span.greenStep; fdbInner = fdbOuter + span.blueStep;#endif#ifdef INTERP_ALPHA fdaInner = fdaOuter + span.alphaStep;#endif#ifdef INTERP_INDEX diInner = diOuter + span.indexStep;#endif#ifdef INTERP_INT_TEX dsInner = dsOuter + span.intTexStep[0]; dtInner = dtOuter + span.intTexStep[1];#endif#ifdef INTERP_ATTRIBS dwInner = dwOuter + span.attrStepX[FRAG_ATTRIB_WPOS][3]; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { daInner[attr][c] = daOuter[attr][c] + span.attrStepX[attr][c]; } ATTRIB_LOOP_END#endif while (lines > 0) { /* initialize the span interpolants to the leftmost value */ /* ff = fixed-pt fragment */ const GLint right = FixedToInt(fxRightEdge); span.x = FixedToInt(fxLeftEdge); if (right <= span.x) span.end = 0; else span.end = right - span.x;#ifdef INTERP_Z span.z = zLeft;#endif#ifdef INTERP_RGB span.red = rLeft; span.green = gLeft; span.blue = bLeft;#endif#ifdef INTERP_ALPHA span.alpha = aLeft;#endif#ifdef INTERP_INDEX span.index = iLeft;#endif#ifdef INTERP_INT_TEX span.intTex[0] = sLeft; span.intTex[1] = tLeft;#endif#ifdef INTERP_ATTRIBS span.attrStart[FRAG_ATTRIB_WPOS][3] = wLeft; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { span.attrStart[attr][c] = attrLeft[attr][c]; } ATTRIB_LOOP_END#endif /* This is where we actually generate fragments */ /* XXX the test for span.y > 0 _shouldn't_ be needed but * it fixes a problem on 64-bit Opterons (bug 4842). */ if (span.end > 0 && span.y >= 0) { const GLint len = span.end - 1; (void) len;#ifdef INTERP_RGB CLAMP_INTERPOLANT(red, redStep, len); CLAMP_INTERPOLANT(green, greenStep, len); CLAMP_INTERPOLANT(blue, blueStep, len);#endif#ifdef INTERP_ALPHA CLAMP_INTERPOLANT(alpha, alphaStep, len);#endif#ifdef INTERP_INDEX CLAMP_INTERPOLANT(index, indexStep, len);#endif { RENDER_SPAN( span ); } } /* * Advance to the next scan line. Compute the * new edge coordinates, and adjust the * pixel-center x coordinate so that it stays * on or inside the major edge. */ span.y++; lines--; fxLeftEdge += fdxLeftEdge; fxRightEdge += fdxRightEdge; fError += fdError; if (fError >= 0) { fError -= FIXED_ONE;#ifdef PIXEL_ADDRESS pRow = (PIXEL_TYPE *) ((GLubyte *) pRow + dPRowOuter);#endif#ifdef INTERP_Z# ifdef DEPTH_TYPE zRow = (DEPTH_TYPE *) ((GLubyte *) zRow + dZRowOuter);# endif zLeft += fdzOuter;#endif#ifdef INTERP_RGB rLeft += fdrOuter; gLeft += fdgOuter; bLeft += fdbOuter;#endif#ifdef INTERP_ALPHA aLeft += fdaOuter;#endif#ifdef INTERP_INDEX iLeft += diOuter;#endif#ifdef INTERP_INT_TEX sLeft += dsOuter; tLeft += dtOuter;#endif#ifdef INTERP_ATTRIBS wLeft += dwOuter; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { attrLeft[attr][c] += daOuter[attr][c]; } ATTRIB_LOOP_END#endif } else {#ifdef PIXEL_ADDRESS pRow = (PIXEL_TYPE *) ((GLubyte *) pRow + dPRowInner);#endif#ifdef INTERP_Z# ifdef DEPTH_TYPE zRow = (DEPTH_TYPE *) ((GLubyte *) zRow + dZRowInner);# endif zLeft += fdzInner;#endif#ifdef INTERP_RGB rLeft += fdrInner; gLeft += fdgInner; bLeft += fdbInner;#endif#ifdef INTERP_ALPHA aLeft += fdaInner;#endif#ifdef INTERP_INDEX iLeft += diInner;#endif#ifdef INTERP_INT_TEX sLeft += dsInner; tLeft += dtInner;#endif#ifdef INTERP_ATTRIBS wLeft += dwInner; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { attrLeft[attr][c] += daInner[attr][c]; } ATTRIB_LOOP_END#endif } } /*while lines>0*/ } /* for subTriangle */ } }}#undef SETUP_CODE#undef RENDER_SPAN#undef PIXEL_TYPE#undef BYTES_PER_ROW#undef PIXEL_ADDRESS#undef DEPTH_TYPE#undef INTERP_Z#undef INTERP_RGB#undef INTERP_ALPHA#undef INTERP_INDEX#undef INTERP_INT_TEX#undef INTERP_ATTRIBS#undef S_SCALE#undef T_SCALE#undef FixedToDepth#undef NAME
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -