From 8d7b4ab321b9a1cbb349d05bb5b0b146f1ac6721 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 12 Sep 2013 17:37:37 -0700 Subject: [PATCH 1/3] add debugging for assignment send and remove a useless cast --- assignment-client/src/main.cpp | 1 + libraries/shared/src/NodeList.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/assignment-client/src/main.cpp b/assignment-client/src/main.cpp index a0cf0be4c1..046179ea02 100644 --- a/assignment-client/src/main.cpp +++ b/assignment-client/src/main.cpp @@ -59,6 +59,7 @@ void childClient() { if (usecTimestampNow() - usecTimestamp(&lastRequest) >= ASSIGNMENT_REQUEST_INTERVAL_USECS) { gettimeofday(&lastRequest, NULL); // if we're here we have no assignment, so send a request + qDebug() << "Sending an assignment request -" << requestAssignment << "\n"; nodeList->sendAssignment(requestAssignment); } diff --git a/libraries/shared/src/NodeList.cpp b/libraries/shared/src/NodeList.cpp index 50853c1c93..cce0aecf14 100644 --- a/libraries/shared/src/NodeList.cpp +++ b/libraries/shared/src/NodeList.cpp @@ -393,7 +393,7 @@ void NodeList::sendAssignment(Assignment& assignment) { ? (sockaddr*) &GLOBAL_ASSIGNMENT_SOCKET : _assignmentServerSocket; - _nodeSocket.send((sockaddr*) assignmentServerSocket, assignmentPacket, numHeaderBytes + numAssignmentBytes); + _nodeSocket.send(assignmentServerSocket, assignmentPacket, numHeaderBytes + numAssignmentBytes); } Node* NodeList::addOrUpdateNode(sockaddr* publicSocket, sockaddr* localSocket, char nodeType, uint16_t nodeId) { From 71d5f3d2d886c959864cb88b9e7330c65c13cb1b Mon Sep 17 00:00:00 2001 From: LionTurtle Date: Thu, 12 Sep 2013 17:38:16 -0700 Subject: [PATCH 2/3] Fix for copy/cut/paste single voxel leaves. --- libraries/voxels/src/VoxelTree.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index 0880af33ee..eeee12e343 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -618,6 +618,7 @@ void VoxelTree::printTreeForDebugging(VoxelNode *startNode) { void VoxelTree::reaverageVoxelColors(VoxelNode *startNode) { // if our tree is a reaveraging tree, then we do this, otherwise we don't do anything if (_shouldReaverage) { + qDebug("Trying to dechunkify\n"); bool hasChildren = false; for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { @@ -635,6 +636,12 @@ void VoxelTree::reaverageVoxelColors(VoxelNode *startNode) { // this is also a good time to recalculateSubTreeNodeCount() startNode->recalculateSubTreeNodeCount(); + + if (startNode->isLeaf()) { + qDebug("dechunkified\n"); + } else { + qDebug("not dechunkified\n"); + } } } @@ -1772,6 +1779,14 @@ void VoxelTree::copySubTreeIntoNewTree(VoxelNode* startNode, VoxelTree* destinat ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS); destinationTree->readBitstreamToTree(&outputBuffer[0], bytesWritten, args); } + + VoxelNode* destinationStartNode; + if (rebaseToRoot) { + destinationStartNode = destinationTree->rootNode; + } else { + destinationStartNode = nodeForOctalCode(destinationTree->rootNode, startNode->getOctalCode(), NULL); + } + destinationStartNode->setColor(startNode->getColor()); } void VoxelTree::copyFromTreeIntoSubTree(VoxelTree* sourceTree, VoxelNode* destinationNode) { @@ -2041,13 +2056,6 @@ void VoxelTree::nudgeSubTree(VoxelNode* nodeToNudge, const glm::vec3& nudgeAmoun return; } - // get octal code of this node - unsigned char* octalCode = nodeToNudge->getOctalCode(); - - // get voxel position/size - VoxelPositionSize ancestorDetails; - voxelDetailsForCode(octalCode, ancestorDetails); - NodeChunkArgs args; args.thisVoxelTree = this; args.nudgeVec = nudgeAmount; From 99db8491efc61027a637b23d474db0e144112c45 Mon Sep 17 00:00:00 2001 From: LionTurtle Date: Thu, 12 Sep 2013 17:41:02 -0700 Subject: [PATCH 3/3] Get rid of qDebug statements in VoxelTree.cpp. --- libraries/voxels/src/VoxelTree.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index eeee12e343..c3d8f78240 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -618,7 +618,6 @@ void VoxelTree::printTreeForDebugging(VoxelNode *startNode) { void VoxelTree::reaverageVoxelColors(VoxelNode *startNode) { // if our tree is a reaveraging tree, then we do this, otherwise we don't do anything if (_shouldReaverage) { - qDebug("Trying to dechunkify\n"); bool hasChildren = false; for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { @@ -636,12 +635,6 @@ void VoxelTree::reaverageVoxelColors(VoxelNode *startNode) { // this is also a good time to recalculateSubTreeNodeCount() startNode->recalculateSubTreeNodeCount(); - - if (startNode->isLeaf()) { - qDebug("dechunkified\n"); - } else { - qDebug("not dechunkified\n"); - } } }