From 1e6e77e84d412d5d7f942448d5c0504dbc7602b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?arvid=20schr=C3=B6der?= Date: Wed, 14 Dec 2022 12:10:31 +0100 Subject: [PATCH] remove divBy0 --- common/texture.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/texture.cpp b/common/texture.cpp index 49ce3e2..bf529e9 100644 --- a/common/texture.cpp +++ b/common/texture.cpp @@ -68,9 +68,9 @@ Color Texture::color(float u, float v, bool interpolate) const { Color x2y1 = this->getPixelAt(static_cast(x2), static_cast(y1)); Color x1y2 = this->getPixelAt(static_cast(x1), static_cast(y2)); Color x2y2 = this->getPixelAt(static_cast(x2), static_cast(y2)); - Color fxy1 = ((x2 - x) / (x2 - x1)) * x1y1 + ((x - x1) / (x2 - x1)) * x2y1; - Color fxy2 = ((x2 - x) / (x2 - x1)) * x1y2 + ((x - x1) / (x2 - x1)) * x2y2; - color = ((y2 - y) / (y2 - y1)) * fxy1 + ((y - y1) / (y2 - y1)) * fxy2; + Color fxy1 = (x2 - x) * x1y1 + (x - x1) * x2y1; + Color fxy2 = (x2 - x) * x1y2 + (x - x1) * x2y2; + color = (y2 - y) * fxy1 + (y - y1) * fxy2; } return color; }