⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s_aatritemp.h

📁 这是一个开放源代码的与WINNT/WIN2K/WIN2003兼容的操作系统
💻 H
📖 第 1 页 / 共 2 页
字号:
               break;
            startX++;
         }

         /* enter interior of triangle */
         ix = startX;
         count = 0;
         while (coverage > 0.0F) {
            /* (cx,cy) = center of fragment */
            const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
            struct span_arrays *array = span.array;
#ifdef DO_INDEX
            array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
#else
            array->coverage[count] = coverage;
#endif
#ifdef DO_Z
            array->z[count] = (GLdepth) IROUND(solve_plane(cx, cy, zPlane));
#endif
#ifdef DO_FOG
	    array->fog[count] = solve_plane(cx, cy, fogPlane);
#endif
#ifdef DO_RGBA
            array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
            array->rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane);
            array->rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane);
            array->rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane);
#endif
#ifdef DO_INDEX
            array->index[count] = (GLint) solve_plane(cx, cy, iPlane);
#endif
#ifdef DO_SPEC
            array->spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
            array->spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
            array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
#endif
#ifdef DO_TEX
            {
               const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
               array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ;
               array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ;
               array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ;
               array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane,
                                                      cx, cy, invQ,
                                                      texWidth, texHeight);
            }
#elif defined(DO_MULTITEX)
            {
               GLuint unit;
               for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
                  if (ctx->Texture.Unit[unit]._ReallyEnabled) {
                     GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
                     array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
                     array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
                     array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
                     array->lambda[unit][count] = compute_lambda(sPlane[unit],
                                      tPlane[unit], vPlane[unit], cx, cy, invQ,
                                      texWidth[unit], texHeight[unit]);
                  }
               }
            }
#endif
            ix++;
            count++;
            coverage = compute_coveragef(pMin, pMid, pMax, ix, iy);
         }
         
         if (ix <= startX)
            continue;
         
         span.x = startX;
         span.y = iy;
         span.end = (GLuint) ix - (GLuint) startX;
         ASSERT(span.interpMask == 0);
#if defined(DO_RGBA)
         _swrast_write_rgba_span(ctx, &span);
#else
         _swrast_write_index_span(ctx, &span);
#endif
      }
   }
   else {
      /* scan right to left */
      const GLfloat *pMin = vMin->win;
      const GLfloat *pMid = vMid->win;
      const GLfloat *pMax = vMax->win;
      const GLfloat dxdy = majDx / majDy;
      const GLfloat xAdj = dxdy > 0 ? dxdy : 0.0F;
      GLfloat x = pMin[0] - (yMin - iyMin) * dxdy;
      GLint iy;
      for (iy = iyMin; iy < iyMax; iy++, x += dxdy) {
         GLint ix, left, startX = (GLint) (x + xAdj);
         GLuint count, n;
         GLfloat coverage = 0.0F;
         
         /* make sure we're not past the window edge */
         if (startX >= ctx->DrawBuffer->_Xmax) {
            startX = ctx->DrawBuffer->_Xmax - 1;
         }

         /* skip fragments with zero coverage */
         while (startX >= 0) {
            coverage = compute_coveragef(pMin, pMax, pMid, startX, iy);
            if (coverage > 0.0F)
               break;
            startX--;
         }
         
         /* enter interior of triangle */
         ix = startX;
         count = 0;
         while (coverage > 0.0F) {
            /* (cx,cy) = center of fragment */
            const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
            struct span_arrays *array = span.array;
#ifdef DO_INDEX
            array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
#else
            array->coverage[ix] = coverage;
#endif
#ifdef DO_Z
            array->z[ix] = (GLdepth) IROUND(solve_plane(cx, cy, zPlane));
#endif
#ifdef DO_FOG
            array->fog[ix] = solve_plane(cx, cy, fogPlane);
#endif
#ifdef DO_RGBA
            array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
            array->rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane);
            array->rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane);
            array->rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane);
#endif
#ifdef DO_INDEX
            array->index[ix] = (GLint) solve_plane(cx, cy, iPlane);
#endif
#ifdef DO_SPEC
            array->spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
            array->spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
            array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
#endif
#ifdef DO_TEX
            {
               const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
               array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ;
               array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ;
               array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ;
               array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane,
                                          cx, cy, invQ, texWidth, texHeight);
            }
#elif defined(DO_MULTITEX)
            {
               GLuint unit;
               for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
                  if (ctx->Texture.Unit[unit]._ReallyEnabled) {
                     GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
                     array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
                     array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
                     array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
                     array->lambda[unit][ix] = compute_lambda(sPlane[unit],
                                                            tPlane[unit],
                                                            vPlane[unit],
                                                            cx, cy, invQ,
                                                            texWidth[unit],
                                                            texHeight[unit]);
                  }
               }
            }
#endif
            ix--;
            count++;
            coverage = compute_coveragef(pMin, pMax, pMid, ix, iy);
         }
         
         if (startX <= ix)
            continue;

         n = (GLuint) startX - (GLuint) ix;

         left = ix + 1;

         /* shift all values to the left */
         /* XXX this is temporary */
         {
            struct span_arrays *array = span.array;
            GLint j;
            for (j = 0; j < (GLint) n; j++) {
#ifdef DO_RGBA
               COPY_CHAN4(array->rgba[j], array->rgba[j + left]);
#endif
#ifdef DO_SPEC
               COPY_CHAN4(array->spec[j], array->spec[j + left]);
#endif
#ifdef DO_INDEX
               array->index[j] = array->index[j + left];
#endif
#ifdef DO_Z
               array->z[j] = array->z[j + left];
#endif
#ifdef DO_FOG
               array->fog[j] = array->fog[j + left];
#endif
#ifdef DO_TEX
               COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]);
#endif
#if defined(DO_MULTITEX) || defined(DO_TEX)
               array->lambda[0][j] = array->lambda[0][j + left];
#endif
               array->coverage[j] = array->coverage[j + left];
            }
         }
#ifdef DO_MULTITEX
         /* shift texcoords */
         {
            struct span_arrays *array = span.array;
            GLuint unit;
            for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
               if (ctx->Texture.Unit[unit]._ReallyEnabled) {
                  GLint j;
                  for (j = 0; j < (GLint) n; j++) {
		     array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0];
                     array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1];
                     array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2];
                     array->lambda[unit][j] = array->lambda[unit][j + left];
                  }
               }
            }
         }
#endif

         span.x = left;
         span.y = iy;
         span.end = n;
         ASSERT(span.interpMask == 0);
#if defined(DO_RGBA)
         _swrast_write_rgba_span(ctx, &span);
#else
         _swrast_write_index_span(ctx, &span);
#endif
      }
   }
}


#ifdef DO_Z
#undef DO_Z
#endif

#ifdef DO_FOG
#undef DO_FOG
#endif

#ifdef DO_RGBA
#undef DO_RGBA
#endif

#ifdef DO_INDEX
#undef DO_INDEX
#endif

#ifdef DO_SPEC
#undef DO_SPEC
#endif

#ifdef DO_TEX
#undef DO_TEX
#endif

#ifdef DO_MULTITEX
#undef DO_MULTITEX
#endif

#ifdef DO_OCCLUSION_TEST
#undef DO_OCCLUSION_TEST
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -