Blend when setting.

This commit is contained in:
Andrzej Kapolka 2014-04-03 23:51:49 -07:00
parent d706e23012
commit dfaa98cc34
2 changed files with 7 additions and 9 deletions

View file

@ -803,7 +803,7 @@ void Voxelizer::voxelize(const glm::vec3& center) {
qDebug() << "Finished voxelizing " << center.x << center.y << center.z;
MetavoxelEditMessage edit = { QVariant::fromValue(SetDataEdit(
center - glm::vec3(_size, _size, _size) * 0.5f, data, false)) };
center - glm::vec3(_size, _size, _size) * 0.5f, data, true)) };
QMetaObject::invokeMethod(Application::getInstance()->getMetavoxels(), "applyEdit",
Q_ARG(const MetavoxelEditMessage&, edit), Q_ARG(bool, true));
}

View file

@ -355,14 +355,12 @@ static void setNode(const AttributeValue& value, MetavoxelNode*& node, Metavoxel
}
OwnedAttributeValue oldValue = node->getAttributeValue(value.getAttribute());
node->blendAttributeValues(other->getAttributeValue(value.getAttribute()), oldValue);
if (other->isLeaf()) {
node->clearChildren(value.getAttribute());
return;
}
for (int i = 0; i < MetavoxelNode::CHILD_COUNT; i++) {
MetavoxelNode* child = node->getChild(i);
setNode(oldValue, child, other->getChild(i), true);
node->setChild(i, child);
if (!other->isLeaf()) {
for (int i = 0; i < MetavoxelNode::CHILD_COUNT; i++) {
MetavoxelNode* child = node->getChild(i);
setNode(oldValue, child, other->getChild(i), true);
node->setChild(i, child);
}
}
node->mergeChildren(value.getAttribute());
}