Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -220,12 +220,19 @@ void VoxelSystem::copyWrittenDataToReadArrays() { · 219 unmodified lines | ||
| 220 | 220 | int VoxelSystem::newTreeToArrays(VoxelNode* node) { |
| 221 | 221 | assert(_viewFrustum); // you must set up _viewFrustum before calling this |
| 222 | 222 | int voxelsUpdated = 0; |
| 223 | − float distanceToNode = node->distanceToCamera(*_viewFrustum); | |
| 224 | − float boundary = boundaryDistanceForRenderLevel(node->getLevel()); | |
| 225 | − float childBoundary = boundaryDistanceForRenderLevel(node->getLevel() + 1); | |
| 226 | − bool inBoundary = (distanceToNode <= boundary); | |
| 227 | − bool inChildBoundary = (distanceToNode <= childBoundary); | |
| 228 | − bool shouldRender = node->isColored() && ((node->isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary)); | |
| 223 | + bool shouldRender = false; // assume we don't need to render it | |
| 224 | + | |
| 225 | + // if it's colored, we might need to render it! | |
| 226 | + if (node->isColored()) { | |
| 227 | + float distanceToNode = node->distanceToCamera(*_viewFrustum); | |
| 228 | + float boundary = boundaryDistanceForRenderLevel(node->getLevel()); | |
| 229 | + float childBoundary = boundaryDistanceForRenderLevel(node->getLevel() + 1); | |
| 230 | + bool inBoundary = (distanceToNode <= boundary); | |
| 231 | + bool inChildBoundary = (distanceToNode <= childBoundary); | |
| 232 | + | |
| 233 | + shouldRender = (node->isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary); | |
| 234 | + } | |
| 235 | + | |
| 229 | 236 | |
| 230 | 237 | node->setShouldRender(shouldRender); |
| 231 | 238 | // let children figure out their renderness |