Showing the changes to interface/src/VoxelSystem.cpp (1 of 87 files). Show all
Unified · Split
| @@ -74,13 +74,13 @@ VoxelSystem::VoxelSystem(float treeScale, int maxVoxels) · 73 unmodified lines | ||
| 74 | 74 | _readRenderFullVBO = true; |
| 75 | 75 | _tree = new VoxelTree(); |
| 76 | 76 | |
| 77 | − _tree->rootNode->setVoxelSystem(this); | |
| 77 | + _tree->getRoot()->setVoxelSystem(this); | |
| 78 | 78 | pthread_mutex_init(&_bufferWriteLock, NULL); |
| 79 | 79 | pthread_mutex_init(&_treeLock, NULL); |
| 80 | 80 | pthread_mutex_init(&_freeIndexLock, NULL); |
| 81 | 81 | |
| 82 | − VoxelNode::addDeleteHook(this); | |
| 83 | − VoxelNode::addUpdateHook(this); | |
| 82 | + VoxelTreeElement::addDeleteHook(this); | |
| 83 | + VoxelTreeElement::addUpdateHook(this); | |
| 84 | 84 | _abandonedVBOSlots = 0; |
| 85 | 85 | _falseColorizeBySource = false; |
| 86 | 86 | _dataSourceUUID = QUuid(); |
| @@ -113,13 +113,14 @@ VoxelSystem::VoxelSystem(float treeScale, int maxVoxels) · 26 unmodified lines | ||
| 113 | 113 | _treeIsBusy = false; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | −void VoxelSystem::voxelDeleted(VoxelNode* node) { | |
| 117 | − if (node->getVoxelSystem() == this) { | |
| 116 | +void VoxelSystem::elementDeleted(OctreeElement* element) { | |
| 117 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 118 | + if (voxel->getVoxelSystem() == this) { | |
| 118 | 119 | if (_voxelsInWriteArrays != 0) { |
| 119 | − forceRemoveNodeFromArrays(node); | |
| 120 | + forceRemoveNodeFromArrays(voxel); | |
| 120 | 121 | } else { |
| 121 | 122 | if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) { |
| 122 | − printf("VoxelSystem::voxelDeleted() while _voxelsInWriteArrays==0, is that expected? \n"); | |
| 123 | + printf("VoxelSystem::elementDeleted() while _voxelsInWriteArrays==0, is that expected? \n"); | |
| 123 | 124 | } |
| 124 | 125 | } |
| 125 | 126 | } |
| @@ -132,50 +133,51 @@ void VoxelSystem::setDisableFastVoxelPipeline(bool disableFastVoxelPipeline) { · 6 unmodified lines | ||
| 132 | 133 | setupNewVoxelsForDrawing(); |
| 133 | 134 | } |
| 134 | 135 | |
| 135 | −void VoxelSystem::voxelUpdated(VoxelNode* node) { | |
| 136 | +void VoxelSystem::elementUpdated(OctreeElement* element) { | |
| 137 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 136 | 138 | // If we're in SetupNewVoxelsForDrawing() or _writeRenderFullVBO then bail.. |
| 137 | 139 | if (!_useFastVoxelPipeline || _inSetupNewVoxelsForDrawing || _writeRenderFullVBO) { |
| 138 | 140 | return; |
| 139 | 141 | } |
| 140 | 142 | |
| 141 | − if (node->getVoxelSystem() == this) { | |
| 143 | + if (voxel->getVoxelSystem() == this) { | |
| 142 | 144 | bool shouldRender = false; // assume we don't need to render it |
| 143 | 145 | // if it's colored, we might need to render it! |
| 144 | 146 | float voxelSizeScale = Menu::getInstance()->getVoxelSizeScale(); |
| 145 | 147 | int boundaryLevelAdjust = Menu::getInstance()->getBoundaryLevelAdjust(); |
| 146 | − shouldRender = node->calculateShouldRender(_viewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 148 | + shouldRender = voxel->calculateShouldRender(_viewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 147 | 149 | |
| 148 | − if (node->getShouldRender() != shouldRender) { | |
| 149 | − node->setShouldRender(shouldRender); | |
| 150 | + if (voxel->getShouldRender() != shouldRender) { | |
| 151 | + voxel->setShouldRender(shouldRender); | |
| 150 | 152 | } |
| 151 | 153 | |
| 152 | − if (!node->isLeaf()) { | |
| 154 | + if (!voxel->isLeaf()) { | |
| 153 | 155 | |
| 154 | 156 | // As we check our children, see if any of them went from shouldRender to NOT shouldRender |
| 155 | 157 | // then we probably dropped LOD and if we don't have color, we want to average our children |
| 156 | 158 | // for a new color. |
| 157 | 159 | int childrenGotHiddenCount = 0; |
| 158 | 160 | for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { |
| 159 | − VoxelNode* childNode = node->getChildAtIndex(i); | |
| 160 | − if (childNode) { | |
| 161 | − bool wasShouldRender = childNode->getShouldRender(); | |
| 162 | − bool isShouldRender = childNode->calculateShouldRender(_viewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 161 | + VoxelTreeElement* childVoxel = voxel->getChildAtIndex(i); | |
| 162 | + if (childVoxel) { | |
| 163 | + bool wasShouldRender = childVoxel->getShouldRender(); | |
| 164 | + bool isShouldRender = childVoxel->calculateShouldRender(_viewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 163 | 165 | if (wasShouldRender && !isShouldRender) { |
| 164 | 166 | childrenGotHiddenCount++; |
| 165 | 167 | } |
| 166 | 168 | } |
| 167 | 169 | } |
| 168 | 170 | if (childrenGotHiddenCount > 0) { |
| 169 | − node->setColorFromAverageOfChildren(); | |
| 171 | + voxel->calculateAverageFromChildren(); | |
| 170 | 172 | } |
| 171 | 173 | } |
| 172 | 174 | |
| 173 | 175 | const bool REUSE_INDEX = true; |
| 174 | 176 | const bool DONT_FORCE_REDRAW = false; |
| 175 | − updateNodeInArrays(node, REUSE_INDEX, DONT_FORCE_REDRAW); | |
| 177 | + updateNodeInArrays(voxel, REUSE_INDEX, DONT_FORCE_REDRAW); | |
| 176 | 178 | _voxelsUpdated++; |
| 177 | 179 | |
| 178 | − node->clearDirtyBit(); // clear the dirty bit, do this before we potentially delete things. | |
| 180 | + voxel->clearDirtyBit(); // clear the dirty bit, do this before we potentially delete things. | |
| 179 | 181 | |
| 180 | 182 | setupNewVoxelsForDrawingSingleNode(); |
| 181 | 183 | } |
| @@ -199,7 +201,7 @@ glBufferIndex VoxelSystem::getNextBufferIndex() { · 17 unmodified lines | ||
| 199 | 201 | return output; |
| 200 | 202 | } |
| 201 | 203 | |
| 202 | −// Release responsibility of the buffer/vbo index from the VoxelNode, and makes the index available for some other node to use | |
| 204 | +// Release responsibility of the buffer/vbo index from the VoxelTreeElement, and makes the index available for some other node to use | |
| 203 | 205 | // will also "clean up" the index data for the buffer/vbo slot, so that if it's in the middle of the draw range, the triangles |
| 204 | 206 | // will be "invisible" |
| 205 | 207 | void VoxelSystem::freeBufferIndex(glBufferIndex index) { |
| @@ -260,8 +262,8 @@ VoxelSystem::~VoxelSystem() { · 54 unmodified lines | ||
| 260 | 262 | pthread_mutex_destroy(&_treeLock); |
| 261 | 263 | pthread_mutex_destroy(&_freeIndexLock); |
| 262 | 264 | |
| 263 | − VoxelNode::removeDeleteHook(this); | |
| 264 | − VoxelNode::removeUpdateHook(this); | |
| 265 | + VoxelTreeElement::removeDeleteHook(this); | |
| 266 | + VoxelTreeElement::removeUpdateHook(this); | |
| 265 | 267 | } |
| 266 | 268 | |
| 267 | 269 | void VoxelSystem::setMaxVoxels(int maxVoxels) { |
| @@ -534,13 +536,8 @@ void VoxelSystem::initVoxelMemory() { · 266 unmodified lines | ||
| 534 | 536 | pthread_mutex_unlock(&_bufferWriteLock); |
| 535 | 537 | } |
| 536 | 538 | |
| 537 | −void VoxelSystem::loadVoxelsFile(const char* fileName, bool wantColorRandomizer) { | |
| 538 | − _tree->loadVoxelsFile(fileName, wantColorRandomizer); | |
| 539 | − setupNewVoxelsForDrawing(); | |
| 540 | −} | |
| 541 | − | |
| 542 | −void VoxelSystem::writeToSVOFile(const char* filename, VoxelNode* node) const { | |
| 543 | − _tree->writeToSVOFile(filename, node); | |
| 539 | +void VoxelSystem::writeToSVOFile(const char* filename, VoxelTreeElement* element) const { | |
| 540 | + _tree->writeToSVOFile(filename, element); | |
| 544 | 541 | } |
| 545 | 542 | |
| 546 | 543 | bool VoxelSystem::readFromSVOFile(const char* filename) { |
| @@ -567,30 +564,6 @@ bool VoxelSystem::readFromSchematicFile(const char* filename) { · 20 unmodified lines | ||
| 567 | 564 | return result; |
| 568 | 565 | } |
| 569 | 566 | |
| 570 | −long int VoxelSystem::getVoxelsCreated() { | |
| 571 | − return _tree->voxelsCreated; | |
| 572 | −} | |
| 573 | − | |
| 574 | −float VoxelSystem::getVoxelsCreatedPerSecondAverage() { | |
| 575 | − return (1 / _tree->voxelsCreatedStats.getEventDeltaAverage()); | |
| 576 | −} | |
| 577 | − | |
| 578 | −long int VoxelSystem::getVoxelsColored() { | |
| 579 | − return _tree->voxelsColored; | |
| 580 | −} | |
| 581 | − | |
| 582 | −float VoxelSystem::getVoxelsColoredPerSecondAverage() { | |
| 583 | − return (1 / _tree->voxelsColoredStats.getEventDeltaAverage()); | |
| 584 | −} | |
| 585 | − | |
| 586 | −long int VoxelSystem::getVoxelsBytesRead() { | |
| 587 | − return _tree->voxelsBytesRead; | |
| 588 | −} | |
| 589 | − | |
| 590 | −float VoxelSystem::getVoxelsBytesReadPerSecondAverage() { | |
| 591 | − return _tree->voxelsBytesReadStats.getAverageSampleValuePerSecond(); | |
| 592 | −} | |
| 593 | − | |
| 594 | 567 | int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { |
| 595 | 568 | |
| 596 | 569 | unsigned char command = *sourceBuffer; |
| @@ -702,7 +675,7 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 105 unmodified lines | ||
| 702 | 675 | if (_writeRenderFullVBO) { |
| 703 | 676 | clearFreeBufferIndexes(); |
| 704 | 677 | } |
| 705 | − _voxelsUpdated = newTreeToArrays(_tree->rootNode); | |
| 678 | + _voxelsUpdated = newTreeToArrays(_tree->getRoot()); | |
| 706 | 679 | _tree->clearDirtyBit(); // after we pull the trees into the array, we can consider the tree clean |
| 707 | 680 | |
| 708 | 681 | if (_writeRenderFullVBO) { |
| @@ -955,56 +928,56 @@ void VoxelSystem::copyWrittenDataToReadArrays(bool fullVBOs) { · 246 unmodified lines | ||
| 955 | 928 | } |
| 956 | 929 | } |
| 957 | 930 | |
| 958 | −int VoxelSystem::newTreeToArrays(VoxelNode* node) { | |
| 931 | +int VoxelSystem::newTreeToArrays(VoxelTreeElement* voxel) { | |
| 959 | 932 | int voxelsUpdated = 0; |
| 960 | 933 | bool shouldRender = false; // assume we don't need to render it |
| 961 | 934 | // if it's colored, we might need to render it! |
| 962 | 935 | float voxelSizeScale = Menu::getInstance()->getVoxelSizeScale();; |
| 963 | 936 | int boundaryLevelAdjust = Menu::getInstance()->getBoundaryLevelAdjust(); |
| 964 | − shouldRender = node->calculateShouldRender(_viewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 937 | + shouldRender = voxel->calculateShouldRender(_viewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 965 | 938 | |
| 966 | − node->setShouldRender(shouldRender); | |
| 939 | + voxel->setShouldRender(shouldRender); | |
| 967 | 940 | // let children figure out their renderness |
| 968 | − if (!node->isLeaf()) { | |
| 941 | + if (!voxel->isLeaf()) { | |
| 969 | 942 | |
| 970 | 943 | // As we check our children, see if any of them went from shouldRender to NOT shouldRender |
| 971 | 944 | // then we probably dropped LOD and if we don't have color, we want to average our children |
| 972 | 945 | // for a new color. |
| 973 | 946 | int childrenGotHiddenCount = 0; |
| 974 | 947 | for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { |
| 975 | − VoxelNode* childNode = node->getChildAtIndex(i); | |
| 976 | − if (childNode) { | |
| 977 | − bool wasShouldRender = childNode->getShouldRender(); | |
| 978 | − voxelsUpdated += newTreeToArrays(childNode); | |
| 979 | − bool isShouldRender = childNode->getShouldRender(); | |
| 948 | + VoxelTreeElement* childVoxel = voxel->getChildAtIndex(i); | |
| 949 | + if (childVoxel) { | |
| 950 | + bool wasShouldRender = childVoxel->getShouldRender(); | |
| 951 | + voxelsUpdated += newTreeToArrays(childVoxel); | |
| 952 | + bool isShouldRender = childVoxel->getShouldRender(); | |
| 980 | 953 | if (wasShouldRender && !isShouldRender) { |
| 981 | 954 | childrenGotHiddenCount++; |
| 982 | 955 | } |
| 983 | 956 | } |
| 984 | 957 | } |
| 985 | 958 | if (childrenGotHiddenCount > 0) { |
| 986 | − node->setColorFromAverageOfChildren(); | |
| 959 | + voxel->calculateAverageFromChildren(); | |
| 987 | 960 | } |
| 988 | 961 | } |
| 989 | 962 | if (_writeRenderFullVBO) { |
| 990 | 963 | const bool DONT_REUSE_INDEX = false; |
| 991 | 964 | const bool FORCE_REDRAW = true; |
| 992 | − voxelsUpdated += updateNodeInArrays(node, DONT_REUSE_INDEX, FORCE_REDRAW); | |
| 965 | + voxelsUpdated += updateNodeInArrays(voxel, DONT_REUSE_INDEX, FORCE_REDRAW); | |
| 993 | 966 | } else { |
| 994 | 967 | const bool REUSE_INDEX = true; |
| 995 | 968 | const bool DONT_FORCE_REDRAW = false; |
| 996 | − voxelsUpdated += updateNodeInArrays(node, REUSE_INDEX, DONT_FORCE_REDRAW); | |
| 969 | + voxelsUpdated += updateNodeInArrays(voxel, REUSE_INDEX, DONT_FORCE_REDRAW); | |
| 997 | 970 | } |
| 998 | − node->clearDirtyBit(); // clear the dirty bit, do this before we potentially delete things. | |
| 971 | + voxel->clearDirtyBit(); // clear the dirty bit, do this before we potentially delete things. | |
| 999 | 972 | |
| 1000 | 973 | return voxelsUpdated; |
| 1001 | 974 | } |
| 1002 | 975 | |
| 1003 | −// called as response to voxelDeleted() in fast pipeline case. The node | |
| 976 | +// called as response to elementDeleted() in fast pipeline case. The node | |
| 1004 | 977 | // is being deleted, but it's state is such that it thinks it should render |
| 1005 | 978 | // and therefore we can't use the normal render calculations. This method |
| 1006 | 979 | // will forcibly remove it from the VBOs because we know better!!! |
| 1007 | −int VoxelSystem::forceRemoveNodeFromArrays(VoxelNode* node) { | |
| 980 | +int VoxelSystem::forceRemoveNodeFromArrays(VoxelTreeElement* node) { | |
| 1008 | 981 | |
| 1009 | 982 | if (!_initialized) { |
| 1010 | 983 | return 0; |
| @@ -1021,7 +994,7 @@ int VoxelSystem::forceRemoveNodeFromArrays(VoxelNode* node) { · 10 unmodified lines | ||
| 1021 | 994 | return 0; // not-updated |
| 1022 | 995 | } |
| 1023 | 996 | |
| 1024 | −int VoxelSystem::updateNodeInArrays(VoxelNode* node, bool reuseIndex, bool forceDraw) { | |
| 997 | +int VoxelSystem::updateNodeInArrays(VoxelTreeElement* node, bool reuseIndex, bool forceDraw) { | |
| 1025 | 998 | // If we've run out of room, then just bail... |
| 1026 | 999 | if (_voxelsInWriteArrays >= _maxVoxels && (_freeIndexes.size() == 0)) { |
| 1027 | 1000 | // We need to think about what else we can do in this case. This basically means that all of our available |
| @@ -1129,7 +1102,7 @@ void VoxelSystem::init() { · 101 unmodified lines | ||
| 1129 | 1102 | initVoxelMemory(); |
| 1130 | 1103 | |
| 1131 | 1104 | // our own _removedVoxels doesn't need to be notified of voxel deletes |
| 1132 | − VoxelNode::removeDeleteHook(&_removedVoxels); | |
| 1105 | + VoxelTreeElement::removeDeleteHook(&_removedVoxels); | |
| 1133 | 1106 | } |
| 1134 | 1107 | |
| 1135 | 1108 | void VoxelSystem::changeTree(VoxelTree* newTree) { |
| @@ -1137,7 +1110,7 @@ void VoxelSystem::changeTree(VoxelTree* newTree) { · 1 unmodified line | ||
| 1137 | 1110 | |
| 1138 | 1111 | _tree = newTree; |
| 1139 | 1112 | _tree->setDirtyBit(); |
| 1140 | − _tree->rootNode->setVoxelSystem(this); | |
| 1113 | + _tree->getRoot()->setVoxelSystem(this); | |
| 1141 | 1114 | |
| 1142 | 1115 | connect(_tree, SIGNAL(importSize(float,float,float)), SIGNAL(importSize(float,float,float))); |
| 1143 | 1116 | connect(_tree, SIGNAL(importProgress(int)), SIGNAL(importProgress(int))); |
| @@ -1457,7 +1430,7 @@ int VoxelSystem::_nodeCount = 0; · 313 unmodified lines | ||
| 1457 | 1430 | |
| 1458 | 1431 | void VoxelSystem::killLocalVoxels() { |
| 1459 | 1432 | lockTree(); |
| 1460 | − _tree->eraseAllVoxels(); | |
| 1433 | + _tree->eraseAllOctreeElements(); | |
| 1461 | 1434 | unlockTree(); |
| 1462 | 1435 | clearFreeBufferIndexes(); |
| 1463 | 1436 | _voxelsInReadArrays = 0; // do we need to do this? |
| @@ -1469,9 +1442,10 @@ void VoxelSystem::redrawInViewVoxels() { · 5 unmodified lines | ||
| 1469 | 1442 | } |
| 1470 | 1443 | |
| 1471 | 1444 | |
| 1472 | −bool VoxelSystem::clearAllNodesBufferIndexOperation(VoxelNode* node, void* extraData) { | |
| 1445 | +bool VoxelSystem::clearAllNodesBufferIndexOperation(OctreeElement* element, void* extraData) { | |
| 1473 | 1446 | _nodeCount++; |
| 1474 | − node->setBufferIndex(GLBUFFER_INDEX_UNKNOWN); | |
| 1447 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1448 | + voxel->setBufferIndex(GLBUFFER_INDEX_UNKNOWN); | |
| 1475 | 1449 | return true; |
| 1476 | 1450 | } |
| 1477 | 1451 | |
| @@ -1485,7 +1459,7 @@ void VoxelSystem::clearAllNodesBufferIndex() { · 7 unmodified lines | ||
| 1485 | 1459 | } |
| 1486 | 1460 | } |
| 1487 | 1461 | |
| 1488 | −bool VoxelSystem::forceRedrawEntireTreeOperation(VoxelNode* node, void* extraData) { | |
| 1462 | +bool VoxelSystem::forceRedrawEntireTreeOperation(OctreeElement* node, void* extraData) { | |
| 1489 | 1463 | _nodeCount++; |
| 1490 | 1464 | node->setDirtyBit(); |
| 1491 | 1465 | return true; |
| @@ -1499,11 +1473,12 @@ void VoxelSystem::forceRedrawEntireTree() { · 7 unmodified lines | ||
| 1499 | 1473 | setupNewVoxelsForDrawing(); |
| 1500 | 1474 | } |
| 1501 | 1475 | |
| 1502 | −bool VoxelSystem::randomColorOperation(VoxelNode* node, void* extraData) { | |
| 1476 | +bool VoxelSystem::randomColorOperation(OctreeElement* element, void* extraData) { | |
| 1477 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1503 | 1478 | _nodeCount++; |
| 1504 | − if (node->isColored()) { | |
| 1479 | + if (voxel->isColored()) { | |
| 1505 | 1480 | nodeColor newColor = { 255, randomColorValue(150), randomColorValue(150), 1 }; |
| 1506 | − node->setColor(newColor); | |
| 1481 | + voxel->setColor(newColor); | |
| 1507 | 1482 | } |
| 1508 | 1483 | return true; |
| 1509 | 1484 | } |
| @@ -1516,10 +1491,11 @@ void VoxelSystem::randomizeVoxelColors() { · 6 unmodified lines | ||
| 1516 | 1491 | setupNewVoxelsForDrawing(); |
| 1517 | 1492 | } |
| 1518 | 1493 | |
| 1519 | −bool VoxelSystem::falseColorizeRandomOperation(VoxelNode* node, void* extraData) { | |
| 1494 | +bool VoxelSystem::falseColorizeRandomOperation(OctreeElement* element, void* extraData) { | |
| 1495 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1520 | 1496 | _nodeCount++; |
| 1521 | 1497 | // always false colorize |
| 1522 | − node->setFalseColor(255, randomColorValue(150), randomColorValue(150)); | |
| 1498 | + voxel->setFalseColor(255, randomColorValue(150), randomColorValue(150)); | |
| 1523 | 1499 | return true; // keep going! |
| 1524 | 1500 | } |
| 1525 | 1501 | |
| @@ -1531,9 +1507,10 @@ void VoxelSystem::falseColorizeRandom() { · 5 unmodified lines | ||
| 1531 | 1507 | setupNewVoxelsForDrawing(); |
| 1532 | 1508 | } |
| 1533 | 1509 | |
| 1534 | −bool VoxelSystem::trueColorizeOperation(VoxelNode* node, void* extraData) { | |
| 1510 | +bool VoxelSystem::trueColorizeOperation(OctreeElement* element, void* extraData) { | |
| 1511 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1535 | 1512 | _nodeCount++; |
| 1536 | − node->setFalseColored(false); | |
| 1513 | + voxel->setFalseColored(false); | |
| 1537 | 1514 | return true; |
| 1538 | 1515 | } |
| 1539 | 1516 | |
| @@ -1547,13 +1524,14 @@ void VoxelSystem::trueColorize() { · 7 unmodified lines | ||
| 1547 | 1524 | } |
| 1548 | 1525 | |
| 1549 | 1526 | // Will false colorize voxels that are not in view |
| 1550 | −bool VoxelSystem::falseColorizeInViewOperation(VoxelNode* node, void* extraData) { | |
| 1527 | +bool VoxelSystem::falseColorizeInViewOperation(OctreeElement* element, void* extraData) { | |
| 1528 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1551 | 1529 | const ViewFrustum* viewFrustum = (const ViewFrustum*) extraData; |
| 1552 | 1530 | _nodeCount++; |
| 1553 | − if (node->isColored()) { | |
| 1554 | − if (!node->isInView(*viewFrustum)) { | |
| 1531 | + if (voxel->isColored()) { | |
| 1532 | + if (!voxel->isInView(*viewFrustum)) { | |
| 1555 | 1533 | // Out of view voxels are colored RED |
| 1556 | − node->setFalseColor(255, 0, 0); | |
| 1534 | + voxel->setFalseColor(255, 0, 0); | |
| 1557 | 1535 | } |
| 1558 | 1536 | } |
| 1559 | 1537 | return true; // keep going! |
| @@ -1584,13 +1562,14 @@ public: · 24 unmodified lines | ||
| 1584 | 1562 | }; |
| 1585 | 1563 | |
| 1586 | 1564 | // Will false colorize voxels that are not in view |
| 1587 | −bool VoxelSystem::falseColorizeBySourceOperation(VoxelNode* node, void* extraData) { | |
| 1565 | +bool VoxelSystem::falseColorizeBySourceOperation(OctreeElement* element, void* extraData) { | |
| 1566 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1588 | 1567 | colorizeBySourceArgs* args = (colorizeBySourceArgs*)extraData; |
| 1589 | 1568 | _nodeCount++; |
| 1590 | − if (node->isColored()) { | |
| 1569 | + if (voxel->isColored()) { | |
| 1591 | 1570 | // pick a color based on the source - we want each source to be obviously different |
| 1592 | − uint16_t nodeIDKey = node->getSourceUUIDKey(); | |
| 1593 | − node->setFalseColor(args->colors[nodeIDKey].red, args->colors[nodeIDKey].green, args->colors[nodeIDKey].blue); | |
| 1571 | + uint16_t nodeIDKey = voxel->getSourceUUIDKey(); | |
| 1572 | + voxel->setFalseColor(args->colors[nodeIDKey].red, args->colors[nodeIDKey].green, args->colors[nodeIDKey].blue); | |
| 1594 | 1573 | } |
| 1595 | 1574 | return true; // keep going! |
| 1596 | 1575 | } |
| @@ -1614,7 +1593,7 @@ void VoxelSystem::falseColorizeBySource() { · 17 unmodified lines | ||
| 1614 | 1593 | NodeList* nodeList = NodeList::getInstance(); |
| 1615 | 1594 | for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| 1616 | 1595 | if (node->getType() == NODE_TYPE_VOXEL_SERVER) { |
| 1617 | − uint16_t nodeID = VoxelNode::getSourceNodeUUIDKey(node->getUUID()); | |
| 1596 | + uint16_t nodeID = VoxelTreeElement::getSourceNodeUUIDKey(node->getUUID()); | |
| 1618 | 1597 | int groupColor = voxelServerCount % NUMBER_OF_COLOR_GROUPS; |
| 1619 | 1598 | args.colors[nodeID] = groupColors[groupColor]; |
| 1620 | 1599 | |
| @@ -1639,10 +1618,11 @@ void VoxelSystem::falseColorizeBySource() { · 18 unmodified lines | ||
| 1639 | 1618 | } |
| 1640 | 1619 | |
| 1641 | 1620 | // Will false colorize voxels based on distance from view |
| 1642 | −bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, void* extraData) { | |
| 1621 | +bool VoxelSystem::falseColorizeDistanceFromViewOperation(OctreeElement* element, void* extraData) { | |
| 1622 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1643 | 1623 | ViewFrustum* viewFrustum = (ViewFrustum*) extraData; |
| 1644 | − if (node->isColored()) { | |
| 1645 | − float distance = node->distanceToCamera(*viewFrustum); | |
| 1624 | + if (voxel->isColored()) { | |
| 1625 | + float distance = voxel->distanceToCamera(*viewFrustum); | |
| 1646 | 1626 | _nodeCount++; |
| 1647 | 1627 | float distanceRatio = (_minDistance == _maxDistance) ? 1 : (distance - _minDistance) / (_maxDistance - _minDistance); |
| 1648 | 1628 | |
| @@ -1651,7 +1631,7 @@ bool VoxelSystem::falseColorizeDistanceFromViewOperation(VoxelNode* node, void* · 2 unmodified lines | ||
| 1651 | 1631 | const unsigned char colorBands = 16; |
| 1652 | 1632 | const unsigned char gradientOver = 128; |
| 1653 | 1633 | unsigned char colorBand = (colorBands * distanceRatio); |
| 1654 | − node->setFalseColor((colorBand * (gradientOver / colorBands)) + (maxColor - gradientOver), 0, 0); | |
| 1634 | + voxel->setFalseColor((colorBand * (gradientOver / colorBands)) + (maxColor - gradientOver), 0, 0); | |
| 1655 | 1635 | } |
| 1656 | 1636 | return true; // keep going! |
| 1657 | 1637 | } |
| @@ -1662,11 +1642,12 @@ float VoxelSystem::_minDistance = FLT_MAX; · 4 unmodified lines | ||
| 1662 | 1642 | // Helper function will get the distance from view range, would be nice if you could just keep track |
| 1663 | 1643 | // of this as voxels are created and/or colored... seems like some transform math could do that so |
| 1664 | 1644 | // we wouldn't need to do two passes of the tree |
| 1665 | −bool VoxelSystem::getDistanceFromViewRangeOperation(VoxelNode* node, void* extraData) { | |
| 1645 | +bool VoxelSystem::getDistanceFromViewRangeOperation(OctreeElement* element, void* extraData) { | |
| 1646 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1666 | 1647 | ViewFrustum* viewFrustum = (ViewFrustum*) extraData; |
| 1667 | 1648 | // only do this for truly colored voxels... |
| 1668 | − if (node->isColored()) { | |
| 1669 | − float distance = node->distanceToCamera(*viewFrustum); | |
| 1649 | + if (voxel->isColored()) { | |
| 1650 | + float distance = voxel->distanceToCamera(*viewFrustum); | |
| 1670 | 1651 | // calculate the range of distances |
| 1671 | 1652 | if (distance > _maxDistance) { |
| 1672 | 1653 | _maxDistance = distance; |
| @@ -1695,16 +1676,16 @@ void VoxelSystem::falseColorizeDistanceFromView() { · 22 unmodified lines | ||
| 1695 | 1676 | // combines the removeOutOfView args into a single class |
| 1696 | 1677 | class removeOutOfViewArgs { |
| 1697 | 1678 | public: |
| 1698 | − VoxelSystem* thisVoxelSystem; | |
| 1699 | − ViewFrustum thisViewFrustum; | |
| 1700 | − VoxelNodeBag dontRecurseBag; | |
| 1679 | + VoxelSystem* thisVoxelSystem; | |
| 1680 | + ViewFrustum thisViewFrustum; | |
| 1681 | + OctreeElementBag dontRecurseBag; | |
| 1701 | 1682 | unsigned long nodesScanned; |
| 1702 | 1683 | unsigned long nodesRemoved; |
| 1703 | 1684 | unsigned long nodesInside; |
| 1704 | 1685 | unsigned long nodesIntersect; |
| 1705 | 1686 | unsigned long nodesOutside; |
| 1706 | − VoxelNode* insideRoot; | |
| 1707 | − VoxelNode* outsideRoot; | |
| 1687 | + VoxelTreeElement* insideRoot; | |
| 1688 | + VoxelTreeElement* outsideRoot; | |
| 1708 | 1689 | |
| 1709 | 1690 | removeOutOfViewArgs(VoxelSystem* voxelSystem, bool widenViewFrustum = true) : |
| 1710 | 1691 | thisVoxelSystem(voxelSystem), |
| @@ -1734,14 +1715,15 @@ void VoxelSystem::cancelImport() { · 23 unmodified lines | ||
| 1734 | 1715 | |
| 1735 | 1716 | // "Remove" voxels from the tree that are not in view. We don't actually delete them, |
| 1736 | 1717 | // we remove them from the tree and place them into a holding area for later deletion |
| 1737 | −bool VoxelSystem::removeOutOfViewOperation(VoxelNode* node, void* extraData) { | |
| 1718 | +bool VoxelSystem::removeOutOfViewOperation(OctreeElement* element, void* extraData) { | |
| 1719 | + VoxelTreeElement* voxel = (VoxelTreeElement*) element; | |
| 1738 | 1720 | removeOutOfViewArgs* args = (removeOutOfViewArgs*)extraData; |
| 1739 | 1721 | |
| 1740 | 1722 | // If our node was previously added to the don't recurse bag, then return false to |
| 1741 | 1723 | // stop the further recursion. This means that the whole node and it's children are |
| 1742 | 1724 | // known to be in view, so don't recurse them |
| 1743 | − if (args->dontRecurseBag.contains(node)) { | |
| 1744 | − args->dontRecurseBag.remove(node); | |
| 1725 | + if (args->dontRecurseBag.contains(voxel)) { | |
| 1726 | + args->dontRecurseBag.remove(voxel); | |
| 1745 | 1727 | return false; // stop recursion |
| 1746 | 1728 | } |
| 1747 | 1729 | |
| @@ -1749,14 +1731,14 @@ bool VoxelSystem::removeOutOfViewOperation(VoxelNode* node, void* extraData) { · 1 unmodified line | ||
| 1749 | 1731 | args->nodesScanned++; |
| 1750 | 1732 | // Need to operate on our child nodes, so we can remove them |
| 1751 | 1733 | for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { |
| 1752 | − VoxelNode* childNode = node->getChildAtIndex(i); | |
| 1734 | + VoxelTreeElement* childNode = voxel->getChildAtIndex(i); | |
| 1753 | 1735 | if (childNode) { |
| 1754 | 1736 | ViewFrustum::location inFrustum = childNode->inFrustum(args->thisViewFrustum); |
| 1755 | 1737 | switch (inFrustum) { |
| 1756 | 1738 | case ViewFrustum::OUTSIDE: { |
| 1757 | 1739 | args->nodesOutside++; |
| 1758 | 1740 | args->nodesRemoved++; |
| 1759 | − node->removeChildAtIndex(i); | |
| 1741 | + voxel->removeChildAtIndex(i); | |
| 1760 | 1742 | thisVoxelSystem->_removedVoxels.insert(childNode); |
| 1761 | 1743 | // by removing the child, it will not get recursed! |
| 1762 | 1744 | } break; |
| @@ -1850,24 +1832,25 @@ void VoxelSystem::showAllLocalVoxels() { · 87 unmodified lines | ||
| 1850 | 1832 | } |
| 1851 | 1833 | } |
| 1852 | 1834 | |
| 1853 | −bool VoxelSystem::showAllLocalVoxelsOperation(VoxelNode* node, void* extraData) { | |
| 1835 | +bool VoxelSystem::showAllLocalVoxelsOperation(OctreeElement* element, void* extraData) { | |
| 1836 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1854 | 1837 | showAllLocalVoxelsArgs* args = (showAllLocalVoxelsArgs*)extraData; |
| 1855 | 1838 | |
| 1856 | 1839 | args->nodesScanned++; |
| 1857 | 1840 | |
| 1858 | 1841 | float voxelSizeScale = Menu::getInstance()->getVoxelSizeScale();; |
| 1859 | 1842 | int boundaryLevelAdjust = Menu::getInstance()->getBoundaryLevelAdjust(); |
| 1860 | − bool shouldRender = node->calculateShouldRender(&args->thisViewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 1861 | − node->setShouldRender(shouldRender); | |
| 1843 | + bool shouldRender = voxel->calculateShouldRender(&args->thisViewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 1844 | + voxel->setShouldRender(shouldRender); | |
| 1862 | 1845 | |
| 1863 | 1846 | if (shouldRender) { |
| 1864 | 1847 | bool falseColorize = false; |
| 1865 | 1848 | if (falseColorize) { |
| 1866 | − node->setFalseColor(0,0,255); // false colorize | |
| 1849 | + voxel->setFalseColor(0,0,255); // false colorize | |
| 1867 | 1850 | } |
| 1868 | 1851 | // These are both needed to force redraw... |
| 1869 | − node->setDirtyBit(); | |
| 1870 | − node->markWithChangedTime(); | |
| 1852 | + voxel->setDirtyBit(); | |
| 1853 | + voxel->markWithChangedTime(); | |
| 1871 | 1854 | } |
| 1872 | 1855 | |
| 1873 | 1856 | return true; // keep recursing! |
| @@ -1991,7 +1974,8 @@ void VoxelSystem::hideOutOfView(bool forceFullFrustum) { · 117 unmodified lines | ||
| 1991 | 1974 | _inhideOutOfView = false; |
| 1992 | 1975 | } |
| 1993 | 1976 | |
| 1994 | −bool VoxelSystem::hideAllSubTreeOperation(VoxelNode* node, void* extraData) { | |
| 1977 | +bool VoxelSystem::hideAllSubTreeOperation(OctreeElement* element, void* extraData) { | |
| 1978 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 1995 | 1979 | hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData; |
| 1996 | 1980 | |
| 1997 | 1981 | // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine |
| @@ -2000,7 +1984,7 @@ bool VoxelSystem::hideAllSubTreeOperation(VoxelNode* node, void* extraData) { · 2 unmodified lines | ||
| 2000 | 1984 | ViewFrustum::location inLastCulledFrustum; |
| 2001 | 1985 | |
| 2002 | 1986 | if (args->culledOnce && args->wantDeltaFrustums) { |
| 2003 | − inLastCulledFrustum = node->inFrustum(args->lastViewFrustum); | |
| 1987 | + inLastCulledFrustum = voxel->inFrustum(args->lastViewFrustum); | |
| 2004 | 1988 | |
| 2005 | 1989 | // if this node is fully OUTSIDE our last culled view frustum, then we don't need to recurse further |
| 2006 | 1990 | if (inLastCulledFrustum == ViewFrustum::OUTSIDE) { |
| @@ -2010,14 +1994,14 @@ bool VoxelSystem::hideAllSubTreeOperation(VoxelNode* node, void* extraData) { · 3 unmodified lines | ||
| 2010 | 1994 | } |
| 2011 | 1995 | |
| 2012 | 1996 | args->nodesOutside++; |
| 2013 | − if (node->isKnownBufferIndex()) { | |
| 1997 | + if (voxel->isKnownBufferIndex()) { | |
| 2014 | 1998 | args->nodesRemoved++; |
| 2015 | 1999 | bool falseColorize = false; |
| 2016 | 2000 | if (falseColorize) { |
| 2017 | − node->setFalseColor(255,0,0); // false colorize | |
| 2001 | + voxel->setFalseColor(255,0,0); // false colorize | |
| 2018 | 2002 | } else { |
| 2019 | 2003 | VoxelSystem* thisVoxelSystem = args->thisVoxelSystem; |
| 2020 | − thisVoxelSystem->_voxelsUpdated += thisVoxelSystem->forceRemoveNodeFromArrays(node); | |
| 2004 | + thisVoxelSystem->_voxelsUpdated += thisVoxelSystem->forceRemoveNodeFromArrays(voxel); | |
| 2021 | 2005 | thisVoxelSystem->setupNewVoxelsForDrawingSingleNode(); |
| 2022 | 2006 | } |
| 2023 | 2007 | |
| @@ -2026,7 +2010,8 @@ bool VoxelSystem::hideAllSubTreeOperation(VoxelNode* node, void* extraData) { · 2 unmodified lines | ||
| 2026 | 2010 | return true; |
| 2027 | 2011 | } |
| 2028 | 2012 | |
| 2029 | −bool VoxelSystem::showAllSubTreeOperation(VoxelNode* node, void* extraData) { | |
| 2013 | +bool VoxelSystem::showAllSubTreeOperation(OctreeElement* element, void* extraData) { | |
| 2014 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 2030 | 2015 | hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData; |
| 2031 | 2016 | |
| 2032 | 2017 | // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine |
| @@ -2035,7 +2020,7 @@ bool VoxelSystem::showAllSubTreeOperation(VoxelNode* node, void* extraData) { · 2 unmodified lines | ||
| 2035 | 2020 | ViewFrustum::location inLastCulledFrustum; |
| 2036 | 2021 | |
| 2037 | 2022 | if (args->culledOnce && args->wantDeltaFrustums) { |
| 2038 | − inLastCulledFrustum = node->inFrustum(args->lastViewFrustum); | |
| 2023 | + inLastCulledFrustum = voxel->inFrustum(args->lastViewFrustum); | |
| 2039 | 2024 | |
| 2040 | 2025 | // if this node is fully inside our last culled view frustum, then we don't need to recurse further |
| 2041 | 2026 | if (inLastCulledFrustum == ViewFrustum::INSIDE) { |
| @@ -2048,17 +2033,17 @@ bool VoxelSystem::showAllSubTreeOperation(VoxelNode* node, void* extraData) { · 6 unmodified lines | ||
| 2048 | 2033 | |
| 2049 | 2034 | float voxelSizeScale = Menu::getInstance()->getVoxelSizeScale(); |
| 2050 | 2035 | int boundaryLevelAdjust = Menu::getInstance()->getBoundaryLevelAdjust(); |
| 2051 | − bool shouldRender = node->calculateShouldRender(&args->thisViewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 2052 | − node->setShouldRender(shouldRender); | |
| 2036 | + bool shouldRender = voxel->calculateShouldRender(&args->thisViewFrustum, voxelSizeScale, boundaryLevelAdjust); | |
| 2037 | + voxel->setShouldRender(shouldRender); | |
| 2053 | 2038 | |
| 2054 | − if (shouldRender && !node->isKnownBufferIndex()) { | |
| 2039 | + if (shouldRender && !voxel->isKnownBufferIndex()) { | |
| 2055 | 2040 | bool falseColorize = false; |
| 2056 | 2041 | if (falseColorize) { |
| 2057 | − node->setFalseColor(0,0,255); // false colorize | |
| 2042 | + voxel->setFalseColor(0,0,255); // false colorize | |
| 2058 | 2043 | } |
| 2059 | 2044 | // These are both needed to force redraw... |
| 2060 | − node->setDirtyBit(); | |
| 2061 | − node->markWithChangedTime(); | |
| 2045 | + voxel->setDirtyBit(); | |
| 2046 | + voxel->markWithChangedTime(); | |
| 2062 | 2047 | } |
| 2063 | 2048 | |
| 2064 | 2049 | return true; // keep recursing! |
| @@ -2067,12 +2052,13 @@ bool VoxelSystem::showAllSubTreeOperation(VoxelNode* node, void* extraData) { · 2 unmodified lines | ||
| 2067 | 2052 | // "hide" voxels in the VBOs that are still in the tree that but not in view. |
| 2068 | 2053 | // We don't remove them from the tree, we don't delete them, we do remove them |
| 2069 | 2054 | // from the VBOs and mark them as such in the tree. |
| 2070 | −bool VoxelSystem::hideOutOfViewOperation(VoxelNode* node, void* extraData) { | |
| 2055 | +bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData) { | |
| 2056 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 2071 | 2057 | hideOutOfViewArgs* args = (hideOutOfViewArgs*)extraData; |
| 2072 | 2058 | |
| 2073 | 2059 | // If we're still recursing the tree using this operator, then we don't know if we're inside or outside... |
| 2074 | 2060 | // so before we move forward we need to determine our frustum location |
| 2075 | − ViewFrustum::location inFrustum = node->inFrustum(args->thisViewFrustum); | |
| 2061 | + ViewFrustum::location inFrustum = voxel->inFrustum(args->thisViewFrustum); | |
| 2076 | 2062 | |
| 2077 | 2063 | // If we've culled at least once, then we will use the status of this voxel in the last culled frustum to determine |
| 2078 | 2064 | // how to proceed. If we've never culled, then we just consider all these voxels to be UNKNOWN so that we will not |
| @@ -2080,7 +2066,7 @@ bool VoxelSystem::hideOutOfViewOperation(VoxelNode* node, void* extraData) { · 1 unmodified line | ||
| 2080 | 2066 | ViewFrustum::location inLastCulledFrustum; |
| 2081 | 2067 | |
| 2082 | 2068 | if (args->culledOnce && args->wantDeltaFrustums) { |
| 2083 | − inLastCulledFrustum = node->inFrustum(args->lastViewFrustum); | |
| 2069 | + inLastCulledFrustum = voxel->inFrustum(args->lastViewFrustum); | |
| 2084 | 2070 | } |
| 2085 | 2071 | |
| 2086 | 2072 | // ok, now do some processing for this node... |
| @@ -2099,7 +2085,7 @@ bool VoxelSystem::hideOutOfViewOperation(VoxelNode* node, void* extraData) { · 12 unmodified lines | ||
| 2099 | 2085 | // if this node is fully OUTSIDE the view, but previously intersected and/or was inside the last view, then |
| 2100 | 2086 | // we need to hide it. Additionally we know that ALL of it's children are also fully OUTSIDE so we can recurse |
| 2101 | 2087 | // the children and simply mark them as hidden |
| 2102 | − args->tree->recurseNodeWithOperation(node, hideAllSubTreeOperation, args ); | |
| 2088 | + args->tree->recurseNodeWithOperation(voxel, hideAllSubTreeOperation, args ); | |
| 2103 | 2089 | |
| 2104 | 2090 | return false; |
| 2105 | 2091 | |
| @@ -2118,7 +2104,7 @@ bool VoxelSystem::hideOutOfViewOperation(VoxelNode* node, void* extraData) { · 12 unmodified lines | ||
| 2118 | 2104 | // if this node is fully INSIDE the view, but previously INTERSECTED and/or was OUTSIDE the last view, then |
| 2119 | 2105 | // we need to show it. Additionally we know that ALL of it's children are also fully INSIDE so we can recurse |
| 2120 | 2106 | // the children and simply mark them as visible (as appropriate based on LOD) |
| 2121 | − args->tree->recurseNodeWithOperation(node, showAllSubTreeOperation, args); | |
| 2107 | + args->tree->recurseNodeWithOperation(voxel, showAllSubTreeOperation, args); | |
| 2122 | 2108 | |
| 2123 | 2109 | return false; |
| 2124 | 2110 | } break; |
| @@ -2138,8 +2124,8 @@ bool VoxelSystem::hideOutOfViewOperation(VoxelNode* node, void* extraData) { · 13 unmodified lines | ||
| 2138 | 2124 | // if the child node INTERSECTs the view, then we want to check to see if it thinks it should render |
| 2139 | 2125 | // if it should render but is missing it's VBO index, then we want to flip it on, and we can stop recursing from |
| 2140 | 2126 | // here because we know will block any children anyway |
| 2141 | − if (node->getShouldRender() && !node->isKnownBufferIndex()) { | |
| 2142 | − node->setDirtyBit(); // will this make it draw? | |
| 2127 | + if (voxel->getShouldRender() && !voxel->isKnownBufferIndex()) { | |
| 2128 | + voxel->setDirtyBit(); // will this make it draw? | |
| 2143 | 2129 | return false; |
| 2144 | 2130 | } |
| 2145 | 2131 | |
| @@ -2159,18 +2145,19 @@ bool VoxelSystem::hideOutOfViewOperation(VoxelNode* node, void* extraData) { · 13 unmodified lines | ||
| 2159 | 2145 | bool VoxelSystem::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, |
| 2160 | 2146 | VoxelDetail& detail, float& distance, BoxFace& face) { |
| 2161 | 2147 | lockTree(); |
| 2162 | − VoxelNode* node; | |
| 2163 | − if (!_tree->findRayIntersection(origin, direction, node, distance, face)) { | |
| 2148 | + OctreeElement* element; | |
| 2149 | + if (!_tree->findRayIntersection(origin, direction, element, distance, face)) { | |
| 2164 | 2150 | unlockTree(); |
| 2165 | 2151 | return false; |
| 2166 | 2152 | } |
| 2167 | − detail.x = node->getCorner().x; | |
| 2168 | − detail.y = node->getCorner().y; | |
| 2169 | − detail.z = node->getCorner().z; | |
| 2170 | − detail.s = node->getScale(); | |
| 2171 | − detail.red = node->getColor()[0]; | |
| 2172 | − detail.green = node->getColor()[1]; | |
| 2173 | − detail.blue = node->getColor()[2]; | |
| 2153 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 2154 | + detail.x = voxel->getCorner().x; | |
| 2155 | + detail.y = voxel->getCorner().y; | |
| 2156 | + detail.z = voxel->getCorner().z; | |
| 2157 | + detail.s = voxel->getScale(); | |
| 2158 | + detail.red = voxel->getColor()[0]; | |
| 2159 | + detail.green = voxel->getColor()[1]; | |
| 2160 | + detail.blue = voxel->getColor()[2]; | |
| 2174 | 2161 | unlockTree(); |
| 2175 | 2162 | return true; |
| 2176 | 2163 | } |
| @@ -2198,14 +2185,15 @@ public: · 21 unmodified lines | ||
| 2198 | 2185 | bool colorThis; |
| 2199 | 2186 | }; |
| 2200 | 2187 | |
| 2201 | −bool VoxelSystem::falseColorizeRandomEveryOtherOperation(VoxelNode* node, void* extraData) { | |
| 2188 | +bool VoxelSystem::falseColorizeRandomEveryOtherOperation(OctreeElement* element, void* extraData) { | |
| 2189 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 2202 | 2190 | falseColorizeRandomEveryOtherArgs* args = (falseColorizeRandomEveryOtherArgs*)extraData; |
| 2203 | 2191 | args->totalNodes++; |
| 2204 | − if (node->isColored()) { | |
| 2192 | + if (voxel->isColored()) { | |
| 2205 | 2193 | args->colorableNodes++; |
| 2206 | 2194 | if (args->colorThis) { |
| 2207 | 2195 | args->coloredNodes++; |
| 2208 | − node->setFalseColor(255, randomColorValue(150), randomColorValue(150)); | |
| 2196 | + voxel->setFalseColor(255, randomColorValue(150), randomColorValue(150)); | |
| 2209 | 2197 | } |
| 2210 | 2198 | args->colorThis = !args->colorThis; |
| 2211 | 2199 | } |
| @@ -2257,42 +2245,43 @@ public: · 45 unmodified lines | ||
| 2257 | 2245 | bool* hasIndexFound; |
| 2258 | 2246 | }; |
| 2259 | 2247 | |
| 2260 | −bool VoxelSystem::collectStatsForTreesAndVBOsOperation(VoxelNode* node, void* extraData) { | |
| 2248 | +bool VoxelSystem::collectStatsForTreesAndVBOsOperation(OctreeElement* element, void* extraData) { | |
| 2249 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 2261 | 2250 | |
| 2262 | 2251 | collectStatsForTreesAndVBOsArgs* args = (collectStatsForTreesAndVBOsArgs*)extraData; |
| 2263 | 2252 | args->totalNodes++; |
| 2264 | 2253 | |
| 2265 | − if (node->isLeaf()) { | |
| 2254 | + if (voxel->isLeaf()) { | |
| 2266 | 2255 | args->leafNodes++; |
| 2267 | 2256 | } |
| 2268 | 2257 | |
| 2269 | − if (node->isColored()) { | |
| 2258 | + if (voxel->isColored()) { | |
| 2270 | 2259 | args->coloredNodes++; |
| 2271 | 2260 | } |
| 2272 | 2261 | |
| 2273 | − if (node->getShouldRender()) { | |
| 2262 | + if (voxel->getShouldRender()) { | |
| 2274 | 2263 | args->shouldRenderNodes++; |
| 2275 | 2264 | } |
| 2276 | 2265 | |
| 2277 | − if (node->isDirty()) { | |
| 2266 | + if (voxel->isDirty()) { | |
| 2278 | 2267 | args->dirtyNodes++; |
| 2279 | 2268 | } |
| 2280 | 2269 | |
| 2281 | − if (node->isKnownBufferIndex()) { | |
| 2270 | + if (voxel->isKnownBufferIndex()) { | |
| 2282 | 2271 | args->nodesInVBO++; |
| 2283 | − unsigned long nodeIndex = node->getBufferIndex(); | |
| 2272 | + unsigned long nodeIndex = voxel->getBufferIndex(); | |
| 2284 | 2273 | |
| 2285 | 2274 | const bool extraDebugging = false; // enable for extra debugging |
| 2286 | 2275 | if (extraDebugging) { |
| 2287 | 2276 | qDebug("node In VBO... [%f,%f,%f] %f ... index=%ld, isDirty=%s, shouldRender=%s \n", |
| 2288 | − node->getCorner().x, node->getCorner().y, node->getCorner().z, node->getScale(), | |
| 2289 | − nodeIndex, debug::valueOf(node->isDirty()), debug::valueOf(node->getShouldRender())); | |
| 2277 | + voxel->getCorner().x, voxel->getCorner().y, voxel->getCorner().z, voxel->getScale(), | |
| 2278 | + nodeIndex, debug::valueOf(voxel->isDirty()), debug::valueOf(voxel->getShouldRender())); | |
| 2290 | 2279 | } |
| 2291 | 2280 | |
| 2292 | 2281 | if (args->hasIndexFound[nodeIndex]) { |
| 2293 | 2282 | args->duplicateVBOIndex++; |
| 2294 | 2283 | qDebug("duplicateVBO found... index=%ld, isDirty=%s, shouldRender=%s \n", nodeIndex, |
| 2295 | − debug::valueOf(node->isDirty()), debug::valueOf(node->getShouldRender())); | |
| 2284 | + debug::valueOf(voxel->isDirty()), debug::valueOf(voxel->getShouldRender())); | |
| 2296 | 2285 | } else { |
| 2297 | 2286 | args->hasIndexFound[nodeIndex] = true; |
| 2298 | 2287 | } |
| @@ -2301,7 +2290,7 @@ bool VoxelSystem::collectStatsForTreesAndVBOsOperation(VoxelNode* node, void* ex · 2 unmodified lines | ||
| 2301 | 2290 | } |
| 2302 | 2291 | |
| 2303 | 2292 | // if it's in VBO but not-shouldRender, track that also... |
| 2304 | − if (!node->getShouldRender()) { | |
| 2293 | + if (!voxel->getShouldRender()) { | |
| 2305 | 2294 | args->nodesInVBONotShouldRender++; |
| 2306 | 2295 | } |
| 2307 | 2296 | } |
| @@ -2368,7 +2357,7 @@ void VoxelSystem::deleteVoxelAt(float x, float y, float z, float s) { · 60 unmodified lines | ||
| 2368 | 2357 | |
| 2369 | 2358 | }; |
| 2370 | 2359 | |
| 2371 | −VoxelNode* VoxelSystem::getVoxelAt(float x, float y, float z, float s) const { | |
| 2360 | +VoxelTreeElement* VoxelSystem::getVoxelAt(float x, float y, float z, float s) const { | |
| 2372 | 2361 | return _tree->getVoxelAt(x, y, z, s); |
| 2373 | 2362 | }; |
| 2374 | 2363 | |
| @@ -2394,20 +2383,20 @@ void VoxelSystem::createSphere(float r,float xc, float yc, float zc, float s, bo · 19 unmodified lines | ||
| 2394 | 2383 | setupNewVoxelsForDrawing(); |
| 2395 | 2384 | }; |
| 2396 | 2385 | |
| 2397 | −void VoxelSystem::copySubTreeIntoNewTree(VoxelNode* startNode, VoxelSystem* destination, bool rebaseToRoot) { | |
| 2386 | +void VoxelSystem::copySubTreeIntoNewTree(VoxelTreeElement* startNode, VoxelSystem* destination, bool rebaseToRoot) { | |
| 2398 | 2387 | _tree->copySubTreeIntoNewTree(startNode, destination->_tree, rebaseToRoot); |
| 2399 | 2388 | destination->setupNewVoxelsForDrawing(); |
| 2400 | 2389 | } |
| 2401 | 2390 | |
| 2402 | −void VoxelSystem::copySubTreeIntoNewTree(VoxelNode* startNode, VoxelTree* destination, bool rebaseToRoot) { | |
| 2391 | +void VoxelSystem::copySubTreeIntoNewTree(VoxelTreeElement* startNode, VoxelTree* destination, bool rebaseToRoot) { | |
| 2403 | 2392 | _tree->copySubTreeIntoNewTree(startNode, destination, rebaseToRoot); |
| 2404 | 2393 | } |
| 2405 | 2394 | |
| 2406 | −void VoxelSystem::copyFromTreeIntoSubTree(VoxelTree* sourceTree, VoxelNode* destinationNode) { | |
| 2395 | +void VoxelSystem::copyFromTreeIntoSubTree(VoxelTree* sourceTree, VoxelTreeElement* destinationNode) { | |
| 2407 | 2396 | _tree->copyFromTreeIntoSubTree(sourceTree, destinationNode); |
| 2408 | 2397 | } |
| 2409 | 2398 | |
| 2410 | −void VoxelSystem::recurseTreeWithOperation(RecurseVoxelTreeOperation operation, void* extraData) { | |
| 2399 | +void VoxelSystem::recurseTreeWithOperation(RecurseOctreeOperation operation, void* extraData) { | |
| 2411 | 2400 | _tree->recurseTreeWithOperation(operation, extraData); |
| 2412 | 2401 | } |
| 2413 | 2402 | |
| @@ -2432,27 +2421,29 @@ struct FalseColorizeSubTreeOperationArgs { · 18 unmodified lines | ||
| 2432 | 2421 | long voxelsTouched; |
| 2433 | 2422 | }; |
| 2434 | 2423 | |
| 2435 | −bool VoxelSystem::falseColorizeSubTreeOperation(VoxelNode* node, void* extraData) { | |
| 2436 | − if (node->getShouldRender()) { | |
| 2424 | +bool VoxelSystem::falseColorizeSubTreeOperation(OctreeElement* element, void* extraData) { | |
| 2425 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 2426 | + if (voxel->getShouldRender()) { | |
| 2437 | 2427 | FalseColorizeSubTreeOperationArgs* args = (FalseColorizeSubTreeOperationArgs*) extraData; |
| 2438 | − node->setFalseColor(args->color[0], args->color[1], args->color[2]); | |
| 2428 | + voxel->setFalseColor(args->color[0], args->color[1], args->color[2]); | |
| 2439 | 2429 | args->voxelsTouched++; |
| 2440 | 2430 | } |
| 2441 | 2431 | return true; |
| 2442 | 2432 | } |
| 2443 | 2433 | |
| 2444 | −bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraData) { | |
| 2434 | +bool VoxelSystem::falseColorizeOccludedOperation(OctreeElement* element, void* extraData) { | |
| 2435 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 2445 | 2436 | |
| 2446 | 2437 | FalseColorizeOccludedArgs* args = (FalseColorizeOccludedArgs*) extraData; |
| 2447 | 2438 | args->totalVoxels++; |
| 2448 | 2439 | |
| 2449 | 2440 | // If we are a parent, let's see if we're completely occluded. |
| 2450 | − if (!node->isLeaf()) { | |
| 2441 | + if (!voxel->isLeaf()) { | |
| 2451 | 2442 | args->nonLeaves++; |
| 2452 | 2443 | |
| 2453 | − AABox voxelBox = node->getAABox(); | |
| 2444 | + AABox voxelBox = voxel->getAABox(); | |
| 2454 | 2445 | voxelBox.scale(TREE_SCALE); |
| 2455 | − VoxelProjectedPolygon* voxelPolygon = new VoxelProjectedPolygon(args->viewFrustum->getProjectedPolygon(voxelBox)); | |
| 2446 | + OctreeProjectedPolygon* voxelPolygon = new OctreeProjectedPolygon(args->viewFrustum->getProjectedPolygon(voxelBox)); | |
| 2456 | 2447 | |
| 2457 | 2448 | // If we're not all in view, then ignore it, and just return. But keep searching... |
| 2458 | 2449 | if (!voxelPolygon->getAllInView()) { |
| @@ -2472,7 +2463,7 @@ bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraDat · 13 unmodified lines | ||
| 2472 | 2463 | subArgs.color[2] = 0; |
| 2473 | 2464 | subArgs.voxelsTouched = 0; |
| 2474 | 2465 | |
| 2475 | − args->tree->recurseNodeWithOperation(node, falseColorizeSubTreeOperation, &subArgs ); | |
| 2466 | + args->tree->recurseNodeWithOperation(voxel, falseColorizeSubTreeOperation, &subArgs ); | |
| 2476 | 2467 | |
| 2477 | 2468 | args->subtreeVoxelsSkipped += (subArgs.voxelsTouched - 1); |
| 2478 | 2469 | args->totalVoxels += (subArgs.voxelsTouched - 1); |
| @@ -2484,12 +2475,12 @@ bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraDat · 5 unmodified lines | ||
| 2484 | 2475 | return true; // keep looking... |
| 2485 | 2476 | } |
| 2486 | 2477 | |
| 2487 | − if (node->isLeaf() && node->isColored() && node->getShouldRender()) { | |
| 2478 | + if (voxel->isLeaf() && voxel->isColored() && voxel->getShouldRender()) { | |
| 2488 | 2479 | args->coloredVoxels++; |
| 2489 | 2480 | |
| 2490 | − AABox voxelBox = node->getAABox(); | |
| 2481 | + AABox voxelBox = voxel->getAABox(); | |
| 2491 | 2482 | voxelBox.scale(TREE_SCALE); |
| 2492 | − VoxelProjectedPolygon* voxelPolygon = new VoxelProjectedPolygon(args->viewFrustum->getProjectedPolygon(voxelBox)); | |
| 2483 | + OctreeProjectedPolygon* voxelPolygon = new OctreeProjectedPolygon(args->viewFrustum->getProjectedPolygon(voxelBox)); | |
| 2493 | 2484 | |
| 2494 | 2485 | // If we're not all in view, then ignore it, and just return. But keep searching... |
| 2495 | 2486 | if (!voxelPolygon->getAllInView()) { |
| @@ -2500,7 +2491,7 @@ bool VoxelSystem::falseColorizeOccludedOperation(VoxelNode* node, void* extraDat · 4 unmodified lines | ||
| 2500 | 2491 | |
| 2501 | 2492 | CoverageMapStorageResult result = args->map->checkMap(voxelPolygon, true); |
| 2502 | 2493 | if (result == OCCLUDED) { |
| 2503 | − node->setFalseColor(255, 0, 0); | |
| 2494 | + voxel->setFalseColor(255, 0, 0); | |
| 2504 | 2495 | args->occludedVoxels++; |
| 2505 | 2496 | } else if (result == STORED) { |
| 2506 | 2497 | args->notOccludedVoxels++; |
| @@ -2530,9 +2521,9 @@ void VoxelSystem::falseColorizeOccluded() { · 23 unmodified lines | ||
| 2530 | 2521 | args.nonLeavesOccluded = 0; |
| 2531 | 2522 | args.tree = _tree; |
| 2532 | 2523 | |
| 2533 | − VoxelProjectedPolygon::pointInside_calls = 0; | |
| 2534 | − VoxelProjectedPolygon::occludes_calls = 0; | |
| 2535 | − VoxelProjectedPolygon::intersects_calls = 0; | |
| 2524 | + OctreeProjectedPolygon::pointInside_calls = 0; | |
| 2525 | + OctreeProjectedPolygon::occludes_calls = 0; | |
| 2526 | + OctreeProjectedPolygon::intersects_calls = 0; | |
| 2536 | 2527 | |
| 2537 | 2528 | glm::vec3 position = args.viewFrustum->getPosition() * (1.0f/TREE_SCALE); |
| 2538 | 2529 | |
| @@ -2543,9 +2534,9 @@ void VoxelSystem::falseColorizeOccluded() { · 4 unmodified lines | ||
| 2543 | 2534 | args.totalVoxels, args.coloredVoxels, args.occludedVoxels, |
| 2544 | 2535 | args.notOccludedVoxels, args.outOfView, args.subtreeVoxelsSkipped, |
| 2545 | 2536 | args.nonLeaves, args.nonLeavesOutOfView, args.nonLeavesOccluded, |
| 2546 | − VoxelProjectedPolygon::pointInside_calls, | |
| 2547 | − VoxelProjectedPolygon::occludes_calls, | |
| 2548 | − VoxelProjectedPolygon::intersects_calls | |
| 2537 | + OctreeProjectedPolygon::pointInside_calls, | |
| 2538 | + OctreeProjectedPolygon::occludes_calls, | |
| 2539 | + OctreeProjectedPolygon::intersects_calls | |
| 2549 | 2540 | ); |
| 2550 | 2541 | |
| 2551 | 2542 | |
| @@ -2555,18 +2546,19 @@ void VoxelSystem::falseColorizeOccluded() { · 3 unmodified lines | ||
| 2555 | 2546 | setupNewVoxelsForDrawing(); |
| 2556 | 2547 | } |
| 2557 | 2548 | |
| 2558 | −bool VoxelSystem::falseColorizeOccludedV2Operation(VoxelNode* node, void* extraData) { | |
| 2549 | +bool VoxelSystem::falseColorizeOccludedV2Operation(OctreeElement* element, void* extraData) { | |
| 2550 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 2559 | 2551 | |
| 2560 | 2552 | FalseColorizeOccludedArgs* args = (FalseColorizeOccludedArgs*) extraData; |
| 2561 | 2553 | args->totalVoxels++; |
| 2562 | 2554 | |
| 2563 | 2555 | // If we are a parent, let's see if we're completely occluded. |
| 2564 | − if (!node->isLeaf()) { | |
| 2556 | + if (!voxel->isLeaf()) { | |
| 2565 | 2557 | args->nonLeaves++; |
| 2566 | 2558 | |
| 2567 | − AABox voxelBox = node->getAABox(); | |
| 2559 | + AABox voxelBox = voxel->getAABox(); | |
| 2568 | 2560 | voxelBox.scale(TREE_SCALE); |
| 2569 | − VoxelProjectedPolygon* voxelPolygon = new VoxelProjectedPolygon(args->viewFrustum->getProjectedPolygon(voxelBox)); | |
| 2561 | + OctreeProjectedPolygon* voxelPolygon = new OctreeProjectedPolygon(args->viewFrustum->getProjectedPolygon(voxelBox)); | |
| 2570 | 2562 | |
| 2571 | 2563 | // If we're not all in view, then ignore it, and just return. But keep searching... |
| 2572 | 2564 | if (!voxelPolygon->getAllInView()) { |
| @@ -2586,7 +2578,7 @@ bool VoxelSystem::falseColorizeOccludedV2Operation(VoxelNode* node, void* extraD · 13 unmodified lines | ||
| 2586 | 2578 | subArgs.color[2] = 0; |
| 2587 | 2579 | subArgs.voxelsTouched = 0; |
| 2588 | 2580 | |
| 2589 | − args->tree->recurseNodeWithOperation(node, falseColorizeSubTreeOperation, &subArgs ); | |
| 2581 | + args->tree->recurseNodeWithOperation(voxel, falseColorizeSubTreeOperation, &subArgs ); | |
| 2590 | 2582 | |
| 2591 | 2583 | args->subtreeVoxelsSkipped += (subArgs.voxelsTouched - 1); |
| 2592 | 2584 | args->totalVoxels += (subArgs.voxelsTouched - 1); |
| @@ -2598,12 +2590,12 @@ bool VoxelSystem::falseColorizeOccludedV2Operation(VoxelNode* node, void* extraD · 5 unmodified lines | ||
| 2598 | 2590 | return true; // keep looking... |
| 2599 | 2591 | } |
| 2600 | 2592 | |
| 2601 | − if (node->isLeaf() && node->isColored() && node->getShouldRender()) { | |
| 2593 | + if (voxel->isLeaf() && voxel->isColored() && voxel->getShouldRender()) { | |
| 2602 | 2594 | args->coloredVoxels++; |
| 2603 | 2595 | |
| 2604 | − AABox voxelBox = node->getAABox(); | |
| 2596 | + AABox voxelBox = voxel->getAABox(); | |
| 2605 | 2597 | voxelBox.scale(TREE_SCALE); |
| 2606 | − VoxelProjectedPolygon* voxelPolygon = new VoxelProjectedPolygon(args->viewFrustum->getProjectedPolygon(voxelBox)); | |
| 2598 | + OctreeProjectedPolygon* voxelPolygon = new OctreeProjectedPolygon(args->viewFrustum->getProjectedPolygon(voxelBox)); | |
| 2607 | 2599 | |
| 2608 | 2600 | // If we're not all in view, then ignore it, and just return. But keep searching... |
| 2609 | 2601 | if (!voxelPolygon->getAllInView()) { |
| @@ -2614,7 +2606,7 @@ bool VoxelSystem::falseColorizeOccludedV2Operation(VoxelNode* node, void* extraD · 4 unmodified lines | ||
| 2614 | 2606 | |
| 2615 | 2607 | CoverageMapV2StorageResult result = args->mapV2->checkMap(voxelPolygon, true); |
| 2616 | 2608 | if (result == V2_OCCLUDED) { |
| 2617 | − node->setFalseColor(255, 0, 0); | |
| 2609 | + voxel->setFalseColor(255, 0, 0); | |
| 2618 | 2610 | args->occludedVoxels++; |
| 2619 | 2611 | } else if (result == V2_STORED) { |
| 2620 | 2612 | args->notOccludedVoxels++; |
| @@ -2634,9 +2626,9 @@ void VoxelSystem::falseColorizeOccludedV2() { · 13 unmodified lines | ||
| 2634 | 2626 | |
| 2635 | 2627 | CoverageMapV2::wantDebugging = true; |
| 2636 | 2628 | |
| 2637 | − VoxelProjectedPolygon::pointInside_calls = 0; | |
| 2638 | − VoxelProjectedPolygon::occludes_calls = 0; | |
| 2639 | − VoxelProjectedPolygon::intersects_calls = 0; | |
| 2629 | + OctreeProjectedPolygon::pointInside_calls = 0; | |
| 2630 | + OctreeProjectedPolygon::occludes_calls = 0; | |
| 2631 | + OctreeProjectedPolygon::intersects_calls = 0; | |
| 2640 | 2632 | |
| 2641 | 2633 | FalseColorizeOccludedArgs args; |
| 2642 | 2634 | args.viewFrustum = _viewFrustum; |
| @@ -2661,9 +2653,9 @@ void VoxelSystem::falseColorizeOccludedV2() { · 18 unmodified lines | ||
| 2661 | 2653 | args.totalVoxels, args.coloredVoxels, args.occludedVoxels, |
| 2662 | 2654 | args.notOccludedVoxels, args.outOfView, args.subtreeVoxelsSkipped, |
| 2663 | 2655 | args.nonLeaves, args.nonLeavesOutOfView, args.nonLeavesOccluded, |
| 2664 | − VoxelProjectedPolygon::pointInside_calls, | |
| 2665 | − VoxelProjectedPolygon::occludes_calls, | |
| 2666 | − VoxelProjectedPolygon::intersects_calls | |
| 2656 | + OctreeProjectedPolygon::pointInside_calls, | |
| 2657 | + OctreeProjectedPolygon::occludes_calls, | |
| 2658 | + OctreeProjectedPolygon::intersects_calls | |
| 2667 | 2659 | ); |
| 2668 | 2660 | //myCoverageMapV2.erase(); |
| 2669 | 2661 | _tree->setDirtyBit(); |
| @@ -2677,13 +2669,14 @@ void VoxelSystem::nodeAdded(Node* node) { · 7 unmodified lines | ||
| 2677 | 2669 | } |
| 2678 | 2670 | } |
| 2679 | 2671 | |
| 2680 | −bool VoxelSystem::killSourceVoxelsOperation(VoxelNode* node, void* extraData) { | |
| 2672 | +bool VoxelSystem::killSourceVoxelsOperation(OctreeElement* element, void* extraData) { | |
| 2673 | + VoxelTreeElement* voxel = (VoxelTreeElement*)element; | |
| 2681 | 2674 | QUuid killedNodeID = *(QUuid*)extraData; |
| 2682 | 2675 | for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { |
| 2683 | − VoxelNode* childNode = node->getChildAtIndex(i); | |
| 2676 | + VoxelTreeElement* childNode = voxel->getChildAtIndex(i); | |
| 2684 | 2677 | if (childNode) { |
| 2685 | 2678 | if (childNode->matchesSourceUUID(killedNodeID)) { |
| 2686 | − node->safeDeepDeleteChildAtIndex(i); | |
| 2679 | + voxel->safeDeepDeleteChildAtIndex(i); | |
| 2687 | 2680 | } |
| 2688 | 2681 | } |
| 2689 | 2682 | } |