WIP: Test Embree alternative to Blender BVH trees #108148

Draft
Lukas Tönne wants to merge 12 commits from LukasTonne/blender:bvh-embree into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 6 additions and 1 deletions
Showing only changes of commit 0d0891f840 - Show all commits

View File

@ -5,6 +5,7 @@
#include "BLI_math_vector_types.hh"
struct Mesh;
struct RTCDeviceTy;
struct RTCSceneTy;
namespace blender {
@ -59,6 +60,7 @@ struct BVHRayHit {
class BVHTree {
private:
RTCDeviceTy *rtc_device = nullptr;
RTCSceneTy *rtc_scene = nullptr;
public:

View File

@ -25,6 +25,7 @@ BVHTree::BVHTree()
BVHTree::~BVHTree()
{
free();
}
static void rtc_error_func(void *, enum RTCError, const char *str)
@ -45,6 +46,8 @@ void BVHTree::free()
{
rtcReleaseScene(rtc_scene);
rtc_scene = nullptr;
rtcReleaseDevice(rtc_device);
rtc_device = nullptr;
}
namespace {
@ -169,7 +172,7 @@ void add_mesh(BvhBuildContext ctx, int id, const Mesh &mesh)
void BVHTree::build_single_mesh(const Mesh &mesh)
{
RTCDevice rtc_device = rtcNewDevice("verbose=0");
rtc_device = rtcNewDevice("verbose=0");
BLI_assert(rtc_device);
rtcSetDeviceErrorFunction(rtc_device, rtc_error_func, nullptr);