Removed code duplicates
This commit is contained in:
parent
78b0a4f455
commit
eeed0e23a7
1 changed files with 6 additions and 4 deletions
|
@ -56,12 +56,14 @@ Color Texture::color(float u, float v, bool interpolate) const {
|
|||
color = this->getPixelAt(int(roundf(u * this->width())), int(roundf(v * this->height())));
|
||||
} else {
|
||||
// IMPLEMENT bilinear interpolation
|
||||
float x1 = std::floor(u * this->width());
|
||||
float x2 = std::ceil(u * this->width());
|
||||
float y1 = std::floor(v * this->height());
|
||||
float y2 = std::ceil(v * this->height());
|
||||
float x = u * this->width();
|
||||
float x1 = std::floor(x);
|
||||
float x2 = std::ceil(x);
|
||||
|
||||
float y = v * this->height();
|
||||
float y1 = std::floor(y);
|
||||
float y2 = std::ceil(y);
|
||||
|
||||
Color x1y1 = this->getPixelAt(static_cast<int>(x1), 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));
|
||||
|
|
Loading…
Reference in a new issue