mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-21 20:39:57 +01:00
Fix nner loop bu
This commit is contained in:
parent
668bb0a44c
commit
cc2e1f08ef
2 changed files with 37 additions and 29 deletions
30
small3dlib.h
30
small3dlib.h
|
@ -1519,7 +1519,7 @@ void S3L_drawTriangle(
|
|||
}
|
||||
|
||||
#if S3L_PERSPECTIVE_CORRECTION == 1
|
||||
S3L_ScreenCoord i = lXClipped - lX - 1; /* helper var to save one
|
||||
S3L_ScreenCoord i = lXClipped - lX; /* helper var to save one
|
||||
substraction in the inner
|
||||
loop */
|
||||
#endif
|
||||
|
@ -1528,14 +1528,11 @@ void S3L_drawTriangle(
|
|||
|
||||
for (S3L_ScreenCoord x = lXClipped; x < rXClipped; ++x)
|
||||
{
|
||||
#if S3L_PERSPECTIVE_CORRECTION == 1
|
||||
++i; /* Has to be done here, because the following tests can skip the
|
||||
the rest of the loop. */
|
||||
#endif
|
||||
int8_t testsPassed = 1;
|
||||
|
||||
#if S3L_STENCIL_BUFFER
|
||||
if (!S3L_stencilTest(x,p.y))
|
||||
continue;
|
||||
testsPassed = 0;
|
||||
#endif
|
||||
p.x = x;
|
||||
|
||||
|
@ -1551,9 +1548,11 @@ void S3L_drawTriangle(
|
|||
|
||||
#if S3L_Z_BUFFER
|
||||
if (!S3L_zTest(p.x,p.y,p.depth))
|
||||
continue;
|
||||
testsPassed = 0;
|
||||
#endif
|
||||
|
||||
if (testsPassed)
|
||||
{
|
||||
#if !S3L_FLAT
|
||||
#if S3L_PERSPECTIVE_CORRECTION == 1
|
||||
*barycentric0 =
|
||||
|
@ -1570,16 +1569,25 @@ void S3L_drawTriangle(
|
|||
#else
|
||||
*barycentric0 = S3L_getFastLerpValue(b0FLS);
|
||||
*barycentric1 = S3L_getFastLerpValue(b1FLS);
|
||||
|
||||
S3L_stepFastLerp(b0FLS);
|
||||
S3L_stepFastLerp(b1FLS);
|
||||
#endif
|
||||
|
||||
*barycentric2 = S3L_FRACTIONS_PER_UNIT - *barycentric0 - *barycentric1;
|
||||
*barycentric2 =
|
||||
S3L_FRACTIONS_PER_UNIT - *barycentric0 - *barycentric1;
|
||||
#endif
|
||||
|
||||
S3L_PIXEL_FUNCTION(&p);
|
||||
}
|
||||
|
||||
#if !S3L_FLAT
|
||||
#if S3L_PERSPECTIVE_CORRECTION == 1
|
||||
i++;
|
||||
#else
|
||||
S3L_stepFastLerp(b0FLS);
|
||||
S3L_stepFastLerp(b1FLS);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // inner loop
|
||||
} // y clipping
|
||||
|
||||
S3L_stepFastLerp(lSideFLS);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#define S3L_FLAT 0
|
||||
#define S3L_STRICT_NEAR_CULLING 0
|
||||
#define S3L_PERSPECTIVE_CORRECTION 1
|
||||
#define S3L_PERSPECTIVE_CORRECTION 0
|
||||
#define S3L_SORT 0
|
||||
#define S3L_Z_BUFFER 1
|
||||
|
||||
|
|
Loading…
Reference in a new issue