handle some models don't fit better

This commit is contained in:
ZappoMan 2014-06-11 13:25:16 -07:00
parent 6389fea320
commit 12d30e9d62
2 changed files with 7 additions and 3 deletions

View file

@ -148,15 +148,20 @@ OctreeElement::AppendState ModelTreeElement::appendElementData(OctreePacketData*
delete elementExtraEncodeData;
}
}
// Determine if no models at all were able to fit
bool noModelsFit = (numberOfModels > 0 && actualNumberOfModels == 0);
// If we wrote fewer models than we expected, update the number of models in our packet
bool successUpdateModelCount = true;
if (numberOfModels != actualNumberOfModels) {
if (!noModelsFit && numberOfModels != actualNumberOfModels) {
successUpdateModelCount = packetData->updatePriorBytes(numberOfModelsOffset,
(const unsigned char*)&actualNumberOfModels, sizeof(actualNumberOfModels));
}
if (!successUpdateModelCount) {
// If we weren't able to update our model count, or we couldn't fit any models, then
// we should discard our element and return a result of NONE
if (!successUpdateModelCount || noModelsFit) {
packetData->discardLevel(elementLevel);
appendElementState = OctreeElement::NONE;
} else {

View file

@ -1598,7 +1598,6 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
// and assume that the appendElementData() has stored any required state data
// in the params extraEncodeData
if (elementAppendState == OctreeElement::PARTIAL) {
qDebug() << "elementAppendState == OctreeElement::PARTIAL... bag.insert(element).....";
bag.insert(element);
}
}