diff --git a/s3l.h b/s3l.h index c24670c..759958a 100644 --- a/s3l.h +++ b/s3l.h @@ -273,7 +273,6 @@ void S3L_drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2 initSide(l,l,r,0); barycentric1 = &p.barycentricC; - barycentric2 = &p.barycentricB; barycentric3 = &p.barycentricA; rSideUnitPos = S3L_FRACTIONS_PER_UNIT - rSideUnitPos; @@ -283,7 +282,11 @@ void S3L_drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2 { initSide(r,r,l,0); - // TODO + barycentric2 = &p.barycentricC; + barycentric3 = &p.barycentricB; + + lSideUnitPos = S3L_FRACTIONS_PER_UNIT - lSideUnitPos; + lSideUnitStep *= -1; } } diff --git a/testSDL.c b/testSDL.c index 17877b3..c4ccdbd 100644 --- a/testSDL.c +++ b/testSDL.c @@ -48,16 +48,17 @@ const int16_t test_coords[] = 100,100, 99,101, 101,101, // 0, small triangle 190,50, 200,10, 400,80, // 1, arbitrary 40,80, 20,50, 100,30, // 2, arbitrary - 150,300, 290,400, 450,400, // 3, regular - 105,300, 120,300, 201,300, // 4, horizontal line - 400,300, 400,320, 400,400 // 5, vertical line + 350,270, 440,200, 490,220, // 3, arbitrary + 150,300, 290,400, 450,400, // 4, regular + 105,200, 120,200, 201,200, // 5, horizontal line + 300,200, 300,250, 300,220 // 6, vertical line }; void draw() { clearScreen(); - for (int c = 0; c < 4; ++c) + for (int c = 0; c < 7; ++c) { int x0 = test_coords[6 * c],