Commit c75ad0f2 authored by Johannes Braun's avatar Johannes Braun
Browse files

Fixed BVH errors

parent b9b946cc
......@@ -108,10 +108,10 @@ namespace glare
//quitPromptDefault(0);
//initializeScene(m_current_scene_root / "artifact_suzanne_x2_glass_0r.dae", 1.f);
//initializeScene(m_current_scene_root / "cube.dae", 1.f);
initializeScene(m_current_scene_root / "glass.dae", 1.f);
//initializeScene(m_current_scene_root / "artifact_suzanne_x2_mirror_0r.dae", 1.f);
//initializeScene(m_current_scene_root / "artifact_suzanne_x2_transparent.dae", 1.f);
initializeScene(m_current_scene_root / "benchmark_stfd_bunny_diff.dae", 1.f);
//initializeScene(m_current_scene_root / "benchmark_stfd_bunny_diff.dae", 1.f);
//initializeScene(m_current_scene_root / "difficult.dae", 1.f);
initializeRenderRequirements();
......
......@@ -231,9 +231,10 @@ namespace glare
return 2.f * glm::dot(glm::vec3(size.x, size.x, size.y), glm::vec3(size.y, size.z, size.z));
}
bool Bounds::empty() const
bool Bounds::notEmpty() const
{
return glm::length(size()) == 0;
auto s = size();
return s.x > 0 && s.y > 0 && s.z > 0;
}
int Bounds::largest() const
......
......@@ -246,7 +246,7 @@ namespace glare
float surface() const;
bool empty() const;
bool notEmpty() const;
int largest() const;
......
......@@ -248,7 +248,7 @@ namespace glare
//centboxes cover the centroids of the triangles, not the whole objects
const math::Bounds centroid_box = m_centroid_boxes[global_id];
const bool splitting = parent < 0 || !centroid_box.empty();
const bool splitting = parent < 0 || centroid_box.notEmpty();
// since the thread will now be processed the value of the kernel_counter is decreased
--m_kernel_counter;
......
......@@ -68,6 +68,7 @@ namespace glare
{
centroid_box.expand(b);
}
centroid_box.max = glm::max(centroid_box.max, centroid_box.min + glm::vec4(1e-5));
m_centroid_boxes[0] = centroid_box;
}
......@@ -159,7 +160,7 @@ namespace glare
//centboxes cover the centroids of the triangles, not the whole objects
const math::Bounds centroid_box = m_centroid_boxes[global_id];
const bool splitting = parent < 0 || !centroid_box.empty();
const bool splitting = parent < 0 || centroid_box.notEmpty();
// since the thread will now be processed the value of the kernel_counter is decreased
--m_kernel_counter;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment