TinyRenderer: support plane shape (creating similar textured plane to OpenGL renderer)

TinyRenderer: perform clipping in double precision to improve accuracy
This commit is contained in:
Erwin Coumans
2020-08-10 20:19:00 -07:00
parent 038cc196e1
commit ff229baf1e
6 changed files with 151 additions and 29 deletions
+4 -4
View File
@@ -166,10 +166,10 @@ TGAColor Model::diffuse(Vec2f uvf)
// bool repeat = true;
// if (repeat)
{
uvf[0] = std::modf(uvf[0], &val);
uvf[1] = std::modf(uvf[1], &val);
}
Vec2i uv(uvf[0] * diffusemap_.get_width(), uvf[1] * diffusemap_.get_height());
uvf[0] = std::modf(uvf[0], &val);
uvf[1] = std::modf(uvf[1], &val);
}
Vec2i uv(uvf[0] * diffusemap_.get_width(), uvf[1] * diffusemap_.get_height());
return diffusemap_.get(uv[0], uv[1]);
}
return TGAColor(255, 255, 255, 255);