From 06226f323e9f5b471b0d0483ee8a31dfe09e5a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Fri, 10 May 2019 23:08:06 +0200 Subject: [PATCH] PC does something --- s3l.h | 15 +++------------ testSDL.c | 8 ++++---- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/s3l.h b/s3l.h index 1fc4b3f..e6fa259 100644 --- a/s3l.h +++ b/s3l.h @@ -847,8 +847,6 @@ void _S3L_drawFilledTriangle( S3L_Unit *barycentric1; // bar. coord that gets higher from R to L S3L_Unit *barycentric2; // bar. coord that gets higher from bottom up -printf("-------\n"); - // Sort the points. #define assignPoints(t,a,b)\ @@ -1030,8 +1028,6 @@ printf("-------\n"); initSide(l,l,r,0); manageSplit(0,2,r) -printf("split L\n"); - #if S3L_PERSPECTIVE_CORRECTION == 1 initPC(l,r,l) initPC(r,t,r) @@ -1043,8 +1039,6 @@ printf("split L\n"); initSide(r,r,l,0); manageSplit(1,2,l) -printf("split R\n"); - #if S3L_PERSPECTIVE_CORRECTION == 1 initPC(r,l,r) initPC(l,t,l) @@ -1071,9 +1065,6 @@ printf("split R\n"); lDepth = S3L_interpolateByUnit(lPC.a[2],lPC.b[2],lT); rDepth = S3L_interpolateByUnit(rPC.a[2],rPC.b[2],rT); -printf("l: %d %d\n",lSideUnitPosScaled >> S3L_LERP_QUALITY,lT); -printf("r: %d %d\n",rSideUnitPosScaled >> S3L_LERP_QUALITY,rT); - S3L_initPerspectiveCorrectionState( S3L_interpolateByUnit(lPC.a[0],lPC.b[0],lT), S3L_interpolateByUnit(lPC.a[1],lPC.b[1],lT), @@ -1094,14 +1085,14 @@ printf("r: %d %d\n",rSideUnitPosScaled >> S3L_LERP_QUALITY,rT); for (S3L_ScreenCoord x = lX; x < rX; ++x) { + #if S3L_PERSPECTIVE_CORRECTION == 1 S3L_Unit rowT = S3L_correctPerspective(S3L_interpolateFrom0(S3L_FRACTIONS_PER_UNIT, x - lX,rowLength),&rowPC); - *barycentric0 = S3L_interpolateByUnitFrom0(lT,rowT); - *barycentric1 = S3L_FRACTIONS_PER_UNIT - - S3L_interpolateByUnitFrom0(S3L_FRACTIONS_PER_UNIT - rT,S3L_FRACTIONS_PER_UNIT - rowT); + *barycentric0 = S3L_interpolateByUnitFrom0(rT,rowT); + *barycentric1 = S3L_interpolateByUnit(lT,0,rowT); #else *barycentric0 = b0 >> S3L_LERP_QUALITY; *barycentric1 = b1 >> S3L_LERP_QUALITY; diff --git a/testSDL.c b/testSDL.c index 3338e8e..592963c 100644 --- a/testSDL.c +++ b/testSDL.c @@ -119,11 +119,11 @@ void draw() //frame = 853; - modelTransform.rotation.z = 30;//frame * 0.1; - modelTransform.rotation.x = 90;//frame * 0.3; + modelTransform.rotation.z = frame * 0.1; + modelTransform.rotation.x = frame * 0.3; -// S3L_drawModelIndexed(ver,tri,12,modelTransform,&camera,&conf); - S3L_drawModelIndexed(ver,tri + 3,1,modelTransform,&camera,&conf); + S3L_drawModelIndexed(ver,tri,12,modelTransform,&camera,&conf); +// S3L_drawModelIndexed(ver,tri + 3,1,modelTransform,&camera,&conf); /* conf.backfaceCulling = S3L_BACKFACE_CULLING_NONE;