Showing the changes to interface/src/VoxelSystem.cpp (1 of 7 files). Show all
Unified · Split
| @@ -82,7 +82,7 @@ VoxelSystem::VoxelSystem(float treeScale, int maxVoxels) · 81 unmodified lines | ||
| 82 | 82 | VoxelNode::addUpdateHook(this); |
| 83 | 83 | _abandonedVBOSlots = 0; |
| 84 | 84 | _falseColorizeBySource = false; |
| 85 | − _dataSourceID = 0; | |
| 85 | + _dataSourceUUID = QUuid(); | |
| 86 | 86 | _voxelServerCount = 0; |
| 87 | 87 | |
| 88 | 88 | _viewFrustum = Application::getInstance()->getViewFrustum(); |
| @@ -576,7 +576,7 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 487 unmodified lines | ||
| 576 | 576 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 577 | 577 | "readBitstreamToTree()"); |
| 578 | 578 | // ask the VoxelTree to read the bitstream into the tree |
| 579 | − ReadBitstreamToTreeParams args(WANT_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID()); | |
| 579 | + ReadBitstreamToTreeParams args(WANT_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceUUID()); | |
| 580 | 580 | pthread_mutex_lock(&_treeLock); |
| 581 | 581 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args); |
| 582 | 582 | pthread_mutex_unlock(&_treeLock); |
| @@ -586,7 +586,7 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 3 unmodified lines | ||
| 586 | 586 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 587 | 587 | "readBitstreamToTree()"); |
| 588 | 588 | // ask the VoxelTree to read the MONOCHROME bitstream into the tree |
| 589 | − ReadBitstreamToTreeParams args(NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceID()); | |
| 589 | + ReadBitstreamToTreeParams args(NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceUUID()); | |
| 590 | 590 | pthread_mutex_lock(&_treeLock); |
| 591 | 591 | _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args); |
| 592 | 592 | pthread_mutex_unlock(&_treeLock); |
| @@ -1417,8 +1417,8 @@ bool VoxelSystem::falseColorizeBySourceOperation(VoxelNode* node, void* extraDat · 824 unmodified lines | ||
| 1417 | 1417 | _nodeCount++; |
| 1418 | 1418 | if (node->isColored()) { |
| 1419 | 1419 | // pick a color based on the source - we want each source to be obviously different |
| 1420 | − uint16_t nodeID = node->getSourceID(); | |
| 1421 | − node->setFalseColor(args->colors[nodeID].red, args->colors[nodeID].green, args->colors[nodeID].blue); | |
| 1420 | + uint16_t nodeIDKey = node->getSourceUUIDKey(); | |
| 1421 | + node->setFalseColor(args->colors[nodeIDKey].red, args->colors[nodeIDKey].green, args->colors[nodeIDKey].blue); | |
| 1422 | 1422 | } |
| 1423 | 1423 | return true; // keep going! |
| 1424 | 1424 | } |
| @@ -1442,7 +1442,7 @@ void VoxelSystem::falseColorizeBySource() { · 17 unmodified lines | ||
| 1442 | 1442 | NodeList* nodeList = NodeList::getInstance(); |
| 1443 | 1443 | for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| 1444 | 1444 | if (node->getType() == NODE_TYPE_VOXEL_SERVER) { |
| 1445 | − uint16_t nodeID = 0; // hardcoded since removal of 16 bit node IDs | |
| 1445 | + uint16_t nodeID = VoxelNode::getSourceNodeUUIDKey(node->getUUID()); // hardcoded since removal of 16 bit node IDs | |
| 1446 | 1446 | int groupColor = voxelServerCount % NUMBER_OF_COLOR_GROUPS; |
| 1447 | 1447 | args.colors[nodeID] = groupColors[groupColor]; |
| 1448 | 1448 | |
| @@ -2305,12 +2305,11 @@ void VoxelSystem::nodeAdded(Node* node) { · 856 unmodified lines | ||
| 2305 | 2305 | } |
| 2306 | 2306 | |
| 2307 | 2307 | bool VoxelSystem::killSourceVoxelsOperation(VoxelNode* node, void* extraData) { |
| 2308 | − uint16_t killedNodeID = *(uint16_t*)extraData; | |
| 2308 | + QUuid killedNodeID = *(QUuid*)extraData; | |
| 2309 | 2309 | for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { |
| 2310 | 2310 | VoxelNode* childNode = node->getChildAtIndex(i); |
| 2311 | 2311 | if (childNode) { |
| 2312 | − uint16_t childNodeID = childNode->getSourceID(); | |
| 2313 | − if (childNodeID == killedNodeID) { | |
| 2312 | + if (childNode->matchesSourceUUID(killedNodeID)) { | |
| 2314 | 2313 | node->safeDeepDeleteChildAtIndex(i); |
| 2315 | 2314 | } |
| 2316 | 2315 | } |
| @@ -2321,14 +2320,17 @@ bool VoxelSystem::killSourceVoxelsOperation(VoxelNode* node, void* extraData) { · 4 unmodified lines | ||
| 2321 | 2320 | void VoxelSystem::nodeKilled(Node* node) { |
| 2322 | 2321 | if (node->getType() == NODE_TYPE_VOXEL_SERVER) { |
| 2323 | 2322 | _voxelServerCount--; |
| 2324 | − qDebug("VoxelSystem... voxel server %s removed...\n", node->getUUID().toString().toLocal8Bit().constData()); | |
| 2323 | + | |
| 2324 | + QUuid nodeUUID = node->getUUID(); | |
| 2325 | + | |
| 2326 | + qDebug("VoxelSystem... voxel server %s removed...\n", nodeUUID.toString().toLocal8Bit().constData()); | |
| 2325 | 2327 | |
| 2326 | 2328 | if (_voxelServerCount > 0) { |
| 2327 | 2329 | // Kill any voxels from the local tree that match this nodeID |
| 2328 | 2330 | // commenting out for removal of 16 bit node IDs |
| 2329 | −// pthread_mutex_lock(&_treeLock); | |
| 2330 | −// _tree->recurseTreeWithOperation(killSourceVoxelsOperation, 0); | |
| 2331 | −// pthread_mutex_unlock(&_treeLock); | |
| 2331 | + pthread_mutex_lock(&_treeLock); | |
| 2332 | + _tree->recurseTreeWithOperation(killSourceVoxelsOperation, &nodeUUID); | |
| 2333 | + pthread_mutex_unlock(&_treeLock); | |
| 2332 | 2334 | _tree->setDirtyBit(); |
| 2333 | 2335 | setupNewVoxelsForDrawing(); |
| 2334 | 2336 | } else { |