mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
fix reset of VoxelSystem on eraseAllVoxels()
This commit is contained in:
parent
001418649f
commit
ca7225e525
3 changed files with 8 additions and 2 deletions
|
@ -73,6 +73,7 @@ VoxelSystem::VoxelSystem(float treeScale, int maxVoxels)
|
||||||
_writeRenderFullVBO = true;
|
_writeRenderFullVBO = true;
|
||||||
_readRenderFullVBO = true;
|
_readRenderFullVBO = true;
|
||||||
_tree = new VoxelTree();
|
_tree = new VoxelTree();
|
||||||
|
|
||||||
_tree->rootNode->setVoxelSystem(this);
|
_tree->rootNode->setVoxelSystem(this);
|
||||||
pthread_mutex_init(&_bufferWriteLock, NULL);
|
pthread_mutex_init(&_bufferWriteLock, NULL);
|
||||||
pthread_mutex_init(&_treeLock, NULL);
|
pthread_mutex_init(&_treeLock, NULL);
|
||||||
|
@ -133,7 +134,7 @@ void VoxelSystem::voxelUpdated(VoxelNode* node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->getVoxelSystem() == this) {
|
if (node->getVoxelSystem() == this) {
|
||||||
bool shouldRender = false; // assume we don't need to render it
|
bool shouldRender = false; // assume we don't need to render it
|
||||||
// if it's colored, we might need to render it!
|
// if it's colored, we might need to render it!
|
||||||
shouldRender = node->calculateShouldRender(_viewFrustum);
|
shouldRender = node->calculateShouldRender(_viewFrustum);
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ void VoxelNode::init(unsigned char * octalCode) {
|
||||||
|
|
||||||
_unknownBufferIndex = true;
|
_unknownBufferIndex = true;
|
||||||
setBufferIndex(GLBUFFER_INDEX_UNKNOWN);
|
setBufferIndex(GLBUFFER_INDEX_UNKNOWN);
|
||||||
|
|
||||||
setVoxelSystem(NULL);
|
setVoxelSystem(NULL);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
_shouldRender = false;
|
_shouldRender = false;
|
||||||
|
@ -146,7 +147,9 @@ std::map<uint8_t, VoxelSystem*> VoxelNode::_mapIndexToVoxelSystemPointers;
|
||||||
VoxelSystem* VoxelNode::getVoxelSystem() const {
|
VoxelSystem* VoxelNode::getVoxelSystem() const {
|
||||||
if (_voxelSystemIndex > INDEX_FOR_NULL) {
|
if (_voxelSystemIndex > INDEX_FOR_NULL) {
|
||||||
if (_mapIndexToVoxelSystemPointers.end() != _mapIndexToVoxelSystemPointers.find(_voxelSystemIndex)) {
|
if (_mapIndexToVoxelSystemPointers.end() != _mapIndexToVoxelSystemPointers.find(_voxelSystemIndex)) {
|
||||||
return _mapIndexToVoxelSystemPointers[_voxelSystemIndex];
|
|
||||||
|
VoxelSystem* voxelSystem = _mapIndexToVoxelSystemPointers[_voxelSystemIndex];
|
||||||
|
return voxelSystem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -476,7 +476,9 @@ void VoxelTree::deleteVoxelCodeFromTreeRecursion(VoxelNode* node, void* extraDat
|
||||||
void VoxelTree::eraseAllVoxels() {
|
void VoxelTree::eraseAllVoxels() {
|
||||||
// XXXBHG Hack attack - is there a better way to erase the voxel tree?
|
// XXXBHG Hack attack - is there a better way to erase the voxel tree?
|
||||||
delete rootNode; // this will recurse and delete all children
|
delete rootNode; // this will recurse and delete all children
|
||||||
|
VoxelSystem* voxelSystem = rootNode->getVoxelSystem();
|
||||||
rootNode = new VoxelNode();
|
rootNode = new VoxelNode();
|
||||||
|
rootNode->setVoxelSystem(voxelSystem);
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue