From 9e3de8c15791a1f7a66bfc13b7719bdec83fdf33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sun, 5 May 2019 17:27:54 +0200 Subject: [PATCH] Rasterization pretty close now --- s3l.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/s3l.h b/s3l.h index d432fe6..f2701a9 100644 --- a/s3l.h +++ b/s3l.h @@ -791,14 +791,14 @@ void S3L_drawTriangle( infinite substracting loop */ #define stepSide(s)\ - while (s##Err >= s##Dy)\ + while (s##Err > s##Dy)\ {\ s##X += s##Inc;\ s##Err -= s##ErrSub;\ }\ s##Err += s##ErrAdd; - initSide(r,t,r,1,1) + initSide(r,t,r,1,0) initSide(l,t,l,1,0) while (currentY < endY) /* draw the triangle from top to bottom -- the @@ -821,7 +821,7 @@ void S3L_drawTriangle( } else { - initSide(r,r,l,0,1); + initSide(r,r,l,0,0); S3L_Unit *tmp = barycentric1; barycentric1 = barycentric2; @@ -845,7 +845,7 @@ void S3L_drawTriangle( S3L_Unit t1 = 0; S3L_Unit t2 = tMax; - for (S3L_ScreenCoord x = lX; x <= rX; ++x) + for (S3L_ScreenCoord x = lX; x < rX; ++x) { *barycentric0 = S3L_interpolateFrom0(rSideUnitPos,t1,tMax); *barycentric1 = S3L_interpolateFrom0(lSideUnitPos,t2,tMax);