Showing the changes to interface/src/VoxelSystem.cpp (1 of 4 files). Show all
Unified · Split
| @@ -149,7 +149,12 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 148 unmodified lines | ||
| 149 | 149 | |
| 150 | 150 | void VoxelSystem::setupNewVoxelsForDrawing() { |
| 151 | 151 | double start = usecTimestampNow(); |
| 152 | − _voxelsUpdated = newTreeToArrays(_tree->rootNode); | |
| 152 | + if (_tree->isDirty()) { | |
| 153 | + _voxelsUpdated = newTreeToArrays(_tree->rootNode); | |
| 154 | + _tree->clearDirtyBit(); // after we pull the trees into the array, we can consider the tree clean | |
| 155 | + } else { | |
| 156 | + _voxelsUpdated = 0; | |
| 157 | + } | |
| 153 | 158 | if (_voxelsUpdated) { |
| 154 | 159 | _voxelsDirty=true; |
| 155 | 160 | } |
| @@ -248,8 +253,8 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { · 92 unmodified lines | ||
| 248 | 253 | _voxelsInArrays++; // our know vertices in the arrays |
| 249 | 254 | } |
| 250 | 255 | voxelsUpdated++; |
| 251 | − node->clearDirtyBit(); | |
| 252 | 256 | } |
| 257 | + node->clearDirtyBit(); // always clear the dirty bit, even if it doesn't need to be rendered | |
| 253 | 258 | return voxelsUpdated; |
| 254 | 259 | } |
| 255 | 260 | |