ReactOS 0.4.15-dev-7693-gd0e2924
tritemp.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 if (y0<=y1)
 
 if (area > -0.05f &&area< 0.05f)
 
 if (eMaj.lines > 0)
 
 if (eTop.lines > 0)
 
 if (eBot.lines > 0)
 
 for (subTriangle=0;subTriangle<=1;subTriangle++)
 

Variables

struct vertex_bufferVB = ctx->VB
 
EdgeT eMaj
 
EdgeT eTop
 
EdgeT eBot
 
GLfloat oneOverArea = 1.0F / area
 
int vMin
 
int vMid
 
int vMax
 
GLfloat y1 = VB->Win[v1][1]
 
GLfloat y2 = VB->Win[v2][1]
 
 else
 
eMaj v1 = vMax
 
eTop v0 = vMid
 
eMaj dx = VB->Win[vMax][0] - VB->Win[vMin][0]
 
eMaj dy = VB->Win[vMax][1] - VB->Win[vMin][1]
 
GLfixed vMin_fy = FloatToFixed(VB->Win[vMin][1] - 0.5F)
 
GLfixed vMid_fx = FloatToFixed(VB->Win[vMid][0] + 0.5F)
 
GLfixed vMid_fy = FloatToFixed(VB->Win[vMid][1] - 0.5F)
 
GLfixed vMax_fy = FloatToFixed(VB->Win[vMax][1] - 0.5F)
 
eMaj fsy = FixedCeil(vMin_fy)
 
eMaj lines = FixedToInt(vMax_fy + FIXED_ONE - FIXED_EPSILON - eMaj.fsy)
 
 ltor = (oneOverArea < 0.0F)
 
GLfixed fx
 
GLfixed fxLeftEdge
 
GLfixed fxRightEdge
 
GLfixed fdxLeftEdge
 
GLfixed fdxRightEdge
 
GLfixed fdxOuter
 
int idxOuter
 
float dxOuter
 
GLfixed fError
 
GLfixed fdError
 
float adjx
 
float adjy
 
GLfixed fy
 
int iy
 

Function Documentation

◆ for()

for ( subTriangle  = 0; subTriangle<=1; subTriangle++)

Definition at line 526 of file tritemp.h.

