removed tons of debugging

This commit is contained in:
ZappoMan 2014-08-20 17:47:16 -07:00
parent ef86d86234
commit 17426a1c71
10 changed files with 14 additions and 248 deletions

View file

@ -65,7 +65,6 @@ GLubyte indices[] = { 0, 1, 2, 2, 3, 0, // front
EntityItem* RenderableBoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
qDebug() << "RenderableBoxEntityItem::factory(const EntityItemID& entityItemID, const EntityItemProperties& properties)...";
return new RenderableBoxEntityItem(entityID, properties);
}

View file

@ -25,7 +25,6 @@
#include "RenderableModelEntityItem.h"
EntityItem* RenderableModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
qDebug() << "RenderableModelEntityItem::factory(const EntityItemID& entityItemID, const EntityItemProperties& properties)...";
return new RenderableModelEntityItem(entityID, properties);
}

View file

@ -25,7 +25,6 @@
EntityItem* RenderableSphereEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
qDebug() << "RenderableSphereEntityItem::factory(const EntityItemID& entityItemID, const EntityItemProperties& properties)...";
return new RenderableSphereEntityItem(entityID, properties);
}

View file

@ -19,11 +19,7 @@
#include "BoxEntityItem.h"
//static bool registerBox = EntityTypes::registerEntityType(EntityTypes::Box, "Box", BoxEntityItem::factory);
EntityItem* BoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
qDebug() << "BoxEntityItem::factory(const EntityItemID& entityItemID, const EntityItemProperties& properties)...";
return new BoxEntityItem(entityID, properties);
}
@ -31,20 +27,13 @@ EntityItem* BoxEntityItem::factory(const EntityItemID& entityID, const EntityIte
BoxEntityItem::BoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID, properties)
{
qDebug() << "BoxEntityItem::BoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties)...";
_type = EntityTypes::Box;
qDebug() << "BoxEntityItem::BoxEntityItem() properties.getModelURL()=" << properties.getModelURL();
qDebug() << "BoxEntityItem::BoxEntityItem() calling setProperties()";
setProperties(properties);
}
EntityItemProperties BoxEntityItem::getProperties() const {
qDebug() << "BoxEntityItem::getProperties()... <<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<";
EntityItemProperties properties = EntityItem::getProperties(); // get the properties from our base class
properties._color = getXColor();
@ -57,8 +46,6 @@ EntityItemProperties BoxEntityItem::getProperties() const {
}
bool BoxEntityItem::setProperties(const EntityItemProperties& properties, bool forceCopy) {
qDebug() << "BoxEntityItem::setProperties()...";
qDebug() << "BoxEntityItem::BoxEntityItem() properties.getModelURL()=" << properties.getModelURL();
bool somethingChanged = false;
somethingChanged = EntityItem::setProperties(properties, forceCopy); // set the properties in our base class
@ -93,8 +80,6 @@ int BoxEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, i
int bytesRead = 0;
const unsigned char* dataAt = data;
qDebug() << "BoxEntityItem::readEntitySubclassDataFromBuffer()... <<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<";
// PROP_COLOR
if (propertyFlags.getHasProperty(PROP_COLOR)) {
rgbColor color;
@ -125,15 +110,10 @@ void BoxEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitst
int& propertyCount,
OctreeElement::AppendState& appendState) const {
qDebug() << "BoxEntityItem::appendSubclassData()... ********************************************";
bool successPropertyFits = true;
// PROP_COLOR
if (requestedProperties.getHasProperty(PROP_COLOR)) {
//qDebug() << "PROP_COLOR requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendColor(getColor());
if (successPropertyFits) {
@ -142,12 +122,10 @@ qDebug() << "BoxEntityItem::appendSubclassData()... ****************************
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_COLOR didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_COLOR NOT requested...";
propertiesDidntFit -= PROP_COLOR;
}

View file

@ -631,26 +631,12 @@ bool EntityTreeElement::removeEntityItem(const EntityItem* entity) {
int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
ReadBitstreamToTreeParams& args) {
bool wantDebug = true;
if (wantDebug) {
qDebug() << "EntityTreeElement::readElementDataFromBuffer()";
qDebug() << " getAACube()=" << getAACube();
qDebug() << " bytesLeftToRead=" << bytesLeftToRead;
}
// If we're the root, but this bitstream doesn't support root elements with data, then
// return without reading any bytes
if (this == _myTree->getRoot() && args.bitstreamVersion < VERSION_ROOT_ELEMENT_HAS_DATA) {
qDebug() << "ROOT ELEMENT: no root data for "
"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;
uint16_t numberOfEntities = 0;
@ -664,28 +650,10 @@ if (wantDebug) {
bytesLeftToRead -= (int)sizeof(numberOfEntities);
bytesRead += sizeof(numberOfEntities);
if (wantDebug) {
qDebug() << " --- after numberOfEntities ---";
qDebug() << " numberOfEntities=" << numberOfEntities;
qDebug() << " expectedBytesPerEntity=" << expectedBytesPerEntity;
qDebug() << " numberOfEntities * expectedBytesPerEntity=" << numberOfEntities * expectedBytesPerEntity;
qDebug() << " bytesLeftToRead=" << bytesLeftToRead;
if (numberOfEntities > 0) {
qDebug() << " WE HAVE ENTITIES!!!";
}
}
if (bytesLeftToRead >= (int)(numberOfEntities * expectedBytesPerEntity)) {
for (uint16_t i = 0; i < numberOfEntities; i++) {
int bytesForThisEntity = 0;
EntityItemID entityItemID = EntityItemID::readEntityItemIDFromBuffer(dataAt, bytesLeftToRead);
if (wantDebug) {
qDebug() << " --- entities loop entity["<< i <<"] ---";
qDebug() << " bytesLeftToRead=" << bytesLeftToRead;
qDebug() << " entityItemID=" << entityItemID;
}
EntityItem* entityItem = _myTree->findEntityByEntityItemID(entityItemID);
bool newEntity = false;
@ -733,10 +701,6 @@ if (wantDebug) {
}
}
if (wantDebug) {
qDebug() << "EntityTreeElement::readElementDataFromBuffer() bytesRead=" << bytesRead;
}
return bytesRead;
}

View file

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

View file

@ -136,8 +136,6 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
int bytesRead = 0;
const unsigned char* dataAt = data;
//qDebug() << "ModelEntityItem::readEntitySubclassDataFromBuffer()... <<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<";
// PROP_COLOR
if (propertyFlags.getHasProperty(PROP_COLOR)) {
rgbColor color;
@ -158,18 +156,11 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
QString modelURLString((const char*)dataAt);
dataAt += modelURLLength;
bytesRead += modelURLLength;
qDebug() << "readEntitySubclassDataFromBuffer() included PROP_MODEL_URL url=" << modelURLString;
if (overwriteLocalData) {
setModelURL(modelURLString);
qDebug() << " called setModelURL() url=" << getModelURL();
}
}
//qDebug() << "ModelEntityItem::readEntityDataFromBuffer()... modelURL=" << getModelURL();
// PROP_ANIMATION_URL
if (propertyFlags.getHasProperty(PROP_ANIMATION_URL)) {
// animationURL
@ -341,13 +332,10 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
EntityPropertyFlags& propertiesDidntFit,
int& propertyCount, OctreeElement::AppendState& appendState) const {
//qDebug() << "ModelEntityItem::appendSubclassData()... ********************************************";
bool successPropertyFits = true;
// PROP_COLOR
if (requestedProperties.getHasProperty(PROP_COLOR)) {
//qDebug() << "PROP_COLOR requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendColor(getColor());
if (successPropertyFits) {
@ -356,18 +344,15 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_COLOR didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_COLOR NOT requested...";
propertiesDidntFit -= PROP_COLOR;
}
// PROP_MODEL_URL
if (requestedProperties.getHasProperty(PROP_MODEL_URL)) {
//qDebug() << "PROP_MODEL_URL requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getModelURL());
if (successPropertyFits) {
@ -375,14 +360,11 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
propertiesDidntFit -= PROP_MODEL_URL;
propertyCount++;
packetData->endLevel(propertyLevel);
qDebug() << "PROP_MODEL_URL DID fit... url=" << getModelURL();
} else {
qDebug() << "PROP_MODEL_URL DID NOT fit... url=" << getModelURL();
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_MODEL_URL NOT requested...";
propertiesDidntFit -= PROP_MODEL_URL;
}
@ -390,7 +372,6 @@ qDebug() << "PROP_MODEL_URL DID NOT fit... url=" << getModelURL();
// PROP_ANIMATION_URL
if (requestedProperties.getHasProperty(PROP_ANIMATION_URL)) {
//qDebug() << "PROP_ANIMATION_URL requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getAnimationURL());
if (successPropertyFits) {
@ -399,18 +380,15 @@ qDebug() << "PROP_MODEL_URL DID NOT fit... url=" << getModelURL();
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_ANIMATION_URL didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_ANIMATION_URL NOT requested...";
propertiesDidntFit -= PROP_ANIMATION_URL;
}
// PROP_ANIMATION_FPS
if (requestedProperties.getHasProperty(PROP_ANIMATION_FPS)) {
//qDebug() << "PROP_ANIMATION_FPS requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getAnimationFPS());
if (successPropertyFits) {
@ -419,18 +397,15 @@ qDebug() << "PROP_MODEL_URL DID NOT fit... url=" << getModelURL();
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_ANIMATION_FPS didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_ANIMATION_FPS NOT requested...";
propertiesDidntFit -= PROP_ANIMATION_FPS;
}
// PROP_ANIMATION_FRAME_INDEX
if (requestedProperties.getHasProperty(PROP_ANIMATION_FRAME_INDEX)) {
//qDebug() << "PROP_ANIMATION_FRAME_INDEX requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getAnimationFrameIndex());
if (successPropertyFits) {
@ -439,18 +414,15 @@ qDebug() << "PROP_MODEL_URL DID NOT fit... url=" << getModelURL();
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_ANIMATION_FRAME_INDEX didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_ANIMATION_FRAME_INDEX NOT requested...";
propertiesDidntFit -= PROP_ANIMATION_FRAME_INDEX;
}
// PROP_ANIMATION_PLAYING
if (requestedProperties.getHasProperty(PROP_ANIMATION_PLAYING)) {
//qDebug() << "PROP_ANIMATION_PLAYING requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getAnimationIsPlaying());
if (successPropertyFits) {
@ -459,12 +431,10 @@ qDebug() << "PROP_MODEL_URL DID NOT fit... url=" << getModelURL();
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_ANIMATION_PLAYING didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_ANIMATION_PLAYING NOT requested...";
propertiesDidntFit -= PROP_ANIMATION_PLAYING;
}

View file

@ -108,7 +108,6 @@ void SphereEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBi
// PROP_COLOR
if (requestedProperties.getHasProperty(PROP_COLOR)) {
//qDebug() << "PROP_COLOR requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendColor(getColor());
if (successPropertyFits) {
@ -117,12 +116,10 @@ void SphereEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBi
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_COLOR didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_COLOR NOT requested...";
propertiesDidntFit -= PROP_COLOR;
}
}

View file

@ -33,11 +33,7 @@ Model properties:
//
// REQUIRED TO DO:
0) render performance of models...
a) make getModel() faster... consider storing the Model* in the actual EntityItem class
b) figure out how to only call simulate when needed:
if the properties change
when animated?
0) test animation again...
1) verify lots of models in single element works
-- repro case - run editModelsExample.js -- create 10 models in the same octree element
@ -242,3 +238,6 @@ Model properties:
// maybe add support for "reserving" bytes in the packet
// SOLVED -- BROKEN File persistence... -- added chunking support in SVO file persistence.
// SOLVED -- G) why does is the Box entity not drawn in it's bounds
// SOLVED -- 0) render performance of models...
// SOLVED -- a) make getModel() faster... consider storing the Model* in the actual EntityItem class
// SOLVED -- b) only call simulate when properties change

View file

@ -969,9 +969,6 @@ int Octree::encodeTreeBitstream(OctreeElement* element,
currentEncodeLevel, parentLocationThisView);
qDebug() << "Octree::encodeTreeBitstream() AFTER encodeTreeBitstreamRecursion()....";
qDebug() << " bag.isEmpty()=" << bag.isEmpty();
// if childBytesWritten == 1 then something went wrong... that's not possible
assert(childBytesWritten != 1);
@ -980,8 +977,6 @@ qDebug() << " bag.isEmpty()=" << bag.isEmpty();
if (params.includeColor && childBytesWritten == 2) {
childBytesWritten = 0;
//params.stopReason = EncodeBitstreamParams::UNKNOWN; // possibly should be DIDNT_FIT...
qDebug() << "STOP REASON.... if (params.includeColor && childBytesWritten == 2)....";
}
// if we wrote child bytes, then return our result of all bytes written
@ -991,22 +986,14 @@ qDebug() << "STOP REASON.... if (params.includeColor && childBytesWritten == 2).
// otherwise... if we didn't write any child bytes, then pretend like we also didn't write our octal code
bytesWritten = 0;
//params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
qDebug() << "STOP REASON.... childBytesWritten == 0?????? params.stopReason=" << params.getStopReason();
}
if (bytesWritten == 0) {
qDebug() << "Octree::encodeTreeBitstream()... calling packetData->discardSubTree()....";
qDebug() << " bytesWritten == 0";
qDebug() << " params.stopReason=" << params.getStopReason();
qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedBytes();
packetData->discardSubTree();
} else {
packetData->endSubTree();
}
if (bytesWritten > 0) {
qDebug() << "encodeTreeBitstream() ----- bytesWritten=" << bytesWritten;
}
return bytesWritten;
}
@ -1016,11 +1003,6 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
const ViewFrustum::location& parentLocationThisView) const {
qDebug() << "ENTERING Octree::encodeTreeBitstreamRecursion()...";
qDebug() << " params.stopReason=" << params.getStopReason();
qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedBytes();
// The append state of this level/element.
OctreeElement::AppendState elementAppendState = OctreeElement::COMPLETED; // assume the best
@ -1186,23 +1168,12 @@ qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedByte
// 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) {
qDebug() << "Octree::encodeTreeBitstream() AFTER attempt to reserve bytes for bitmasks....";
qDebug() << "attempt to reserve bytes for bitmasks failed... ";
qDebug() << " discarding level";
qDebug() << " returning EncodeBitstreamParams::DIDNT_FIT...";
qDebug() << " insert our element back in bag, since if we came here, we need to be encoded, but we were removed by the caller...";
packetData->discardLevel(thisLevelKey);
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
bag.insert(element);
qDebug() << " bag.isEmpty()=" << bag.isEmpty();
return bytesAtThisLevel;
}
qDebug() << "after reserving bytes for bitmasks...";
qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedBytes();
int inViewCount = 0;
int inViewNotLeafCount = 0;
int inViewWithColorCount = 0;
@ -1387,13 +1358,9 @@ qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedByte
// but we may come back later and update the bits that are actually included
packetData->releaseReservedBytes(sizeof(childrenDataBits));
continueThisLevel = packetData->appendBitMask(childrenDataBits);
qDebug() << " packetData->appendBitMask(childrenDataBits) line:" << __LINE__;
qDebug() << " continueThisLevel=" << continueThisLevel;
// we know the last thing we wrote to the packet was our childrenDataBits. Let's remember where that was!
int childDataBitsPlaceHolder = packetData->getUncompressedByteOffset(sizeof(childrenDataBits));
qDebug() << " childDataBitsPlaceHolder=" << childDataBitsPlaceHolder << "line:" << __LINE__;
unsigned char actualChildrenDataBits = 0;
if (continueThisLevel) {
@ -1403,11 +1370,6 @@ qDebug() << " childDataBitsPlaceHolder=" << childDataBitsPlaceHolder << "line
}
}
qDebug() << "--- BEFORE CHILD LOOP --- line:" << __LINE__;
qDebug() << " packetData->getUncompressedSize()=" << packetData->getUncompressedSize() << "line:" << __LINE__;
qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedBytes();
// write the child element data...
if (continueThisLevel && params.includeColor) {
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
@ -1427,17 +1389,8 @@ qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedByte
// Make our local buffer large enough to handle writing at this level in case we need to.
LevelDetails childDataLevelKey = packetData->startLevel();
qDebug() << "--- BEFORE childElement->appendElementData() --- line:" << __LINE__;
qDebug() << " packetData->getUncompressedSize()=" << packetData->getUncompressedSize() << "line:" << __LINE__;
qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedBytes();
OctreeElement::AppendState childAppendState = childElement->appendElementData(packetData, params);
qDebug() << "--- AFTER childElement->appendElementData() --- line:" << __LINE__;
qDebug() << " packetData->getUncompressedSize()=" << packetData->getUncompressedSize() << "line:" << __LINE__;
qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedBytes();
// Continue this level so long as some part of this child element was appended.
// TODO: consider if we want to also keep going in the child append state was NONE... to do this
// we'd need to make sure the appendElementData didn't accidentally add bad partial data, we'd
@ -1451,44 +1404,22 @@ qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedByte
// this child data
if (childFit) {
actualChildrenDataBits += (1 << (7 - i));
qDebug() << " ----------- child DID (partially or fully) fit ------";
qDebug() << " packetData->endLevel(childDataLevelKey)... line:" << __LINE__;
continueThisLevel = packetData->endLevel(childDataLevelKey);
} else {
qDebug() << " ----------- child didn't fit ------";
qDebug() << " packetData->discardLevel(childDataLevelKey)... line:" << __LINE__;
packetData->discardLevel(childDataLevelKey);
qDebug() << " since child data didn't fit, this element (not the child) is a partial element....";
elementAppendState = OctreeElement::PARTIAL;
qDebug() << " also set params.stopReason = EncodeBitstreamParams::DIDNT_FIT";
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
}
qDebug() << "Octree::encodeTreeBitstreamRecursion()...";
qDebug() << " called childElement->appendElementData()";
qDebug() << " continueThisLevel=" << continueThisLevel;
qDebug() << " childAppendState=" << childAppendState;
// If this child was partially appended, then consider this element to be partially appended
if (childAppendState == OctreeElement::PARTIAL) {
elementAppendState = OctreeElement::PARTIAL;
qDebug() << " childAppendState == OctreeElement::PARTIAL ... so elementAppendState = OctreeElement::PARTIAL";
qDebug() << " also set params.stopReason = EncodeBitstreamParams::DIDNT_FIT";
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
}
int bytesAfterChild = packetData->getUncompressedSize();
qDebug() << " bytes from this child -- (bytesAfterChild - bytesBeforeChild) -- =" << (bytesAfterChild - bytesBeforeChild) << "line:" << __LINE__;
qDebug() << " bytesAfterChild=" << bytesAfterChild << "line:" << __LINE__;
//if (!continueThisLevel) {
//qDebug() << " BREAKING!!!";
//break; // no point in continuing
//}
bytesAtThisLevel += (bytesAfterChild - bytesBeforeChild); // keep track of byte count for this child
qDebug() << " bytesAtThisLevel=" << bytesAtThisLevel << "line:" << __LINE__;
// don't need to check childElement here, because we can't get here with no childElement
if (params.stats && (childAppendState != OctreeElement::NONE)) {
@ -1499,19 +1430,9 @@ qDebug() << " bytesAtThisLevel=" << bytesAtThisLevel << "line:" << __LINE__;
}
}
qDebug() << "--- AFTER CHILD LOOP --- line:" << __LINE__;
qDebug() << " childrenDataBits=" << childrenDataBits << "line:" << __LINE__;
qDebug() << " actualChildrenDataBits=" << actualChildrenDataBits << "line:" << __LINE__;
qDebug() << " continueThisLevel=" << continueThisLevel << "line:" << __LINE__;
qDebug() << " bytesAtThisLevel=" << bytesAtThisLevel << "line:" << __LINE__;
qDebug() << " packetData->getUncompressedSize()=" << packetData->getUncompressedSize() << "line:" << __LINE__;
if (actualChildrenDataBits != childrenDataBits) {
qDebug() << "--------- repair the child data mask ------------- line:" << __LINE__;
// repair the child data mask
continueThisLevel = packetData->updatePriorBitMask(childDataBitsPlaceHolder, actualChildrenDataBits);
qDebug() << " packetData->updatePriorBitMask() line:" << __LINE__;
qDebug() << " continueThisLevel=" << continueThisLevel;
}
// if the caller wants to include childExistsBits, then include them even if not in view, put them before the
@ -1519,8 +1440,6 @@ qDebug() << " packetData->getUncompressedSize()=" << packetData->getUncompres
if (continueThisLevel && params.includeExistsBits) {
packetData->releaseReservedBytes(sizeof(childrenExistInTreeBits));
continueThisLevel = packetData->appendBitMask(childrenExistInTreeBits);
qDebug() << " packetData->appendBitMask(childrenExistInTreeBits) line:" << __LINE__;
qDebug() << " continueThisLevel=" << continueThisLevel;
if (continueThisLevel) {
bytesAtThisLevel += sizeof(childrenExistInTreeBits); // keep track of byte count
if (params.stats) {
@ -1533,8 +1452,6 @@ qDebug() << " continueThisLevel=" << continueThisLevel;
if (continueThisLevel) {
packetData->releaseReservedBytes(sizeof(childrenExistInPacketBits));
continueThisLevel = packetData->appendBitMask(childrenExistInPacketBits);
qDebug() << " packetData->appendBitMask(childrenExistInPacketBits) line:" << __LINE__;
qDebug() << " continueThisLevel=" << continueThisLevel;
if (continueThisLevel) {
bytesAtThisLevel += sizeof(childrenExistInPacketBits); // keep track of byte count
if (params.stats) {
@ -1546,11 +1463,6 @@ qDebug() << " continueThisLevel=" << continueThisLevel;
// We only need to keep digging, if there is at least one child that is inView, and not a leaf.
keepDiggingDeeper = (inViewNotLeafCount > 0);
qDebug() << " --- ABOUT TO DIG DEEPER --- line:" << __LINE__;
qDebug() << " continueThisLevel=" << continueThisLevel;
qDebug() << " packetData->getUncompressedSize()=" << packetData->getUncompressedSize() << "line:" << __LINE__;
qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedBytes();
if (continueThisLevel && keepDiggingDeeper) {
// at this point, we need to iterate the children who are in view, even if not colored
@ -1603,26 +1515,11 @@ qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedByte
// called databits), then we wouldn't send the children. So those types of Octree's should tell us to keep
// recursing, by returning TRUE in recurseChildrenWithData().
qDebug() << "--- BEFORE encodeTreeBitstreamRecursion(childElement) --- line:" << __LINE__;
qDebug() << " packetData->getUncompressedSize()=" << packetData->getUncompressedSize() << "line:" << __LINE__;
qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedBytes();
qDebug() << " recurseChildrenWithData()=" << recurseChildrenWithData();
qDebug() << " params.viewFrustum=" << params.viewFrustum;
qDebug() << " oneAtBit(childrenDataBits, originalIndex)=" << oneAtBit(childrenDataBits, originalIndex);
if (recurseChildrenWithData() || !params.viewFrustum || !oneAtBit(childrenDataBits, originalIndex)) {
qDebug() << " CALLING RECURSION....";
childTreeBytesOut = encodeTreeBitstreamRecursion(childElement, packetData, bag, params,
thisLevel, nodeLocationThisView);
}
qDebug() << "--- AFTER encodeTreeBitstreamRecursion(childElement) --- line:" << __LINE__;
qDebug() << " packetData->getUncompressedSize()=" << packetData->getUncompressedSize() << "line:" << __LINE__;
qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedBytes();
// remember this for reshuffling
recursiveSliceSizes[originalIndex] = childTreeBytesOut;
allSlicesSize += childTreeBytesOut;
@ -1648,16 +1545,13 @@ qDebug() << " packetData->getReservedBytes()=" << packetData->getReservedByte
// TODO: this might be wrong for non-voxel cases... we might want to add a virtual function
// to override this case... can it happen with entities? and if it happens is is correct to
// remove it????
qDebug() << " >>>>>>>>>>> SPECIAL CASE FOR EMPTY TREES <<<<<<<<<<<<<< line:" << __LINE__;
qDebug() << " params.includeColor=" << params.includeColor;
qDebug() << " params.includeExistsBits=" << params.includeExistsBits;
qDebug() << " childTreeBytesOut=" << childTreeBytesOut;
qDebug() << " >>>>>>>>>>> SPECIAL CASE FOR EMPTY TREES <<<<<<<<<<<<<< line:" << __LINE__;
qDebug() << " params.includeColor=" << params.includeColor;
qDebug() << " params.includeExistsBits=" << params.includeExistsBits;
qDebug() << " childTreeBytesOut=" << childTreeBytesOut;
childTreeBytesOut = 0; // this is the degenerate case of a tree with no colors and no child trees
qDebug() << " SETTING.... childTreeBytesOut=" << childTreeBytesOut;
}
// We used to try to collapse trees that didn't contain any data, but this does appear to create a problem
// in detecting element deletion. So, I've commented this out but left it in here as a warning to anyone else
@ -1674,16 +1568,10 @@ qDebug() << " SETTING.... childTreeBytesOut=" << childTreeBytesOut;
if (childTreeBytesOut == 0) {
// remove this child's bit...
qDebug() << " AFTER CHILD TREE RECURSION --- removing child bits --- line:" << __LINE__;
qDebug() << " OLD childrenExistInPacketBits=" << childrenExistInPacketBits;
childrenExistInPacketBits -= (1 << (7 - originalIndex));
qDebug() << " NEW childrenExistInPacketBits=" << childrenExistInPacketBits;
// repair the child exists mask
continueThisLevel = packetData->updatePriorBitMask(childExistsPlaceHolder, childrenExistInPacketBits);
qDebug() << " packetData->updatePriorBitMask(childExistsPlaceHolder, childrenExistInPacketBits) line:" << __LINE__;
qDebug() << " continueThisLevel=" << continueThisLevel;
// If this is the last of the child exists bits, then we're actually be rolling out the entire tree
if (params.stats && childrenExistInPacketBits == 0) {
@ -1691,10 +1579,10 @@ qDebug() << " continueThisLevel=" << continueThisLevel;
}
if (!continueThisLevel) {
qDebug() << " WARNING ************************************************* line:" << __LINE__;
qDebug() << " breaking the child recursion loop with continueThisLevel=false!!!";
qDebug() << " AFTER attempting to updatePriorBitMask() for empty sub tree....";
qDebug() << " IS THIS ACCEPTABLE!!!!";
qDebug() << " WARNING ************************************************* line:" << __LINE__;
qDebug() << " breaking the child recursion loop with continueThisLevel=false!!!";
qDebug() << " AFTER attempting to updatePriorBitMask() for empty sub tree....";
qDebug() << " IS THIS ACCEPTABLE!!!!";
break; // can't continue...
}
@ -1724,8 +1612,6 @@ qDebug() << " IS THIS ACCEPTABLE!!!!";
// now that all slices are back in the correct order, copy them to the correct output buffer
continueThisLevel = packetData->updatePriorBytes(firstRecursiveSliceOffset, &tempReshuffleBuffer[0], allSlicesSize);
qDebug() << " packetData->updatePriorBytes() line:" << __LINE__;
qDebug() << " continueThisLevel=" << continueThisLevel;
}
} // end keepDiggingDeeper
@ -1733,35 +1619,23 @@ qDebug() << " continueThisLevel=" << continueThisLevel;
// 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;
LevelDetails rootDataLevelKey = packetData->startLevel();
OctreeElement::AppendState rootAppendState = element->appendElementData(packetData, params);
qDebug() << " rootAppendState=" << rootAppendState;
bool partOfRootFit = (rootAppendState != OctreeElement::NONE);
bool allOfRootFit = (rootAppendState == OctreeElement::COMPLETED);
qDebug() << " partOfRootFit=" << partOfRootFit;
qDebug() << " allOfRootFit=" << allOfRootFit;
if (partOfRootFit) {
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__;
packetData->discardLevel(rootDataLevelKey);
}
if (!allOfRootFit) {
qDebug() << " ----------- SINCE NOT ALL OF root fit ------";
qDebug() << " elementAppendState = OctreeElement::PARTIAL... line:" << __LINE__;
qDebug() << " params.stopReason = EncodeBitstreamParams::DIDNT_FIT... line:" << __LINE__;
elementAppendState = OctreeElement::PARTIAL;
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
}
@ -1769,12 +1643,8 @@ qDebug() << " allOfRootFit=" << allOfRootFit;
// do we really ever NOT want to continue this level???
//continueThisLevel = (rootAppendState == OctreeElement::COMPLETED);
qDebug() << " continueThisLevel=" << continueThisLevel;
int bytesAfterChild = packetData->getUncompressedSize();
qDebug() << " bytesAfterChild=" << bytesAfterChild;
if (continueThisLevel) {
bytesAtThisLevel += (bytesAfterChild - bytesBeforeChild); // keep track of byte count for this child
@ -1787,10 +1657,8 @@ qDebug() << " bytesAfterChild=" << bytesAfterChild;
// if we were unable to fit this level in our packet, then rewind and add it to the element bag for
// sending later...
if (continueThisLevel) {
qDebug() << " line:" << __LINE__ << "packetData->endLevel()...";
continueThisLevel = packetData->endLevel(thisLevelKey);
} else {
qDebug() << " line:" << __LINE__ << "packetData->discardLevel()...";
packetData->discardLevel(thisLevelKey);
}
@ -1807,9 +1675,6 @@ qDebug() << " line:" << __LINE__ << "packetData->discardLevel()...";
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
bytesAtThisLevel = 0; // didn't fit
qDebug() << " line:" << __LINE__ << "params.stopReason = EncodeBitstreamParams::DIDNT_FIT.... bytesAtThisLevel=0";
} else {
// assuming we made it here with continueThisLevel == true, we STILL might want
@ -1818,14 +1683,10 @@ qDebug() << " line:" << __LINE__ << "params.stopReason = EncodeBitstreamParam
// and assume that the appendElementData() has stored any required state data
// in the params extraEncodeData
if (elementAppendState == OctreeElement::PARTIAL) {
qDebug() << " line:" << __LINE__ << "elementAppendState == OctreeElement::PARTIAL.... bag.insert(element);";
bag.insert(element);
}
}
qDebug() << "LEAVING... line:" << __LINE__;
qDebug() << " bytesAtThisLevel=" << bytesAtThisLevel;
qDebug() << " params.stopReason=" << params.getStopReason();
return bytesAtThisLevel;
}