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 | void VoxelSystem::setMaxVoxels(int maxVoxels) { | 152 | void VoxelSystem::setMaxVoxels(int maxVoxels) { |
| 153 | if (maxVoxels == _maxVoxels) { | ||
| 154 | return; | ||
| 155 | } | ||
| 153 | pthread_mutex_lock(&_bufferWriteLock); | 156 | pthread_mutex_lock(&_bufferWriteLock); |
| 154 | bool wasInitialized = _initialized; | 157 | bool wasInitialized = _initialized; |
| 155 | if (wasInitialized) { | 158 | if (wasInitialized) { |
| @@ -161,13 +164,16 @@ void VoxelSystem::setMaxVoxels(int maxVoxels) { · 5 unmodified lines | |||
| 161 | init(); | 164 | init(); |
| 162 | } | 165 | } |
| 163 | pthread_mutex_unlock(&_bufferWriteLock); | 166 | pthread_mutex_unlock(&_bufferWriteLock); |
| 164 | |||
| 165 | if (wasInitialized) { | 167 | if (wasInitialized) { |
| 166 | forceRedrawEntireTree(); | 168 | forceRedrawEntireTree(); |
| 167 | } | 169 | } |
| 168 | } | 170 | } |
| 169 | 171 | ||
| 170 | void VoxelSystem::setUseVoxelShader(bool useVoxelShader) { | 172 | void VoxelSystem::setUseVoxelShader(bool useVoxelShader) { |
| 173 | if (_useVoxelShader == useVoxelShader) { | ||
| 174 | return; | ||
| 175 | } | ||
| 176 | |||
| 171 | pthread_mutex_lock(&_bufferWriteLock); | 177 | pthread_mutex_lock(&_bufferWriteLock); |
| 172 | bool wasInitialized = _initialized; | 178 | bool wasInitialized = _initialized; |
| 173 | if (wasInitialized) { | 179 | if (wasInitialized) { |
| @@ -896,6 +902,11 @@ void VoxelSystem::updateVBOSegment(glBufferIndex segmentStart, glBufferIndex seg · 722 unmodified lines | |||
| 896 | void VoxelSystem::render(bool texture) { | 902 | void VoxelSystem::render(bool texture) { |
| 897 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "render()"); | 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 | // get the lock so that the update thread won't change anything | 910 | // get the lock so that the update thread won't change anything |
| 900 | pthread_mutex_lock(&_bufferWriteLock); | 911 | pthread_mutex_lock(&_bufferWriteLock); |
| 901 | 912 | ||
| @@ -1034,8 +1045,6 @@ void VoxelSystem::clearAllNodesBufferIndex() { · 132 unmodified lines | |||
| 1034 | _nodeCount = 0; | 1045 | _nodeCount = 0; |
| 1035 | _tree->recurseTreeWithOperation(clearAllNodesBufferIndexOperation); | 1046 | _tree->recurseTreeWithOperation(clearAllNodesBufferIndexOperation); |
| 1036 | qDebug("clearing buffer index of %d nodes\n", _nodeCount); | 1047 | qDebug("clearing buffer index of %d nodes\n", _nodeCount); |
| 1037 | _tree->setDirtyBit(); | ||
| 1038 | setupNewVoxelsForDrawing(); | ||
| 1039 | } | 1048 | } |
| 1040 | 1049 | ||
| 1041 | bool VoxelSystem::forceRedrawEntireTreeOperation(VoxelNode* node, void* extraData) { | 1050 | bool VoxelSystem::forceRedrawEntireTreeOperation(VoxelNode* node, void* extraData) { |