From 15df512cc986b167acb5fc95c32e65833e43280c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Tue, 21 May 2019 16:27:13 +0200 Subject: [PATCH] Add persp. corr. depth --- s3l.h | 4 ++++ testSDL.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/s3l.h b/s3l.h index dedbc45..ba0eb87 100644 --- a/s3l.h +++ b/s3l.h @@ -1421,6 +1421,10 @@ void _S3L_drawFilledTriangle( *barycentric1 = S3L_interpolateByUnitFrom0(lT,S3L_FRACTIONS_PER_UNIT - rowT); + + #if S3L_COMPUTE_DEPTH + p->depth = S3L_interpolateByUnit(lDepth,rDepth,rowT); + #endif #else *barycentric0 = S3L_getFastLerpValue(b0FLS); *barycentric1 = S3L_getFastLerpValue(b1FLS); diff --git a/testSDL.c b/testSDL.c index dde4d92..78857cd 100644 --- a/testSDL.c +++ b/testSDL.c @@ -13,7 +13,7 @@ #define S3L_RESOLUTION_Y 480 #define S3L_COMPUTE_DEPTH 1 -#define S3L_PERSPECTIVE_CORRECTION 0 +#define S3L_PERSPECTIVE_CORRECTION 1 #include "s3l.h"