From 8706ad19a8b29073afeece115092f03cbbf369c4 Mon Sep 17 00:00:00 2001 From: quou Date: Wed, 3 Jul 2024 21:27:03 +1000 Subject: persp protects against divide by zero. --- maths.c | 1 + 1 file changed, 1 insertion(+) diff --git a/maths.c b/maths.c index 5ec40d7..db11491 100644 --- a/maths.c +++ b/maths.c @@ -229,6 +229,7 @@ int* vec_cpy(int* d, const int* s, int c) { } void persp(int* v, int asp) { + v[2] += !v[2]; v[0] = ((v[0] << fbits) / v[2]); v[1] = ((v[1] << fbits) / v[2]) * asp >> fbits; v[2] = f1; -- cgit v1.2.3-54-g00ecf