Intelligent Sigend Distance Fields
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
700 B

//
// Created by dtouch on 23-5-14.
//
#ifndef RENDERSDF_BVH_H
#define RENDERSDF_BVH_H
#include "aabb.h"
#include "rod.h"
#include "vector"
typedef struct BVHNode {
AABB box;
BVHNode *left{};
BVHNode *right{};
// int start{}; // start index of the triangle list
// int end{}; // end index of the triangle list
// int rodCnt;
std::vector<int> rods;
} BVHNode;
class RodBVH {
int maxDepth{};
int maxLeafSize{};
BVHNode *root{};
RodCrystal rodCrystal;
public:
explicit RodBVH(RodCrystal _rodCrystal);
void build();
private:
void recursiveBuild(BVHNode*node);
void quickSelect(std::vector<int>& rods, int axis);
};
#endif //RENDERSDF_BVH_H