From cca1c2fcd4c2d42db2b90cd06c36546e82c418d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sat, 29 Jun 2019 18:15:14 +0200 Subject: [PATCH] DrawTriangle update --- small3dlib.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/small3dlib.h b/small3dlib.h index f030b45..f39c782 100644 --- a/small3dlib.h +++ b/small3dlib.h @@ -1928,13 +1928,13 @@ void S3L_drawTriangle( velues can be computed. See http://www.lysator.liu.se/~mikaelk/doc/perspectivetexture/ */ -#if S3L_PERSPECTIVE_CORRECTION == 1 - #define Z_RECIP_NUMERATOR\ - (S3L_FRACTIONS_PER_UNIT * S3L_FRACTIONS_PER_UNIT * S3L_FRACTIONS_PER_UNIT) -#elif S3L_PERSPECTIVE_CORRECTION == 2 - #define Z_RECIP_NUMERATOR\ - (S3L_FRACTIONS_PER_UNIT * S3L_FRACTIONS_PER_UNIT) -#endif + #if S3L_PERSPECTIVE_CORRECTION == 1 + #define Z_RECIP_NUMERATOR\ + (S3L_FRACTIONS_PER_UNIT * S3L_FRACTIONS_PER_UNIT * S3L_FRACTIONS_PER_UNIT) + #elif S3L_PERSPECTIVE_CORRECTION == 2 + #define Z_RECIP_NUMERATOR\ + (S3L_FRACTIONS_PER_UNIT * S3L_FRACTIONS_PER_UNIT) + #endif /* ^ This numerator is a number by which we divide values for the reciprocals. For PC == 2 it has to be lower because linear interpolation scaling would make it overflow -- this results in lower depth precision @@ -2251,16 +2251,18 @@ void S3L_drawTriangle( } // inner loop } // y clipping +#if !S3L_FLAT S3L_stepFastLerp(lSideFLS); S3L_stepFastLerp(rSideFLS); -#if S3L_COMPUTE_LERP_DEPTH + #if S3L_COMPUTE_LERP_DEPTH S3L_stepFastLerp(lDepthFLS); S3L_stepFastLerp(rDepthFLS); + #endif #endif ++currentY; - } + } // row drawing #undef manageSplit #undef initPC