526 {
527 EdgeT *eLeft, *eRight;
528 int setupLeft, setupRight;
529 int lines;
530
531 if (subTriangle==0) {
532 /* bottom half */
533 if (ltor) {
534 eLeft = &eMaj;
535 eRight = &eBot;
536 lines = eRight->lines;
537 setupLeft = 1;
538 setupRight = 1;
539 }
540 else {
541 eLeft = &eBot;
542 eRight = &eMaj;
543 lines = eLeft->lines;
544 setupLeft = 1;
545 setupRight = 1;
546 }
547 }
548 else {
549 /* top half */
550 if (ltor) {
551 eLeft = &eMaj;
552 eRight = &eTop;
553 lines = eRight->lines;
554 setupLeft = 0;
555 setupRight = 1;
556 }
557 else {
558 eLeft = &eTop;
559 eRight = &eMaj;
560 lines = eLeft->lines;
561 setupLeft = 1;
562 setupRight = 0;
563 }
564 if (lines==0) return;
565 }
566
567 if (setupLeft && eLeft->lines>0) {
568 GLint vLower;
569 GLfixed fsx = eLeft->fsx;
570 fx = FixedCeil(fsx);
571 fError = fx - fsx - FIXED_ONE;
573 fdxLeftEdge = eLeft->fdxdy;
578
579 fy = eLeft->fsy;
580 iy = FixedToInt(fy);
581
582 adjx = (float)(fx - eLeft->fx0); /* SCALED! */
583 adjy = eLeft->adjy; /* SCALED! */
584
585 vLower = eLeft->v0;
586
587#ifdef PIXEL_ADDRESS
588 {
589 pRow = PIXEL_ADDRESS( FixedToInt(fxLeftEdge), iy );
590 dPRowOuter = -((int)BYTES_PER_ROW) + idxOuter * sizeof(PIXEL_TYPE);
591 /* negative because Y=0 at bottom and increases upward */
592 }
593#endif
594 /*
595 * Now we need the set of parameter (z, color, etc.) values at
596 * the point (fx, fy). This gives us properly-sampled parameter
597 * values that we can step from pixel to pixel. Furthermore,
598 * although we might have intermediate results that overflow
599 * the normal parameter range when we step temporarily outside
600 * the triangle, we shouldn't overflow or underflow for any
601 * pixel that's actually inside the triangle.
602 */
603
604#if INTERP_Z
605 {
606 GLfloat z0;
607 z0 = VB->Win[vLower][2] + ctx->PolygonZoffset;
608
609 /* interpolate depth values exactly */
610 fz = (GLint) (z0 + dzdx*FixedToFloat(adjx) + dzdy*FixedToFloat(adjy));
611 fdzOuter = (GLint) (dzdy + dxOuter * dzdx);
612 zRow = Z_ADDRESS( ctx, FixedToInt(fxLeftEdge), iy );
613 dZRowOuter = (ctx->Buffer->Width + idxOuter) * sizeof(GLdepth);
614 }
615#endif
616#if INTERP_RGB
617 fr = (GLfixed)(IntToFixed(VB->Color[vLower][0]) + drdx * adjx + drdy * adjy)
618 + FIXED_HALF;
619 fdrOuter = SignedFloatToFixed(drdy + dxOuter * drdx);
620
621 fg = (GLfixed)(IntToFixed(VB->Color[vLower][1]) + dgdx * adjx + dgdy * adjy)
622 + FIXED_HALF;
623 fdgOuter = SignedFloatToFixed(dgdy + dxOuter * dgdx);
624
625 fb = (GLfixed)(IntToFixed(VB->Color[vLower][2]) + dbdx * adjx + dbdy * adjy)
626 + FIXED_HALF;
627 fdbOuter = SignedFloatToFixed(dbdy + dxOuter * dbdx);
628#endif
629#if INTERP_ALPHA
630 fa = (GLfixed)(IntToFixed(VB->Color[vLower][3]) + dadx * adjx + dady * adjy)
631 + FIXED_HALF;
632 fdaOuter = SignedFloatToFixed(dady + dxOuter * dadx);
633#endif
634#if INTERP_INDEX
635 fi = (GLfixed)(VB->Index[vLower] * FIXED_SCALE + didx * adjx
636 + didy * adjy) + FIXED_HALF;
637 fdiOuter = SignedFloatToFixed(didy + dxOuter * didx);
638#endif
639#if INTERP_ST
640 {
641 GLfloat s0, t0;
642 s0 = VB->TexCoord[vLower][0] * S_SCALE;
643 fs = (GLfixed)(s0 * FIXED_SCALE + dsdx * adjx + dsdy * adjy) + FIXED_HALF;
644 fdsOuter = SignedFloatToFixed(dsdy + dxOuter * dsdx);
645 t0 = VB->TexCoord[vLower][1] * T_SCALE;
646 ft = (GLfixed)(t0 * FIXED_SCALE + dtdx * adjx + dtdy * adjy) + FIXED_HALF;
647 fdtOuter = SignedFloatToFixed(dtdy + dxOuter * dtdx);
648 }
649#endif
650#if INTERP_STW
651 {
652 GLfloat w0 = 1.0F / VB->Clip[vLower][3];
653 GLfloat s0, t0, u0, v0;
654 wLeft = w0 + (dwdx * adjx + dwdy * adjy) * (1.0F/FIXED_SCALE);
655 dwOuter = dwdy + dxOuter * dwdx;
656 s0 = VB->TexCoord[vLower][0] * w0;
657 sLeft = s0 + (dsdx * adjx + dsdy * adjy) * (1.0F/FIXED_SCALE);
658 dsOuter = dsdy + dxOuter * dsdx;
659 t0 = VB->TexCoord[vLower][1] * w0;
660 tLeft = t0 + (dtdx * adjx + dtdy * adjy) * (1.0F/FIXED_SCALE);
661 dtOuter = dtdy + dxOuter * dtdx;
662#if INTERP_UV
663 u0 = VB->TexCoord[vLower][2] * w0;
664 uLeft = u0 + (dudx * adjx + dudy * adjy) * (1.0F/FIXED_SCALE);
665 duOuter = dudy + dxOuter * dudx;
666 /* Note: don't divide V component by W */
667 v0 = VB->TexCoord[vLower][3];
668 vLeft = v0 + (dvdx * adjx + dvdy * adjy) * (1.0F/FIXED_SCALE);
669 dvOuter = dvdy + dxOuter * dvdx;
670#endif
671 }
672#endif
673
674 } /*if setupLeft*/
675
676
677 if (setupRight && eRight->lines>0) {
678 fxRightEdge = eRight->fsx - FIXED_EPSILON;
679 fdxRightEdge = eRight->fdxdy;
680 }
681
682 if (lines==0) {
683 continue;
684 }
685
686
687 /* Rasterize setup */
688#ifdef PIXEL_ADDRESS
689 dPRowInner = dPRowOuter + sizeof(PIXEL_TYPE);
690#endif
691#if INTERP_Z
692 dZRowInner = dZRowOuter + sizeof(GLdepth);
693 fdzInner = fdzOuter + fdzdx;
694#endif
695#if INTERP_RGB
696 fdrInner = fdrOuter + fdrdx;
697 fdgInner = fdgOuter + fdgdx;
698 fdbInner = fdbOuter + fdbdx;
699#endif
700#if INTERP_ALPHA
701 fdaInner = fdaOuter + fdadx;
702#endif
703#if INTERP_INDEX
704 fdiInner = fdiOuter + fdidx;
705#endif
706#if INTERP_ST
707 fdsInner = fdsOuter + fdsdx;
708 fdtInner = fdtOuter + fdtdx;
709#endif
710#if INTERP_STW
711 dwInner = dwOuter + dwdx;
712 dsInner = dsOuter + dsdx;
713 dtInner = dtOuter + dtdx;
714#if INTERP_UV
715 duInner = duOuter + dudx;
716 dvInner = dvOuter + dvdx;
717#endif
718#endif
719
720 while (lines>0) {
721 /* initialize the span interpolants to the leftmost value */
722 /* ff = fixed-pt fragment */
723#if INTERP_Z
724 GLfixed ffz = fz;
725 /*GLdepth *zp = zRow;*/
726#endif
727#if INTERP_RGB
728 GLfixed ffr = fr, ffg = fg, ffb = fb;
729#endif
730#if INTERP_ALPHA
731 GLfixed ffa = fa;
732#endif
733#if INTERP_INDEX
734 GLfixed ffi = fi;
735#endif
736#if INTERP_ST
737 GLfixed ffs = fs, fft = ft;
738#endif
739#if INTERP_STW
740 GLfloat ss = sLeft, tt = tLeft, ww = wLeft;
741#endif
742#if INTERP_UV
743 GLfloat uu = uLeft, vv = vLeft;
744#endif
747
748#if INTERP_RGB
749 {
750 /* need this to accomodate round-off errors */
751 GLfixed ffrend = ffr+(right-left-1)*fdrdx;
752 GLfixed ffgend = ffg+(right-left-1)*fdgdx;
753 GLfixed ffbend = ffb+(right-left-1)*fdbdx;
754 if (ffrend<0) ffr -= ffrend;
755 if (ffgend<0) ffg -= ffgend;
756 if (ffbend<0) ffb -= ffbend;
757 if (ffr<0) ffr = 0;
758 if (ffg<0) ffg = 0;
759 if (ffb<0) ffb = 0;
760 }
761#endif
762#if INTERP_ALPHA
763 {
764 GLfixed ffaend = ffa+(right-left-1)*fdadx;
765 if (ffaend<0) ffa -= ffaend;
766 if (ffa<0) ffa = 0;
767 }
768#endif
769#if INTERP_INDEX
770 if (ffi<0) ffi = 0;
771#endif
772
773 INNER_LOOP( left, right, iy );
774
775 /*
776 * Advance to the next scan line. Compute the
777 * new edge coordinates, and adjust the
778 * pixel-center x coordinate so that it stays
779 * on or inside the major edge.
780 */
781 iy++;
782 lines--;
783
786
787
788 fError += fdError;
789 if (fError >= 0) {
790 fError -= FIXED_ONE;
791#ifdef PIXEL_ADDRESS
792 pRow = (PIXEL_TYPE*) ((GLubyte*)pRow + dPRowOuter);
793#endif
794#if INTERP_Z
795 zRow = (GLdepth*) ((GLubyte*)zRow + dZRowOuter);
796 fz += fdzOuter;
797#endif
798#if INTERP_RGB
799 fr += fdrOuter; fg += fdgOuter; fb += fdbOuter;
800#endif
801#if INTERP_ALPHA
802 fa += fdaOuter;
803#endif
804#if INTERP_INDEX
805 fi += fdiOuter;
806#endif
807#if INTERP_ST
808 fs += fdsOuter; ft += fdtOuter;
809#endif
810#if INTERP_STW
811 sLeft += dsOuter;
812 tLeft += dtOuter;
813 wLeft += dwOuter;
814#endif
815#if INTERP_UV
816 uLeft += duOuter;
817 vLeft += dvOuter;
818#endif
819 }
820 else {
821#ifdef PIXEL_ADDRESS
822 pRow = (PIXEL_TYPE*) ((GLubyte*)pRow + dPRowInner);
823#endif
824#if INTERP_Z
825 zRow = (GLdepth*) ((GLubyte*)zRow + dZRowInner);
826 fz += fdzInner;
827#endif
828#if INTERP_RGB
829 fr += fdrInner; fg += fdgInner; fb += fdbInner;
830#endif
831#if INTERP_ALPHA
832 fa += fdaInner;
833#endif
834#if INTERP_INDEX
835 fi += fdiInner;
836#endif
837#if INTERP_ST
838 fs += fdsInner; ft += fdtInner;
839#endif
840#if INTERP_STW
841 sLeft += dsInner;
842 tLeft += dtInner;
843 wLeft += dwInner;
844#endif
845#if INTERP_UV
846 uLeft += duInner;
847 vLeft += dvInner;
848#endif
849 }
850 } /*while lines>0*/
851
852 } /* for subTriangle */
#define ffz(x)
Definition: bitops.h:109
#define Z_ADDRESS(CTX, X, Y)
Definition: depth.h:45
GLint GLdepth
Definition: types.h:218
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define FixedToFloat(X)
Definition: fixed.h:52
#define FIXED_HALF
Definition: fixed.h:39
#define FixedToInt(X)
Definition: fixed.h:47
#define FIXED_EPSILON
Definition: fixed.h:42
#define FIXED_SCALE
Definition: fixed.h:43
#define SignedFloatToFixed(X)
Definition: fixed.h:54
#define FixedCeil(X)
Definition: fixed.h:49
#define FixedFloor(X)
Definition: fixed.h:50
#define FIXED_ONE
Definition: fixed.h:38
int GLfixed
Definition: fixed.h:36
#define IntToFixed(I)
Definition: fixed.h:46
unsigned char GLubyte
Definition: gl.h:157
float GLfloat
Definition: gl.h:161
int GLint
Definition: gl.h:156
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLfloat v0
Definition: glext.h:6061
#define fs
Definition: i386-dis.c:444
#define ss
Definition: i386-dis.c:441
static float(__cdecl *square_half_float)(float x
#define ffs
Definition: port.h:359
f_args fa
Definition: format.c:280
Definition: ffs.h:70
#define T_SCALE
#define S_SCALE
#define INNER_LOOP(LEFT, RIGHT, Y)
float adjy
Definition: tritemp.h:489
int idxOuter
Definition: tritemp.h:486
EdgeT eMaj
Definition: tritemp.h:140
GLfixed fError
Definition: tritemp.h:488
GLfixed fxLeftEdge
Definition: tritemp.h:484
float dxOuter
Definition: tritemp.h:487
eTop v0
Definition: tritemp.h:176
int iy
Definition: tritemp.h:491
EdgeT eBot
Definition: tritemp.h:140
GLfixed fxRightEdge
Definition: tritemp.h:484
GLfixed fdError
Definition: tritemp.h:488
eMaj lines
Definition: tritemp.h:206
GLfixed fdxOuter
Definition: tritemp.h:485
ltor
Definition: tritemp.h:310
EdgeT eTop
Definition: tritemp.h:140
GLfixed fdxLeftEdge
Definition: tritemp.h:484
GLfixed fx
Definition: tritemp.h:484
struct vertex_buffer * VB
Definition: tritemp.h:139
GLfixed fy
Definition: tritemp.h:490
float adjx
Definition: tritemp.h:489
GLfixed fdxRightEdge
Definition: tritemp.h:484

◆ if() [1/5]

if ( area  )

Definition at line 190 of file tritemp.h.

190 {
191 return; /* very small; CULLED */
192 }

◆ if() [2/5]

if ( eBot.  lines,
 
)

Definition at line 230 of file tritemp.h.

230 {
231 GLfloat dxdy = eBot.dx / eBot.dy;
232 eBot.fdxdy = SignedFloatToFixed(dxdy);
233 eBot.adjy = (GLfloat) (eBot.fsy - vMin_fy); /* SCALED! */
234 eBot.fx0 = vMin_fx;
235 eBot.fsx = eBot.fx0 + (GLfixed) (eBot.adjy * dxdy);
236 }
GLfixed vMin_fy
Definition: tritemp.h:200

◆ if() [3/5]

if ( eMaj.  lines,
 
)

Definition at line 207 of file tritemp.h.

207 {
208 GLfloat dxdy = eMaj.dx / eMaj.dy;
209 eMaj.fdxdy = SignedFloatToFixed(dxdy);
210 eMaj.adjy = (GLfloat) (eMaj.fsy - vMin_fy); /* SCALED! */
211 eMaj.fx0 = vMin_fx;
212 eMaj.fsx = eMaj.fx0 + (GLfixed) (eMaj.adjy * dxdy);
213 }

◆ if() [4/5]

if ( eTop.  lines,
 
)

Definition at line 220 of file tritemp.h.

220 {
221 GLfloat dxdy = eTop.dx / eTop.dy;
222 eTop.fdxdy = SignedFloatToFixed(dxdy);
223 eTop.adjy = (GLfloat) (eTop.fsy - vMid_fy); /* SCALED! */
224 eTop.fx0 = vMid_fx;
225 eTop.fsx = eTop.fx0 + (GLfixed) (eTop.adjy * dxdy);
226 }
GLfixed vMid_fx
Definition: tritemp.h:201
GLfixed vMid_fy
Definition: tritemp.h:202

◆ if() [5/5]

if ( y0<=  y1)

Definition at line 150 of file tritemp.h.

150 {
151 if (y1<=y2) {
152 vMin = v0; vMid = v1; vMax = v2; /* y0<=y1<=y2 */
153 }
154 else if (y2<=y0) {
155 vMin = v2; vMid = v0; vMax = v1; /* y2<=y0<=y1 */
156 }
157 else {
158 vMin = v0; vMid = v2; vMax = v1; /* y0<=y2<=y1 */
159 }
160 }
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLint y0
Definition: linetemp.h:96
eMaj v1
Definition: tritemp.h:175
int vMid
Definition: tritemp.h:142
int vMax
Definition: tritemp.h:142
int vMin
Definition: tritemp.h:142
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711

Variable Documentation

◆ adjx

float adjx

Definition at line 489 of file tritemp.h.

Referenced by for().

◆ adjy

float adjy

Definition at line 489 of file tritemp.h.

Referenced by for().

◆ dx

eBot dx = VB->Win[vMax][0] - VB->Win[vMin][0]

Definition at line 180 of file tritemp.h.

◆ dxOuter

float dxOuter

Definition at line 487 of file tritemp.h.

Referenced by for().

◆ dy

eBot dy = VB->Win[vMax][1] - VB->Win[vMin][1]

Definition at line 181 of file tritemp.h.

◆ eBot

EdgeT eBot

Definition at line 140 of file tritemp.h.

Referenced by for(), and if().

◆ else

else
Initial value:
{
if (y0<=y2) {
vMin = v1; vMid = v0; vMax = v2;
}
else if (y2<=y1) {
vMin = v2; vMid = v1; vMax = v0;
}
else {
vMin = v1; vMid = v2; vMax = v0;
}
}
}
eMaj.v0 = vMin

