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; }