From c1668553fd46dfc24b57c4e123ee0ab13a902f3b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 15 Jun 2015 11:22:07 -0700 Subject: [PATCH 1/3] make sure that the root node always appends an entity count (even if it's zero). This keeps the unreasonably-deep-recursion warnings from happening --- libraries/entities/src/EntityTreeElement.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index 5a59636fe7..5ccac49728 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -350,6 +350,8 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData } } else { // we we couldn't add the entity count, then we couldn't add anything for this element and we're in a NONE state + if (this == _myTree->getRoot()) + qDebug() << "OctreeElement::NONE 0";; appendElementState = OctreeElement::NONE; } @@ -392,17 +394,20 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData // If we wrote fewer entities than we expected, update the number of entities in our packet bool successUpdateEntityCount = true; - if (!noEntitiesFit && numberOfEntities != actualNumberOfEntities) { + if (numberOfEntities != actualNumberOfEntities) { successUpdateEntityCount = packetData->updatePriorBytes(numberOfEntitiesOffset, (const unsigned char*)&actualNumberOfEntities, sizeof(actualNumberOfEntities)); } // If we weren't able to update our entity count, or we couldn't fit any entities, then // we should discard our element and return a result of NONE - if (!successUpdateEntityCount || noEntitiesFit) { + if (!successUpdateEntityCount) { packetData->discardLevel(elementLevel); appendElementState = OctreeElement::NONE; } else { + if (noEntitiesFit) { + appendElementState = OctreeElement::PARTIAL; + } packetData->endLevel(elementLevel); } return appendElementState; From 5f3b9027986b6e6de6ed43468deced53826abc51 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 15 Jun 2015 11:24:29 -0700 Subject: [PATCH 2/3] remove debugging print --- libraries/entities/src/EntityTreeElement.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index 5ccac49728..80333a44e5 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -350,8 +350,6 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData } } else { // we we couldn't add the entity count, then we couldn't add anything for this element and we're in a NONE state - if (this == _myTree->getRoot()) - qDebug() << "OctreeElement::NONE 0";; appendElementState = OctreeElement::NONE; } From 1c3b48446659703005cc0de28634eae752ee1895 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 15 Jun 2015 12:48:51 -0700 Subject: [PATCH 3/3] fix detailed ray picking against models --- libraries/render-utils/src/Model.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 145f352658..71178070c6 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1761,7 +1761,7 @@ void Model::setupBatchTransform(gpu::Batch& batch, RenderArgs* args) { } AABox Model::getPartBounds(int meshIndex, int partIndex) { - if (!_calculatedMeshPartBoxesValid) { + if (!_calculatedMeshPartBoxesValid || !_calculatedMeshBoxesValid) { recalculateMeshBoxes(true); } @@ -1802,7 +1802,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran // we always need these properly calculated before we can render, this will likely already have been done // since the engine will call our getPartBounds() before rendering us. - if (!_calculatedMeshPartBoxesValid) { + if (!_calculatedMeshPartBoxesValid || !_calculatedMeshBoxesValid) { recalculateMeshBoxes(true); } auto textureCache = DependencyManager::get();