From 48d9c131adccbd66b0e885ac3f386fe4c87eb179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Thu, 13 Jun 2013 17:45:26 +0200 Subject: [PATCH] Finally attained perspective correctness --- src/rendering/render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rendering/render.c b/src/rendering/render.c index 51210d2..2f13971 100644 --- a/src/rendering/render.c +++ b/src/rendering/render.c @@ -390,7 +390,7 @@ static void _scanInterpolate(CameraDefinition* camera, ScanPoint* v1, ScanPoint* result->pixel.x = v1->pixel.x + diff->pixel.x * value; result->pixel.y = v1->pixel.y + diff->pixel.y * value; - result->pixel.z = ((1.0 - value) * (v1->pixel.z / v1depth) + value * (v1->pixel.z + diff->pixel.z) / v2depth) / factor; + result->pixel.z = v1->pixel.z + diff->pixel.z * value; result->location.x = ((1.0 - value) * (v1->location.x / v1depth) + value * (v1->location.x + diff->location.x) / v2depth) / factor; result->location.y = ((1.0 - value) * (v1->location.y / v1depth) + value * (v1->location.y + diff->location.y) / v2depth) / factor; result->location.z = ((1.0 - value) * (v1->location.z / v1depth) + value * (v1->location.z + diff->location.z) / v2depth) / factor;