remove divBy0

This commit is contained in:
arvid schröder 2022-12-14 12:10:31 +01:00
parent cf9e9175c2
commit 1e6e77e84d

View file

@ -68,9 +68,9 @@ Color Texture::color(float u, float v, bool interpolate) const {
Color x2y1 = this->getPixelAt(static_cast<int>(x2), static_cast<int>(y1)); Color x2y1 = this->getPixelAt(static_cast<int>(x2), static_cast<int>(y1));
Color x1y2 = this->getPixelAt(static_cast<int>(x1), static_cast<int>(y2)); Color x1y2 = this->getPixelAt(static_cast<int>(x1), static_cast<int>(y2));
Color x2y2 = this->getPixelAt(static_cast<int>(x2), static_cast<int>(y2)); Color x2y2 = this->getPixelAt(static_cast<int>(x2), static_cast<int>(y2));
Color fxy1 = ((x2 - x) / (x2 - x1)) * x1y1 + ((x - x1) / (x2 - x1)) * x2y1; Color fxy1 = (x2 - x) * x1y1 + (x - x1) * x2y1;
Color fxy2 = ((x2 - x) / (x2 - x1)) * x1y2 + ((x - x1) / (x2 - x1)) * x2y2; Color fxy2 = (x2 - x) * x1y2 + (x - x1) * x2y2;
color = ((y2 - y) / (y2 - y1)) * fxy1 + ((y - y1) / (y2 - y1)) * fxy2; color = (y2 - y) * fxy1 + (y - y1) * fxy2;
} }
return color; return color;
} }