Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
yumcyaWiz committed Nov 21, 2021
1 parent 2c46552 commit d9f743f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class Scene {
faceID);
}

// populate bxdfs, lights, primitives
// populate bxdfs
for (size_t faceID = 0; faceID < nFaces(); ++faceID) {
// add bxdf
// TODO: remove duplicate
Expand All @@ -234,9 +234,13 @@ class Scene {
else {
this->bxdfs.push_back(createDefaultBxDF());
}
}

// populate lights, primitives
for (size_t faceID = 0; faceID < nFaces(); ++faceID) {
// add light
std::shared_ptr<Light> light = nullptr;
const auto material = this->materials[faceID];
if (material) {
const tinyobj::material_t& m = material.value();
light = createAreaLight(m, &this->triangles[faceID]);
Expand All @@ -246,7 +250,8 @@ class Scene {
}

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

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

0 comments on commit d9f743f

Please sign in to comment.