mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-21 20:39:57 +01:00
Rasterization pretty close now
This commit is contained in:
parent
d585310b97
commit
9e3de8c157
1 changed files with 4 additions and 4 deletions
8
s3l.h
8
s3l.h
|
@ -791,14 +791,14 @@ void S3L_drawTriangle(
|
||||||
infinite substracting loop */
|
infinite substracting loop */
|
||||||
|
|
||||||
#define stepSide(s)\
|
#define stepSide(s)\
|
||||||
while (s##Err >= s##Dy)\
|
while (s##Err > s##Dy)\
|
||||||
{\
|
{\
|
||||||
s##X += s##Inc;\
|
s##X += s##Inc;\
|
||||||
s##Err -= s##ErrSub;\
|
s##Err -= s##ErrSub;\
|
||||||
}\
|
}\
|
||||||
s##Err += s##ErrAdd;
|
s##Err += s##ErrAdd;
|
||||||
|
|
||||||
initSide(r,t,r,1,1)
|
initSide(r,t,r,1,0)
|
||||||
initSide(l,t,l,1,0)
|
initSide(l,t,l,1,0)
|
||||||
|
|
||||||
while (currentY < endY) /* draw the triangle from top to bottom -- the
|
while (currentY < endY) /* draw the triangle from top to bottom -- the
|
||||||
|
@ -821,7 +821,7 @@ void S3L_drawTriangle(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
initSide(r,r,l,0,1);
|
initSide(r,r,l,0,0);
|
||||||
|
|
||||||
S3L_Unit *tmp = barycentric1;
|
S3L_Unit *tmp = barycentric1;
|
||||||
barycentric1 = barycentric2;
|
barycentric1 = barycentric2;
|
||||||
|
@ -845,7 +845,7 @@ void S3L_drawTriangle(
|
||||||
S3L_Unit t1 = 0;
|
S3L_Unit t1 = 0;
|
||||||
S3L_Unit t2 = tMax;
|
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);
|
*barycentric0 = S3L_interpolateFrom0(rSideUnitPos,t1,tMax);
|
||||||
*barycentric1 = S3L_interpolateFrom0(lSideUnitPos,t2,tMax);
|
*barycentric1 = S3L_interpolateFrom0(lSideUnitPos,t2,tMax);
|
||||||
|
|
Loading…
Reference in a new issue