31 lines
871 B
C
Raw Permalink Normal View History

2022-04-07 18:46:57 +02:00
#pragma once
#include <vector>
#include <nori/mesh.h>
NORI_NAMESPACE_BEGIN
class OctreeNode {
public:
//Constructor for Internal Node
OctreeNode(BoundingBox3f bbox) : m_bbox(bbox) {};
//Constructor for Leaf Node
OctreeNode(BoundingBox3f bbox, std::vector<uint32_t>* triangle_ids) : m_triangle_ids(*triangle_ids), m_bbox(bbox) {};
//Computes the Statistics of the Octree Node
void computeStats(size_t* internal, size_t* leaf, size_t* triangles);
OctreeNode* m_child_nodes[8] = {0}; ///< Child Nodes (Branch)
std::vector<uint32_t> m_triangle_ids; ///< Triangle Ids (Leaf)
BoundingBox3f m_bbox; ///< Bounding Box
private:
};
//Creates a Octree Node
OctreeNode* octreenode_builder(Mesh* mesh, BoundingBox3f bbox, std::vector<uint32_t>* triangle_ids, int depth);
NORI_NAMESPACE_END