1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-24 21:09:57 +01:00

Advance barycentric

This commit is contained in:
Miloslav Číž 2018-11-18 09:33:15 +01:00
parent d3a3e12f33
commit 85f48c1d79
2 changed files with 10 additions and 6 deletions

7
s3l.h
View file

@ -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;
}
}

View file

@ -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],