split out octree logging

This commit is contained in:
Seth Alves 2015-04-06 17:04:49 -07:00
parent 8bd77fbcc7
commit 91861e9e5a
14 changed files with 299 additions and 284 deletions

View file

@ -15,6 +15,7 @@
#include <SharedUtil.h> #include <SharedUtil.h>
#include "OctreeLogging.h"
#include "CoverageMap.h" #include "CoverageMap.h"
int CoverageMap::_mapCount = 0; int CoverageMap::_mapCount = 0;
@ -73,19 +74,19 @@ CoverageMap::~CoverageMap() {
}; };
void CoverageMap::printStats() { void CoverageMap::printStats() {
qDebug("CoverageMap::printStats()..."); qCDebug(octree, "CoverageMap::printStats()...");
qDebug("MINIMUM_POLYGON_AREA_TO_STORE=%f",MINIMUM_POLYGON_AREA_TO_STORE); qCDebug(octree, "MINIMUM_POLYGON_AREA_TO_STORE=%f",MINIMUM_POLYGON_AREA_TO_STORE);
qDebug("_mapCount=%d",_mapCount); qCDebug(octree, "_mapCount=%d",_mapCount);
qDebug("_checkMapRootCalls=%d",_checkMapRootCalls); qCDebug(octree, "_checkMapRootCalls=%d",_checkMapRootCalls);
qDebug("_notAllInView=%d",_notAllInView); qCDebug(octree, "_notAllInView=%d",_notAllInView);
qDebug("_maxPolygonsUsed=%d",CoverageRegion::_maxPolygonsUsed); qCDebug(octree, "_maxPolygonsUsed=%d",CoverageRegion::_maxPolygonsUsed);
qDebug("_totalPolygons=%d",CoverageRegion::_totalPolygons); qCDebug(octree, "_totalPolygons=%d",CoverageRegion::_totalPolygons);
qDebug("_occlusionTests=%d",CoverageRegion::_occlusionTests); qCDebug(octree, "_occlusionTests=%d",CoverageRegion::_occlusionTests);
qDebug("_regionSkips=%d",CoverageRegion::_regionSkips); qCDebug(octree, "_regionSkips=%d",CoverageRegion::_regionSkips);
qDebug("_tooSmallSkips=%d",CoverageRegion::_tooSmallSkips); qCDebug(octree, "_tooSmallSkips=%d",CoverageRegion::_tooSmallSkips);
qDebug("_regionFullSkips=%d",CoverageRegion::_regionFullSkips); qCDebug(octree, "_regionFullSkips=%d",CoverageRegion::_regionFullSkips);
qDebug("_outOfOrderPolygon=%d",CoverageRegion::_outOfOrderPolygon); qCDebug(octree, "_outOfOrderPolygon=%d",CoverageRegion::_outOfOrderPolygon);
qDebug("_clippedPolygons=%d",CoverageRegion::_clippedPolygons); qCDebug(octree, "_clippedPolygons=%d",CoverageRegion::_clippedPolygons);
} }
void CoverageMap::erase() { void CoverageMap::erase() {
@ -104,7 +105,7 @@ void CoverageMap::erase() {
} }
if (_isRoot && wantDebugging) { if (_isRoot && wantDebugging) {
qDebug("CoverageMap last to be deleted..."); qCDebug(octree, "CoverageMap last to be deleted...");
printStats(); printStats();
CoverageRegion::_maxPolygonsUsed = 0; CoverageRegion::_maxPolygonsUsed = 0;
@ -235,9 +236,9 @@ CoverageMapStorageResult CoverageMap::checkMap(OctreeProjectedPolygon* polygon,
/* /*
if (result == STORED) if (result == STORED)
qDebug("CoverageMap2::checkMap()... STORED\n"); qCDebug(octree, "CoverageMap2::checkMap()... STORED\n");
else else
qDebug("CoverageMap2::checkMap()... OCCLUDED\n"); qCDebug(octree, "CoverageMap2::checkMap()... OCCLUDED\n");
*/ */
return result; return result;
@ -260,16 +261,16 @@ CoverageMapStorageResult CoverageMap::checkMap(OctreeProjectedPolygon* polygon,
/* /*
switch (result) { switch (result) {
case STORED: case STORED:
qDebug("checkMap() = STORED\n"); qCDebug(octree, "checkMap() = STORED\n");
break; break;
case NOT_STORED: case NOT_STORED:
qDebug("checkMap() = NOT_STORED\n"); qCDebug(octree, "checkMap() = NOT_STORED\n");
break; break;
case OCCLUDED: case OCCLUDED:
qDebug("checkMap() = OCCLUDED\n"); qCDebug(octree, "checkMap() = OCCLUDED\n");
break; break;
default: default:
qDebug("checkMap() = ????? \n"); qCDebug(octree, "checkMap() = ????? \n");
break; break;
} }
*/ */
@ -327,11 +328,11 @@ void CoverageRegion::erase() {
/** /**
if (_polygonCount) { if (_polygonCount) {
qDebug("CoverageRegion::erase()...\n"); qCDebug(octree, "CoverageRegion::erase()...\n");
qDebug("_polygonCount=%d\n",_polygonCount); qCDebug(octree, "_polygonCount=%d\n",_polygonCount);
_myBoundingBox.printDebugDetails(getRegionName()); _myBoundingBox.printDebugDetails(getRegionName());
//for (int i = 0; i < _polygonCount; i++) { //for (int i = 0; i < _polygonCount; i++) {
// qDebug("_polygons[%d]=",i); // qCDebug(octree, "_polygons[%d]=",i);
// _polygons[i]->getBoundingBox().printDebugDetails(); // _polygons[i]->getBoundingBox().printDebugDetails();
//} //}
} }
@ -538,4 +539,4 @@ CoverageMapStorageResult CoverageRegion::checkRegion(OctreeProjectedPolygon* pol
} }
} }
return result; return result;
} }

View file

@ -16,6 +16,7 @@
#include <SharedUtil.h> #include <SharedUtil.h>
#include "OctreeLogging.h"
#include "CoverageMapV2.h" #include "CoverageMapV2.h"
int CoverageMapV2::_mapCount = 0; int CoverageMapV2::_mapCount = 0;
@ -80,11 +81,11 @@ void CoverageMapV2::erase() {
} }
if (_isRoot && wantDebugging) { if (_isRoot && wantDebugging) {
qDebug("CoverageMapV2 last to be deleted..."); qCDebug(octree, "CoverageMapV2 last to be deleted...");
qDebug("MINIMUM_POLYGON_AREA_TO_STORE=%f",MINIMUM_POLYGON_AREA_TO_STORE); qCDebug(octree, "MINIMUM_POLYGON_AREA_TO_STORE=%f",MINIMUM_POLYGON_AREA_TO_STORE);
qDebug("_mapCount=%d",_mapCount); qCDebug(octree, "_mapCount=%d",_mapCount);
qDebug("_checkMapRootCalls=%d",_checkMapRootCalls); qCDebug(octree, "_checkMapRootCalls=%d",_checkMapRootCalls);
qDebug("_notAllInView=%d",_notAllInView); qCDebug(octree, "_notAllInView=%d",_notAllInView);
_mapCount = 0; _mapCount = 0;
_checkMapRootCalls = 0; _checkMapRootCalls = 0;
_notAllInView = 0; _notAllInView = 0;
@ -247,4 +248,4 @@ void CoverageMapV2::recurseMap(const OctreeProjectedPolygon* polygon, bool store
} }
// normal exit case... return... // normal exit case... return...
} }

View file

@ -17,6 +17,7 @@
#include <PacketHeaders.h> #include <PacketHeaders.h>
#include <OctalCode.h> #include <OctalCode.h>
#include "OctreeLogging.h"
#include "JurisdictionMap.h" #include "JurisdictionMap.h"
@ -148,12 +149,12 @@ void myDebugPrintOctalCode(const unsigned char* octalCode, bool withNewLine) {
JurisdictionMap::JurisdictionMap(const char* rootHexCode, const char* endNodesHexCodes) { JurisdictionMap::JurisdictionMap(const char* rootHexCode, const char* endNodesHexCodes) {
qDebug("JurisdictionMap::JurisdictionMap(const char* rootHexCode=[%p] %s, const char* endNodesHexCodes=[%p] %s)", qCDebug(octree, "JurisdictionMap::JurisdictionMap(const char* rootHexCode=[%p] %s, const char* endNodesHexCodes=[%p] %s)",
rootHexCode, rootHexCode, endNodesHexCodes, endNodesHexCodes); rootHexCode, rootHexCode, endNodesHexCodes, endNodesHexCodes);
_rootOctalCode = hexStringToOctalCode(QString(rootHexCode)); _rootOctalCode = hexStringToOctalCode(QString(rootHexCode));
qDebug("JurisdictionMap::JurisdictionMap() _rootOctalCode=%p octalCode=", _rootOctalCode); qCDebug(octree, "JurisdictionMap::JurisdictionMap() _rootOctalCode=%p octalCode=", _rootOctalCode);
myDebugPrintOctalCode(_rootOctalCode, true); myDebugPrintOctalCode(_rootOctalCode, true);
QString endNodesHexStrings(endNodesHexCodes); QString endNodesHexStrings(endNodesHexCodes);
@ -165,13 +166,13 @@ JurisdictionMap::JurisdictionMap(const char* rootHexCode, const char* endNodesHe
unsigned char* endNodeOctcode = hexStringToOctalCode(endNodeHexString); unsigned char* endNodeOctcode = hexStringToOctalCode(endNodeHexString);
qDebug("JurisdictionMap::JurisdictionMap() endNodeList(%d)=%s", qCDebug(octree, "JurisdictionMap::JurisdictionMap() endNodeList(%d)=%s",
i, endNodeHexString.toLocal8Bit().constData()); i, endNodeHexString.toLocal8Bit().constData());
//printOctalCode(endNodeOctcode); //printOctalCode(endNodeOctcode);
_endNodes.push_back(endNodeOctcode); _endNodes.push_back(endNodeOctcode);
qDebug("JurisdictionMap::JurisdictionMap() endNodeOctcode=%p octalCode=", endNodeOctcode); qCDebug(octree, "JurisdictionMap::JurisdictionMap() endNodeOctcode=%p octalCode=", endNodeOctcode);
myDebugPrintOctalCode(endNodeOctcode, true); myDebugPrintOctalCode(endNodeOctcode, true);
} }
@ -212,7 +213,7 @@ bool JurisdictionMap::readFromFile(const char* filename) {
QString settingsFile(filename); QString settingsFile(filename);
QSettings settings(settingsFile, QSettings::IniFormat); QSettings settings(settingsFile, QSettings::IniFormat);
QString rootCode = settings.value("root","00").toString(); QString rootCode = settings.value("root","00").toString();
qDebug() << "rootCode=" << rootCode; qCDebug(octree) << "rootCode=" << rootCode;
_rootOctalCode = hexStringToOctalCode(rootCode); _rootOctalCode = hexStringToOctalCode(rootCode);
printOctalCode(_rootOctalCode); printOctalCode(_rootOctalCode);
@ -223,7 +224,7 @@ bool JurisdictionMap::readFromFile(const char* filename) {
foreach (const QString &childKey, childKeys) { foreach (const QString &childKey, childKeys) {
QString childValue = settings.value(childKey).toString(); QString childValue = settings.value(childKey).toString();
values.insert(childKey, childValue); values.insert(childKey, childValue);
qDebug() << childKey << "=" << childValue; qCDebug(octree) << childKey << "=" << childValue;
unsigned char* octcode = hexStringToOctalCode(childValue); unsigned char* octcode = hexStringToOctalCode(childValue);
printOctalCode(octcode); printOctalCode(octcode);
@ -237,11 +238,11 @@ bool JurisdictionMap::readFromFile(const char* filename) {
void JurisdictionMap::displayDebugDetails() const { void JurisdictionMap::displayDebugDetails() const {
QString rootNodeValue = octalCodeToHexString(_rootOctalCode); QString rootNodeValue = octalCodeToHexString(_rootOctalCode);
qDebug() << "root:" << rootNodeValue; qCDebug(octree) << "root:" << rootNodeValue;
for (size_t i = 0; i < _endNodes.size(); i++) { for (size_t i = 0; i < _endNodes.size(); i++) {
QString value = octalCodeToHexString(_endNodes[i]); QString value = octalCodeToHexString(_endNodes[i]);
qDebug() << "End node[" << i << "]: " << rootNodeValue; qCDebug(octree) << "End node[" << i << "]: " << rootNodeValue;
} }
} }

View file

@ -46,6 +46,7 @@
#include "OctreeElementBag.h" #include "OctreeElementBag.h"
#include "Octree.h" #include "Octree.h"
#include "ViewFrustum.h" #include "ViewFrustum.h"
#include "OctreeLogging.h"
QVector<QString> PERSIST_EXTENSIONS = {"svo", "json"}; QVector<QString> PERSIST_EXTENSIONS = {"svo", "json"};
@ -89,7 +90,7 @@ void Octree::recurseElementWithOperation(OctreeElement* element, RecurseOctreeOp
= LogHandler::getInstance().addRepeatedMessageRegex( = LogHandler::getInstance().addRepeatedMessageRegex(
"Octree::recurseElementWithOperation\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!"); "Octree::recurseElementWithOperation\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!");
qDebug() << "Octree::recurseElementWithOperation() reached DANGEROUSLY_DEEP_RECURSION, bailing!"; qCDebug(octree) << "Octree::recurseElementWithOperation() reached DANGEROUSLY_DEEP_RECURSION, bailing!";
return; return;
} }
@ -111,7 +112,7 @@ void Octree::recurseElementWithPostOperation(OctreeElement* element, RecurseOctr
= LogHandler::getInstance().addRepeatedMessageRegex( = LogHandler::getInstance().addRepeatedMessageRegex(
"Octree::recurseElementWithPostOperation\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!"); "Octree::recurseElementWithPostOperation\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!");
qDebug() << "Octree::recurseElementWithPostOperation() reached DANGEROUSLY_DEEP_RECURSION, bailing!"; qCDebug(octree) << "Octree::recurseElementWithPostOperation() reached DANGEROUSLY_DEEP_RECURSION, bailing!";
return; return;
} }
@ -141,7 +142,7 @@ void Octree::recurseElementWithOperationDistanceSorted(OctreeElement* element, R
= LogHandler::getInstance().addRepeatedMessageRegex( = LogHandler::getInstance().addRepeatedMessageRegex(
"Octree::recurseElementWithOperationDistanceSorted\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!"); "Octree::recurseElementWithOperationDistanceSorted\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!");
qDebug() << "Octree::recurseElementWithOperationDistanceSorted() reached DANGEROUSLY_DEEP_RECURSION, bailing!"; qCDebug(octree) << "Octree::recurseElementWithOperationDistanceSorted() reached DANGEROUSLY_DEEP_RECURSION, bailing!";
return; return;
} }
@ -182,7 +183,7 @@ bool Octree::recurseElementWithOperator(OctreeElement* element, RecurseOctreeOpe
= LogHandler::getInstance().addRepeatedMessageRegex( = LogHandler::getInstance().addRepeatedMessageRegex(
"Octree::recurseElementWithOperator\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!"); "Octree::recurseElementWithOperator\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!");
qDebug() << "Octree::recurseElementWithOperator() reached DANGEROUSLY_DEEP_RECURSION, bailing!"; qCDebug(octree) << "Octree::recurseElementWithOperator() reached DANGEROUSLY_DEEP_RECURSION, bailing!";
return false; return false;
} }
@ -251,7 +252,7 @@ OctreeElement* Octree::createMissingElement(OctreeElement* lastParentElement, co
= LogHandler::getInstance().addRepeatedMessageRegex( = LogHandler::getInstance().addRepeatedMessageRegex(
"Octree::createMissingElement\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!"); "Octree::createMissingElement\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!");
qDebug() << "Octree::createMissingElement() reached DANGEROUSLY_DEEP_RECURSION, bailing!"; qCDebug(octree) << "Octree::createMissingElement() reached DANGEROUSLY_DEEP_RECURSION, bailing!";
return lastParentElement; return lastParentElement;
} }
int indexOfNewChild = branchIndexWithDescendant(lastParentElement->getOctalCode(), codeToReach); int indexOfNewChild = branchIndexWithDescendant(lastParentElement->getOctalCode(), codeToReach);
@ -283,13 +284,13 @@ int Octree::readElementData(OctreeElement* destinationElement, const unsigned ch
const unsigned char ALL_CHILDREN_ASSUMED_TO_EXIST = 0xFF; const unsigned char ALL_CHILDREN_ASSUMED_TO_EXIST = 0xFF;
if ((size_t)bytesLeftToRead < sizeof(unsigned char)) { if ((size_t)bytesLeftToRead < sizeof(unsigned char)) {
qDebug() << "UNEXPECTED: readElementData() only had " << bytesLeftToRead << " bytes. " qCDebug(octree) << "UNEXPECTED: readElementData() only had " << bytesLeftToRead << " bytes. "
"Not enough for meaningful data."; "Not enough for meaningful data.";
return bytesAvailable; // assume we read the entire buffer... return bytesAvailable; // assume we read the entire buffer...
} }
if (destinationElement->getScale() < SCALE_AT_DANGEROUSLY_DEEP_RECURSION) { if (destinationElement->getScale() < SCALE_AT_DANGEROUSLY_DEEP_RECURSION) {
qDebug() << "UNEXPECTED: readElementData() destination element is unreasonably small [" qCDebug(octree) << "UNEXPECTED: readElementData() destination element is unreasonably small ["
<< destinationElement->getScale() << " meters] " << destinationElement->getScale() << " meters] "
<< " Discarding " << bytesAvailable << " remaining bytes."; << " Discarding " << bytesAvailable << " remaining bytes.";
return bytesAvailable; // assume we read the entire buffer... return bytesAvailable; // assume we read the entire buffer...
@ -331,7 +332,7 @@ int Octree::readElementData(OctreeElement* destinationElement, const unsigned ch
if (bytesLeftToRead < bytesForMasks) { if (bytesLeftToRead < bytesForMasks) {
if (bytesLeftToRead > 0) { if (bytesLeftToRead > 0) {
qDebug() << "UNEXPECTED: readElementDataFromBuffer() only had " << bytesLeftToRead << " bytes before masks. " qCDebug(octree) << "UNEXPECTED: readElementDataFromBuffer() only had " << bytesLeftToRead << " bytes before masks. "
"Not enough for meaningful data."; "Not enough for meaningful data.";
} }
return bytesAvailable; // assume we read the entire buffer... return bytesAvailable; // assume we read the entire buffer...
@ -414,14 +415,14 @@ void Octree::readBitstreamToTree(const unsigned char * bitstream, unsigned long
); );
qDebug() << "UNEXPECTED: parsing of the octal code would make UNREASONABLY_DEEP_RECURSION... " qCDebug(octree) << "UNEXPECTED: parsing of the octal code would make UNREASONABLY_DEEP_RECURSION... "
"numberOfThreeBitSectionsInStream:" << numberOfThreeBitSectionsInStream << "numberOfThreeBitSectionsInStream:" << numberOfThreeBitSectionsInStream <<
"This buffer is corrupt. Returning."; "This buffer is corrupt. Returning.";
return; return;
} }
if (numberOfThreeBitSectionsInStream == OVERFLOWED_OCTCODE_BUFFER) { if (numberOfThreeBitSectionsInStream == OVERFLOWED_OCTCODE_BUFFER) {
qDebug() << "UNEXPECTED: parsing of the octal code would overflow the buffer. " qCDebug(octree) << "UNEXPECTED: parsing of the octal code would overflow the buffer. "
"This buffer is corrupt. Returning."; "This buffer is corrupt. Returning.";
return; return;
} }
@ -605,7 +606,7 @@ void Octree::processRemoveOctreeElementsBitstream(const unsigned char* bitstream
int codeLength = numberOfThreeBitSectionsInCode(voxelCode, maxSize); int codeLength = numberOfThreeBitSectionsInCode(voxelCode, maxSize);
if (codeLength == OVERFLOWED_OCTCODE_BUFFER) { if (codeLength == OVERFLOWED_OCTCODE_BUFFER) {
qDebug("WARNING! Got remove voxel bitstream that would overflow buffer in numberOfThreeBitSectionsInCode()," qCDebug(octree, "WARNING! Got remove voxel bitstream that would overflow buffer in numberOfThreeBitSectionsInCode(),"
" bailing processing of packet!"); " bailing processing of packet!");
break; break;
} }
@ -616,7 +617,7 @@ void Octree::processRemoveOctreeElementsBitstream(const unsigned char* bitstream
voxelCode += voxelDataSize; voxelCode += voxelDataSize;
atByte += voxelDataSize; atByte += voxelDataSize;
} else { } else {
qDebug("WARNING! Got remove voxel bitstream that would overflow buffer, bailing processing!"); qCDebug(octree, "WARNING! Got remove voxel bitstream that would overflow buffer, bailing processing!");
break; break;
} }
} }
@ -636,7 +637,7 @@ void Octree::reaverageOctreeElements(OctreeElement* startElement) {
recursionCount++; recursionCount++;
} }
if (recursionCount > UNREASONABLY_DEEP_RECURSION) { if (recursionCount > UNREASONABLY_DEEP_RECURSION) {
qDebug("Octree::reaverageOctreeElements()... bailing out of UNREASONABLY_DEEP_RECURSION"); qCDebug(octree, "Octree::reaverageOctreeElements()... bailing out of UNREASONABLY_DEEP_RECURSION");
recursionCount--; recursionCount--;
return; return;
} }
@ -1004,7 +1005,7 @@ int Octree::encodeTreeBitstream(OctreeElement* element,
// you can't call this without a valid element // you can't call this without a valid element
if (!element) { if (!element) {
qDebug("WARNING! encodeTreeBitstream() called with element=NULL"); qCDebug(octree, "WARNING! encodeTreeBitstream() called with element=NULL");
params.stopReason = EncodeBitstreamParams::NULL_NODE; params.stopReason = EncodeBitstreamParams::NULL_NODE;
return bytesWritten; return bytesWritten;
} }
@ -1100,7 +1101,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
// you can't call this without a valid element // you can't call this without a valid element
if (!element) { if (!element) {
qDebug("WARNING! encodeTreeBitstreamRecursion() called with element=NULL"); qCDebug(octree, "WARNING! encodeTreeBitstreamRecursion() called with element=NULL");
params.stopReason = EncodeBitstreamParams::NULL_NODE; params.stopReason = EncodeBitstreamParams::NULL_NODE;
return bytesAtThisLevel; return bytesAtThisLevel;
} }
@ -1541,16 +1542,16 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
} }
if (!mustIncludeAllChildData() && !continueThisLevel) { if (!mustIncludeAllChildData() && !continueThisLevel) {
qDebug() << "WARNING UNEXPECTED CASE: reached end of child element data loop with continueThisLevel=FALSE"; qCDebug(octree) << "WARNING UNEXPECTED CASE: reached end of child element data loop with continueThisLevel=FALSE";
qDebug() << "This is not expected!!!! -- continueThisLevel=FALSE...."; qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
} }
if (continueThisLevel && actualChildrenDataBits != childrenDataBits) { if (continueThisLevel && actualChildrenDataBits != childrenDataBits) {
// repair the child data mask // repair the child data mask
continueThisLevel = packetData->updatePriorBitMask(childDataBitsPlaceHolder, actualChildrenDataBits); continueThisLevel = packetData->updatePriorBitMask(childDataBitsPlaceHolder, actualChildrenDataBits);
if (!continueThisLevel) { if (!continueThisLevel) {
qDebug() << "WARNING UNEXPECTED CASE: Failed to update childDataBitsPlaceHolder"; qCDebug(octree) << "WARNING UNEXPECTED CASE: Failed to update childDataBitsPlaceHolder";
qDebug() << "This is not expected!!!! -- continueThisLevel=FALSE...."; qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
} }
} }
@ -1565,8 +1566,8 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
params.stats->existsBitsWritten(); params.stats->existsBitsWritten();
} }
} else { } else {
qDebug() << "WARNING UNEXPECTED CASE: Failed to append childrenExistInTreeBits"; qCDebug(octree) << "WARNING UNEXPECTED CASE: Failed to append childrenExistInTreeBits";
qDebug() << "This is not expected!!!! -- continueThisLevel=FALSE...."; qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
} }
} }
@ -1580,8 +1581,8 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
params.stats->existsInPacketBitsWritten(); params.stats->existsInPacketBitsWritten();
} }
} else { } else {
qDebug() << "WARNING UNEXPECTED CASE: Failed to append childrenExistInPacketBits"; qCDebug(octree) << "WARNING UNEXPECTED CASE: Failed to append childrenExistInPacketBits";
qDebug() << "This is not expected!!!! -- continueThisLevel=FALSE...."; qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
} }
} }
@ -1697,8 +1698,8 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
// repair the child exists mask // repair the child exists mask
continueThisLevel = packetData->updatePriorBitMask(childExistsPlaceHolder, childrenExistInPacketBits); continueThisLevel = packetData->updatePriorBitMask(childExistsPlaceHolder, childrenExistInPacketBits);
if (!continueThisLevel) { if (!continueThisLevel) {
qDebug() << "WARNING UNEXPECTED CASE: Failed to update childExistsPlaceHolder"; qCDebug(octree) << "WARNING UNEXPECTED CASE: Failed to update childExistsPlaceHolder";
qDebug() << "This is not expected!!!! -- continueThisLevel=FALSE...."; qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
} }
// If this is the last of the child exists bits, then we're actually be rolling out the entire tree // If this is the last of the child exists bits, then we're actually be rolling out the entire tree
@ -1708,10 +1709,10 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
if (!continueThisLevel) { if (!continueThisLevel) {
if (wantDebug) { if (wantDebug) {
qDebug() << " WARNING line:" << __LINE__; qCDebug(octree) << " WARNING line:" << __LINE__;
qDebug() << " breaking the child recursion loop with continueThisLevel=false!!!"; qCDebug(octree) << " breaking the child recursion loop with continueThisLevel=false!!!";
qDebug() << " AFTER attempting to updatePriorBitMask() for empty sub tree...."; qCDebug(octree) << " AFTER attempting to updatePriorBitMask() for empty sub tree....";
qDebug() << " IS THIS ACCEPTABLE!!!!"; qCDebug(octree) << " IS THIS ACCEPTABLE!!!!";
} }
break; // can't continue... break; // can't continue...
} }
@ -1743,8 +1744,8 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
// now that all slices are back in the correct order, copy them to the correct output buffer // now that all slices are back in the correct order, copy them to the correct output buffer
continueThisLevel = packetData->updatePriorBytes(firstRecursiveSliceOffset, &tempReshuffleBuffer[0], allSlicesSize); continueThisLevel = packetData->updatePriorBytes(firstRecursiveSliceOffset, &tempReshuffleBuffer[0], allSlicesSize);
if (!continueThisLevel) { if (!continueThisLevel) {
qDebug() << "WARNING UNEXPECTED CASE: Failed to update recursive slice!!!"; qCDebug(octree) << "WARNING UNEXPECTED CASE: Failed to update recursive slice!!!";
qDebug() << "This is not expected!!!! -- continueThisLevel=FALSE...."; qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
} }
} }
} // end keepDiggingDeeper } // end keepDiggingDeeper
@ -1766,7 +1767,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
if (partOfRootFit) { if (partOfRootFit) {
continueThisLevel = packetData->endLevel(rootDataLevelKey); continueThisLevel = packetData->endLevel(rootDataLevelKey);
if (!continueThisLevel) { if (!continueThisLevel) {
qDebug() << " UNEXPECTED ROOT ELEMENT -- could not packetData->endLevel(rootDataLevelKey) -- line:" << __LINE__; qCDebug(octree) << " UNEXPECTED ROOT ELEMENT -- could not packetData->endLevel(rootDataLevelKey) -- line:" << __LINE__;
} }
} else { } else {
packetData->discardLevel(rootDataLevelKey); packetData->discardLevel(rootDataLevelKey);
@ -1791,8 +1792,8 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
} }
if (!continueThisLevel) { if (!continueThisLevel) {
qDebug() << "WARNING UNEXPECTED CASE: Something failed in packing ROOT data"; qCDebug(octree) << "WARNING UNEXPECTED CASE: Something failed in packing ROOT data";
qDebug() << "This is not expected!!!! -- continueThisLevel=FALSE...."; qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
} }
} }
@ -1805,8 +1806,8 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
packetData->discardLevel(thisLevelKey); packetData->discardLevel(thisLevelKey);
if (!mustIncludeAllChildData()) { if (!mustIncludeAllChildData()) {
qDebug() << "WARNING UNEXPECTED CASE: Something failed in attempting to pack this element"; qCDebug(octree) << "WARNING UNEXPECTED CASE: Something failed in attempting to pack this element";
qDebug() << "This is not expected!!!! -- continueThisLevel=FALSE...."; qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
} }
} }
@ -1815,9 +1816,9 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
// added back to the element bag. // added back to the element bag.
if (!continueThisLevel) { if (!continueThisLevel) {
if (!mustIncludeAllChildData()) { if (!mustIncludeAllChildData()) {
qDebug() << "WARNING UNEXPECTED CASE - Something failed in attempting to pack this element."; qCDebug(octree) << "WARNING UNEXPECTED CASE - Something failed in attempting to pack this element.";
qDebug() << " If the datatype requires all child data, then this might happen. Otherwise" ; qCDebug(octree) << " If the datatype requires all child data, then this might happen. Otherwise" ;
qDebug() << " this is an unexpected case and we should research a potential logic error." ; qCDebug(octree) << " this is an unexpected case and we should research a potential logic error." ;
} }
bag.insert(element); bag.insert(element);
@ -1864,7 +1865,7 @@ bool Octree::readFromFile(const char* fileName) {
emit importSize(1.0f, 1.0f, 1.0f); emit importSize(1.0f, 1.0f, 1.0f);
emit importProgress(0); emit importProgress(0);
qDebug() << "Loading file" << qFileName << "..."; qCDebug(octree) << "Loading file" << qFileName << "...";
fileOk = readFromStream(fileLength, fileInputStream); fileOk = readFromStream(fileLength, fileInputStream);
@ -1891,7 +1892,7 @@ bool Octree::readFromURL(const QString& urlString) {
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
QNetworkReply* reply = networkAccessManager.get(request); QNetworkReply* reply = networkAccessManager.get(request);
qDebug() << "Downloading svo at" << qPrintable(urlString); qCDebug(octree) << "Downloading svo at" << qPrintable(urlString);
QEventLoop loop; QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
@ -1916,10 +1917,10 @@ bool Octree::readFromStream(unsigned long streamLength, QDataStream& inputStream
device->ungetChar(firstChar); device->ungetChar(firstChar);
if (firstChar == (char) PacketTypeEntityData) { if (firstChar == (char) PacketTypeEntityData) {
qDebug() << "Reading from SVO Stream length:" << streamLength; qCDebug(octree) << "Reading from SVO Stream length:" << streamLength;
return readSVOFromStream(streamLength, inputStream); return readSVOFromStream(streamLength, inputStream);
} else { } else {
qDebug() << "Reading from JSON Stream length:" << streamLength; qCDebug(octree) << "Reading from JSON Stream length:" << streamLength;
return readJSONFromStream(streamLength, inputStream); return readJSONFromStream(streamLength, inputStream);
} }
} }
@ -1965,28 +1966,28 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
dataAt += sizeof(gotVersion); dataAt += sizeof(gotVersion);
dataLength -= sizeof(gotVersion); dataLength -= sizeof(gotVersion);
fileOk = true; fileOk = true;
qDebug("SVO file version match. Expected: %d Got: %d", qCDebug(octree, "SVO file version match. Expected: %d Got: %d",
versionForPacketType(expectedDataPacketType()), gotVersion); versionForPacketType(expectedDataPacketType()), gotVersion);
hasBufferBreaks = versionHasSVOfileBreaks(gotVersion); hasBufferBreaks = versionHasSVOfileBreaks(gotVersion);
} else { } else {
qDebug("SVO file version mismatch. Expected: %d Got: %d", qCDebug(octree, "SVO file version mismatch. Expected: %d Got: %d",
versionForPacketType(expectedDataPacketType()), gotVersion); versionForPacketType(expectedDataPacketType()), gotVersion);
} }
} else { } else {
qDebug() << "SVO file type mismatch. Expected: " << nameForPacketType(expectedType) qCDebug(octree) << "SVO file type mismatch. Expected: " << nameForPacketType(expectedType)
<< " Got: " << nameForPacketType(gotType); << " Got: " << nameForPacketType(gotType);
} }
} else { } else {
qDebug() << " NOTE: this file type does not include type and version information."; qCDebug(octree) << " NOTE: this file type does not include type and version information.";
fileOk = true; // assume the file is ok fileOk = true; // assume the file is ok
} }
if (hasBufferBreaks) { if (hasBufferBreaks) {
qDebug() << " this version includes buffer breaks"; qCDebug(octree) << " this version includes buffer breaks";
} else { } else {
qDebug() << " this version does not include buffer breaks"; qCDebug(octree) << " this version does not include buffer breaks";
} }
if (fileOk) { if (fileOk) {
@ -2022,13 +2023,13 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
remainingLength -= sizeof(chunkLength); remainingLength -= sizeof(chunkLength);
if (chunkLength > remainingLength) { if (chunkLength > remainingLength) {
qDebug() << "UNEXPECTED chunk size of:" << chunkLength qCDebug(octree) << "UNEXPECTED chunk size of:" << chunkLength
<< "greater than remaining length:" << remainingLength; << "greater than remaining length:" << remainingLength;
break; break;
} }
if (chunkLength > MAX_CHUNK_LENGTH) { if (chunkLength > MAX_CHUNK_LENGTH) {
qDebug() << "UNEXPECTED chunk size of:" << chunkLength qCDebug(octree) << "UNEXPECTED chunk size of:" << chunkLength
<< "greater than MAX_CHUNK_LENGTH:" << MAX_CHUNK_LENGTH; << "greater than MAX_CHUNK_LENGTH:" << MAX_CHUNK_LENGTH;
break; break;
} }
@ -2078,7 +2079,7 @@ void Octree::writeToFile(const char* fileName, OctreeElement* element, QString p
} else if (persistAsFileType == "json") { } else if (persistAsFileType == "json") {
writeToJSONFile(cFileName, element); writeToJSONFile(cFileName, element);
} else { } else {
qDebug() << "unable to write octree to file of type" << persistAsFileType; qCDebug(octree) << "unable to write octree to file of type" << persistAsFileType;
} }
} }
@ -2086,7 +2087,7 @@ void Octree::writeToJSONFile(const char* fileName, OctreeElement* element) {
QFile persistFile(fileName); QFile persistFile(fileName);
QVariantMap entityDescription; QVariantMap entityDescription;
qDebug("Saving to file %s...", fileName); qCDebug(octree, "Saving to file %s...", fileName);
OctreeElement* top; OctreeElement* top;
if (element) { if (element) {
@ -2107,7 +2108,7 @@ void Octree::writeToSVOFile(const char* fileName, OctreeElement* element) {
std::ofstream file(fileName, std::ios::out|std::ios::binary); std::ofstream file(fileName, std::ios::out|std::ios::binary);
if(file.is_open()) { if(file.is_open()) {
qDebug("Saving to file %s...", fileName); qCDebug(octree, "Saving to file %s...", fileName);
PacketType expectedType = expectedDataPacketType(); PacketType expectedType = expectedDataPacketType();
PacketVersion expectedVersion = versionForPacketType(expectedType); PacketVersion expectedVersion = versionForPacketType(expectedType);
@ -2118,14 +2119,14 @@ void Octree::writeToSVOFile(const char* fileName, OctreeElement* element) {
// if so, read the first byte of the file and see if it matches the expected version code // if so, read the first byte of the file and see if it matches the expected version code
file.write(reinterpret_cast<char*>(&expectedType), sizeof(expectedType)); file.write(reinterpret_cast<char*>(&expectedType), sizeof(expectedType));
file.write(&expectedVersion, sizeof(expectedVersion)); file.write(&expectedVersion, sizeof(expectedVersion));
qDebug() << "SVO file type: " << nameForPacketType(expectedType) << " version: " << (int)expectedVersion; qCDebug(octree) << "SVO file type: " << nameForPacketType(expectedType) << " version: " << (int)expectedVersion;
hasBufferBreaks = versionHasSVOfileBreaks(expectedVersion); hasBufferBreaks = versionHasSVOfileBreaks(expectedVersion);
} }
if (hasBufferBreaks) { if (hasBufferBreaks) {
qDebug() << " this version includes buffer breaks"; qCDebug(octree) << " this version includes buffer breaks";
} else { } else {
qDebug() << " this version does not include buffer breaks"; qCDebug(octree) << " this version does not include buffer breaks";
} }

View file

@ -15,6 +15,7 @@
#include <OctalCode.h> #include <OctalCode.h>
#include <PacketHeaders.h> #include <PacketHeaders.h>
#include "OctreeLogging.h"
#include "OctreeEditPacketSender.h" #include "OctreeEditPacketSender.h"
const int OctreeEditPacketSender::DEFAULT_MAX_PENDING_MESSAGES = PacketSender::DEFAULT_PACKETS_PER_SECOND; const int OctreeEditPacketSender::DEFAULT_MAX_PENDING_MESSAGES = PacketSender::DEFAULT_PACKETS_PER_SECOND;
@ -119,7 +120,7 @@ void OctreeEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned c
quint64 queuedAt = usecTimestampNow(); quint64 queuedAt = usecTimestampNow();
quint64 transitTime = queuedAt - createdAt; quint64 transitTime = queuedAt - createdAt;
qDebug() << "OctreeEditPacketSender::queuePacketToNode() queued " << buffer[0] << qCDebug(octree) << "OctreeEditPacketSender::queuePacketToNode() queued " << buffer[0] <<
" - command to node bytes=" << length << " - command to node bytes=" << length <<
" satoshiCost=" << satoshiCost << " satoshiCost=" << satoshiCost <<
" sequence=" << sequence << " sequence=" << sequence <<

View file

@ -26,6 +26,7 @@
#include "OctreeConstants.h" #include "OctreeConstants.h"
#include "OctreeElement.h" #include "OctreeElement.h"
#include "Octree.h" #include "Octree.h"
#include "OctreeLogging.h"
#include "SharedUtil.h" #include "SharedUtil.h"
quint64 OctreeElement::_octreeMemoryUsage = 0; quint64 OctreeElement::_octreeMemoryUsage = 0;
@ -282,7 +283,7 @@ void OctreeElement::auditChildren(const char* label) const {
OctreeElement* testChildNew = getChildAtIndex(childIndex); OctreeElement* testChildNew = getChildAtIndex(childIndex);
OctreeElement* testChildOld = _childrenArray[childIndex]; OctreeElement* testChildOld = _childrenArray[childIndex];
qDebug("child at index %d... testChildOld=%p testChildNew=%p %s", qCebug("child at index %d... testChildOld=%p testChildNew=%p %s",
childIndex, testChildOld, testChildNew , childIndex, testChildOld, testChildNew ,
((testChildNew != testChildOld) ? " DOES NOT MATCH <<<< BAD <<<<" : " - OK ") ((testChildNew != testChildOld) ? " DOES NOT MATCH <<<< BAD <<<<" : " - OK ")
); );
@ -435,7 +436,7 @@ OctreeElement* OctreeElement::getChildAtIndex(int childIndex) const {
if (externalIndex < childCount && externalIndex >= 0) { if (externalIndex < childCount && externalIndex >= 0) {
result = _children.external[externalIndex]; result = _children.external[externalIndex];
} else { } else {
qDebug("getChildAtIndex() attempt to access external client out of " qCDebug(octree, "getChildAtIndex() attempt to access external client out of "
"bounds externalIndex=%d <<<<<<<<<< WARNING!!!", externalIndex); "bounds externalIndex=%d <<<<<<<<<< WARNING!!!", externalIndex);
} }
break; break;
@ -446,7 +447,7 @@ OctreeElement* OctreeElement::getChildAtIndex(int childIndex) const {
} }
#ifdef HAS_AUDIT_CHILDREN #ifdef HAS_AUDIT_CHILDREN
if (result != _childrenArray[childIndex]) { if (result != _childrenArray[childIndex]) {
qDebug("getChildAtIndex() case:%s result<%p> != _childrenArray[childIndex]<%p> <<<<<<<<<< WARNING!!!", qCDebug(octree, "getChildAtIndex() case:%s result<%p> != _childrenArray[childIndex]<%p> <<<<<<<<<< WARNING!!!",
caseStr, result,_childrenArray[childIndex]); caseStr, result,_childrenArray[childIndex]);
} }
#endif // def HAS_AUDIT_CHILDREN #endif // def HAS_AUDIT_CHILDREN
@ -1119,7 +1120,7 @@ void OctreeElement::setChildAtIndex(int childIndex, OctreeElement* child) {
_externalChildrenMemoryUsage += newChildCount * sizeof(OctreeElement*); _externalChildrenMemoryUsage += newChildCount * sizeof(OctreeElement*);
} else { } else {
//assert(false); //assert(false);
qDebug("THIS SHOULD NOT HAPPEN previousChildCount == %d && newChildCount == %d",previousChildCount, newChildCount); qCDebug(octree, "THIS SHOULD NOT HAPPEN previousChildCount == %d && newChildCount == %d",previousChildCount, newChildCount);
} }
// check to see if we could store these 4 children locally // check to see if we could store these 4 children locally
@ -1163,7 +1164,7 @@ bool OctreeElement::safeDeepDeleteChildAtIndex(int childIndex, int recursionCoun
= LogHandler::getInstance().addRepeatedMessageRegex( = LogHandler::getInstance().addRepeatedMessageRegex(
"OctreeElement::safeDeepDeleteChildAtIndex\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!"); "OctreeElement::safeDeepDeleteChildAtIndex\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!");
qDebug() << "OctreeElement::safeDeepDeleteChildAtIndex() reached DANGEROUSLY_DEEP_RECURSION, bailing!"; qCDebug(octree) << "OctreeElement::safeDeepDeleteChildAtIndex() reached DANGEROUSLY_DEEP_RECURSION, bailing!";
return deleteApproved; return deleteApproved;
} }
OctreeElement* childToDelete = getChildAtIndex(childIndex); OctreeElement* childToDelete = getChildAtIndex(childIndex);
@ -1398,7 +1399,7 @@ OctreeElement* OctreeElement::getOrCreateChildElementAt(float x, float y, float
float halfOurScale = ourScale / 2.0f; float halfOurScale = ourScale / 2.0f;
if(s > ourScale) { if(s > ourScale) {
qDebug("UNEXPECTED -- OctreeElement::getOrCreateChildElementAt() s=[%f] > ourScale=[%f] ", s, ourScale); qCDebug(octree, "UNEXPECTED -- OctreeElement::getOrCreateChildElementAt() s=[%f] > ourScale=[%f] ", s, ourScale);
} }
if (s > halfOurScale) { if (s > halfOurScale) {
@ -1521,11 +1522,11 @@ int OctreeElement::getMyChildContaining(const AACube& cube) const {
// TODO: consider changing this to assert() // TODO: consider changing this to assert()
if (cubeScale > ourScale) { if (cubeScale > ourScale) {
qDebug() << "UNEXPECTED -- OctreeElement::getMyChildContaining() -- (cubeScale > ourScale)"; qCDebug(octree) << "UNEXPECTED -- OctreeElement::getMyChildContaining() -- (cubeScale > ourScale)";
qDebug() << " cube=" << cube; qCDebug(octree) << " cube=" << cube;
qDebug() << " elements AACube=" << _cube; qCDebug(octree) << " elements AACube=" << _cube;
qDebug() << " cubeScale=" << cubeScale; qCDebug(octree) << " cubeScale=" << cubeScale;
qDebug() << " ourScale=" << ourScale; qCDebug(octree) << " ourScale=" << ourScale;
assert(false); assert(false);
} }
@ -1553,7 +1554,7 @@ int OctreeElement::getMyChildContaining(const AABox& box) const {
// TODO: consider changing this to assert() // TODO: consider changing this to assert()
if(boxLargestScale > ourScale) { if(boxLargestScale > ourScale) {
qDebug("UNEXPECTED -- OctreeElement::getMyChildContaining() " qCDebug(octree, "UNEXPECTED -- OctreeElement::getMyChildContaining() "
"boxLargestScale=[%f] > ourScale=[%f] ", boxLargestScale, ourScale); "boxLargestScale=[%f] > ourScale=[%f] ", boxLargestScale, ourScale);
} }

View file

@ -11,6 +11,7 @@
#include <NodeList.h> #include <NodeList.h>
#include "OctreeLogging.h"
#include "OctreeHeadlessViewer.h" #include "OctreeHeadlessViewer.h"
OctreeHeadlessViewer::OctreeHeadlessViewer() : OctreeHeadlessViewer::OctreeHeadlessViewer() :
@ -41,16 +42,16 @@ void OctreeHeadlessViewer::queryOctree() {
bool wantExtraDebugging = false; bool wantExtraDebugging = false;
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "OctreeHeadlessViewer::queryOctree() _jurisdictionListener=" << _jurisdictionListener; qCDebug(octree) << "OctreeHeadlessViewer::queryOctree() _jurisdictionListener=" << _jurisdictionListener;
qDebug() << "---------------"; qCDebug(octree) << "---------------";
qDebug() << "_jurisdictionListener=" << _jurisdictionListener; qCDebug(octree) << "_jurisdictionListener=" << _jurisdictionListener;
qDebug() << "Jurisdictions..."; qCDebug(octree) << "Jurisdictions...";
jurisdictions.lockForRead(); jurisdictions.lockForRead();
for (NodeToJurisdictionMapIterator i = jurisdictions.begin(); i != jurisdictions.end(); ++i) { for (NodeToJurisdictionMapIterator i = jurisdictions.begin(); i != jurisdictions.end(); ++i) {
qDebug() << i.key() << ": " << &i.value(); qCDebug(octree) << i.key() << ": " << &i.value();
} }
jurisdictions.unlock(); jurisdictions.unlock();
qDebug() << "---------------"; qCDebug(octree) << "---------------";
} }
// These will be the same for all servers, so we can set them up once and then reuse for each server we send to. // These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
@ -115,7 +116,7 @@ void OctreeHeadlessViewer::queryOctree() {
}); });
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug("Servers: total %d, in view %d, unknown jurisdiction %d", qCDebug(octree, "Servers: total %d, in view %d, unknown jurisdiction %d",
totalServers, inViewServers, unknownJurisdictionServers); totalServers, inViewServers, unknownJurisdictionServers);
} }
@ -136,7 +137,7 @@ void OctreeHeadlessViewer::queryOctree() {
} }
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer); qCDebug(octree, "perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer);
} }
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
@ -157,7 +158,7 @@ void OctreeHeadlessViewer::queryOctree() {
jurisdictions.unlock(); jurisdictions.unlock();
unknownView = true; // assume it's in view unknownView = true; // assume it's in view
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "no known jurisdiction for node " << *node << ", assume it's visible."; qCDebug(octree) << "no known jurisdiction for node " << *node << ", assume it's visible.";
} }
} else { } else {
const JurisdictionMap& map = (jurisdictions)[nodeUUID]; const JurisdictionMap& map = (jurisdictions)[nodeUUID];
@ -179,7 +180,7 @@ void OctreeHeadlessViewer::queryOctree() {
} else { } else {
jurisdictions.unlock(); jurisdictions.unlock();
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "Jurisdiction without RootCode for node " << *node << ". That's unusual!"; qCDebug(octree) << "Jurisdiction without RootCode for node " << *node << ". That's unusual!";
} }
} }
} }
@ -187,11 +188,11 @@ void OctreeHeadlessViewer::queryOctree() {
if (inView) { if (inView) {
_octreeQuery.setMaxOctreePacketsPerSecond(perServerPPS); _octreeQuery.setMaxOctreePacketsPerSecond(perServerPPS);
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "inView for node " << *node << ", give it budget of " << perServerPPS; qCDebug(octree) << "inView for node " << *node << ", give it budget of " << perServerPPS;
} }
} else if (unknownView) { } else if (unknownView) {
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "no known jurisdiction for node " << *node << ", give it budget of " qCDebug(octree) << "no known jurisdiction for node " << *node << ", give it budget of "
<< perUnknownServer << " to send us jurisdiction."; << perUnknownServer << " to send us jurisdiction.";
} }
@ -205,11 +206,11 @@ void OctreeHeadlessViewer::queryOctree() {
_octreeQuery.setCameraNearClip(0.1f); _octreeQuery.setCameraNearClip(0.1f);
_octreeQuery.setCameraFarClip(0.1f); _octreeQuery.setCameraFarClip(0.1f);
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "Using 'minimal' camera position for node" << *node; qCDebug(octree) << "Using 'minimal' camera position for node" << *node;
} }
} else { } else {
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "Using regular camera position for node" << *node; qCDebug(octree) << "Using regular camera position for node" << *node;
} }
} }
_octreeQuery.setMaxOctreePacketsPerSecond(perUnknownServer); _octreeQuery.setMaxOctreePacketsPerSecond(perUnknownServer);

View file

@ -12,6 +12,7 @@
#include <GLMHelpers.h> #include <GLMHelpers.h>
#include <PerfStat.h> #include <PerfStat.h>
#include "OctreeLogging.h"
#include "OctreePacketData.h" #include "OctreePacketData.h"
bool OctreePacketData::_debug = false; bool OctreePacketData::_debug = false;
@ -65,12 +66,12 @@ bool OctreePacketData::append(const unsigned char* data, int length) {
const bool wantDebug = false; const bool wantDebug = false;
if (wantDebug && !success) { if (wantDebug && !success) {
qDebug() << "OctreePacketData::append(const unsigned char* data, int length) FAILING...."; qCDebug(octree) << "OctreePacketData::append(const unsigned char* data, int length) FAILING....";
qDebug() << " length=" << length; qCDebug(octree) << " length=" << length;
qDebug() << " _bytesAvailable=" << _bytesAvailable; qCDebug(octree) << " _bytesAvailable=" << _bytesAvailable;
qDebug() << " _bytesInUse=" << _bytesInUse; qCDebug(octree) << " _bytesInUse=" << _bytesInUse;
qDebug() << " _targetSize=" << _targetSize; qCDebug(octree) << " _targetSize=" << _targetSize;
qDebug() << " _bytesReserved=" << _bytesReserved; qCDebug(octree) << " _bytesReserved=" << _bytesReserved;
} }
return success; return success;
} }
@ -176,7 +177,7 @@ const unsigned char* OctreePacketData::getFinalizedData() {
if (_dirty) { if (_dirty) {
if (_debug) { if (_debug) {
qDebug("getFinalizedData() _compressedBytes=%d _bytesInUse=%d",_compressedBytes, _bytesInUse); qCDebug(octree, "getFinalizedData() _compressedBytes=%d _bytesInUse=%d",_compressedBytes, _bytesInUse);
} }
compressContent(); compressContent();
} }
@ -190,7 +191,7 @@ int OctreePacketData::getFinalizedSize() {
if (_dirty) { if (_dirty) {
if (_debug) { if (_debug) {
qDebug("getFinalizedSize() _compressedBytes=%d _bytesInUse=%d",_compressedBytes, _bytesInUse); qCDebug(octree, "getFinalizedSize() _compressedBytes=%d _bytesInUse=%d",_compressedBytes, _bytesInUse);
} }
compressContent(); compressContent();
} }
@ -241,7 +242,7 @@ void OctreePacketData::discardLevel(LevelDetails key) {
_totalBytesOfColor -= reduceBytesOfColor; _totalBytesOfColor -= reduceBytesOfColor;
if (_debug) { if (_debug) {
qDebug("discardLevel() BEFORE _dirty=%s bytesInLevel=%d _compressedBytes=%d _bytesInUse=%d", qCDebug(octree, "discardLevel() BEFORE _dirty=%s bytesInLevel=%d _compressedBytes=%d _bytesInUse=%d",
debug::valueOf(_dirty), bytesInLevel, _compressedBytes, _bytesInUse); debug::valueOf(_dirty), bytesInLevel, _compressedBytes, _bytesInUse);
} }
@ -253,7 +254,7 @@ void OctreePacketData::discardLevel(LevelDetails key) {
_bytesReserved = key._bytesReservedAtStart; _bytesReserved = key._bytesReservedAtStart;
if (_debug) { if (_debug) {
qDebug("discardLevel() AFTER _dirty=%s bytesInLevel=%d _compressedBytes=%d _bytesInUse=%d", qCDebug(octree, "discardLevel() AFTER _dirty=%s bytesInLevel=%d _compressedBytes=%d _bytesInUse=%d",
debug::valueOf(_dirty), bytesInLevel, _compressedBytes, _bytesInUse); debug::valueOf(_dirty), bytesInLevel, _compressedBytes, _bytesInUse);
} }
} }
@ -263,9 +264,9 @@ bool OctreePacketData::endLevel(LevelDetails key) {
// reserved bytes should be the same value as when the level started // reserved bytes should be the same value as when the level started
if (_bytesReserved != key._bytesReservedAtStart) { if (_bytesReserved != key._bytesReservedAtStart) {
qDebug() << "WARNING: endLevel() called but some reserved bytes not used."; qCDebug(octree) << "WARNING: endLevel() called but some reserved bytes not used.";
qDebug() << " current bytesReserved:" << _bytesReserved; qCDebug(octree) << " current bytesReserved:" << _bytesReserved;
qDebug() << " start level bytesReserved:" << key._bytesReservedAtStart; qCDebug(octree) << " start level bytesReserved:" << key._bytesReservedAtStart;
} }
return success; return success;
@ -499,13 +500,13 @@ void OctreePacketData::loadFinalizedContent(const unsigned char* data, int lengt
} }
} else { } else {
if (_debug) { if (_debug) {
qDebug("OctreePacketData::loadCompressedContent()... length = 0, nothing to do..."); qCDebug(octree, "OctreePacketData::loadCompressedContent()... length = 0, nothing to do...");
} }
} }
} }
void OctreePacketData::debugContent() { void OctreePacketData::debugContent() {
qDebug("OctreePacketData::debugContent()... COMPRESSED DATA.... size=%d",_compressedBytes); qCDebug(octree, "OctreePacketData::debugContent()... COMPRESSED DATA.... size=%d",_compressedBytes);
int perline=0; int perline=0;
for (int i = 0; i < _compressedBytes; i++) { for (int i = 0; i < _compressedBytes; i++) {
printf("%.2x ",_compressed[i]); printf("%.2x ",_compressed[i]);
@ -517,7 +518,7 @@ void OctreePacketData::debugContent() {
} }
printf("\n"); printf("\n");
qDebug("OctreePacketData::debugContent()... UNCOMPRESSED DATA.... size=%d",_bytesInUse); qCDebug(octree, "OctreePacketData::debugContent()... UNCOMPRESSED DATA.... size=%d",_bytesInUse);
perline=0; perline=0;
for (int i = 0; i < _bytesInUse; i++) { for (int i = 0; i < _bytesInUse; i++) {
printf("%.2x ",_uncompressed[i]); printf("%.2x ",_uncompressed[i]);

View file

@ -26,6 +26,7 @@
#include <SharedUtil.h> #include <SharedUtil.h>
#include <PathUtils.h> #include <PathUtils.h>
#include "OctreeLogging.h"
#include "OctreePersistThread.h" #include "OctreePersistThread.h"
const int OctreePersistThread::DEFAULT_PERSIST_INTERVAL = 1000 * 30; // every 30 seconds const int OctreePersistThread::DEFAULT_PERSIST_INTERVAL = 1000 * 30; // every 30 seconds
@ -54,7 +55,7 @@ OctreePersistThread::OctreePersistThread(Octree* tree, const QString& filename,
void OctreePersistThread::parseSettings(const QJsonObject& settings) { void OctreePersistThread::parseSettings(const QJsonObject& settings) {
if (settings["backups"].isArray()) { if (settings["backups"].isArray()) {
const QJsonArray& backupRules = settings["backups"].toArray(); const QJsonArray& backupRules = settings["backups"].toArray();
qDebug() << "BACKUP RULES:"; qCDebug(octree) << "BACKUP RULES:";
foreach (const QJsonValue& value, backupRules) { foreach (const QJsonValue& value, backupRules) {
@ -77,10 +78,10 @@ void OctreePersistThread::parseSettings(const QJsonObject& settings) {
count = countVal.toInt(); count = countVal.toInt();
} }
qDebug() << " Name:" << obj["Name"].toString(); qCDebug(octree) << " Name:" << obj["Name"].toString();
qDebug() << " format:" << obj["format"].toString(); qCDebug(octree) << " format:" << obj["format"].toString();
qDebug() << " interval:" << interval; qCDebug(octree) << " interval:" << interval;
qDebug() << " count:" << count; qCDebug(octree) << " count:" << count;
BackupRule newRule = { obj["Name"].toString(), interval, obj["format"].toString(), count, 0}; BackupRule newRule = { obj["Name"].toString(), interval, obj["format"].toString(), count, 0};
@ -89,15 +90,15 @@ void OctreePersistThread::parseSettings(const QJsonObject& settings) {
if (newRule.lastBackup > 0) { if (newRule.lastBackup > 0) {
quint64 now = usecTimestampNow(); quint64 now = usecTimestampNow();
quint64 sinceLastBackup = now - newRule.lastBackup; quint64 sinceLastBackup = now - newRule.lastBackup;
qDebug() << " lastBackup:" << qPrintable(formatUsecTime(sinceLastBackup)) << "ago"; qCDebug(octree) << " lastBackup:" << qPrintable(formatUsecTime(sinceLastBackup)) << "ago";
} else { } else {
qDebug() << " lastBackup: NEVER"; qCDebug(octree) << " lastBackup: NEVER";
} }
_backupRules << newRule; _backupRules << newRule;
} }
} else { } else {
qDebug() << "BACKUP RULES: NONE"; qCDebug(octree) << "BACKUP RULES: NONE";
} }
} }
@ -122,7 +123,7 @@ bool OctreePersistThread::process() {
if (!_initialLoadComplete) { if (!_initialLoadComplete) {
quint64 loadStarted = usecTimestampNow(); quint64 loadStarted = usecTimestampNow();
qDebug() << "loading Octrees from file: " << _filename << "..."; qCDebug(octree) << "loading Octrees from file: " << _filename << "...";
bool persistantFileRead; bool persistantFileRead;
@ -135,7 +136,7 @@ bool OctreePersistThread::process() {
QString lockFileName = _filename + ".lock"; QString lockFileName = _filename + ".lock";
std::ifstream lockFile(qPrintable(lockFileName), std::ios::in|std::ios::binary|std::ios::ate); std::ifstream lockFile(qPrintable(lockFileName), std::ios::in|std::ios::binary|std::ios::ate);
if(lockFile.is_open()) { if(lockFile.is_open()) {
qDebug() << "WARNING: Octree lock file detected at startup:" << lockFileName qCDebug(octree) << "WARNING: Octree lock file detected at startup:" << lockFileName
<< "-- Attempting to restore from previous backup file."; << "-- Attempting to restore from previous backup file.";
// This is where we should attempt to find the most recent backup and restore from // This is where we should attempt to find the most recent backup and restore from
@ -143,9 +144,9 @@ bool OctreePersistThread::process() {
restoreFromMostRecentBackup(); restoreFromMostRecentBackup();
lockFile.close(); lockFile.close();
qDebug() << "Loading Octree... lock file closed:" << lockFileName; qCDebug(octree) << "Loading Octree... lock file closed:" << lockFileName;
remove(qPrintable(lockFileName)); remove(qPrintable(lockFileName));
qDebug() << "Loading Octree... lock file removed:" << lockFileName; qCDebug(octree) << "Loading Octree... lock file removed:" << lockFileName;
} }
persistantFileRead = _tree->readFromFile(qPrintable(_filename.toLocal8Bit())); persistantFileRead = _tree->readFromFile(qPrintable(_filename.toLocal8Bit()));
@ -157,23 +158,23 @@ bool OctreePersistThread::process() {
_loadTimeUSecs = loadDone - loadStarted; _loadTimeUSecs = loadDone - loadStarted;
_tree->clearDirtyBit(); // the tree is clean since we just loaded it _tree->clearDirtyBit(); // the tree is clean since we just loaded it
qDebug("DONE loading Octrees from file... fileRead=%s", debug::valueOf(persistantFileRead)); qCDebug(octree, "DONE loading Octrees from file... fileRead=%s", debug::valueOf(persistantFileRead));
unsigned long nodeCount = OctreeElement::getNodeCount(); unsigned long nodeCount = OctreeElement::getNodeCount();
unsigned long internalNodeCount = OctreeElement::getInternalNodeCount(); unsigned long internalNodeCount = OctreeElement::getInternalNodeCount();
unsigned long leafNodeCount = OctreeElement::getLeafNodeCount(); unsigned long leafNodeCount = OctreeElement::getLeafNodeCount();
qDebug("Nodes after loading scene %lu nodes %lu internal %lu leaves", nodeCount, internalNodeCount, leafNodeCount); qCDebug(octree, "Nodes after loading scene %lu nodes %lu internal %lu leaves", nodeCount, internalNodeCount, leafNodeCount);
bool wantDebug = false; bool wantDebug = false;
if (wantDebug) { if (wantDebug) {
double usecPerGet = (double)OctreeElement::getGetChildAtIndexTime() double usecPerGet = (double)OctreeElement::getGetChildAtIndexTime()
/ (double)OctreeElement::getGetChildAtIndexCalls(); / (double)OctreeElement::getGetChildAtIndexCalls();
qDebug() << "getChildAtIndexCalls=" << OctreeElement::getGetChildAtIndexCalls() qCDebug(octree) << "getChildAtIndexCalls=" << OctreeElement::getGetChildAtIndexCalls()
<< " getChildAtIndexTime=" << OctreeElement::getGetChildAtIndexTime() << " perGet=" << usecPerGet; << " getChildAtIndexTime=" << OctreeElement::getGetChildAtIndexTime() << " perGet=" << usecPerGet;
double usecPerSet = (double)OctreeElement::getSetChildAtIndexTime() double usecPerSet = (double)OctreeElement::getSetChildAtIndexTime()
/ (double)OctreeElement::getSetChildAtIndexCalls(); / (double)OctreeElement::getSetChildAtIndexCalls();
qDebug() << "setChildAtIndexCalls=" << OctreeElement::getSetChildAtIndexCalls() qCDebug(octree) << "setChildAtIndexCalls=" << OctreeElement::getSetChildAtIndexCalls()
<< " setChildAtIndexTime=" << OctreeElement::getSetChildAtIndexTime() << " perSet=" << usecPerSet; << " setChildAtIndexTime=" << OctreeElement::getSetChildAtIndexTime() << " perSet=" << usecPerSet;
} }
@ -224,47 +225,47 @@ bool OctreePersistThread::process() {
void OctreePersistThread::aboutToFinish() { void OctreePersistThread::aboutToFinish() {
qDebug() << "Persist thread about to finish..."; qCDebug(octree) << "Persist thread about to finish...";
persist(); persist();
qDebug() << "Persist thread done with about to finish..."; qCDebug(octree) << "Persist thread done with about to finish...";
} }
void OctreePersistThread::persist() { void OctreePersistThread::persist() {
if (_tree->isDirty()) { if (_tree->isDirty()) {
_tree->lockForWrite(); _tree->lockForWrite();
{ {
qDebug() << "pruning Octree before saving..."; qCDebug(octree) << "pruning Octree before saving...";
_tree->pruneTree(); _tree->pruneTree();
qDebug() << "DONE pruning Octree before saving..."; qCDebug(octree) << "DONE pruning Octree before saving...";
} }
_tree->unlock(); _tree->unlock();
qDebug() << "persist operation calling backup..."; qCDebug(octree) << "persist operation calling backup...";
backup(); // handle backup if requested backup(); // handle backup if requested
qDebug() << "persist operation DONE with backup..."; qCDebug(octree) << "persist operation DONE with backup...";
// create our "lock" file to indicate we're saving. // create our "lock" file to indicate we're saving.
QString lockFileName = _filename + ".lock"; QString lockFileName = _filename + ".lock";
std::ofstream lockFile(qPrintable(lockFileName), std::ios::out|std::ios::binary); std::ofstream lockFile(qPrintable(lockFileName), std::ios::out|std::ios::binary);
if(lockFile.is_open()) { if(lockFile.is_open()) {
qDebug() << "saving Octree lock file created at:" << lockFileName; qCDebug(octree) << "saving Octree lock file created at:" << lockFileName;
_tree->writeToFile(qPrintable(_filename), NULL, _persistAsFileType); _tree->writeToFile(qPrintable(_filename), NULL, _persistAsFileType);
time(&_lastPersistTime); time(&_lastPersistTime);
_tree->clearDirtyBit(); // tree is clean after saving _tree->clearDirtyBit(); // tree is clean after saving
qDebug() << "DONE saving Octree to file..."; qCDebug(octree) << "DONE saving Octree to file...";
lockFile.close(); lockFile.close();
qDebug() << "saving Octree lock file closed:" << lockFileName; qCDebug(octree) << "saving Octree lock file closed:" << lockFileName;
remove(qPrintable(lockFileName)); remove(qPrintable(lockFileName));
qDebug() << "saving Octree lock file removed:" << lockFileName; qCDebug(octree) << "saving Octree lock file removed:" << lockFileName;
} }
} }
} }
void OctreePersistThread::restoreFromMostRecentBackup() { void OctreePersistThread::restoreFromMostRecentBackup() {
qDebug() << "Restoring from most recent backup..."; qCDebug(octree) << "Restoring from most recent backup...";
QString mostRecentBackupFileName; QString mostRecentBackupFileName;
QDateTime mostRecentBackupTime; QDateTime mostRecentBackupTime;
@ -273,20 +274,20 @@ void OctreePersistThread::restoreFromMostRecentBackup() {
// If we found a backup file, restore from that file. // If we found a backup file, restore from that file.
if (recentBackup) { if (recentBackup) {
qDebug() << "BEST backup file:" << mostRecentBackupFileName << " last modified:" << mostRecentBackupTime.toString(); qCDebug(octree) << "BEST backup file:" << mostRecentBackupFileName << " last modified:" << mostRecentBackupTime.toString();
qDebug() << "Removing old file:" << _filename; qCDebug(octree) << "Removing old file:" << _filename;
remove(qPrintable(_filename)); remove(qPrintable(_filename));
qDebug() << "Restoring backup file " << mostRecentBackupFileName << "..."; qCDebug(octree) << "Restoring backup file " << mostRecentBackupFileName << "...";
bool result = QFile::copy(mostRecentBackupFileName, _filename); bool result = QFile::copy(mostRecentBackupFileName, _filename);
if (result) { if (result) {
qDebug() << "DONE restoring backup file " << mostRecentBackupFileName << "to" << _filename << "..."; qCDebug(octree) << "DONE restoring backup file " << mostRecentBackupFileName << "to" << _filename << "...";
} else { } else {
qDebug() << "ERROR while restoring backup file " << mostRecentBackupFileName << "to" << _filename << "..."; qCDebug(octree) << "ERROR while restoring backup file " << mostRecentBackupFileName << "to" << _filename << "...";
} }
} else { } else {
qDebug() << "NO BEST backup file found."; qCDebug(octree) << "NO BEST backup file found.";
} }
} }
@ -346,7 +347,7 @@ void OctreePersistThread::rollOldBackupVersions(const BackupRule& rule) {
if (rule.extensionFormat.contains("%N")) { if (rule.extensionFormat.contains("%N")) {
if (rule.maxBackupVersions > 0) { if (rule.maxBackupVersions > 0) {
qDebug() << "Rolling old backup versions for rule" << rule.name << "..."; qCDebug(octree) << "Rolling old backup versions for rule" << rule.name << "...";
for(int n = rule.maxBackupVersions - 1; n > 0; n--) { for(int n = rule.maxBackupVersions - 1; n > 0; n--) {
QString backupExtensionN = rule.extensionFormat; QString backupExtensionN = rule.extensionFormat;
QString backupExtensionNplusOne = rule.extensionFormat; QString backupExtensionNplusOne = rule.extensionFormat;
@ -359,18 +360,18 @@ void OctreePersistThread::rollOldBackupVersions(const BackupRule& rule) {
QFile backupFileN(backupFilenameN); QFile backupFileN(backupFilenameN);
if (backupFileN.exists()) { if (backupFileN.exists()) {
qDebug() << "rolling backup file " << backupFilenameN << "to" << backupFilenameNplusOne << "..."; qCDebug(octree) << "rolling backup file " << backupFilenameN << "to" << backupFilenameNplusOne << "...";
int result = rename(qPrintable(backupFilenameN), qPrintable(backupFilenameNplusOne)); int result = rename(qPrintable(backupFilenameN), qPrintable(backupFilenameNplusOne));
if (result == 0) { if (result == 0) {
qDebug() << "DONE rolling backup file " << backupFilenameN << "to" << backupFilenameNplusOne << "..."; qCDebug(octree) << "DONE rolling backup file " << backupFilenameN << "to" << backupFilenameNplusOne << "...";
} else { } else {
qDebug() << "ERROR in rolling backup file " << backupFilenameN << "to" << backupFilenameNplusOne << "..."; qCDebug(octree) << "ERROR in rolling backup file " << backupFilenameN << "to" << backupFilenameNplusOne << "...";
} }
} }
} }
qDebug() << "Done rolling old backup versions..."; qCDebug(octree) << "Done rolling old backup versions...";
} else { } else {
qDebug() << "Rolling backups for rule" << rule.name << "." qCDebug(octree) << "Rolling backups for rule" << rule.name << "."
<< " Max Rolled Backup Versions less than 1 [" << rule.maxBackupVersions << "]." << " Max Rolled Backup Versions less than 1 [" << rule.maxBackupVersions << "]."
<< " No need to roll backups..."; << " No need to roll backups...";
} }
@ -379,7 +380,7 @@ void OctreePersistThread::rollOldBackupVersions(const BackupRule& rule) {
void OctreePersistThread::backup() { void OctreePersistThread::backup() {
qDebug() << "backup operation wantBackup:" << _wantBackup; qCDebug(octree) << "backup operation wantBackup:" << _wantBackup;
if (_wantBackup) { if (_wantBackup) {
quint64 now = usecTimestampNow(); quint64 now = usecTimestampNow();
@ -390,11 +391,11 @@ void OctreePersistThread::backup() {
quint64 SECS_TO_USECS = 1000 * 1000; quint64 SECS_TO_USECS = 1000 * 1000;
quint64 intervalToBackup = rule.interval * SECS_TO_USECS; quint64 intervalToBackup = rule.interval * SECS_TO_USECS;
qDebug() << "Checking [" << rule.name << "] - Time since last backup [" << sinceLastBackup << "] " << qCDebug(octree) << "Checking [" << rule.name << "] - Time since last backup [" << sinceLastBackup << "] " <<
"compared to backup interval [" << intervalToBackup << "]..."; "compared to backup interval [" << intervalToBackup << "]...";
if (sinceLastBackup > intervalToBackup) { if (sinceLastBackup > intervalToBackup) {
qDebug() << "Time since last backup [" << sinceLastBackup << "] for rule [" << rule.name qCDebug(octree) << "Time since last backup [" << sinceLastBackup << "] for rule [" << rule.name
<< "] exceeds backup interval [" << intervalToBackup << "] doing backup now..."; << "] exceeds backup interval [" << intervalToBackup << "] doing backup now...";
struct tm* localTime = localtime(&_lastPersistTime); struct tm* localTime = localtime(&_lastPersistTime);
@ -417,25 +418,25 @@ void OctreePersistThread::backup() {
if (rule.maxBackupVersions > 0) { if (rule.maxBackupVersions > 0) {
QFile persistFile(_filename); QFile persistFile(_filename);
if (persistFile.exists()) { if (persistFile.exists()) {
qDebug() << "backing up persist file " << _filename << "to" << backupFileName << "..."; qCDebug(octree) << "backing up persist file " << _filename << "to" << backupFileName << "...";
bool result = QFile::copy(_filename, backupFileName); bool result = QFile::copy(_filename, backupFileName);
if (result) { if (result) {
qDebug() << "DONE backing up persist file..."; qCDebug(octree) << "DONE backing up persist file...";
rule.lastBackup = now; // only record successful backup in this case. rule.lastBackup = now; // only record successful backup in this case.
} else { } else {
qDebug() << "ERROR in backing up persist file..."; qCDebug(octree) << "ERROR in backing up persist file...";
} }
} else { } else {
qDebug() << "persist file " << _filename << " does not exist. " << qCDebug(octree) << "persist file " << _filename << " does not exist. " <<
"nothing to backup for this rule ["<< rule.name << "]..."; "nothing to backup for this rule ["<< rule.name << "]...";
} }
} else { } else {
qDebug() << "This backup rule" << rule.name qCDebug(octree) << "This backup rule" << rule.name
<< " has Max Rolled Backup Versions less than 1 [" << rule.maxBackupVersions << "]." << " has Max Rolled Backup Versions less than 1 [" << rule.maxBackupVersions << "]."
<< " There are no backups to be done..."; << " There are no backups to be done...";
} }
} else { } else {
qDebug() << "Backup not needed for this rule ["<< rule.name << "]..."; qCDebug(octree) << "Backup not needed for this rule ["<< rule.name << "]...";
} }
} }
} }

View file

@ -15,6 +15,7 @@
#include "GeometryUtil.h" #include "GeometryUtil.h"
#include "SharedUtil.h" #include "SharedUtil.h"
#include "OctreeLogging.h"
#include "OctreeProjectedPolygon.h" #include "OctreeProjectedPolygon.h"
@ -94,7 +95,7 @@ void BoundingBox::explandToInclude(const BoundingBox& box) {
void BoundingBox::printDebugDetails(const char* label) const { void BoundingBox::printDebugDetails(const char* label) const {
qDebug("%s _set=%s\n corner=%f,%f size=%f,%f\n bounds=[(%f,%f) to (%f,%f)]", qCDebug(octree, "%s _set=%s\n corner=%f,%f size=%f,%f\n bounds=[(%f,%f) to (%f,%f)]",
(label ? label : "BoundingBox"), (label ? label : "BoundingBox"),
debug::valueOf(_set), corner.x, corner.y, size.x, size.y, corner.x, corner.y, corner.x+size.x, corner.y+size.y); debug::valueOf(_set), corner.x, corner.y, size.x, size.y, corner.x, corner.y, corner.x+size.x, corner.y+size.y);
} }
@ -263,12 +264,12 @@ bool OctreeProjectedPolygon::pointInside(const glm::vec2& point, bool* matchesVe
} }
void OctreeProjectedPolygon::printDebugDetails() const { void OctreeProjectedPolygon::printDebugDetails() const {
qDebug("OctreeProjectedPolygon..." qCDebug(octree, "OctreeProjectedPolygon..."
" minX=%f maxX=%f minY=%f maxY=%f", getMinX(), getMaxX(), getMinY(), getMaxY()); " minX=%f maxX=%f minY=%f maxY=%f", getMinX(), getMaxX(), getMinY(), getMaxY());
qDebug(" vertex count=%d distance=%f", getVertexCount(), getDistance()); qCDebug(octree, " vertex count=%d distance=%f", getVertexCount(), getDistance());
for (int i = 0; i < getVertexCount(); i++) { for (int i = 0; i < getVertexCount(); i++) {
glm::vec2 point = getVertex(i); glm::vec2 point = getVertex(i);
qDebug(" vertex[%d] = %f, %f ", i, point.x, point.y); qCDebug(octree, " vertex[%d] = %f, %f ", i, point.x, point.y);
} }
} }

View file

@ -15,6 +15,7 @@
#include <SharedUtil.h> #include <SharedUtil.h>
#include <PerfStat.h> #include <PerfStat.h>
#include <RenderArgs.h> #include <RenderArgs.h>
#include "OctreeLogging.h"
#include "OctreeRenderer.h" #include "OctreeRenderer.h"
OctreeRenderer::OctreeRenderer() : OctreeRenderer::OctreeRenderer() :
@ -49,11 +50,11 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
bool extraDebugging = false; bool extraDebugging = false;
if (extraDebugging) { if (extraDebugging) {
qDebug() << "OctreeRenderer::processDatagram()"; qCDebug(octree) << "OctreeRenderer::processDatagram()";
} }
if (!_tree) { if (!_tree) {
qDebug() << "OctreeRenderer::processDatagram() called before init, calling init()..."; qCDebug(octree) << "OctreeRenderer::processDatagram() called before init, calling init()...";
this->init(); this->init();
} }
@ -94,7 +95,7 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
unsigned int dataBytes = packetLength - (numBytesPacketHeader + OCTREE_PACKET_EXTRA_HEADERS_SIZE); unsigned int dataBytes = packetLength - (numBytesPacketHeader + OCTREE_PACKET_EXTRA_HEADERS_SIZE);
if (extraDebugging) { if (extraDebugging) {
qDebug("OctreeRenderer::processDatagram() ... Got Packet Section" qCDebug(octree, "OctreeRenderer::processDatagram() ... Got Packet Section"
" color:%s compressed:%s sequence: %u flight:%d usec size:%u data:%u", " color:%s compressed:%s sequence: %u flight:%d usec size:%u data:%u",
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed), debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
sequence, flightTime, packetLength, dataBytes); sequence, flightTime, packetLength, dataBytes);
@ -123,7 +124,7 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
OctreePacketData packetData(packetIsCompressed); OctreePacketData packetData(packetIsCompressed);
packetData.loadFinalizedContent(dataAt, sectionLength); packetData.loadFinalizedContent(dataAt, sectionLength);
if (extraDebugging) { if (extraDebugging) {
qDebug("OctreeRenderer::processDatagram() ... Got Packet Section" qCDebug(octree, "OctreeRenderer::processDatagram() ... Got Packet Section"
" color:%s compressed:%s sequence: %u flight:%d usec size:%u data:%u" " color:%s compressed:%s sequence: %u flight:%d usec size:%u data:%u"
" subsection:%d sectionLength:%d uncompressed:%d", " subsection:%d sectionLength:%d uncompressed:%d",
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed), debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
@ -131,11 +132,11 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
packetData.getUncompressedSize()); packetData.getUncompressedSize());
} }
if (extraDebugging) { if (extraDebugging) {
qDebug() << "OctreeRenderer::processDatagram() ******* START _tree->readBitstreamToTree()..."; qCDebug(octree) << "OctreeRenderer::processDatagram() ******* START _tree->readBitstreamToTree()...";
} }
_tree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args); _tree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args);
if (extraDebugging) { if (extraDebugging) {
qDebug() << "OctreeRenderer::processDatagram() ******* END _tree->readBitstreamToTree()..."; qCDebug(octree) << "OctreeRenderer::processDatagram() ******* END _tree->readBitstreamToTree()...";
} }
_tree->unlock(); _tree->unlock();

View file

@ -19,6 +19,7 @@
#include "OctreePacketData.h" #include "OctreePacketData.h"
#include "OctreeElement.h" #include "OctreeElement.h"
#include "OctreeLogging.h"
#include "OctreeSceneStats.h" #include "OctreeSceneStats.h"
@ -630,51 +631,51 @@ int OctreeSceneStats::unpackFromMessage(const unsigned char* sourceBuffer, int a
void OctreeSceneStats::printDebugDetails() { void OctreeSceneStats::printDebugDetails() {
qDebug() << "\n------------------------------"; qCDebug(octree) << "\n------------------------------";
qDebug() << "OctreeSceneStats:"; qCDebug(octree) << "OctreeSceneStats:";
qDebug() << "start: " << _start; qCDebug(octree) << "start: " << _start;
qDebug() << "end: " << _end; qCDebug(octree) << "end: " << _end;
qDebug() << "elapsed: " << _elapsed; qCDebug(octree) << "elapsed: " << _elapsed;
qDebug() << "encoding: " << _totalEncodeTime; qCDebug(octree) << "encoding: " << _totalEncodeTime;
qDebug(); qCDebug(octree);
qDebug() << "full scene: " << debug::valueOf(_isFullScene); qCDebug(octree) << "full scene: " << debug::valueOf(_isFullScene);
qDebug() << "moving: " << debug::valueOf(_isMoving); qCDebug(octree) << "moving: " << debug::valueOf(_isMoving);
qDebug(); qCDebug(octree);
qDebug() << "packets: " << _packets; qCDebug(octree) << "packets: " << _packets;
qDebug() << "bytes: " << _bytes; qCDebug(octree) << "bytes: " << _bytes;
qDebug(); qCDebug(octree);
qDebug() << "total elements: " << _totalElements; qCDebug(octree) << "total elements: " << _totalElements;
qDebug() << "internal: " << _totalInternal; qCDebug(octree) << "internal: " << _totalInternal;
qDebug() << "leaves: " << _totalLeaves; qCDebug(octree) << "leaves: " << _totalLeaves;
qDebug() << "traversed: " << _traversed; qCDebug(octree) << "traversed: " << _traversed;
qDebug() << "internal: " << _internal; qCDebug(octree) << "internal: " << _internal;
qDebug() << "leaves: " << _leaves; qCDebug(octree) << "leaves: " << _leaves;
qDebug() << "skipped distance: " << _skippedDistance; qCDebug(octree) << "skipped distance: " << _skippedDistance;
qDebug() << "internal: " << _internalSkippedDistance; qCDebug(octree) << "internal: " << _internalSkippedDistance;
qDebug() << "leaves: " << _leavesSkippedDistance; qCDebug(octree) << "leaves: " << _leavesSkippedDistance;
qDebug() << "skipped out of view: " << _skippedOutOfView; qCDebug(octree) << "skipped out of view: " << _skippedOutOfView;
qDebug() << "internal: " << _internalSkippedOutOfView; qCDebug(octree) << "internal: " << _internalSkippedOutOfView;
qDebug() << "leaves: " << _leavesSkippedOutOfView; qCDebug(octree) << "leaves: " << _leavesSkippedOutOfView;
qDebug() << "skipped was in view: " << _skippedWasInView; qCDebug(octree) << "skipped was in view: " << _skippedWasInView;
qDebug() << "internal: " << _internalSkippedWasInView; qCDebug(octree) << "internal: " << _internalSkippedWasInView;
qDebug() << "leaves: " << _leavesSkippedWasInView; qCDebug(octree) << "leaves: " << _leavesSkippedWasInView;
qDebug() << "skipped no change: " << _skippedNoChange; qCDebug(octree) << "skipped no change: " << _skippedNoChange;
qDebug() << "internal: " << _internalSkippedNoChange; qCDebug(octree) << "internal: " << _internalSkippedNoChange;
qDebug() << "leaves: " << _leavesSkippedNoChange; qCDebug(octree) << "leaves: " << _leavesSkippedNoChange;
qDebug() << "skipped occluded: " << _skippedOccluded; qCDebug(octree) << "skipped occluded: " << _skippedOccluded;
qDebug() << "internal: " << _internalSkippedOccluded; qCDebug(octree) << "internal: " << _internalSkippedOccluded;
qDebug() << "leaves: " << _leavesSkippedOccluded; qCDebug(octree) << "leaves: " << _leavesSkippedOccluded;
qDebug(); qCDebug(octree);
qDebug() << "color sent: " << _colorSent; qCDebug(octree) << "color sent: " << _colorSent;
qDebug() << "internal: " << _internalColorSent; qCDebug(octree) << "internal: " << _internalColorSent;
qDebug() << "leaves: " << _leavesColorSent; qCDebug(octree) << "leaves: " << _leavesColorSent;
qDebug() << "Didn't Fit: " << _didntFit; qCDebug(octree) << "Didn't Fit: " << _didntFit;
qDebug() << "internal: " << _internalDidntFit; qCDebug(octree) << "internal: " << _internalDidntFit;
qDebug() << "leaves: " << _leavesDidntFit; qCDebug(octree) << "leaves: " << _leavesDidntFit;
qDebug() << "color bits: " << _colorBitsWritten; qCDebug(octree) << "color bits: " << _colorBitsWritten;
qDebug() << "exists bits: " << _existsBitsWritten; qCDebug(octree) << "exists bits: " << _existsBitsWritten;
qDebug() << "in packet bit: " << _existsInPacketBitsWritten; qCDebug(octree) << "in packet bit: " << _existsInPacketBitsWritten;
qDebug() << "trees removed: " << _treesRemoved; qCDebug(octree) << "trees removed: " << _treesRemoved;
} }
OctreeSceneStats::ItemInfo OctreeSceneStats::_ITEMS[] = { OctreeSceneStats::ItemInfo OctreeSceneStats::_ITEMS[] = {
@ -845,10 +846,10 @@ void OctreeSceneStats::trackIncomingOctreePacket(const QByteArray& packet,
qint64 flightTime = arrivedAt - sentAt + nodeClockSkewUsec; qint64 flightTime = arrivedAt - sentAt + nodeClockSkewUsec;
if (wantExtraDebugging) { if (wantExtraDebugging) {
qDebug() << "sentAt:" << sentAt << " usecs"; qCDebug(octree) << "sentAt:" << sentAt << " usecs";
qDebug() << "arrivedAt:" << arrivedAt << " usecs"; qCDebug(octree) << "arrivedAt:" << arrivedAt << " usecs";
qDebug() << "nodeClockSkewUsec:" << nodeClockSkewUsec << " usecs"; qCDebug(octree) << "nodeClockSkewUsec:" << nodeClockSkewUsec << " usecs";
qDebug() << "flightTime:" << flightTime << " usecs"; qCDebug(octree) << "flightTime:" << flightTime << " usecs";
} }
// Guard against possible corrupted packets... with bad timestamps // Guard against possible corrupted packets... with bad timestamps
@ -859,7 +860,7 @@ void OctreeSceneStats::trackIncomingOctreePacket(const QByteArray& packet,
= LogHandler::getInstance().addRepeatedMessageRegex( = LogHandler::getInstance().addRepeatedMessageRegex(
"ignoring unreasonable packet... flightTime: -?\\d+ nodeClockSkewUsec: -?\\d+ usecs"); "ignoring unreasonable packet... flightTime: -?\\d+ nodeClockSkewUsec: -?\\d+ usecs");
qDebug() << "ignoring unreasonable packet... flightTime:" << flightTime qCDebug(octree) << "ignoring unreasonable packet... flightTime:" << flightTime
<< "nodeClockSkewUsec:" << nodeClockSkewUsec << "usecs";; << "nodeClockSkewUsec:" << nodeClockSkewUsec << "usecs";;
return; // ignore any packets that are unreasonable return; // ignore any packets that are unreasonable
} }

View file

@ -13,6 +13,8 @@
// //
#include "Plane.h" #include "Plane.h"
#include "OctreeLogging.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
@ -63,6 +65,6 @@ float Plane::distance(const glm::vec3 &point) const {
} }
void Plane::print() const { void Plane::print() const {
qDebug("Plane - point (x=%f y=%f z=%f) normal (x=%f y=%f z=%f) d=%f", qCDebug(octree, "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); _point.x, _point.y, _point.z, _normal.x, _normal.y, _normal.z, _dCoefficient);
} }

View file

@ -21,6 +21,7 @@
#include "GLMHelpers.h" #include "GLMHelpers.h"
#include "SharedUtil.h" #include "SharedUtil.h"
#include "ViewFrustum.h" #include "ViewFrustum.h"
#include "OctreeLogging.h"
#include "OctreeConstants.h" #include "OctreeConstants.h"
using namespace std; using namespace std;
@ -432,43 +433,43 @@ bool ViewFrustum::matches(const ViewFrustum& compareTo, bool debug) const {
testMatches(compareTo._eyeOffsetOrientation, _eyeOffsetOrientation); testMatches(compareTo._eyeOffsetOrientation, _eyeOffsetOrientation);
if (!result && debug) { if (!result && debug) {
qDebug("ViewFrustum::matches()... result=%s", debug::valueOf(result)); qCDebug(octree, "ViewFrustum::matches()... result=%s", debug::valueOf(result));
qDebug("%s -- compareTo._position=%f,%f,%f _position=%f,%f,%f", qCDebug(octree, "%s -- compareTo._position=%f,%f,%f _position=%f,%f,%f",
(testMatches(compareTo._position,_position) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._position,_position) ? "MATCHES " : "NO MATCH"),
compareTo._position.x, compareTo._position.y, compareTo._position.z, compareTo._position.x, compareTo._position.y, compareTo._position.z,
_position.x, _position.y, _position.z ); _position.x, _position.y, _position.z );
qDebug("%s -- compareTo._direction=%f,%f,%f _direction=%f,%f,%f", qCDebug(octree, "%s -- compareTo._direction=%f,%f,%f _direction=%f,%f,%f",
(testMatches(compareTo._direction, _direction) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._direction, _direction) ? "MATCHES " : "NO MATCH"),
compareTo._direction.x, compareTo._direction.y, compareTo._direction.z, compareTo._direction.x, compareTo._direction.y, compareTo._direction.z,
_direction.x, _direction.y, _direction.z ); _direction.x, _direction.y, _direction.z );
qDebug("%s -- compareTo._up=%f,%f,%f _up=%f,%f,%f", qCDebug(octree, "%s -- compareTo._up=%f,%f,%f _up=%f,%f,%f",
(testMatches(compareTo._up, _up) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._up, _up) ? "MATCHES " : "NO MATCH"),
compareTo._up.x, compareTo._up.y, compareTo._up.z, compareTo._up.x, compareTo._up.y, compareTo._up.z,
_up.x, _up.y, _up.z ); _up.x, _up.y, _up.z );
qDebug("%s -- compareTo._right=%f,%f,%f _right=%f,%f,%f", qCDebug(octree, "%s -- compareTo._right=%f,%f,%f _right=%f,%f,%f",
(testMatches(compareTo._right, _right) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._right, _right) ? "MATCHES " : "NO MATCH"),
compareTo._right.x, compareTo._right.y, compareTo._right.z, compareTo._right.x, compareTo._right.y, compareTo._right.z,
_right.x, _right.y, _right.z ); _right.x, _right.y, _right.z );
qDebug("%s -- compareTo._fieldOfView=%f _fieldOfView=%f", qCDebug(octree, "%s -- compareTo._fieldOfView=%f _fieldOfView=%f",
(testMatches(compareTo._fieldOfView, _fieldOfView) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._fieldOfView, _fieldOfView) ? "MATCHES " : "NO MATCH"),
compareTo._fieldOfView, _fieldOfView); compareTo._fieldOfView, _fieldOfView);
qDebug("%s -- compareTo._aspectRatio=%f _aspectRatio=%f", qCDebug(octree, "%s -- compareTo._aspectRatio=%f _aspectRatio=%f",
(testMatches(compareTo._aspectRatio, _aspectRatio) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._aspectRatio, _aspectRatio) ? "MATCHES " : "NO MATCH"),
compareTo._aspectRatio, _aspectRatio); compareTo._aspectRatio, _aspectRatio);
qDebug("%s -- compareTo._nearClip=%f _nearClip=%f", qCDebug(octree, "%s -- compareTo._nearClip=%f _nearClip=%f",
(testMatches(compareTo._nearClip, _nearClip) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._nearClip, _nearClip) ? "MATCHES " : "NO MATCH"),
compareTo._nearClip, _nearClip); compareTo._nearClip, _nearClip);
qDebug("%s -- compareTo._farClip=%f _farClip=%f", qCDebug(octree, "%s -- compareTo._farClip=%f _farClip=%f",
(testMatches(compareTo._farClip, _farClip) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._farClip, _farClip) ? "MATCHES " : "NO MATCH"),
compareTo._farClip, _farClip); compareTo._farClip, _farClip);
qDebug("%s -- compareTo._focalLength=%f _focalLength=%f", qCDebug(octree, "%s -- compareTo._focalLength=%f _focalLength=%f",
(testMatches(compareTo._focalLength, _focalLength) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._focalLength, _focalLength) ? "MATCHES " : "NO MATCH"),
compareTo._focalLength, _focalLength); compareTo._focalLength, _focalLength);
qDebug("%s -- compareTo._eyeOffsetPosition=%f,%f,%f _eyeOffsetPosition=%f,%f,%f", qCDebug(octree, "%s -- compareTo._eyeOffsetPosition=%f,%f,%f _eyeOffsetPosition=%f,%f,%f",
(testMatches(compareTo._eyeOffsetPosition, _eyeOffsetPosition) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._eyeOffsetPosition, _eyeOffsetPosition) ? "MATCHES " : "NO MATCH"),
compareTo._eyeOffsetPosition.x, compareTo._eyeOffsetPosition.y, compareTo._eyeOffsetPosition.z, compareTo._eyeOffsetPosition.x, compareTo._eyeOffsetPosition.y, compareTo._eyeOffsetPosition.z,
_eyeOffsetPosition.x, _eyeOffsetPosition.y, _eyeOffsetPosition.z); _eyeOffsetPosition.x, _eyeOffsetPosition.y, _eyeOffsetPosition.z);
qDebug("%s -- compareTo._eyeOffsetOrientation=%f,%f,%f,%f _eyeOffsetOrientation=%f,%f,%f,%f", qCDebug(octree, "%s -- compareTo._eyeOffsetOrientation=%f,%f,%f,%f _eyeOffsetOrientation=%f,%f,%f,%f",
(testMatches(compareTo._eyeOffsetOrientation, _eyeOffsetOrientation) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._eyeOffsetOrientation, _eyeOffsetOrientation) ? "MATCHES " : "NO MATCH"),
compareTo._eyeOffsetOrientation.x, compareTo._eyeOffsetOrientation.y, compareTo._eyeOffsetOrientation.x, compareTo._eyeOffsetOrientation.y,
compareTo._eyeOffsetOrientation.z, compareTo._eyeOffsetOrientation.w, compareTo._eyeOffsetOrientation.z, compareTo._eyeOffsetOrientation.w,
@ -514,46 +515,46 @@ bool ViewFrustum::isVerySimilar(const ViewFrustum& compareTo, bool debug) const
if (!result && debug) { if (!result && debug) {
qDebug("ViewFrustum::isVerySimilar()... result=%s\n", debug::valueOf(result)); qCDebug(octree, "ViewFrustum::isVerySimilar()... result=%s\n", debug::valueOf(result));
qDebug("%s -- compareTo._position=%f,%f,%f _position=%f,%f,%f", qCDebug(octree, "%s -- compareTo._position=%f,%f,%f _position=%f,%f,%f",
(testMatches(compareTo._position,_position, POSITION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"), (testMatches(compareTo._position,_position, POSITION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"),
compareTo._position.x, compareTo._position.y, compareTo._position.z, compareTo._position.x, compareTo._position.y, compareTo._position.z,
_position.x, _position.y, _position.z ); _position.x, _position.y, _position.z );
qDebug("%s -- positionDistance=%f", qCDebug(octree, "%s -- positionDistance=%f",
(testMatches(0,positionDistance, POSITION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"), (testMatches(0,positionDistance, POSITION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"),
positionDistance); positionDistance);
qDebug("%s -- angleOrientation=%f", qCDebug(octree, "%s -- angleOrientation=%f",
(testMatches(0, angleOrientation, ORIENTATION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"), (testMatches(0, angleOrientation, ORIENTATION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"),
angleOrientation); angleOrientation);
qDebug("%s -- compareTo._fieldOfView=%f _fieldOfView=%f", qCDebug(octree, "%s -- compareTo._fieldOfView=%f _fieldOfView=%f",
(testMatches(compareTo._fieldOfView, _fieldOfView) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._fieldOfView, _fieldOfView) ? "MATCHES " : "NO MATCH"),
compareTo._fieldOfView, _fieldOfView); compareTo._fieldOfView, _fieldOfView);
qDebug("%s -- compareTo._aspectRatio=%f _aspectRatio=%f", qCDebug(octree, "%s -- compareTo._aspectRatio=%f _aspectRatio=%f",
(testMatches(compareTo._aspectRatio, _aspectRatio) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._aspectRatio, _aspectRatio) ? "MATCHES " : "NO MATCH"),
compareTo._aspectRatio, _aspectRatio); compareTo._aspectRatio, _aspectRatio);
qDebug("%s -- compareTo._nearClip=%f _nearClip=%f", qCDebug(octree, "%s -- compareTo._nearClip=%f _nearClip=%f",
(testMatches(compareTo._nearClip, _nearClip) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._nearClip, _nearClip) ? "MATCHES " : "NO MATCH"),
compareTo._nearClip, _nearClip); compareTo._nearClip, _nearClip);
qDebug("%s -- compareTo._farClip=%f _farClip=%f", qCDebug(octree, "%s -- compareTo._farClip=%f _farClip=%f",
(testMatches(compareTo._farClip, _farClip) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._farClip, _farClip) ? "MATCHES " : "NO MATCH"),
compareTo._farClip, _farClip); compareTo._farClip, _farClip);
qDebug("%s -- compareTo._focalLength=%f _focalLength=%f", qCDebug(octree, "%s -- compareTo._focalLength=%f _focalLength=%f",
(testMatches(compareTo._focalLength, _focalLength) ? "MATCHES " : "NO MATCH"), (testMatches(compareTo._focalLength, _focalLength) ? "MATCHES " : "NO MATCH"),
compareTo._focalLength, _focalLength); compareTo._focalLength, _focalLength);
qDebug("%s -- compareTo._eyeOffsetPosition=%f,%f,%f _eyeOffsetPosition=%f,%f,%f", qCDebug(octree, "%s -- compareTo._eyeOffsetPosition=%f,%f,%f _eyeOffsetPosition=%f,%f,%f",
(testMatches(compareTo._eyeOffsetPosition, _eyeOffsetPosition, POSITION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"), (testMatches(compareTo._eyeOffsetPosition, _eyeOffsetPosition, POSITION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"),
compareTo._eyeOffsetPosition.x, compareTo._eyeOffsetPosition.y, compareTo._eyeOffsetPosition.z, compareTo._eyeOffsetPosition.x, compareTo._eyeOffsetPosition.y, compareTo._eyeOffsetPosition.z,
_eyeOffsetPosition.x, _eyeOffsetPosition.y, _eyeOffsetPosition.z); _eyeOffsetPosition.x, _eyeOffsetPosition.y, _eyeOffsetPosition.z);
qDebug("%s -- eyeOffsetpositionDistance=%f", qCDebug(octree, "%s -- eyeOffsetpositionDistance=%f",
(testMatches(0,eyeOffsetpositionDistance, EYEOFFSET_POSITION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"), (testMatches(0,eyeOffsetpositionDistance, EYEOFFSET_POSITION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"),
eyeOffsetpositionDistance); eyeOffsetpositionDistance);
qDebug("%s -- angleEyeOffsetOrientation=%f", qCDebug(octree, "%s -- angleEyeOffsetOrientation=%f",
(testMatches(0, angleEyeOffsetOrientation, ORIENTATION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"), (testMatches(0, angleEyeOffsetOrientation, ORIENTATION_SIMILAR_ENOUGH) ? "IS SIMILAR ENOUGH " : "IS NOT SIMILAR ENOUGH"),
angleEyeOffsetOrientation); angleEyeOffsetOrientation);
} }
@ -631,19 +632,19 @@ void ViewFrustum::computeOffAxisFrustum(float& left, float& right, float& bottom
} }
void ViewFrustum::printDebugDetails() const { void ViewFrustum::printDebugDetails() const {
qDebug("ViewFrustum::printDebugDetails()..."); qCDebug(octree, "ViewFrustum::printDebugDetails()...");
qDebug("_position=%f,%f,%f", _position.x, _position.y, _position.z ); qCDebug(octree, "_position=%f,%f,%f", _position.x, _position.y, _position.z );
qDebug("_direction=%f,%f,%f", _direction.x, _direction.y, _direction.z ); qCDebug(octree, "_direction=%f,%f,%f", _direction.x, _direction.y, _direction.z );
qDebug("_up=%f,%f,%f", _up.x, _up.y, _up.z ); qCDebug(octree, "_up=%f,%f,%f", _up.x, _up.y, _up.z );
qDebug("_right=%f,%f,%f", _right.x, _right.y, _right.z ); qCDebug(octree, "_right=%f,%f,%f", _right.x, _right.y, _right.z );
qDebug("_fieldOfView=%f", _fieldOfView); qCDebug(octree, "_fieldOfView=%f", _fieldOfView);
qDebug("_aspectRatio=%f", _aspectRatio); qCDebug(octree, "_aspectRatio=%f", _aspectRatio);
qDebug("_keyHoleRadius=%f", _keyholeRadius); qCDebug(octree, "_keyHoleRadius=%f", _keyholeRadius);
qDebug("_nearClip=%f", _nearClip); qCDebug(octree, "_nearClip=%f", _nearClip);
qDebug("_farClip=%f", _farClip); qCDebug(octree, "_farClip=%f", _farClip);
qDebug("_focalLength=%f", _focalLength); qCDebug(octree, "_focalLength=%f", _focalLength);
qDebug("_eyeOffsetPosition=%f,%f,%f", _eyeOffsetPosition.x, _eyeOffsetPosition.y, _eyeOffsetPosition.z ); qCDebug(octree, "_eyeOffsetPosition=%f,%f,%f", _eyeOffsetPosition.x, _eyeOffsetPosition.y, _eyeOffsetPosition.z );
qDebug("_eyeOffsetOrientation=%f,%f,%f,%f", _eyeOffsetOrientation.x, _eyeOffsetOrientation.y, _eyeOffsetOrientation.z, qCDebug(octree, "_eyeOffsetOrientation=%f,%f,%f,%f", _eyeOffsetOrientation.x, _eyeOffsetOrientation.y, _eyeOffsetOrientation.z,
_eyeOffsetOrientation.w ); _eyeOffsetOrientation.w );
} }