Showing the changes to interface/src/VoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -150,6 +150,9 @@ VoxelSystem::~VoxelSystem() { · 149 unmodified lines | ||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | void VoxelSystem::setMaxVoxels(int maxVoxels) { |
| 153 | + if (maxVoxels == _maxVoxels) { | |
| 154 | + return; | |
| 155 | + } | |
| 153 | 156 | pthread_mutex_lock(&_bufferWriteLock); |
| 154 | 157 | bool wasInitialized = _initialized; |
| 155 | 158 | if (wasInitialized) { |
| @@ -161,13 +164,16 @@ void VoxelSystem::setMaxVoxels(int maxVoxels) { · 5 unmodified lines | ||
| 161 | 164 | init(); |
| 162 | 165 | } |
| 163 | 166 | pthread_mutex_unlock(&_bufferWriteLock); |
| 164 | − | |
| 165 | 167 | if (wasInitialized) { |
| 166 | 168 | forceRedrawEntireTree(); |
| 167 | 169 | } |
| 168 | 170 | } |
| 169 | 171 | |
| 170 | 172 | void VoxelSystem::setUseVoxelShader(bool useVoxelShader) { |
| 173 | + if (_useVoxelShader == useVoxelShader) { | |
| 174 | + return; | |
| 175 | + } | |
| 176 | + | |
| 171 | 177 | pthread_mutex_lock(&_bufferWriteLock); |
| 172 | 178 | bool wasInitialized = _initialized; |
| 173 | 179 | if (wasInitialized) { |
| @@ -896,6 +902,11 @@ void VoxelSystem::updateVBOSegment(glBufferIndex segmentStart, glBufferIndex seg · 722 unmodified lines | ||
| 896 | 902 | void VoxelSystem::render(bool texture) { |
| 897 | 903 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "render()"); |
| 898 | 904 | |
| 905 | + // If we got here and we're not initialized then bail! | |
| 906 | + if (!_initialized) { | |
| 907 | + return; | |
| 908 | + } | |
| 909 | + | |
| 899 | 910 | // get the lock so that the update thread won't change anything |
| 900 | 911 | pthread_mutex_lock(&_bufferWriteLock); |
| 901 | 912 | |
| @@ -1034,8 +1045,6 @@ void VoxelSystem::clearAllNodesBufferIndex() { · 132 unmodified lines | ||
| 1034 | 1045 | _nodeCount = 0; |
| 1035 | 1046 | _tree->recurseTreeWithOperation(clearAllNodesBufferIndexOperation); |
| 1036 | 1047 | qDebug("clearing buffer index of %d nodes\n", _nodeCount); |
| 1037 | − _tree->setDirtyBit(); | |
| 1038 | − setupNewVoxelsForDrawing(); | |
| 1039 | 1048 | } |
| 1040 | 1049 | |
| 1041 | 1050 | bool VoxelSystem::forceRedrawEntireTreeOperation(VoxelNode* node, void* extraData) { |