History

added dirty bit support to VoxelTree, use it to determine when to call treeToArrays

ZappoMan committed 13 years ago

Commit 5a14c711 parent c353c1d4 files · +35 −7Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 4 files). Show all

Unified · Split

interface/src/VoxelSystem.cpp+7−2
@@ -149,7 +149,12 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 148 unmodified lines
149 149
150void VoxelSystem::setupNewVoxelsForDrawing() {150void VoxelSystem::setupNewVoxelsForDrawing() {
151 double start = usecTimestampNow();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 if (_voxelsUpdated) {158 if (_voxelsUpdated) {
154 _voxelsDirty=true;159 _voxelsDirty=true;
155 }160 }
@@ -248,8 +253,8 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { · 92 unmodified lines
248 _voxelsInArrays++; // our know vertices in the arrays253 _voxelsInArrays++; // our know vertices in the arrays
249 }254 }
250 voxelsUpdated++;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 return voxelsUpdated;258 return voxelsUpdated;
254}259}
255 260