1#include "core/Scene.hpp"
2#include "interfaces/IHittable.hpp"
4#ifndef __BVH_NODE_HPP__
5 #define __BVH_NODE_HPP__
7namespace Raytracer::Utils
11 std::shared_ptr<Interfaces::IHittable> _left;
12 std::shared_ptr<Interfaces::IHittable> _right;
18 BVHNode(std::vector<std::shared_ptr<Interfaces::IHittable>> &objects,
19 size_t start,
size_t end);
23 static bool boxCompare(
const std::shared_ptr<Interfaces::IHittable> &a,
24 const std::shared_ptr<Interfaces::IHittable> &b,
int axis);
26 const std::shared_ptr<Interfaces::IHittable> &a,
27 const std::shared_ptr<Interfaces::IHittable> &b);
29 const std::shared_ptr<Interfaces::IHittable> &a,
30 const std::shared_ptr<Interfaces::IHittable> &b);
32 const std::shared_ptr<Interfaces::IHittable> &a,
33 const std::shared_ptr<Interfaces::IHittable> &b);
34 GET_SET(std::shared_ptr<Interfaces::IHittable>, left)
35 GET_SET(std::shared_ptr<Interfaces::IHittable>, right)
Definition Payload.hpp:11
Definition IHittable.hpp:11
Definition AxisAlignedBBox.hpp:10
AxisAlignedBBox boundingBox() const override
Get the bounding box of the BVHNode.
Definition BVHNode.cpp:105
static bool boxYCompare(const std::shared_ptr< Interfaces::IHittable > &a, const std::shared_ptr< Interfaces::IHittable > &b)
Compare two objects based on the y-axis.
Definition BVHNode.cpp:167
static bool boxXCompare(const std::shared_ptr< Interfaces::IHittable > &a, const std::shared_ptr< Interfaces::IHittable > &b)
Compare two objects based on the x-axis.
Definition BVHNode.cpp:147
static bool boxCompare(const std::shared_ptr< Interfaces::IHittable > &a, const std::shared_ptr< Interfaces::IHittable > &b, int axis)
Compare two objects based on the given axis.
Definition BVHNode.cpp:124
bool hit(const Core::Ray &ray, Interval interval, Core::Payload &payload) const override
Check if the ray hits the BVHNode.
Definition BVHNode.cpp:81
static bool boxZCompare(const std::shared_ptr< Interfaces::IHittable > &a, const std::shared_ptr< Interfaces::IHittable > &b)
Compare two objects based on the z-axis.
Definition BVHNode.cpp:187
Definition Interval.hpp:9