Merge (but don't clear redundant nodes) after reading subdivisions.

This commit is contained in:
Andrzej Kapolka 2014-07-15 09:31:23 -07:00
parent 60e8c12d4b
commit 9d55100087

View file

@ -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;
}
}