debugging tweaks

This commit is contained in:
ZappoMan 2014-08-19 09:43:09 -07:00
parent 7d675b78fe
commit 960e9eb2f4
4 changed files with 29 additions and 17 deletions

View file

@ -421,7 +421,7 @@ int EntityItem::expectedBytes() {
int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args) {
bool wantDebug = false;
bool wantDebug = true;
if (args.bitstreamVersion < VERSION_ENTITIES_SUPPORT_SPLIT_MTU) {
qDebug() << "EntityItem::readEntityDataFromBuffer()... ERROR CASE...args.bitstreamVersion < VERSION_ENTITIES_SUPPORT_SPLIT_MTU";

View file

@ -631,7 +631,7 @@ bool EntityTreeElement::removeEntityItem(const EntityItem* entity) {
int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args) {
bool wantDebug = false;
bool wantDebug = true;
if (wantDebug) {
qDebug() << "EntityTreeElement::readElementDataFromBuffer()";
qDebug() << " getAACube()=" << getAACube();
@ -645,6 +645,11 @@ if (wantDebug) {
"bitstreamVersion=" << (int)args.bitstreamVersion << " bytesLeftToRead=" << bytesLeftToRead;
return 0;
}
if (this == _myTree->getRoot() && args.bitstreamVersion >= VERSION_ROOT_ELEMENT_HAS_DATA) {
qDebug() << "ROOT ELEMENT: -------- NOW READING ROOT DATA ---------";
}
const unsigned char* dataAt = data;
int bytesRead = 0;

View file

@ -75,7 +75,7 @@ bool EntityTypes::registerEntityType(EntityType entityType, const char* name, En
}
EntityItem* EntityTypes::constructEntityItem(EntityType entityType, const EntityItemID& entityID, const EntityItemProperties& properties) {
bool wantDebug = false;
bool wantDebug = true;
if (wantDebug) {
qDebug() << "EntityTypes::constructEntityItem(EntityType entityType, const EntityItemID& entityID, const EntityItemProperties& properties)";
qDebug() << " entityType=" << entityType;
@ -96,7 +96,7 @@ EntityItem* EntityTypes::constructEntityItem(EntityType entityType, const Entity
EntityItem* EntityTypes::constructEntityItem(const unsigned char* data, int bytesToRead,
ReadBitstreamToTreeParams& args) {
bool wantDebug = false;
bool wantDebug = true;
//qDebug() << "EntityTypes::constructEntityItem(const unsigned char* data, int bytesToRead)";
//qDebug() << "EntityTypes::constructEntityItem(const unsigned char* data, int bytesToRead).... CALLED BUT NOT IMPLEMENTED!!!";

View file

@ -236,7 +236,7 @@ OctreeElement* Octree::createMissingElement(OctreeElement* lastParentElement, co
int Octree::readElementData(OctreeElement* destinationElement, const unsigned char* nodeData, int bytesLeftToRead,
ReadBitstreamToTreeParams& args) {
bool wantDebug = false;
bool wantDebug = true;
if (wantDebug) {
qDebug() << "Octree::readElementData()";
qDebug() << " destinationElement->getAACube()=" << destinationElement->getAACube();
@ -324,16 +324,20 @@ if (wantDebug) {
// if this is the root, and there is more data to read, allow it to read it's element data...
if (destinationElement == _rootElement && rootElementHasData() && (bytesLeftToRead - bytesRead) > 0) {
// tell the element to read the subsequent data
if (wantDebug) {
qDebug() << "Octree::readElementData().... reading element data for root element.....";
}
if (wantDebug) {
qDebug() << "Octree::readElementData().... reading element data for root element.....";
qDebug() << " bytesRead=" << bytesRead;
qDebug() << " bytesLeftToRead - bytesRead=" << bytesLeftToRead - bytesRead;
qDebug() << " READING ROOT DATA....";
}
bytesRead += _rootElement->readElementDataFromBuffer(nodeData + bytesRead, bytesLeftToRead - bytesRead, args);
}
if (wantDebug) {
qDebug() << "Octree::readElementData()";
qDebug() << " bytesRead=" << bytesLeftToRead;
}
if (wantDebug) {
qDebug() << "Octree::readElementData()";
qDebug() << " bytesRead=" << bytesLeftToRead;
}
return bytesRead;
}
@ -341,7 +345,7 @@ if (wantDebug) {
void Octree::readBitstreamToTree(const unsigned char * bitstream, unsigned long int bufferSizeBytes,
ReadBitstreamToTreeParams& args) {
bool wantDebug = false;
bool wantDebug = true;
if (wantDebug) {
qDebug() << "Octree::readBitstreamToTree()";
qDebug() << " bufferSizeBytes=" << bufferSizeBytes;
@ -1220,9 +1224,8 @@ qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedByte
// Make our local buffer large enough to handle writing at this level in case we need to.
LevelDetails thisLevelKey = packetData->startLevel();
bool continueThisLevel = packetData->reserveBytes(sizeof(childrenDataBits)
+ sizeof(childrenExistInPacketBits)
+ sizeof(childrenExistInTreeBits));
int requiredBytes = sizeof(childrenDataBits) + sizeof(childrenExistInPacketBits) + sizeof(childrenExistInTreeBits);
bool continueThisLevel = packetData->reserveBytes(requiredBytes);
// If we can't reserve our minimum bytes then we can discard this level and return as if none of this level fits
if (!continueThisLevel) {
@ -1772,6 +1775,7 @@ qDebug() << " continueThisLevel=" << continueThisLevel;
// If we made it this far, then we've written all of our child data... if this element is the root
// element, then we also allow the root element to write out it's data...
if (continueThisLevel && element == _rootElement && rootElementHasData()) {
qDebug() << " ---- ROOT ELEMENT HANDLING ---- line:" << __LINE__;
int bytesBeforeChild = packetData->getUncompressedSize();
qDebug() << " bytesBeforeChild=" << bytesBeforeChild;
@ -1788,6 +1792,9 @@ qDebug() << " allOfRootFit=" << allOfRootFit;
qDebug() << " ----------- root DID (partially or fully) fit ------";
qDebug() << " packetData->endLevel(rootDataLevelKey)... line:" << __LINE__;
continueThisLevel = packetData->endLevel(rootDataLevelKey);
if (!continueThisLevel) {
qDebug() << " UNEXPECTED ROOT ELEMENT -- could not packetData->endLevel(rootDataLevelKey) -- line:" << __LINE__;
}
} else {
qDebug() << " ----------- root didn't fit ------";
qDebug() << " packetData->discardLevel(rootDataLevelKey)... line:" << __LINE__;
@ -1879,7 +1886,7 @@ bool Octree::readFromSVOFile(const char* fileName) {
unsigned long fileLength = file.tellg();
file.seekg( 0, std::ios::beg );
bool wantDebug = false;
bool wantDebug = true;
if (wantDebug) {
qDebug() << "Octree::readFromSVOFile()";
qDebug() << " fileLength=" << fileLength;