dev-VirtualTexture
wuyize 2022-08-08 13:14:28 +08:00
commit 950a6d7526
1 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ QVector4D BvhTree::Union(QVector4D a, QVector4D b) {
QVector4D BvhTree::calcBound(QVector4D initBound[], int l, int r) {
QVector4D res = initBound[l];
for (int i = l + 1; i < r; i++) {
for (int i = l + 1; i <= r; i++) {
res = Union(res, initBound[i]);
}
return res;
@ -34,9 +34,9 @@ bvhPtr BvhTree::subBvhTree(QVector4D initBound[], int l, int r) {
if (l == r) return p;
int dim = p.get()->maximumBound();
if (dim == 0) {
std::sort(initBound + l, initBound + r, BvhNode::x_compare);
std::sort(initBound + l, initBound + r+1, BvhNode::x_compare);
} else {
std::sort(initBound + l, initBound + r, BvhNode::y_compare);
std::sort(initBound + l, initBound + r+1, BvhNode::y_compare);
}
int mid = (l + r) >> 1;
p.get()->child[0] = subBvhTree(initBound, l, mid);