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 | int VoxelSystem::newTreeToArrays(VoxelNode* node) { | 220 | int VoxelSystem::newTreeToArrays(VoxelNode* node) { |
| 221 | assert(_viewFrustum); // you must set up _viewFrustum before calling this | 221 | assert(_viewFrustum); // you must set up _viewFrustum before calling this |
| 222 | int voxelsUpdated = 0; | 222 | int voxelsUpdated = 0; |
| 223 | float distanceToNode = node->distanceToCamera(*_viewFrustum); | 223 | bool shouldRender = false; // assume we don't need to render it |
| 224 | float boundary = boundaryDistanceForRenderLevel(node->getLevel()); | 224 | |
| 225 | float childBoundary = boundaryDistanceForRenderLevel(node->getLevel() + 1); | 225 | // if it's colored, we might need to render it! |
| 226 | bool inBoundary = (distanceToNode <= boundary); | 226 | if (node->isColored()) { |
| 227 | bool inChildBoundary = (distanceToNode <= childBoundary); | 227 | float distanceToNode = node->distanceToCamera(*_viewFrustum); |
| 228 | bool shouldRender = node->isColored() && ((node->isLeaf() && inChildBoundary) || (inBoundary && !inChildBoundary)); | 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 | node->setShouldRender(shouldRender); | 237 | node->setShouldRender(shouldRender); |
| 231 | // let children figure out their renderness | 238 | // let children figure out their renderness |