From 1d52e3b5168379fe01f031616e4e125ac4c4e82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sun, 18 Nov 2018 10:28:20 +0100 Subject: [PATCH] Continue bar --- s3l.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/s3l.h b/s3l.h index 001ce34..22ca5f8 100644 --- a/s3l.h +++ b/s3l.h @@ -145,11 +145,7 @@ void S3L_drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2 S3L_UNIT *barycentric0; // bar. coord that gets higher from L to R S3L_UNIT *barycentric1; // bar. coord that gets higher from R to L - S3L_UNIT *barycentric2; // bar. coord that is computed from previous two - -barycentric0 = &p.barycentric0; -barycentric1 = &p.barycentric1; -barycentric2 = &p.barycentric2; + S3L_UNIT *barycentric2; // bar. coord that gets higher from bottom up // Sort the points. @@ -158,11 +154,15 @@ barycentric2 = &p.barycentric2; {\ lPointX = x##a; lPointY = y##a;\ rPointX = x##b; rPointY = y##b;\ + barycentric0 = &p.barycentric##b;\ + barycentric1 = &p.barycentric##a;\ }\ else\ {\ lPointX = x##b; lPointY = y##b;\ rPointX = x##a; rPointY = y##a;\ + barycentric0 = &p.barycentric##a;\ + barycentric1 = &p.barycentric##b;\ } if (y0 <= y1) @@ -171,12 +171,14 @@ barycentric2 = &p.barycentric2; { tPointX = x0; tPointY = y0; + barycentric2 = &p.barycentric0; handleLR(1,2) } else { tPointX = x2; tPointY = y2; + barycentric2 = &p.barycentric2; handleLR(0,1) } } @@ -186,12 +188,14 @@ barycentric2 = &p.barycentric2; { tPointX = x1; tPointY = y1; + barycentric2 = &p.barycentric1; handleLR(0,2) } else { tPointX = x2; tPointY = y2; + barycentric2 = &p.barycentric2; handleLR(0,1) } }