mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 10:46:45 +02:00
optimize OctreeElement::calculateShouldRender()
This commit is contained in:
parent
adaa01c13e
commit
3d0207b926
1 changed files with 9 additions and 5 deletions
|
@ -1209,11 +1209,15 @@ bool OctreeElement::calculateShouldRender(const ViewFrustum* viewFrustum, float
|
|||
bool shouldRender = false;
|
||||
if (hasContent()) {
|
||||
float furthestDistance = furthestDistanceToCamera(*viewFrustum);
|
||||
float boundary = boundaryDistanceForRenderLevel(getLevel() + boundaryLevelAdjust, voxelScaleSize);
|
||||
float childBoundary = boundaryDistanceForRenderLevel(getLevel() + 1 + boundaryLevelAdjust, voxelScaleSize);
|
||||
bool inBoundary = (furthestDistance <= boundary);
|
||||
bool inChildBoundary = (furthestDistance <= childBoundary);
|
||||
shouldRender = (isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary);
|
||||
float childBoundary = boundaryDistanceForRenderLevel(getLevel() + 1 + boundaryLevelAdjust, voxelScaleSize);
|
||||
bool inChildBoundary = (furthestDistance <= childBoundary);
|
||||
if (isLeaf() && inChildBoundary) {
|
||||
shouldRender = true;
|
||||
} else {
|
||||
float boundary = childBoundary * 2.0f; // the boundary is always twice the distance of the child boundary
|
||||
bool inBoundary = (furthestDistance <= boundary);
|
||||
shouldRender = inBoundary && !inChildBoundary;
|
||||
}
|
||||
}
|
||||
return shouldRender;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue