mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-24 21:09:57 +01:00
PC does something
This commit is contained in:
parent
438c4d7db3
commit
06226f323e
2 changed files with 7 additions and 16 deletions
15
s3l.h
15
s3l.h
|
@ -847,8 +847,6 @@ void _S3L_drawFilledTriangle(
|
||||||
S3L_Unit *barycentric1; // bar. coord that gets higher from R to L
|
S3L_Unit *barycentric1; // bar. coord that gets higher from R to L
|
||||||
S3L_Unit *barycentric2; // bar. coord that gets higher from bottom up
|
S3L_Unit *barycentric2; // bar. coord that gets higher from bottom up
|
||||||
|
|
||||||
printf("-------\n");
|
|
||||||
|
|
||||||
// Sort the points.
|
// Sort the points.
|
||||||
|
|
||||||
#define assignPoints(t,a,b)\
|
#define assignPoints(t,a,b)\
|
||||||
|
@ -1030,8 +1028,6 @@ printf("-------\n");
|
||||||
initSide(l,l,r,0);
|
initSide(l,l,r,0);
|
||||||
manageSplit(0,2,r)
|
manageSplit(0,2,r)
|
||||||
|
|
||||||
printf("split L\n");
|
|
||||||
|
|
||||||
#if S3L_PERSPECTIVE_CORRECTION == 1
|
#if S3L_PERSPECTIVE_CORRECTION == 1
|
||||||
initPC(l,r,l)
|
initPC(l,r,l)
|
||||||
initPC(r,t,r)
|
initPC(r,t,r)
|
||||||
|
@ -1043,8 +1039,6 @@ printf("split L\n");
|
||||||
initSide(r,r,l,0);
|
initSide(r,r,l,0);
|
||||||
manageSplit(1,2,l)
|
manageSplit(1,2,l)
|
||||||
|
|
||||||
printf("split R\n");
|
|
||||||
|
|
||||||
#if S3L_PERSPECTIVE_CORRECTION == 1
|
#if S3L_PERSPECTIVE_CORRECTION == 1
|
||||||
initPC(r,l,r)
|
initPC(r,l,r)
|
||||||
initPC(l,t,l)
|
initPC(l,t,l)
|
||||||
|
@ -1071,9 +1065,6 @@ printf("split R\n");
|
||||||
lDepth = S3L_interpolateByUnit(lPC.a[2],lPC.b[2],lT);
|
lDepth = S3L_interpolateByUnit(lPC.a[2],lPC.b[2],lT);
|
||||||
rDepth = S3L_interpolateByUnit(rPC.a[2],rPC.b[2],rT);
|
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_initPerspectiveCorrectionState(
|
||||||
S3L_interpolateByUnit(lPC.a[0],lPC.b[0],lT),
|
S3L_interpolateByUnit(lPC.a[0],lPC.b[0],lT),
|
||||||
S3L_interpolateByUnit(lPC.a[1],lPC.b[1],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)
|
for (S3L_ScreenCoord x = lX; x < rX; ++x)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if S3L_PERSPECTIVE_CORRECTION == 1
|
#if S3L_PERSPECTIVE_CORRECTION == 1
|
||||||
S3L_Unit rowT =
|
S3L_Unit rowT =
|
||||||
S3L_correctPerspective(S3L_interpolateFrom0(S3L_FRACTIONS_PER_UNIT,
|
S3L_correctPerspective(S3L_interpolateFrom0(S3L_FRACTIONS_PER_UNIT,
|
||||||
x - lX,rowLength),&rowPC);
|
x - lX,rowLength),&rowPC);
|
||||||
|
|
||||||
*barycentric0 = S3L_interpolateByUnitFrom0(lT,rowT);
|
*barycentric0 = S3L_interpolateByUnitFrom0(rT,rowT);
|
||||||
*barycentric1 = S3L_FRACTIONS_PER_UNIT -
|
*barycentric1 = S3L_interpolateByUnit(lT,0,rowT);
|
||||||
S3L_interpolateByUnitFrom0(S3L_FRACTIONS_PER_UNIT - rT,S3L_FRACTIONS_PER_UNIT - rowT);
|
|
||||||
#else
|
#else
|
||||||
*barycentric0 = b0 >> S3L_LERP_QUALITY;
|
*barycentric0 = b0 >> S3L_LERP_QUALITY;
|
||||||
*barycentric1 = b1 >> S3L_LERP_QUALITY;
|
*barycentric1 = b1 >> S3L_LERP_QUALITY;
|
||||||
|
|
|
@ -119,11 +119,11 @@ void draw()
|
||||||
|
|
||||||
//frame = 853;
|
//frame = 853;
|
||||||
|
|
||||||
modelTransform.rotation.z = 30;//frame * 0.1;
|
modelTransform.rotation.z = frame * 0.1;
|
||||||
modelTransform.rotation.x = 90;//frame * 0.3;
|
modelTransform.rotation.x = frame * 0.3;
|
||||||
|
|
||||||
// S3L_drawModelIndexed(ver,tri,12,modelTransform,&camera,&conf);
|
S3L_drawModelIndexed(ver,tri,12,modelTransform,&camera,&conf);
|
||||||
S3L_drawModelIndexed(ver,tri + 3,1,modelTransform,&camera,&conf);
|
// S3L_drawModelIndexed(ver,tri + 3,1,modelTransform,&camera,&conf);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
conf.backfaceCulling = S3L_BACKFACE_CULLING_NONE;
|
conf.backfaceCulling = S3L_BACKFACE_CULLING_NONE;
|
||||||
|
|
Loading…
Reference in a new issue