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