1 static __inline__ int IS_INF_OR_NAN(float x)
11 typedef struct sw_span {
19 static void simple_textured_triangle( float * * v1)
55 ((vMid[4][0] * (float)2048) + 0.5F) :
56 ((vMid[4][0] * (float)2048) - 0.5F));
57 eMaj.dx = (vMax_fx - vMin_fx) * (1.0F / (float)2048);
58 eMaj.dy = (vMax_fy - vMin_fy) * (1.0F / (float)2048);
59 eTop.dx = (vMax_fx - vMid_fx) * (1.0F / (float)2048);
60 eBot.dy = (vMid_fy - vMin_fy) * (1.0F / (float)2048);
61 float area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
62 if (IS_INF_OR_NAN(area))
64 oneOverArea = 1.0F / area;
66 int scan_from_left_to_right;
69 float eMaj_ds = (vMax[4][0] - vMin[4][0]);
71 span.attrStepX[4][0] =
72 oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds);
75 ((span.attrStepX[4][0] >=
76 0.0F) ? span.attrStepX[4][0] :
77 (span.attrStepX[4][0] * (float)2048) - 0.5F);
80 for (subTriangle = 0; subTriangle <= 1; subTriangle++) {
83 if (subTriangle == 0) {
84 if (scan_from_left_to_right) {
86 lines = eRight->lines;
91 if (scan_from_left_to_right) {
94 fxRightEdge = eRight->fsx;
98 if (fxRightEdge <= span.x)
101 span.end = fxRightEdge - span.x;
103 if (span.end > 0 && span.y >= 0) {
106 for (i = 0; i < span.end; i++) {
107 rgb[i] = texture[span.intTex[0]];
108 span.intTex[0] += span.intTexStep[0];
118 return simple_textured_triangle;