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.
37 lines
700 B
37 lines
700 B
2 years ago
|
//
|
||
|
// 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
|