Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -292,7 +292,6 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { · 291 unmodified lines | |||
| 292 | assert(_viewFrustum); // you must set up _viewFrustum before calling this | 292 | assert(_viewFrustum); // you must set up _viewFrustum before calling this |
| 293 | int voxelsUpdated = 0; | 293 | int voxelsUpdated = 0; |
| 294 | bool shouldRender = false; // assume we don't need to render it | 294 | bool shouldRender = false; // assume we don't need to render it |
| 295 | bool isLeaf = node->isLeaf(); | ||
| 296 | // if it's colored, we might need to render it! | 295 | // if it's colored, we might need to render it! |
| 297 | if (node->isColored()) { | 296 | if (node->isColored()) { |
| 298 | float distanceToNode = node->distanceToCamera(*_viewFrustum); | 297 | float distanceToNode = node->distanceToCamera(*_viewFrustum); |
| @@ -300,11 +299,11 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { · 1 unmodified line | |||
| 300 | float childBoundary = boundaryDistanceForRenderLevel(node->getLevel() + 1); | 299 | float childBoundary = boundaryDistanceForRenderLevel(node->getLevel() + 1); |
| 301 | bool inBoundary = (distanceToNode <= boundary); | 300 | bool inBoundary = (distanceToNode <= boundary); |
| 302 | bool inChildBoundary = (distanceToNode <= childBoundary); | 301 | bool inChildBoundary = (distanceToNode <= childBoundary); |
| 303 | shouldRender = (isLeaf && inChildBoundary) || (inBoundary && !inChildBoundary); | 302 | shouldRender = (node->isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary); |
| 304 | } | 303 | } |
| 305 | node->setShouldRender(shouldRender && !node->isStagedForDeletion()); | 304 | node->setShouldRender(shouldRender && !node->isStagedForDeletion()); |
| 306 | // let children figure out their renderness | 305 | // let children figure out their renderness |
| 307 | if (!isLeaf) { | 306 | if (!node->isLeaf()) { |
| 308 | for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { | 307 | for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { |
| 309 | if (node->getChildAtIndex(i)) { | 308 | if (node->getChildAtIndex(i)) { |
| 310 | voxelsUpdated += newTreeToArrays(node->getChildAtIndex(i)); | 309 | voxelsUpdated += newTreeToArrays(node->getChildAtIndex(i)); |