mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 09:57:26 +02:00
short circuit shouldRender logic in treeToArrays()
This commit is contained in:
parent
2c8c6a2600
commit
af6f51527a
1 changed files with 13 additions and 6 deletions
|
@ -220,12 +220,19 @@ void VoxelSystem::copyWrittenDataToReadArrays() {
|
||||||
int VoxelSystem::newTreeToArrays(VoxelNode* node) {
|
int VoxelSystem::newTreeToArrays(VoxelNode* node) {
|
||||||
assert(_viewFrustum); // you must set up _viewFrustum before calling this
|
assert(_viewFrustum); // you must set up _viewFrustum before calling this
|
||||||
int voxelsUpdated = 0;
|
int voxelsUpdated = 0;
|
||||||
|
bool shouldRender = false; // assume we don't need to render it
|
||||||
|
|
||||||
|
// if it's colored, we might need to render it!
|
||||||
|
if (node->isColored()) {
|
||||||
float distanceToNode = node->distanceToCamera(*_viewFrustum);
|
float distanceToNode = node->distanceToCamera(*_viewFrustum);
|
||||||
float boundary = boundaryDistanceForRenderLevel(node->getLevel());
|
float boundary = boundaryDistanceForRenderLevel(node->getLevel());
|
||||||
float childBoundary = boundaryDistanceForRenderLevel(node->getLevel() + 1);
|
float childBoundary = boundaryDistanceForRenderLevel(node->getLevel() + 1);
|
||||||
bool inBoundary = (distanceToNode <= boundary);
|
bool inBoundary = (distanceToNode <= boundary);
|
||||||
bool inChildBoundary = (distanceToNode <= childBoundary);
|
bool inChildBoundary = (distanceToNode <= childBoundary);
|
||||||
bool shouldRender = node->isColored() && ((node->isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary));
|
|
||||||
|
shouldRender = (node->isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
node->setShouldRender(shouldRender);
|
node->setShouldRender(shouldRender);
|
||||||
// let children figure out their renderness
|
// let children figure out their renderness
|
||||||
|
|
Loading…
Reference in a new issue