Start out with gray, fix coloring smaller portions by (similar to deleting)

breaking up leaf nodes into their components.
This commit is contained in:
Andrzej Kapolka 2013-05-14 14:23:08 -07:00
parent 4eced82cf4
commit ebc612f87a
2 changed files with 10 additions and 2 deletions

View file

@ -1093,7 +1093,9 @@ void Application::initMenu() {
(_logOn = toolsMenu->addAction("Log"))->setCheckable(true); (_logOn = toolsMenu->addAction("Log"))->setCheckable(true);
_logOn->setChecked(true); _logOn->setChecked(true);
_voxelPaintColor = toolsMenu->addAction("Voxel Paint Color", this, SLOT(chooseVoxelPaintColor()), Qt::Key_7); _voxelPaintColor = toolsMenu->addAction("Voxel Paint Color", this, SLOT(chooseVoxelPaintColor()), Qt::Key_7);
_voxelPaintColor->setIcon(createSwatchIcon(QColor())); QColor paintColor(128, 128, 128);
_voxelPaintColor->setData(paintColor);
_voxelPaintColor->setIcon(createSwatchIcon(paintColor));
QMenu* frustumMenu = menuBar->addMenu("Frustum"); QMenu* frustumMenu = menuBar->addMenu("Frustum");
(_frustumOn = frustumMenu->addAction("Display Frustum"))->setCheckable(true); (_frustumOn = frustumMenu->addAction("Display Frustum"))->setCheckable(true);

View file

@ -103,7 +103,13 @@ VoxelNode* VoxelTree::createMissingNode(VoxelNode* lastParentNode, unsigned char
int indexOfNewChild = branchIndexWithDescendant(lastParentNode->getOctalCode(), codeToReach); int indexOfNewChild = branchIndexWithDescendant(lastParentNode->getOctalCode(), codeToReach);
// we could be coming down a branch that was already created, so don't stomp on it. // we could be coming down a branch that was already created, so don't stomp on it.
if (!lastParentNode->getChildAtIndex(indexOfNewChild)) { if (lastParentNode->isLeaf() && lastParentNode->isColored()) {
// for colored leaves, we must add *all* the children
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
lastParentNode->addChildAtIndex(i);
lastParentNode->getChildAtIndex(i)->setColor(lastParentNode->getColor());
}
} else if (!lastParentNode->getChildAtIndex(indexOfNewChild)) {
lastParentNode->addChildAtIndex(indexOfNewChild); lastParentNode->addChildAtIndex(indexOfNewChild);
} }