Skip to content

Commit

Permalink
fix populating bxdfs, lights, primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
yumcyaWiz committed Nov 21, 2021
1 parent 8bd10ac commit 2c46552
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions include/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ 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>(kd);
return std::make_shared<Lambert>(Vec3(0.9f));
}

// create AreaLight from tinyobj material
Expand Down Expand Up @@ -239,16 +239,14 @@ class Scene {
std::shared_ptr<Light> light = nullptr;
if (material) {
const tinyobj::material_t& m = material.value();
light =
createAreaLight(m, &this->triangles[this->triangles.size() - 1]);
light = createAreaLight(m, &this->triangles[faceID]);
if (light != nullptr) {
lights.push_back(light);
}
}

// add primitive
primitives.emplace_back(&this->triangles[this->triangles.size() - 1],
this->bxdfs[this->bxdfs.size() - 1], light);
primitives.emplace_back(&this->triangles[faceID], this->bxdfs[this->bxdfs.size() - 1], light);
}

spdlog::info("[Scene] vertices: {}", nVertices());
Expand Down

0 comments on commit 2c46552

Please sign in to comment.