/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* TopBVH.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ycontre +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/01/16 21:36:19 by TheRed #+# #+# */ /* Updated: 2025/01/17 18:59:28 by ycontre ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef RT_TOPBVH__HPP # define RT_TOPBVH__HPP # include "RT.hpp" struct GPUBvhData; struct GPUTopBvh; struct AABB; class TopBVH { public: TopBVH(std::vector &bvhs_data, std::vector &bvhs, int first_bvh, int bvh_count); void updateBounds(std::vector &bvhs_data, std::vector &bvhs); void subdivide(std::vector &bvhs_data, std::vector &bvhs); float evaluateSah(std::vector &bvhs_data, std::vector &bvhs, int axis, float pos); int getSize(); // int getLeaves(); // void flatten(std::vector &TopBVHs, int ¤tIndex); // GPUTopBvh toGPUTopBvh(); std::vector getGPUTopBvhs(); void flatten(std::vector &top_bvhs, int ¤tIndex); // const AABB &getAABB() const; // std::vector getGPUTopBvhs(); private: AABB _aabb; TopBVH *_left; TopBVH *_right; bool _is_leaf; int _first_bvh; int _bvh_count; }; #endif