From 9d5510008797e288ffa4f79620a1fc2059e2b1de Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 15 Jul 2014 09:31:23 -0700 Subject: [PATCH] Merge (but don't clear redundant nodes) after reading subdivisions. --- libraries/metavoxels/src/MetavoxelData.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/metavoxels/src/MetavoxelData.cpp b/libraries/metavoxels/src/MetavoxelData.cpp index 72d5392a39..fdce323708 100644 --- a/libraries/metavoxels/src/MetavoxelData.cpp +++ b/libraries/metavoxels/src/MetavoxelData.cpp @@ -767,7 +767,7 @@ void MetavoxelNode::mergeChildren(const AttributePointer& attribute, bool postRe childValues[i] = _children[i]->_attributeValue; allLeaves &= _children[i]->isLeaf(); } - if (attribute->merge(_attributeValue, childValues, postRead) && allLeaves) { + if (attribute->merge(_attributeValue, childValues, postRead) && allLeaves && !postRead) { clearChildren(attribute); } } @@ -917,6 +917,7 @@ bool MetavoxelNode::readSubdivision(MetavoxelStreamState& state) { _children[i] = new MetavoxelNode(state.attribute); _children[i]->read(nextState); } + mergeChildren(state.attribute, true); return true; } else { @@ -932,6 +933,9 @@ bool MetavoxelNode::readSubdivision(MetavoxelStreamState& state) { } } } + if (changed) { + mergeChildren(state.attribute, true); + } return changed; } }