From 681aab5bf036a75383918a6822f1f01f9277e3b3 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 21 Apr 2014 16:17:45 -0700 Subject: [PATCH] Remove printf and replace them by qDebug() --- animation-server/src/AnimationServer.cpp | 36 +++++++++---------- .../octree/OctreeInboundPacketProcessor.cpp | 10 +++--- assignment-client/src/octree/OctreeServer.cpp | 18 +++++----- interface/src/Application.cpp | 6 ++-- interface/src/DatagramProcessor.cpp | 2 +- interface/src/Util.cpp | 2 +- interface/src/avatar/MyAvatar.cpp | 2 +- interface/src/devices/SixenseManager.cpp | 2 +- interface/src/voxels/VoxelSystem.cpp | 2 +- libraries/networking/src/Logging.cpp | 2 +- libraries/octree/src/Octree.cpp | 10 +++--- libraries/octree/src/Octree.h | 20 +++++------ .../octree/src/OctreeEditPacketSender.cpp | 4 +-- libraries/octree/src/OctreeElement.cpp | 4 +-- libraries/octree/src/OctreePacketData.cpp | 14 ++++---- .../octree/src/OctreeProjectedPolygon.cpp | 8 ++--- libraries/octree/src/Plane.cpp | 4 ++- libraries/particles/src/Particle.cpp | 28 +++++++-------- .../particles/src/ParticleTreeElement.cpp | 6 ++-- voxel-edit/src/SceneUtils.cpp | 8 ++--- 20 files changed, 95 insertions(+), 93 deletions(-) diff --git a/animation-server/src/AnimationServer.cpp b/animation-server/src/AnimationServer.cpp index ffb98b4ae0..32a95b48ea 100644 --- a/animation-server/src/AnimationServer.cpp +++ b/animation-server/src/AnimationServer.cpp @@ -171,7 +171,7 @@ static void renderMovingBug() { } } else { - //printf("bugPathCenter=(%f,%f,%f)\n", bugPathCenter.x, bugPathCenter.y, bugPathCenter.z); + //qDebug("bugPathCenter=(%f,%f,%f)", bugPathCenter.x, bugPathCenter.y, bugPathCenter.z); bugPathTheta += bugAngleDelta; // move slightly bugRotation -= bugAngleDelta; // rotate slightly @@ -187,12 +187,12 @@ static void renderMovingBug() { float y = bugPathCenter.y; bugPosition = glm::vec3(x, y, z); - //printf("bugPathTheta=%f\n", bugPathTheta); - //printf("bugRotation=%f\n", bugRotation); + //qDebug("bugPathTheta=%f", bugPathTheta); + //qDebug("bugRotation=%f", bugRotation); } - //printf("bugPosition=(%f,%f,%f)\n", bugPosition.x, bugPosition.y, bugPosition.z); - //printf("bugDirection=(%f,%f,%f)\n", bugDirection.x, bugDirection.y, bugDirection.z); + //qDebug("bugPosition=(%f,%f,%f)", bugPosition.x, bugPosition.y, bugPosition.z); + //qDebug("bugDirection=(%f,%f,%f)", bugDirection.x, bugDirection.y, bugDirection.z); // would be nice to add some randomness here... // Generate voxels for where bug is going to @@ -690,32 +690,32 @@ AnimationServer::AnimationServer(int &argc, char **argv) : // Handle Local Domain testing with the --local command line const char* NON_THREADED_PACKETSENDER = "--NonThreadedPacketSender"; ::nonThreadedPacketSender = cmdOptionExists(argc, (const char**) argv, NON_THREADED_PACKETSENDER); - printf("nonThreadedPacketSender=%s\n", debug::valueOf(::nonThreadedPacketSender)); + qDebug("nonThreadedPacketSender=%s", debug::valueOf(::nonThreadedPacketSender)); // Handle Local Domain testing with the --local command line const char* NO_BILLBOARD = "--NoBillboard"; ::includeBillboard = !cmdOptionExists(argc, (const char**) argv, NO_BILLBOARD); - printf("includeBillboard=%s\n", debug::valueOf(::includeBillboard)); + qDebug("includeBillboard=%s", debug::valueOf(::includeBillboard)); const char* NO_BORDER_TRACER = "--NoBorderTracer"; ::includeBorderTracer = !cmdOptionExists(argc, (const char**) argv, NO_BORDER_TRACER); - printf("includeBorderTracer=%s\n", debug::valueOf(::includeBorderTracer)); + qDebug("includeBorderTracer=%s", debug::valueOf(::includeBorderTracer)); const char* NO_MOVING_BUG = "--NoMovingBug"; ::includeMovingBug = !cmdOptionExists(argc, (const char**) argv, NO_MOVING_BUG); - printf("includeMovingBug=%s\n", debug::valueOf(::includeMovingBug)); + qDebug("includeMovingBug=%s", debug::valueOf(::includeMovingBug)); const char* INCLUDE_BLINKING_VOXEL = "--includeBlinkingVoxel"; ::includeBlinkingVoxel = cmdOptionExists(argc, (const char**) argv, INCLUDE_BLINKING_VOXEL); - printf("includeBlinkingVoxel=%s\n", debug::valueOf(::includeBlinkingVoxel)); + qDebug("includeBlinkingVoxel=%s", debug::valueOf(::includeBlinkingVoxel)); const char* NO_DANCE_FLOOR = "--NoDanceFloor"; ::includeDanceFloor = !cmdOptionExists(argc, (const char**) argv, NO_DANCE_FLOOR); - printf("includeDanceFloor=%s\n", debug::valueOf(::includeDanceFloor)); + qDebug("includeDanceFloor=%s", debug::valueOf(::includeDanceFloor)); const char* BUILD_STREET = "--BuildStreet"; ::buildStreet = cmdOptionExists(argc, (const char**) argv, BUILD_STREET); - printf("buildStreet=%s\n", debug::valueOf(::buildStreet)); + qDebug("buildStreet=%s", debug::valueOf(::buildStreet)); // Handle Local Domain testing with the --local command line const char* showPPS = "--showPPS"; @@ -725,7 +725,7 @@ AnimationServer::AnimationServer(int &argc, char **argv) : const char* local = "--local"; ::wantLocalDomain = cmdOptionExists(argc, (const char**) argv,local); if (::wantLocalDomain) { - printf("Local Domain MODE!\n"); + qDebug("Local Domain MODE!"); nodeList->getDomainHandler().setIPToLocalhost(); } @@ -738,7 +738,7 @@ AnimationServer::AnimationServer(int &argc, char **argv) : if (packetsPerSecondCommand) { ::packetsPerSecond = atoi(packetsPerSecondCommand); } - printf("packetsPerSecond=%d\n",packetsPerSecond); + qDebug("packetsPerSecond=%d",packetsPerSecond); const char* animateFPSCommand = getCmdOption(argc, (const char**) argv, "--AnimateFPS"); const char* animateIntervalCommand = getCmdOption(argc, (const char**) argv, "--AnimateInterval"); @@ -753,8 +753,8 @@ AnimationServer::AnimationServer(int &argc, char **argv) : ::ANIMATE_VOXELS_INTERVAL_USECS = (ANIMATE_FPS_IN_MILLISECONDS * 1000.0); // converts from milliseconds to usecs } } - printf("ANIMATE_FPS=%d\n",ANIMATE_FPS); - printf("ANIMATE_VOXELS_INTERVAL_USECS=%llu\n",ANIMATE_VOXELS_INTERVAL_USECS); + qDebug("ANIMATE_FPS=%d",ANIMATE_FPS); + qDebug("ANIMATE_VOXELS_INTERVAL_USECS=%llu",ANIMATE_VOXELS_INTERVAL_USECS); const char* processingFPSCommand = getCmdOption(argc, (const char**) argv, "--ProcessingFPS"); const char* processingIntervalCommand = getCmdOption(argc, (const char**) argv, "--ProcessingInterval"); @@ -769,8 +769,8 @@ AnimationServer::AnimationServer(int &argc, char **argv) : ::PROCESSING_INTERVAL_USECS = (PROCESSING_FPS_IN_MILLISECONDS * 1000.0) - FUDGE_USECS; // converts from milliseconds to usecs } } - printf("PROCESSING_FPS=%d\n",PROCESSING_FPS); - printf("PROCESSING_INTERVAL_USECS=%llu\n",PROCESSING_INTERVAL_USECS); + qDebug("PROCESSING_FPS=%d",PROCESSING_FPS); + qDebug("PROCESSING_INTERVAL_USECS=%llu",PROCESSING_INTERVAL_USECS); nodeList->linkedDataCreateCallback = NULL; // do we need a callback? diff --git a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp index 41158bf339..545c502036 100644 --- a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp +++ b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp @@ -45,7 +45,7 @@ void OctreeInboundPacketProcessor::processPacket(const SharedNodePointer& sendin bool debugProcessPacket = _myServer->wantsVerboseDebug(); if (debugProcessPacket) { - printf("OctreeInboundPacketProcessor::processPacket() packetData=%p packetLength=%d\n", &packet, packet.size()); + qDebug("OctreeInboundPacketProcessor::processPacket() packetData=%p packetLength=%d", &packet, packet.size()); } int numBytesPacketHeader = numBytesForPacketHeader(packet); @@ -78,8 +78,8 @@ void OctreeInboundPacketProcessor::processPacket(const SharedNodePointer& sendin int maxSize = packet.size() - atByte; if (debugProcessPacket) { - printf("OctreeInboundPacketProcessor::processPacket() %c " - "packetData=%p packetLength=%d voxelData=%p atByte=%d maxSize=%d\n", + qDebug("OctreeInboundPacketProcessor::processPacket() %c " + "packetData=%p packetLength=%d voxelData=%p atByte=%d maxSize=%d", packetType, packetData, packet.size(), editData, atByte, maxSize); } @@ -105,8 +105,8 @@ void OctreeInboundPacketProcessor::processPacket(const SharedNodePointer& sendin } if (debugProcessPacket) { - printf("OctreeInboundPacketProcessor::processPacket() DONE LOOPING FOR %c " - "packetData=%p packetLength=%d voxelData=%p atByte=%d\n", + qDebug("OctreeInboundPacketProcessor::processPacket() DONE LOOPING FOR %c " + "packetData=%p packetLength=%d voxelData=%p atByte=%d", packetType, packetData, packet.size(), editData, atByte); } diff --git a/assignment-client/src/octree/OctreeServer.cpp b/assignment-client/src/octree/OctreeServer.cpp index 2e8a354c6a..21762f1534 100644 --- a/assignment-client/src/octree/OctreeServer.cpp +++ b/assignment-client/src/octree/OctreeServer.cpp @@ -486,7 +486,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url // encode float averageEncodeTime = getAverageEncodeTime(); - statsString += QString().sprintf(" Average encode time: %9.2f usecs\r\n", averageEncodeTime); + statsString += QString().sqDebug(" Average encode time: %9.2f usecs\r", averageEncodeTime); int allEncodeTimes = _noEncode + _shortEncode + _longEncode + _extraLongEncode; @@ -554,9 +554,9 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url noVsTotalSend * AS_PERCENT, _noSend); float averageNodeWaitTime = getAverageNodeWaitTime(); - statsString += QString().sprintf(" Average node lock wait time: %9.2f usecs\r\n", averageNodeWaitTime); + statsString += QString().sqDebug(" Average node lock wait time: %9.2f usecs\r", averageNodeWaitTime); - statsString += QString().sprintf("--------------------------------------------------------------\r\n"); + statsString += QString().sqDebug("--------------------------------------------------------------\r"); float encodeToInsidePercent = averageInsideTime == 0.0f ? 0.0f : (averageEncodeTime / averageInsideTime) * AS_PERCENT; statsString += QString().sprintf(" encode ratio: %5.2f%%\r\n", @@ -564,7 +564,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url float waitToInsidePercent = averageInsideTime == 0.0f ? 0.0f : ((averageTreeWaitTime + averageNodeWaitTime) / averageInsideTime) * AS_PERCENT; - statsString += QString().sprintf(" waiting ratio: %5.2f%%\r\n", waitToInsidePercent); + statsString += QString().sqDebug(" waiting ratio: %5.2f%%\r", waitToInsidePercent); float compressAndWriteToInsidePercent = averageInsideTime == 0.0f ? 0.0f : (averageCompressAndWriteTime / averageInsideTime) * AS_PERCENT; @@ -573,7 +573,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url float sendingToInsidePercent = averageInsideTime == 0.0f ? 0.0f : (averagePacketSendingTime / averageInsideTime) * AS_PERCENT; - statsString += QString().sprintf(" sending ratio: %5.2f%%\r\n", sendingToInsidePercent); + statsString += QString().sqDebug(" sending ratio: %5.2f%%\r", sendingToInsidePercent); @@ -615,7 +615,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url .arg(locale.toString((uint)totalPacketsProcessed).rightJustified(COLUMN_WIDTH, ' ')); statsString += QString(" Total Inbound Elements: %1 elements\r\n") .arg(locale.toString((uint)totalElementsProcessed).rightJustified(COLUMN_WIDTH, ' ')); - statsString += QString().sprintf(" Average Inbound Elements/Packet: %f elements/packet\r\n", averageElementsPerPacket); + statsString += QString().sqDebug(" Average Inbound Elements/Packet: %f elements/packet\r", averageElementsPerPacket); statsString += QString(" Average Transit Time/Packet: %1 usecs\r\n") .arg(locale.toString((uint)averageTransitTimePerPacket).rightJustified(COLUMN_WIDTH, ' ')); statsString += QString(" Average Process Time/Packet: %1 usecs\r\n") @@ -671,7 +671,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url // display memory usage stats statsString += "Current Memory Usage Statistics\r\n"; - statsString += QString().sprintf("\r\nOctreeElement size... %ld bytes\r\n", sizeof(OctreeElement)); + statsString += QString().sqDebug("\r\nOctreeElement size... %ld bytes\r", sizeof(OctreeElement)); statsString += "\r\n"; const char* memoryScaleLabel; @@ -738,8 +738,8 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url OctreeElement::getExternalChildrenCount(); statsString += " ----------------\r\n"; - statsString += QString().sprintf(" Total: %10.llu nodes\r\n", checkSum); - statsString += QString().sprintf(" Expected: %10.lu nodes\r\n", nodeCount); + statsString += QString().sqDebug(" Total: %10.llu nodes\r", checkSum); + statsString += QString().sqDebug(" Expected: %10.lu nodes\r", nodeCount); statsString += "\r\n"; statsString += "In other news....\r\n"; diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index cd07f21300..a885c80968 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3122,7 +3122,7 @@ void Application::nodeKilled(SharedNodePointer node) { VoxelPositionSize rootDetails; voxelDetailsForCode(rootCode, rootDetails); - printf("voxel server going away...... v[%f, %f, %f, %f]\n", + qDebug("voxel server going away...... v[%f, %f, %f, %f]", rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s); // Add the jurisditionDetails object to the list of "fade outs" @@ -3153,7 +3153,7 @@ void Application::nodeKilled(SharedNodePointer node) { VoxelPositionSize rootDetails; voxelDetailsForCode(rootCode, rootDetails); - printf("particle server going away...... v[%f, %f, %f, %f]\n", + qDebug("particle server going away...... v[%f, %f, %f, %f]", rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s); // Add the jurisditionDetails object to the list of "fade outs" @@ -3234,7 +3234,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin if (jurisdiction->find(nodeUUID) == jurisdiction->end()) { - printf("stats from new server... v[%f, %f, %f, %f]\n", + qDebug("stats from new server... v[%f, %f, %f, %f]", rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s); // Add the jurisditionDetails object to the list of "fade outs" diff --git a/interface/src/DatagramProcessor.cpp b/interface/src/DatagramProcessor.cpp index 92260ad9dc..6525e79cf2 100644 --- a/interface/src/DatagramProcessor.cpp +++ b/interface/src/DatagramProcessor.cpp @@ -78,7 +78,7 @@ void DatagramProcessor::processDatagrams() { OCTREE_PACKET_SENT_TIME arrivedAt = usecTimestampNow(); int flightTime = arrivedAt - sentAt; - printf("got PacketType_VOXEL_DATA, sequence:%d flightTime:%d\n", sequence, flightTime); + qDebug("got PacketType_VOXEL_DATA, sequence:%d flightTime:%d", sequence, flightTime); } SharedNodePointer matchedNode = NodeList::getInstance()->sendingNodeForPacket(incomingPacket); diff --git a/interface/src/Util.cpp b/interface/src/Util.cpp index 1dae3a4fd6..febcb2f36e 100644 --- a/interface/src/Util.cpp +++ b/interface/src/Util.cpp @@ -63,7 +63,7 @@ void eulerToOrthonormals(glm::vec3 * angles, glm::vec3 * front, glm::vec3 * righ } void printVector(glm::vec3 vec) { - printf("%4.2f, %4.2f, %4.2f\n", vec.x, vec.y, vec.z); + qDebug("%4.2f, %4.2f, %4.2f", vec.x, vec.y, vec.z); } // Return the azimuth angle (in radians) between two points. diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 8229611646..317f408aa7 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -432,7 +432,7 @@ void MyAvatar::renderDebugBodyPoints() { glm::vec3 headPosition(getHead()->getEyePosition()); float torsoToHead = glm::length(headPosition - torsoPosition); glm::vec3 position; - printf("head-above-torso %.2f, scale = %0.2f\n", torsoToHead, getScale()); + qDebug("head-above-torso %.2f, scale = %0.2f", torsoToHead, getScale()); // Torso Sphere position = torsoPosition; diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index b950e6097c..f7c00411c1 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -96,7 +96,7 @@ void SixenseManager::update(float deltaTime) { hand->getPalms().push_back(newPalm); palm = &(hand->getPalms()[hand->getNumPalms() - 1]); palm->setSixenseID(data->controller_index); - printf("Found new Sixense controller, ID %i\n", data->controller_index); + qDebug("Found new Sixense controller, ID %i", data->controller_index); } palm->setActive(true); diff --git a/interface/src/voxels/VoxelSystem.cpp b/interface/src/voxels/VoxelSystem.cpp index 692f299bdc..8d59f33674 100644 --- a/interface/src/voxels/VoxelSystem.cpp +++ b/interface/src/voxels/VoxelSystem.cpp @@ -117,7 +117,7 @@ void VoxelSystem::elementDeleted(OctreeElement* element) { forceRemoveNodeFromArrays(voxel); } else { if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) { - printf("VoxelSystem::elementDeleted() while _voxelsInWriteArrays==0, is that expected? \n"); + qDebug("VoxelSystem::elementDeleted() while _voxelsInWriteArrays==0, is that expected? "); } } } diff --git a/libraries/networking/src/Logging.cpp b/libraries/networking/src/Logging.cpp index 17a4706de0..f42f1bda58 100644 --- a/libraries/networking/src/Logging.cpp +++ b/libraries/networking/src/Logging.cpp @@ -46,7 +46,7 @@ const HifiSockAddr& Logging::socket() { // use the first IP address _logstashSocket.setAddress(hostInfo.addresses().first()); } else { - printf("Failed to lookup logstash IP - will try again on next log attempt.\n"); + qDebug("Failed to lookup logstash IP - will try again on next log attempt."); } } diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index 696a65b4b5..d7fc7713cf 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -471,8 +471,8 @@ void Octree::processRemoveOctreeElementsBitstream(const unsigned char* bitstream int codeLength = numberOfThreeBitSectionsInCode(voxelCode, maxSize); if (codeLength == OVERFLOWED_OCTCODE_BUFFER) { - printf("WARNING! Got remove voxel bitstream that would overflow buffer in numberOfThreeBitSectionsInCode(), "); - printf("bailing processing of packet!\n"); + qDebug("WARNING! Got remove voxel bitstream that would overflow buffer in numberOfThreeBitSectionsInCode()," + " bailing processing of packet!"); break; } int voxelDataSize = bytesRequiredForCodeLength(codeLength) + SIZE_OF_COLOR_DATA; @@ -482,7 +482,7 @@ void Octree::processRemoveOctreeElementsBitstream(const unsigned char* bitstream voxelCode += voxelDataSize; atByte += voxelDataSize; } else { - printf("WARNING! Got remove voxel bitstream that would overflow buffer, bailing processing!\n"); + qDebug("WARNING! Got remove voxel bitstream that would overflow buffer, bailing processing!"); break; } } @@ -1404,7 +1404,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* node, outputBits(childrenExistInPacketBits, false, true); printf(" childrenColored:"); outputBits(childrenColoredBits, false, true); - printf("\n"); + qDebug(""); **/ // if we were unable to fit this level in our packet, then rewind and add it to the node bag for @@ -1620,7 +1620,7 @@ void Octree::copyFromTreeIntoSubTree(Octree* sourceTree, OctreeElement* destinat } void dumpSetContents(const char* name, std::set set) { - printf("set %s has %ld elements\n", name, set.size()); + qDebug("set %s has %ld elements", name, set.size()); /* for (std::set::iterator i = set.begin(); i != set.end(); ++i) { printOctalCode(*i); diff --git a/libraries/octree/src/Octree.h b/libraries/octree/src/Octree.h index 839e61d1c2..3c868ab172 100644 --- a/libraries/octree/src/Octree.h +++ b/libraries/octree/src/Octree.h @@ -129,17 +129,17 @@ public: printf("StopReason: "); switch (stopReason) { default: - case UNKNOWN: printf("UNKNOWN\n"); break; + case UNKNOWN: qDebug("UNKNOWN"); break; - case DIDNT_FIT: printf("DIDNT_FIT\n"); break; - case NULL_NODE: printf("NULL_NODE\n"); break; - case TOO_DEEP: printf("TOO_DEEP\n"); break; - case OUT_OF_JURISDICTION: printf("OUT_OF_JURISDICTION\n"); break; - case LOD_SKIP: printf("LOD_SKIP\n"); break; - case OUT_OF_VIEW: printf("OUT_OF_VIEW\n"); break; - case WAS_IN_VIEW: printf("WAS_IN_VIEW\n"); break; - case NO_CHANGE: printf("NO_CHANGE\n"); break; - case OCCLUDED: printf("OCCLUDED\n"); break; + case DIDNT_FIT: qDebug("DIDNT_FIT"); break; + case NULL_NODE: qDebug("NULL_NODE"); break; + case TOO_DEEP: qDebug("TOO_DEEP"); break; + case OUT_OF_JURISDICTION: qDebug("OUT_OF_JURISDICTION"); break; + case LOD_SKIP: qDebug("LOD_SKIP"); break; + case OUT_OF_VIEW: qDebug("OUT_OF_VIEW"); break; + case WAS_IN_VIEW: qDebug("WAS_IN_VIEW"); break; + case NO_CHANGE: qDebug("NO_CHANGE"); break; + case OCCLUDED: qDebug("OCCLUDED"); break; } } }; diff --git a/libraries/octree/src/OctreeEditPacketSender.cpp b/libraries/octree/src/OctreeEditPacketSender.cpp index b606dffe44..7e59b3ae7f 100644 --- a/libraries/octree/src/OctreeEditPacketSender.cpp +++ b/libraries/octree/src/OctreeEditPacketSender.cpp @@ -37,7 +37,7 @@ OctreeEditPacketSender::OctreeEditPacketSender() : _serverJurisdictions(NULL), _sequenceNumber(0), _maxPacketSize(MAX_PACKET_SIZE) { - //printf("OctreeEditPacketSender::OctreeEditPacketSender() [%p] created... \n", this); + //qDebug("OctreeEditPacketSender::OctreeEditPacketSender() [%p] created... ", this); } OctreeEditPacketSender::~OctreeEditPacketSender() { @@ -53,7 +53,7 @@ OctreeEditPacketSender::~OctreeEditPacketSender() { _preServerPackets.erase(_preServerPackets.begin()); } _pendingPacketsLock.unlock(); - //printf("OctreeEditPacketSender::~OctreeEditPacketSender() [%p] destroyed... \n", this); + //qDebug("OctreeEditPacketSender::~OctreeEditPacketSender() [%p] destroyed... ", this); } diff --git a/libraries/octree/src/OctreeElement.cpp b/libraries/octree/src/OctreeElement.cpp index e21148df5e..96311ceabd 100644 --- a/libraries/octree/src/OctreeElement.cpp +++ b/libraries/octree/src/OctreeElement.cpp @@ -204,7 +204,7 @@ void OctreeElement::calculateAABox() { void OctreeElement::deleteChildAtIndex(int childIndex) { OctreeElement* childAt = getChildAtIndex(childIndex); if (childAt) { - //printf("deleteChildAtIndex()... about to call delete childAt=%p\n",childAt); + //qDebug("deleteChildAtIndex()... about to call delete childAt=%p",childAt); delete childAt; setChildAtIndex(childIndex, NULL); _isDirty = true; @@ -1315,7 +1315,7 @@ OctreeElement* OctreeElement::getOrCreateChildElementAt(float x, float y, float float halfOurScale = ourScale / 2.0f; if(s > ourScale) { - printf("UNEXPECTED -- OctreeElement::getOrCreateChildElementAt() s=[%f] > ourScale=[%f] \n", s, ourScale); + qDebug("UNEXPECTED -- OctreeElement::getOrCreateChildElementAt() s=[%f] > ourScale=[%f] ", s, ourScale); } if (s > halfOurScale) { diff --git a/libraries/octree/src/OctreePacketData.cpp b/libraries/octree/src/OctreePacketData.cpp index 2edf560de6..b54a87bef8 100644 --- a/libraries/octree/src/OctreePacketData.cpp +++ b/libraries/octree/src/OctreePacketData.cpp @@ -125,7 +125,7 @@ const unsigned char* OctreePacketData::getFinalizedData() { if (_dirty) { if (_debug) { - printf("getFinalizedData() _compressedBytes=%d _bytesInUse=%d\n",_compressedBytes, _bytesInUse); + qDebug("getFinalizedData() _compressedBytes=%d _bytesInUse=%d",_compressedBytes, _bytesInUse); } compressContent(); } @@ -139,7 +139,7 @@ int OctreePacketData::getFinalizedSize() { if (_dirty) { if (_debug) { - printf("getFinalizedSize() _compressedBytes=%d _bytesInUse=%d\n",_compressedBytes, _bytesInUse); + qDebug("getFinalizedSize() _compressedBytes=%d _bytesInUse=%d",_compressedBytes, _bytesInUse); } compressContent(); } @@ -187,7 +187,7 @@ void OctreePacketData::discardLevel(LevelDetails key) { _totalBytesOfColor -= reduceBytesOfColor; if (_debug) { - printf("discardLevel() BEFORE _dirty=%s bytesInLevel=%d _compressedBytes=%d _bytesInUse=%d\n", + qDebug("discardLevel() BEFORE _dirty=%s bytesInLevel=%d _compressedBytes=%d _bytesInUse=%d", debug::valueOf(_dirty), bytesInLevel, _compressedBytes, _bytesInUse); } @@ -196,7 +196,7 @@ void OctreePacketData::discardLevel(LevelDetails key) { _dirty = true; if (_debug) { - printf("discardLevel() AFTER _dirty=%s bytesInLevel=%d _compressedBytes=%d _bytesInUse=%d\n", + qDebug("discardLevel() AFTER _dirty=%s bytesInLevel=%d _compressedBytes=%d _bytesInUse=%d", debug::valueOf(_dirty), bytesInLevel, _compressedBytes, _bytesInUse); } } @@ -413,13 +413,13 @@ void OctreePacketData::loadFinalizedContent(const unsigned char* data, int lengt } } else { if (_debug) { - printf("OctreePacketData::loadCompressedContent()... length = 0, nothing to do...\n"); + qDebug("OctreePacketData::loadCompressedContent()... length = 0, nothing to do..."); } } } void OctreePacketData::debugContent() { - printf("OctreePacketData::debugContent()... COMPRESSED DATA.... size=%d\n",_compressedBytes); + qDebug("OctreePacketData::debugContent()... COMPRESSED DATA.... size=%d",_compressedBytes); int perline=0; for (int i = 0; i < _compressedBytes; i++) { printf("%.2x ",_compressed[i]); @@ -431,7 +431,7 @@ void OctreePacketData::debugContent() { } printf("\n"); - printf("OctreePacketData::debugContent()... UNCOMPRESSED DATA.... size=%d\n",_bytesInUse); + qDebug("OctreePacketData::debugContent()... UNCOMPRESSED DATA.... size=%d",_bytesInUse); perline=0; for (int i = 0; i < _bytesInUse; i++) { printf("%.2x ",_uncompressed[i]); diff --git a/libraries/octree/src/OctreeProjectedPolygon.cpp b/libraries/octree/src/OctreeProjectedPolygon.cpp index f86d598a87..92a5b2ac18 100644 --- a/libraries/octree/src/OctreeProjectedPolygon.cpp +++ b/libraries/octree/src/OctreeProjectedPolygon.cpp @@ -263,12 +263,12 @@ bool OctreeProjectedPolygon::pointInside(const glm::vec2& point, bool* matchesVe } void OctreeProjectedPolygon::printDebugDetails() const { - printf("OctreeProjectedPolygon..."); - printf(" minX=%f maxX=%f minY=%f maxY=%f\n", getMinX(), getMaxX(), getMinY(), getMaxY()); - printf(" vertex count=%d distance=%f\n", getVertexCount(), getDistance()); + qDebug("OctreeProjectedPolygon..." + " minX=%f maxX=%f minY=%f maxY=%f", getMinX(), getMaxX(), getMinY(), getMaxY()); + qDebug(" vertex count=%d distance=%f", getVertexCount(), getDistance()); for (int i = 0; i < getVertexCount(); i++) { glm::vec2 point = getVertex(i); - printf(" vertex[%d] = %f, %f \n", i, point.x, point.y); + qDebug(" vertex[%d] = %f, %f ", i, point.x, point.y); } } diff --git a/libraries/octree/src/Plane.cpp b/libraries/octree/src/Plane.cpp index d7cb2c54ff..d9e5633233 100755 --- a/libraries/octree/src/Plane.cpp +++ b/libraries/octree/src/Plane.cpp @@ -14,6 +14,8 @@ #include "Plane.h" +#include + #include void Plane::set3Points(const glm::vec3 &v1, const glm::vec3 &v2, const glm::vec3 &v3) { @@ -61,6 +63,6 @@ float Plane::distance(const glm::vec3 &point) const { } void Plane::print() const { - printf("Plane - point (x=%f y=%f z=%f) normal (x=%f y=%f z=%f) d=%f\n", + qDebug("Plane - point (x=%f y=%f z=%f) normal (x=%f y=%f z=%f) d=%f", _point.x, _point.y, _point.z, _normal.x, _normal.y, _normal.z, _dCoefficient); } diff --git a/libraries/particles/src/Particle.cpp b/libraries/particles/src/Particle.cpp index a36998aad4..59265c00dc 100644 --- a/libraries/particles/src/Particle.cpp +++ b/libraries/particles/src/Particle.cpp @@ -146,7 +146,7 @@ bool Particle::appendParticleData(OctreePacketData* packetData) const { bool success = packetData->appendValue(getID()); - //printf("Particle::appendParticleData()... getID()=%d\n", getID()); + //qDebug("Particle::appendParticleData()... getID()=%d", getID()); if (success) { success = packetData->appendValue(getAge()); @@ -541,15 +541,15 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr } void Particle::debugDump() const { - printf("Particle id :%u\n", _id); - printf(" age:%f\n", getAge()); - printf(" edited ago:%f\n", getEditedAgo()); - printf(" should die:%s\n", debug::valueOf(getShouldDie())); - printf(" position:%f,%f,%f\n", _position.x, _position.y, _position.z); - printf(" radius:%f\n", getRadius()); - printf(" velocity:%f,%f,%f\n", _velocity.x, _velocity.y, _velocity.z); - printf(" gravity:%f,%f,%f\n", _gravity.x, _gravity.y, _gravity.z); - printf(" color:%d,%d,%d\n", _color[0], _color[1], _color[2]); + qDebug("Particle id :%u", _id); + qDebug(" age:%f", getAge()); + qDebug(" edited ago:%f", getEditedAgo()); + qDebug(" should die:%s", debug::valueOf(getShouldDie())); + qDebug(" position:%f,%f,%f", _position.x, _position.y, _position.z); + qDebug(" radius:%f", getRadius()); + qDebug(" velocity:%f,%f,%f", _velocity.x, _velocity.y, _velocity.z); + qDebug(" gravity:%f,%f,%f", _gravity.x, _gravity.y, _gravity.z); + qDebug(" color:%d,%d,%d", _color[0], _color[1], _color[2]); } bool Particle::encodeParticleEditMessageDetails(PacketType command, ParticleID id, const ParticleProperties& properties, @@ -732,9 +732,9 @@ bool Particle::encodeParticleEditMessageDetails(PacketType command, ParticleID i bool wantDebugging = false; if (wantDebugging) { - printf("encodeParticleEditMessageDetails()....\n"); - printf("Particle id :%u\n", id.id); - printf(" nextID:%u\n", _nextID); + qDebug("encodeParticleEditMessageDetails()...."); + qDebug("Particle id :%u", id.id); + qDebug(" nextID:%u", _nextID); } // cleanup @@ -844,7 +844,7 @@ void Particle::update(const quint64& now) { // handle damping glm::vec3 dampingResistance = _velocity * _damping; _velocity -= dampingResistance * timeElapsed; - //printf("applying damping to Particle timeElapsed=%f\n",timeElapsed); + //qDebug("applying damping to Particle timeElapsed=%f",timeElapsed); } } diff --git a/libraries/particles/src/ParticleTreeElement.cpp b/libraries/particles/src/ParticleTreeElement.cpp index 19353c427a..d28ccf2f5e 100644 --- a/libraries/particles/src/ParticleTreeElement.cpp +++ b/libraries/particles/src/ParticleTreeElement.cpp @@ -142,7 +142,7 @@ bool ParticleTreeElement::updateParticle(const Particle& particle) { bool localOlder = thisParticle.getLastUpdated() < particle.getLastUpdated(); if (changedOnServer || localOlder) { if (wantDebug) { - printf("local particle [id:%d] %s and %s than server particle by %d, particle.isNewlyCreated()=%s\n", + qDebug("local particle [id:%d] %s and %s than server particle by %d, particle.isNewlyCreated()=%s", particle.getID(), (changedOnServer ? "CHANGED" : "same"), (localOlder ? "OLDER" : "NEWER"), difference, debug::valueOf(particle.isNewlyCreated()) ); @@ -150,8 +150,8 @@ bool ParticleTreeElement::updateParticle(const Particle& particle) { thisParticle.copyChangedProperties(particle); } else { if (wantDebug) { - printf(">>> IGNORING SERVER!!! Would've caused jutter! <<< " - "local particle [id:%d] %s and %s than server particle by %d, particle.isNewlyCreated()=%s\n", + qDebug(">>> IGNORING SERVER!!! Would've caused jutter! <<< " + "local particle [id:%d] %s and %s than server particle by %d, particle.isNewlyCreated()=%s", particle.getID(), (changedOnServer ? "CHANGED" : "same"), (localOlder ? "OLDER" : "NEWER"), difference, debug::valueOf(particle.isNewlyCreated()) ); diff --git a/voxel-edit/src/SceneUtils.cpp b/voxel-edit/src/SceneUtils.cpp index 19e227c71a..937b03cc39 100644 --- a/voxel-edit/src/SceneUtils.cpp +++ b/voxel-edit/src/SceneUtils.cpp @@ -20,7 +20,7 @@ void addCornersAndAxisLines(VoxelTree* tree) { float voxelSize = 0.5f / TREE_SCALE; // Now some more examples... a little more complex - printf("creating corner points...\n"); + qDebug("creating corner points..."); tree->createVoxel(0 , 0 , 0 , voxelSize, 255, 255 ,255); tree->createVoxel(1.0 - voxelSize, 0 , 0 , voxelSize, 255, 0 ,0 ); tree->createVoxel(0 , 1.0 - voxelSize, 0 , voxelSize, 0 , 255 ,0 ); @@ -29,11 +29,11 @@ void addCornersAndAxisLines(VoxelTree* tree) { tree->createVoxel(0 , 1.0 - voxelSize, 1.0 - voxelSize, voxelSize, 0 , 255 ,255); tree->createVoxel(1.0 - voxelSize, 1.0 - voxelSize, 0 , voxelSize, 255, 255 ,0 ); tree->createVoxel(1.0 - voxelSize, 1.0 - voxelSize, 1.0 - voxelSize, voxelSize, 255, 255 ,255); - printf("DONE creating corner points...\n"); + qDebug("DONE creating corner points..."); } void addSurfaceScene(VoxelTree * tree) { - printf("adding surface scene...\n"); + qDebug("adding surface scene..."); float voxelSize = 1.f / (8 * TREE_SCALE); // color 1= blue, color 2=green @@ -57,5 +57,5 @@ void addSurfaceScene(VoxelTree * tree) { } } } - printf("DONE adding surface scene...\n"); + qDebug("DONE adding surface scene..."); }