Definition at line 161 of file tritemp.h.

Referenced by EDIT_UpdateUniscribeData_linedef(), FatSetFsLabelInfo(), i386PrintFrames(), inflateUndermine(), MiRosUnmapViewOfSection(), and TOOLTIPS_Show().

◆ eMaj

EdgeT eMaj

Definition at line 140 of file tritemp.h.

Referenced by for(), and if().

◆ eTop

EdgeT eTop

Definition at line 140 of file tritemp.h.

Referenced by for(), and if().

◆ fdError

GLfixed fdError

Definition at line 488 of file tritemp.h.

Referenced by for().

◆ fdxLeftEdge

GLfixed fdxLeftEdge

Definition at line 484 of file tritemp.h.

Referenced by for().

◆ fdxOuter

GLfixed fdxOuter

Definition at line 485 of file tritemp.h.

Referenced by for().

◆ fdxRightEdge

GLfixed fdxRightEdge

Definition at line 484 of file tritemp.h.

Referenced by for().

◆ fError

GLfixed fError

Definition at line 488 of file tritemp.h.

Referenced by for().

◆ fsy

Definition at line 205 of file tritemp.h.

◆ fx

◆ fxLeftEdge

GLfixed fxLeftEdge

Definition at line 484 of file tritemp.h.

