594{
595#define INTERP_Z 1
596#define INTERP_RGB 1
597#define INTERP_ALPHA 1
598#define INTERP_STW 1
599#define INTERP_UV 1
600
601#define SETUP_CODE \
602 GLboolean flat_shade = (ctx->Light.ShadeModel==GL_FLAT); \
603 GLint r, g, b, a; \
604 GLfloat twidth, theight; \
605 if (ctx->Texture.Enabled & TEXTURE_2D) { \
606 twidth = (GLfloat) ctx->Texture.Current2D->Image[0]->Width; \
607 theight = (GLfloat) ctx->Texture.Current2D->Image[0]->Height; \
608 } \
609 else { \
610 twidth = (GLfloat) ctx->Texture.Current1D->Image[0]->Width; \
611 theight = 1.0; \
612 } \
613 if (flat_shade) { \
614 r = VB->Color[pv][0]; \
615 g = VB->Color[pv][1]; \
616 b = VB->Color[pv][2]; \
617 a = VB->Color[pv][3]; \
618 }
619
620#define INNER_LOOP( LEFT, RIGHT, Y ) \
621 { \
622 GLint i, n = RIGHT-LEFT; \
623 GLdepth zspan[MAX_WIDTH]; \
624 GLubyte red[MAX_WIDTH], green[MAX_WIDTH]; \
625 GLubyte blue[MAX_WIDTH], alpha[MAX_WIDTH]; \
626 GLfloat s[MAX_WIDTH], t[MAX_WIDTH], u[MAX_WIDTH]; \
627 DEFARRAY(GLfloat,lambda,MAX_WIDTH); \
628 if (n>0) { \
629 if (flat_shade) { \
630 for (i=0;i<n;i++) { \
631 GLdouble wwvvInv = 1.0 / (ww*vv); \
632 zspan[i] = ffz; \
633 red[i] = r; \
634 green[i] = g; \
635 blue[i] = b; \
636 alpha[i] = a; \
637 s[i] = ss*wwvvInv; \
638 t[i] = tt*wwvvInv; \
639 u[i] = uu*wwvvInv; \
640 lambda[i] = compute_lambda( s[i], t[i], \
641 dsdx, dsdy, \
642 dtdx, dtdy, ww, \
643 dwdx, dwdy, \
644 twidth, theight ); \
645 ffz += fdzdx; \
646 ss += dsdx; \
647 tt += dtdx; \
648 uu += dudx; \
649 vv += dvdx; \
650 ww += dwdx; \
651 } \
652 } \
653 else { \
654 for (i=0;i<n;i++) { \
655 GLdouble wwvvInv = 1.0 / (ww*vv); \
656 zspan[i] = ffz; \
657 red[i] = FixedToInt(ffr); \
658 green[i] = FixedToInt(ffg); \
659 blue[i] = FixedToInt(ffb); \
660 alpha[i] = FixedToInt(ffa); \
661 s[i] = ss*wwvvInv; \
662 t[i] = tt*wwvvInv; \
663 u[i] = uu*wwvvInv; \
664 lambda[i] = compute_lambda( s[i], t[i], \
665 dsdx, dsdy, \
666 dtdx, dtdy, ww, \
667 dwdx, dwdy, \
668 twidth, theight ); \
669 ffz += fdzdx; \
670 ffr += fdrdx; \
671 ffg += fdgdx; \
672 ffb += fdbdx; \
673 ffa += fdadx; \
674 ss += dsdx; \
675 tt += dtdx; \
676 uu += dudx; \
677 vv += dvdx; \
678 ww += dwdx; \
679 } \
680 } \
681 gl_write_texture_span( ctx, n, LEFT, Y, zspan, \
682 s, t, u, lambda, \
683 red, green, blue, alpha, \
684 GL_POLYGON ); \
685 } \
686 UNDEFARRAY(lambda); \
687 }
688
690}