Skip to content

Commit

Permalink
load mirror, glass from mtl
Browse files Browse the repository at this point in the history
  • Loading branch information
yumcyaWiz committed Nov 21, 2021
1 parent d9f743f commit d2d23db
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion include/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "primitive.h"
#include "tiny_obj_loader.h"

// create default BxDF
const std::shared_ptr<BxDF> createDefaultBxDF() {
return std::make_shared<Lambert>(Vec3(0.9f));
}
Expand All @@ -24,7 +25,20 @@ const std::shared_ptr<BxDF> createBxDF(const tinyobj::material_t& material) {
Vec3f(material.specular[0], material.specular[1], material.specular[2]);
const Vec3f ke =
Vec3f(material.emission[0], material.emission[1], material.emission[2]);
return std::make_shared<Lambert>(Vec3(0.9f));

switch (material.illum) {
case 2:
// lambert
return std::make_shared<Lambert>(kd);
case 5:
// mirror
return std::make_shared<Mirror>(Vec3(1.0f));
case 7:
// glass
return std::make_shared<Glass>(Vec3(1.0f), material.ior);
default:
return std::make_shared<Lambert>(kd);
}
}

// create AreaLight from tinyobj material
Expand Down

0 comments on commit d2d23db

Please sign in to comment.