Skip to content

Commit

Permalink
Merge branch 'main' of github.com:NJUCG/Moer-lite into main
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
xiaoyaoing committed Mar 20, 2023
2 parents bd510d1 + 1485c84 commit 74edc10
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Moer-lite的框架基于Moer主干:https://github.com/NJUCG/Moer .
- bool Octree::rayIntersect
- 增加了`examples/lab1-test0`测试场景,用于测试加速结构的效率
- 目前可以修改配置文件中scene的acceleration参数用来测试不同的加速结构,现在可选的参数有`embree`(default)、`linear`(没有任何求交加速)、`octree`(需要实现)
- 修改了面光源存在时运行发生段错误
- 2023-3-18
lab1有关内容更新 具体请看实验手册

## TODO
- 对mesh和sphere实现表面采样(目前只有parallelogram可以配置为面光源)
- 加速环境光的采样
1 change: 1 addition & 0 deletions src/FunctionLayer/Acceleration/BVH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ void BVH::build() {
}
bool BVH::rayIntersect(Ray &ray, int *geomID, int *primID, float *u, float *v) const {
//* todo 完成BVH求交
return false;
}


4 changes: 3 additions & 1 deletion src/FunctionLayer/Acceleration/Octree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ struct Octree::OctreeNode {
AABB boundingBox;
std::shared_ptr<OctreeNode> subNodes[8];
int primCount = -1;
int primIdxBuffer[MAX_LEAF_SIZE];
int primIdxBuffer[ocLeafMaxSize];
};
Octree::OctreeNode * Octree::recursiveBuild(const AABB &aabb,
const std::vector<int> &primIdxBuffer) {
//* todo 完成递归构建八叉树
//* 构建方法请看实验手册
//* 要注意的一种特殊是当节点的某个子包围盒和当前节点所有物体都相交,我们就不用细分了,当前节点作为叶子节点即可。
return nullptr;
}
void Octree::build() {
//* 首先计算整个场景的范围
Expand All @@ -33,4 +34,5 @@ void Octree::build() {
bool Octree::rayIntersect(Ray &ray, int *geomID, int *primID,
float *u, float *v) const {
//*todo 完成八叉树求交
return false;
}
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
1 change: 1 addition & 0 deletions src/FunctionLayer/Shape/Cone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ bool Cone::rayIntersectShape(Ray &ray, int *primID, float *u, float *v) const {
//* 3.检验交点是否在圆锥范围内
//* 4.更新ray的tFar,减少光线和其他物体的相交计算次数
//* Write your code here.
return false;
}

void Cone::fillIntersection(float distance, int primID, float u, float v, Intersection *intersection) const {
Expand Down
1 change: 1 addition & 0 deletions src/FunctionLayer/Shape/Cylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ bool Cylinder::rayIntersectShape(Ray &ray, int *primID, float *u, float *v) cons
//* 3.检验交点是否在圆柱范围内
//* 4.更新ray的tFar,减少光线和其他物体的相交计算次数
//* Write your code here.
return false;
}

void Cylinder::fillIntersection(float distance, int primID, float u, float v, Intersection *intersection) const {
Expand Down
1 change: 1 addition & 0 deletions src/FunctionLayer/Shape/Disk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ bool Disk::rayIntersectShape(Ray &ray, int *primID, float *u, float *v) const {
//* 4.检验交点是否在圆环内
//* 5.更新ray的tFar,减少光线和其他物体的相交计算次数
//* Write your code here.
return false;
}

void Disk::fillIntersection(float distance, int primID, float u, float v, Intersection *intersection) const {
Expand Down

0 comments on commit 74edc10

Please sign in to comment.