History

fix voxel nodes to work with new UUID format

ZappoMan committed 13 years ago

Commit 9b0cc141 parent 3c9518d7 files · +91 −26Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 7 files). Show all

Unified · Split

interface/src/VoxelSystem.cpp+15−13
@@ -82,7 +82,7 @@ VoxelSystem::VoxelSystem(float treeScale, int maxVoxels) · 81 unmodified lines
8282 VoxelNode::addUpdateHook(this);
8383 _abandonedVBOSlots = 0;
8484 _falseColorizeBySource = false;
85− _dataSourceID = 0;
85+ _dataSourceUUID = QUuid();
8686 _voxelServerCount = 0;
8787
8888 _viewFrustum = Application::getInstance()->getViewFrustum();
@@ -576,7 +576,7 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 487 unmodified lines
576576 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
577577 "readBitstreamToTree()");
578578 // 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());
580580 pthread_mutex_lock(&_treeLock);
581581 _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args);
582582 pthread_mutex_unlock(&_treeLock);
@@ -586,7 +586,7 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 3 unmodified lines
586586 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
587587 "readBitstreamToTree()");
588588 // 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());
590590 pthread_mutex_lock(&_treeLock);
591591 _tree->readBitstreamToTree(voxelData, numBytes - numBytesPacketHeader, args);
592592 pthread_mutex_unlock(&_treeLock);
@@ -1417,8 +1417,8 @@ bool VoxelSystem::falseColorizeBySourceOperation(VoxelNode* node, void* extraDat · 824 unmodified lines
14171417 _nodeCount++;
14181418 if (node->isColored()) {
14191419 // 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);
14221422 }
14231423 return true; // keep going!
14241424 }
@@ -1442,7 +1442,7 @@ void VoxelSystem::falseColorizeBySource() { · 17 unmodified lines
14421442 NodeList* nodeList = NodeList::getInstance();
14431443 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
14441444 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
14461446 int groupColor = voxelServerCount % NUMBER_OF_COLOR_GROUPS;
14471447 args.colors[nodeID] = groupColors[groupColor];
14481448
@@ -2305,12 +2305,11 @@ void VoxelSystem::nodeAdded(Node* node) { · 856 unmodified lines
23052305 }
23062306
23072307 bool VoxelSystem::killSourceVoxelsOperation(VoxelNode* node, void* extraData) {
2308− uint16_t killedNodeID = *(uint16_t*)extraData;
2308+ QUuid killedNodeID = *(QUuid*)extraData;
23092309 for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
23102310 VoxelNode* childNode = node->getChildAtIndex(i);
23112311 if (childNode) {
2312− uint16_t childNodeID = childNode->getSourceID();
2313− if (childNodeID == killedNodeID) {
2312+ if (childNode->matchesSourceUUID(killedNodeID)) {
23142313 node->safeDeepDeleteChildAtIndex(i);
23152314 }
23162315 }
@@ -2321,14 +2320,17 @@ bool VoxelSystem::killSourceVoxelsOperation(VoxelNode* node, void* extraData) { · 4 unmodified lines
23212320 void VoxelSystem::nodeKilled(Node* node) {
23222321 if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
23232322 _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());
23252327
23262328 if (_voxelServerCount > 0) {
23272329 // Kill any voxels from the local tree that match this nodeID
23282330 // 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);
23322334 _tree->setDirtyBit();
23332335 setupNewVoxelsForDrawing();
23342336 } else {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t