diff options
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r-- | src/mesa/swrast/s_lines.c | 27 | ||||
-rw-r--r-- | src/mesa/swrast/s_linetemp.h | 16 | ||||
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 17 | ||||
-rw-r--r-- | src/mesa/swrast/s_tritemp.h | 29 |
4 files changed, 78 insertions, 11 deletions
diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index 114ddeb320b..9e856d41534 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -1,4 +1,4 @@ -/* $Id: s_lines.c,v 1.12 2001/03/03 20:33:30 brianp Exp $ */ +/* $Id: s_lines.c,v 1.13 2001/03/08 17:33:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -52,7 +52,6 @@ */ - /* Flat, color index line */ static void flat_ci_line( GLcontext *ctx, const SWvertex *vert0, @@ -82,6 +81,7 @@ static void flat_ci_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); #include "s_linetemp.h" @@ -121,6 +121,7 @@ static void flat_rgba_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); #include "s_linetemp.h" @@ -176,6 +177,7 @@ static void smooth_ci_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_INDEX 1 #define PLOT(X,Y) \ @@ -245,6 +247,7 @@ static void smooth_rgba_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -294,6 +297,7 @@ static void general_smooth_ci_line( GLcontext *ctx, /* stippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_INDEX 1 #define WIDE 1 #define STIPPLE 1 @@ -313,6 +317,7 @@ static void general_smooth_ci_line( GLcontext *ctx, /* special case: unstippled and width=2 */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_INDEX 1 #define XMAJOR_PLOT(X,Y) \ pbx[count] = X; pbx[count+1] = X; \ @@ -336,6 +341,7 @@ static void general_smooth_ci_line( GLcontext *ctx, /* unstippled, any width */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_INDEX 1 #define WIDE 1 #define PLOT(X,Y) \ @@ -373,6 +379,7 @@ static void general_flat_ci_line( GLcontext *ctx, /* stippled, any width */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define WIDE 1 #define STIPPLE 1 #define PLOT(X,Y) \ @@ -390,6 +397,7 @@ static void general_flat_ci_line( GLcontext *ctx, /* special case: unstippled and width=2 */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define XMAJOR_PLOT(X,Y) \ pbx[count] = X; pbx[count+1] = X; \ pby[count] = Y; pby[count+1] = Y+1; \ @@ -410,6 +418,7 @@ static void general_flat_ci_line( GLcontext *ctx, /* unstippled, any width */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define WIDE 1 #define PLOT(X,Y) \ pbx[count] = X; \ @@ -446,6 +455,7 @@ static void general_smooth_rgba_line( GLcontext *ctx, /* stippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define WIDE 1 @@ -469,6 +479,7 @@ static void general_smooth_rgba_line( GLcontext *ctx, /* special case: unstippled and width=2 */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define XMAJOR_PLOT(X,Y) \ @@ -507,6 +518,7 @@ static void general_smooth_rgba_line( GLcontext *ctx, /* unstippled, any width */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define WIDE 1 @@ -542,6 +554,7 @@ static void general_flat_rgba_line( GLcontext *ctx, /* stippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define WIDE 1 #define STIPPLE 1 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); @@ -553,6 +566,7 @@ static void general_flat_rgba_line( GLcontext *ctx, /* special case: unstippled and width=2 */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \ PB_WRITE_PIXEL(PB, X, Y+1, Z, fog0); #define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \ @@ -563,6 +577,7 @@ static void general_flat_rgba_line( GLcontext *ctx, /* unstippled, any width */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define WIDE 1 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); #include "s_linetemp.h" @@ -595,6 +610,7 @@ static void flat_textured_line( GLcontext *ctx, /* stippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_TEX 1 #define WIDE 1 #define STIPPLE 1 @@ -616,6 +632,7 @@ static void flat_textured_line( GLcontext *ctx, /* unstippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_TEX 1 #define WIDE 1 #define PLOT(X,Y) \ @@ -661,6 +678,7 @@ static void smooth_textured_line( GLcontext *ctx, /* stippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define INTERP_TEX 1 @@ -688,6 +706,7 @@ static void smooth_textured_line( GLcontext *ctx, /* unstippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define INTERP_TEX 1 @@ -738,6 +757,7 @@ static void smooth_multitextured_line( GLcontext *ctx, /* stippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_SPEC 1 #define INTERP_ALPHA 1 @@ -775,6 +795,7 @@ static void smooth_multitextured_line( GLcontext *ctx, /* unstippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_SPEC 1 #define INTERP_ALPHA 1 @@ -839,6 +860,7 @@ static void flat_multitextured_line( GLcontext *ctx, /* stippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_ALPHA 1 #define INTERP_MULTITEX 1 #define WIDE 1 @@ -874,6 +896,7 @@ static void flat_multitextured_line( GLcontext *ctx, /* unstippled */ #define INTERP_XY 1 #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_ALPHA 1 #define INTERP_MULTITEX 1 #define WIDE 1 diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h index e451f448557..dd7d33f8cde 100644 --- a/src/mesa/swrast/s_linetemp.h +++ b/src/mesa/swrast/s_linetemp.h @@ -1,4 +1,4 @@ -/* $Id: s_linetemp.h,v 1.5 2001/02/07 18:36:52 brianp Exp $ */ +/* $Id: s_linetemp.h,v 1.6 2001/03/08 17:33:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -32,7 +32,8 @@ * * The following macros may be defined to indicate what auxillary information * must be interplated along the line: - * INTERP_Z - if defined, interpolate Z and FOG values + * INTERP_Z - if defined, interpolate Z values + * INTERP_FOG - if defined, interpolate FOG values * INTERP_RGB - if defined, interpolate RGB values * INTERP_SPEC - if defined, interpolate specular RGB values * INTERP_ALPHA - if defined, interpolate Alpha values @@ -92,6 +93,8 @@ GLint zPtrXstep, zPtrYstep; DEPTH_TYPE *zPtr; # endif +#endif +#ifdef INTERP_FOG GLfixed fog0 = FloatToFixed(vert0->fog); GLfixed dfog = FloatToFixed(vert1->fog) - fog0; #endif @@ -293,6 +296,8 @@ GLint errorDec = error-dx; #ifdef INTERP_Z dz = (z1-z0) / dx; +#endif +#ifdef INTERP_FOG dfog /= dx; #endif #ifdef INTERP_RGB @@ -398,6 +403,8 @@ zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); # endif z0 += dz; +#endif +#ifdef INTERP_FOG fog0 += dfog; #endif #ifdef INTERP_RGB @@ -464,6 +471,8 @@ GLint errorDec = error-dy; #ifdef INTERP_Z dz = (z1-z0) / dy; +#endif +#ifdef INTERP_FOG dfog /= dy; #endif #ifdef INTERP_RGB @@ -569,6 +578,8 @@ zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); # endif z0 += dz; +#endif +#ifdef INTERP_FOG fog0 += dfog; #endif #ifdef INTERP_RGB @@ -632,6 +643,7 @@ #undef INTERP_XY #undef INTERP_Z +#undef INTERP_FOG #undef INTERP_RGB #undef INTERP_SPEC #undef INTERP_ALPHA diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 58609b0f40c..fbacc7ddd4a 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1,4 +1,4 @@ -/* $Id: s_triangle.c,v 1.16 2001/03/08 15:23:46 brianp Exp $ */ +/* $Id: s_triangle.c,v 1.17 2001/03/08 17:33:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -66,6 +66,7 @@ GLboolean _mesa_cull_triangle( GLcontext *ctx, } + /* * Render a flat-shaded color index triangle. */ @@ -75,6 +76,7 @@ static void flat_ci_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -108,6 +110,7 @@ static void smooth_ci_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_INDEX 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ @@ -145,6 +148,7 @@ static void flat_rgba_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INNER_LOOP( LEFT, RIGHT, Y ) \ @@ -184,6 +188,7 @@ static void smooth_rgba_triangle( GLcontext *ctx, { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -293,6 +298,7 @@ static void simple_z_textured_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_INT_TEX 1 #define S_SCALE twidth @@ -360,6 +366,7 @@ static void affine_textured_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -689,6 +696,7 @@ static void near_persp_textured_triangle(GLcontext *ctx, #define BIAS 4096.0F #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -1420,6 +1428,7 @@ static void lin_persp_textured_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -1595,6 +1604,7 @@ static void general_textured_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -1689,6 +1699,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx, GLchan spec[MAX_WIDTH][4] ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_SPEC 1 @@ -1793,6 +1804,7 @@ static void lambda_textured_triangle1( GLcontext *ctx, GLfloat u[MAX_WIDTH] ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -1896,6 +1908,7 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx, GLfloat u[MAX_WIDTH] ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_SPEC 1 @@ -2012,6 +2025,7 @@ lambda_multitextured_triangle1( GLcontext *ctx, GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH]) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -2185,6 +2199,7 @@ static void occlusion_zless_triangle( GLcontext *ctx, #define DO_OCCLUSION_TEST #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index 254f0fd2d20..a854b995b89 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -1,4 +1,4 @@ -/* $Id: s_tritemp.h,v 1.12 2001/03/07 05:06:12 brianp Exp $ */ +/* $Id: s_tritemp.h,v 1.13 2001/03/08 17:33:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -33,9 +33,10 @@ * The following macros may be defined to indicate what auxillary information * must be interplated across the triangle: * INTERP_Z - if defined, interpolate Z values + * INTERP_FOG - if defined, interpolate fog values * INTERP_RGB - if defined, interpolate RGB values - * INTERP_SPEC - if defined, interpolate specular RGB values * INTERP_ALPHA - if defined, interpolate Alpha values + * INTERP_SPEC - if defined, interpolate specular RGB values * INTERP_INDEX - if defined, interpolate color index values * INTERP_INT_TEX - if defined, interpolate integer ST texcoords * (fast, simple 2-D texture mapping) @@ -253,6 +254,8 @@ GLint ltor; /* true if scanning left-to-right */ #ifdef INTERP_Z GLfloat dzdx, dzdy; GLfixed fdzdx; +#endif +#ifdef INTERP_FOG GLfloat dfogdx, dfogdy; GLfixed fdfogdx; #endif #ifdef INTERP_RGB @@ -332,6 +335,8 @@ else fdzdx = (GLint) dzdx; } +#endif +#ifdef INTERP_FOG { GLfloat eMaj_dfog, eBot_dfog; eMaj_dfog = (vMax->fog - vMin->fog) * 256; @@ -579,6 +584,8 @@ int dZRowOuter, dZRowInner; /* offset in bytes */ # endif GLfixed fz, fdzOuter, fdzInner; +#endif +#ifdef INTERP_FOG GLfixed ffog, fdfogOuter, fdfogInner; #endif #ifdef INTERP_RGB @@ -724,10 +731,11 @@ dZRowOuter = (ctx->DrawBuffer->Width + idxOuter) * sizeof(DEPTH_TYPE); # endif } - { - ffog = FloatToFixed(vLower->fog * 256 + dfogdx * adjx + dfogdy * adjy) + FIXED_HALF; - fdfogOuter = SignedFloatToFixed(dfogdy + dxOuter * dfogdx); - } +#endif +#ifdef INTERP_FOG + ffog = FloatToFixed(vLower->fog * 256 + dfogdx * adjx + + dfogdy * adjy) + FIXED_HALF; + fdfogOuter = SignedFloatToFixed(dfogdy + dxOuter * dfogdx); #endif #ifdef INTERP_RGB fr = (GLfixed)(IntToFixed(vLower->color[0]) @@ -841,6 +849,8 @@ dZRowInner = dZRowOuter + sizeof(DEPTH_TYPE); # endif fdzInner = fdzOuter + fdzdx; +#endif +#ifdef INTERP_FOG fdfogInner = fdfogOuter + fdfogdx; #endif #ifdef INTERP_RGB @@ -890,6 +900,8 @@ GLint right = FixedToInt(fxRightEdge); #ifdef INTERP_Z GLfixed ffz = fz; +#endif +#ifdef INTERP_FOG GLfixed fffog = ffog; #endif #ifdef INTERP_RGB @@ -1050,6 +1062,8 @@ zRow = (DEPTH_TYPE *) ((GLubyte*)zRow + dZRowOuter); # endif fz += fdzOuter; +#endif +#ifdef INTERP_FOG ffog += fdfogOuter; #endif #ifdef INTERP_RGB @@ -1096,6 +1110,8 @@ zRow = (DEPTH_TYPE *) ((GLubyte*)zRow + dZRowInner); # endif fz += fdzInner; +#endif +#ifdef INTERP_FOG ffog += fdfogInner; #endif #ifdef INTERP_RGB @@ -1149,6 +1165,7 @@ #undef PIXEL_ADDRESS #undef INTERP_Z +#undef INTERP_FOG #undef INTERP_RGB #undef INTERP_SPEC #undef INTERP_ALPHA |