Skip to content

Commit

Permalink
fix bugs in arealight scene
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenxiZhou0619 committed Mar 11, 2023
1 parent 6322773 commit 1485c84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Moer-lite的框架基于Moer主干:https://github.com/NJUCG/Moer .
- bool OctreeAcceleration::rayIntersect
- 增加了`examples/lab1-test0`测试场景,用于测试加速结构的效率
- 目前可以修改配置文件中scene的acceleration参数用来测试不同的加速结构,现在可选的参数有`embree`(default)、`linear`(没有任何求交加速)、`octree`(需要实现)
- 修改了面光源存在时运行发生段错误

## TODO
- 对mesh和sphere实现表面采样(目前只有parallelogram可以配置为面光源)
Expand Down
4 changes: 3 additions & 1 deletion src/FunctionLayer/Scene/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ Scene::Scene(const Json &json) {
acceleration = Acceleration::createAcceleration();

//* 添加几何体
int geomID = 0;
auto shapes = json["shapes"];
for (int i = 0; i < shapes.size(); ++i) {
auto shape = Factory::construct_class<Shape>(shapes[i]);
shape->geometryID = i;
shape->geometryID = geomID++;
acceleration->attachShape(shape);
}
//* 添加光源
Expand All @@ -34,6 +35,7 @@ Scene::Scene(const Json &json) {
if (light->type == LightType::AreaLight) {
auto shape = std::static_pointer_cast<AreaLight>(light)->shape;
shape->light = light;
shape->geometryID = geomID++;
acceleration->attachShape(shape);
}
}
Expand Down

0 comments on commit 1485c84

Please sign in to comment.