refactor(Core/Misc): add braces and impove codestyle (#6402)

This commit is contained in:
Kargatum
2021-06-25 00:50:18 +07:00
committed by GitHub
parent 33c271cc7c
commit 3c24b511f2
72 changed files with 1486 additions and 401 deletions

View File

@@ -47,7 +47,9 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
// perform quick consistency checks
G3D::Vector3 d( gridBox.hi - gridBox.lo );
if (d.x < 0 || d.y < 0 || d.z < 0)
{
throw std::logic_error("negative node extents");
}
for (int i = 0; i < 3; i++)
{
if (nodeBox.hi[i] < gridBox.lo[i] || nodeBox.lo[i] > gridBox.hi[i])
@@ -76,7 +78,9 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
// stay left
i++;
if (clipL < maxb)
{
clipL = maxb;
}
}
else
{
@@ -86,7 +90,9 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
dat.indices[right] = t;
right--;
if (clipR > minb)
{
clipR = minb;
}
}
nodeL = std::min(nodeL, minb);
nodeR = std::max(nodeR, maxb);
@@ -212,7 +218,9 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
tempTree.push_back(0);
}
else
{
nextIndex -= 3;
}
// allocate right node
if (nr > 0)
{
@@ -233,13 +241,21 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
nodeBoxR.lo[axis] = clipR;
// recurse
if (nl > 0)
{
subdivide(left, right, tempTree, dat, gridBoxL, nodeBoxL, nextIndex, depth + 1, stats);
}
else
{
stats.updateLeaf(depth + 1, 0);
}
if (nr > 0)
{
subdivide(right + 1, rightOrig, tempTree, dat, gridBoxR, nodeBoxR, nextIndex + 3, depth + 1, stats);
}
else
{
stats.updateLeaf(depth + 1, 0);
}
}
bool BIH::writeToFile(FILE* wf) const