mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-24 21:09:57 +01:00
Fix triangle flicker
This commit is contained in:
parent
d9ed6e322e
commit
85cadda3b3
2 changed files with 7 additions and 7 deletions
4
s3l.h
4
s3l.h
|
@ -876,7 +876,7 @@ void _S3L_drawFilledTriangle(
|
|||
int16_t bDx = x##b - x##t;\
|
||||
int16_t aDy = S3L_nonZero(y##a - y##t);\
|
||||
int16_t bDy = S3L_nonZero(y##b - y##t);\
|
||||
if ((aDx << 4) / aDy < (bDx << 4) / bDy)\
|
||||
if ((aDx << 5) / aDy < (bDx << 5) / bDy)\
|
||||
{\
|
||||
lPointSx = x##a; lPointSy = y##a;\
|
||||
rPointSx = x##b; rPointSy = y##b;\
|
||||
|
@ -1175,10 +1175,8 @@ void S3L_drawTriangle(S3L_Vec4 point0, S3L_Vec4 point1, S3L_Vec4 point2,
|
|||
const S3L_DrawConfig *config, const S3L_Camera *camera,
|
||||
S3L_Index triangleID)
|
||||
{
|
||||
|
||||
if (config->backfaceCulling != S3L_BACKFACE_CULLING_NONE)
|
||||
{
|
||||
|
||||
int32_t winding = // determines CW or CCW
|
||||
(
|
||||
(point1.y - point0.y) * (point2.x - point1.x) -
|
||||
|
|
10
testSDL.c
10
testSDL.c
|
@ -129,11 +129,13 @@ void draw()
|
|||
|
||||
clearScreen();
|
||||
|
||||
modelTransform.rotation.z = frame * 0.1;
|
||||
modelTransform.rotation.x = frame * 0.3;
|
||||
uint32_t f = frame;
|
||||
|
||||
modelTransform.translation.x = sin(frame >> 7) * 700;
|
||||
modelTransform.translation.y = sin(frame >> 8) * 600;
|
||||
modelTransform.rotation.z = f * 0.1;
|
||||
modelTransform.rotation.x = f * 0.3;
|
||||
|
||||
modelTransform.translation.x = sin(f >> 7) * 700;
|
||||
modelTransform.translation.y = sin(f >> 8) * 600;
|
||||
|
||||
S3L_drawModelIndexed(ver,tri,12,modelTransform,&camera,&conf);
|
||||
|
||||
|
|
Loading…
Reference in a new issue