initial hookup of TinyRenderer to shared memory interface

This commit is contained in:
Erwin Coumans
2016-06-01 17:47:41 -07:00
parent 9a5394c4bc
commit aa4d2ae01d
13 changed files with 129 additions and 40 deletions

View File

@@ -130,8 +130,12 @@ void Model::load_texture(std::string filename, const char *suffix, TGAImage &img
}
TGAColor Model::diffuse(Vec2f uvf) {
Vec2i uv(uvf[0]*diffusemap_.get_width(), uvf[1]*diffusemap_.get_height());
return diffusemap_.get(uv[0], uv[1]);
if (diffusemap_.get_width() && diffusemap_.get_height())
{
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);
}
Vec3f Model::normal(Vec2f uvf) {