more work on fixing voxels

This commit is contained in:
ZappoMan 2014-09-05 11:51:17 -07:00
parent f234dbf9a1
commit a25790b350
4 changed files with 33 additions and 2 deletions

View file

@ -67,7 +67,8 @@ public:
virtual int minimumRequiredRootDataBytes() const { return sizeof(uint16_t); }
virtual bool suppressEmptySubtrees() const { return false; }
virtual void releaseSceneEncodeData(OctreeElementExtraEncodeData* extraEncodeData) const;
virtual void mustIncludeAllChildData() const { return false; }
virtual bool versionHasSVOfileBreaks(PacketVersion thisVersion) const
{ return thisVersion >= VERSION_ENTITIES_HAS_FILE_BREAKS; }

View file

@ -1050,6 +1050,10 @@ int Octree::encodeTreeBitstream(OctreeElement* element,
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
return bytesWritten;
}
qDebug() << "WROTE octalcode for element " << element->getAACube();
bytesWritten += codeLength; // keep track of byte count
@ -1468,6 +1472,8 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
packetData->releaseReservedBytes(sizeof(childrenDataBits));
continueThisLevel = packetData->appendBitMask(childrenDataBits);
qDebug() << "WROTE child data bits for element " << element->getAACube();
int childDataBitsPlaceHolder = packetData->getUncompressedByteOffset(sizeof(childrenDataBits));
unsigned char actualChildrenDataBits = 0;
@ -1556,6 +1562,13 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
// repair the child data mask
continueThisLevel = packetData->updatePriorBitMask(childDataBitsPlaceHolder, actualChildrenDataBits);
qDebug() << "UPDATED child data bits for element " << element->getAACube()
<< " was:" << childrenDataBits
<< " now:" << actualChildrenDataBits
<< " params.stopReason:" << params.getStopReason()
<< " elementAppendState:" << elementAppendState
<< " bytesAtThisLevel:" << bytesAtThisLevel;
if (!continueThisLevel) {
qDebug() << "WARNING UNEXPECTED CASE: Failed to update childDataBitsPlaceHolder";
qDebug() << "This is not expected!!!! -- continueThisLevel=FALSE....";
@ -1583,6 +1596,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
packetData->releaseReservedBytes(sizeof(childrenExistInPacketBits));
continueThisLevel = packetData->appendBitMask(childrenExistInPacketBits);
if (continueThisLevel) {
//qDebug() << "WROTE child exists in packet bits for element " << element->getAACube();
bytesAtThisLevel += sizeof(childrenExistInPacketBits); // keep track of byte count
if (params.stats) {
params.stats->existsInPacketBitsWritten();
@ -1654,8 +1668,10 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
// Allow the datatype a chance to determine if it really wants to recurse this tree. Usually this
// will be true. But if the tree has already been encoded, we will skip this.
if (element->shouldRecurseChildTree(originalIndex, params)) {
//qDebug() << "START RECURSION child element " << childElement->getAACube();
childTreeBytesOut = encodeTreeBitstreamRecursion(childElement, packetData, bag, params,
thisLevel, nodeLocationThisView);
//qDebug() << "END RECURSION child element " << childElement->getAACube();
} else {
childTreeBytesOut = 0;
}

View file

@ -238,6 +238,7 @@ public:
virtual int minimumRequiredRootDataBytes() const { return 0; }
virtual bool suppressEmptySubtrees() const { return true; }
virtual void releaseSceneEncodeData(OctreeElementExtraEncodeData* extraEncodeData) const { }
virtual void mustIncludeAllChildData() const { return true; }
/// some versions of the SVO file will include breaks with buffer lengths between each buffer chunk in the SVO
/// file. If the Octree subclass expects this for this particular version of the file, it should override this

View file

@ -66,7 +66,20 @@ void VoxelTreeElement::splitChildren() {
}
OctreeElement::AppendState VoxelTreeElement::appendElementData(OctreePacketData* packetData, EncodeBitstreamParams& params) const {
return packetData->appendColor(getColor()) ? OctreeElement::COMPLETED : OctreeElement::NONE;
OctreeElement::AppendState appendState = packetData->appendColor(getColor()) ? OctreeElement::COMPLETED : OctreeElement::NONE;
/*
if (appendState == OctreeElement::COMPLETED) {
qDebug() << "WROTE color for element " << getAACube() << " color: "
<< getColor()[0] << ", "
<< getColor()[1] << ", "
<< getColor()[2];
} else {
qDebug() << "COULD NOT WRITE color for element " << getAACube();
}
*/
return appendState;
}