Referenced by for().

◆ fxRightEdge

GLfixed fxRightEdge

Definition at line 484 of file tritemp.h.

Referenced by for().

◆ fy

◆ idxOuter

int idxOuter

Definition at line 486 of file tritemp.h.

Referenced by for().

◆ iy

◆ lines

◆ ltor

ltor = (oneOverArea < 0.0F)

Definition at line 310 of file tritemp.h.

Referenced by for().

◆ oneOverArea

oneOverArea = 1.0F / area

Definition at line 141 of file tritemp.h.

◆ v0

Definition at line 176 of file tritemp.h.

Referenced by for(), and if().

◆ v1

Definition at line 175 of file tritemp.h.

Referenced by if().

◆ VB

◆ vMax

int vMax

Definition at line 142 of file tritemp.h.

Referenced by gridWrap::gridWrap(), if(), and Slicer::slice_new().

◆ vMax_fy

GLfixed vMax_fy = FloatToFixed(VB->Win[vMax][1] - 0.5F)

Definition at line 203 of file tritemp.h.

◆ vMid

int vMid

Definition at line 142 of file tritemp.h.

Referenced by if().

◆ vMid_fx

GLfixed vMid_fx = FloatToFixed(VB->Win[vMid][0] + 0.5F)

Definition at line 201 of file tritemp.h.

Referenced by if().

◆ vMid_fy

GLfixed vMid_fy = FloatToFixed(VB->Win[vMid][1] - 0.5F)

Definition at line 202 of file tritemp.h.

Referenced by if().

◆ vMin

int vMin

Definition at line 142 of file tritemp.h.

Referenced by gridWrap::gridWrap(), if(), and Slicer::slice_new().

◆ vMin_fy

GLfixed vMin_fy = FloatToFixed(VB->Win[vMin][1] - 0.5F)

Definition at line 200 of file tritemp.h.

Referenced by if().

◆ y1

GLfloat y1 = VB->Win[v1][1]

Definition at line 147 of file tritemp.h.

◆ y2

GLfloat y2 = VB->Win[v2][1]

Definition at line 148 of file tritemp.h.