mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 06:53:46 +02:00
Merge branch 'master' of https://github.com/worklist/hifi
This commit is contained in:
commit
62a97f23bf
3 changed files with 41 additions and 7 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <ifaddrs.h>
|
||||
#endif
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGLWidget>
|
||||
#include <QKeyEvent>
|
||||
|
@ -213,6 +214,7 @@ Application::Application(int& argc, char** argv) :
|
|||
QRect available = desktop()->availableGeometry();
|
||||
_window->resize(available.size());
|
||||
_window->setVisible(true);
|
||||
_glWidget->setFocusPolicy(Qt::StrongFocus);
|
||||
_glWidget->setFocus();
|
||||
|
||||
// enable mouse tracking; otherwise, we only get drag events
|
||||
|
@ -840,9 +842,10 @@ void Application::idle() {
|
|||
}
|
||||
|
||||
if (_mouseMode == COLOR_VOXEL_MODE) {
|
||||
_mouseVoxel.red = 0;
|
||||
_mouseVoxel.green = 255;
|
||||
_mouseVoxel.blue = 0;
|
||||
QColor paintColor = _voxelPaintColor->data().value<QColor>();
|
||||
_mouseVoxel.red = paintColor.red();
|
||||
_mouseVoxel.green = paintColor.green();
|
||||
_mouseVoxel.blue = paintColor.blue();
|
||||
|
||||
} else if (_mouseMode == DELETE_VOXEL_MODE) {
|
||||
// red indicates deletion
|
||||
|
@ -1030,9 +1033,27 @@ void Application::setWantsResIn(bool wantsResIn) {
|
|||
_myAvatar.setWantResIn(wantsResIn);
|
||||
}
|
||||
|
||||
|
||||
void Application::setWantsDelta(bool wantsDelta) {
|
||||
_myAvatar.setWantDelta(wantsDelta);
|
||||
}
|
||||
|
||||
static QIcon createSwatchIcon(const QColor& color) {
|
||||
QPixmap map(16, 16);
|
||||
map.fill(color);
|
||||
return QIcon(map);
|
||||
}
|
||||
|
||||
void Application::chooseVoxelPaintColor() {
|
||||
QColor selected = QColorDialog::getColor(_voxelPaintColor->data().value<QColor>(), _glWidget, "Voxel Paint Color");
|
||||
if (selected.isValid()) {
|
||||
_voxelPaintColor->setData(selected);
|
||||
_voxelPaintColor->setIcon(createSwatchIcon(selected));
|
||||
}
|
||||
|
||||
// restore the main window's active state
|
||||
_window->activateWindow();
|
||||
}
|
||||
|
||||
void Application::initMenu() {
|
||||
QMenuBar* menuBar = new QMenuBar();
|
||||
|
@ -1069,6 +1090,10 @@ void Application::initMenu() {
|
|||
_renderStatsOn->setShortcut(Qt::Key_Slash);
|
||||
(_logOn = toolsMenu->addAction("Log"))->setCheckable(true);
|
||||
_logOn->setChecked(true);
|
||||
_voxelPaintColor = toolsMenu->addAction("Voxel Paint Color", this, SLOT(chooseVoxelPaintColor()), Qt::Key_7);
|
||||
QColor paintColor(128, 128, 128);
|
||||
_voxelPaintColor->setData(paintColor);
|
||||
_voxelPaintColor->setIcon(createSwatchIcon(paintColor));
|
||||
toolsMenu->addAction("Create Voxel is Destructive", this, SLOT(setDestructivePaint(bool)))->setCheckable(true);
|
||||
|
||||
QMenu* frustumMenu = menuBar->addMenu("Frustum");
|
||||
|
@ -1841,9 +1866,10 @@ void Application::addVoxelInFrontOfAvatar() {
|
|||
detail.x = detail.s * floor(position.x / detail.s);
|
||||
detail.y = detail.s * floor(position.y / detail.s);
|
||||
detail.z = detail.s * floor(position.z / detail.s);
|
||||
detail.red = 128;
|
||||
detail.green = 128;
|
||||
detail.blue = 128;
|
||||
QColor paintColor = _voxelPaintColor->data().value<QColor>();
|
||||
detail.red = paintColor.red();
|
||||
detail.green = paintColor.green();
|
||||
detail.blue = paintColor.blue();
|
||||
|
||||
PACKET_HEADER message = (_destructiveAddVoxel ? PACKET_HEADER_SET_VOXEL_DESTRUCTIVE : PACKET_HEADER_SET_VOXEL);
|
||||
sendVoxelEditMessage(message, detail);
|
||||
|
|
|
@ -89,6 +89,7 @@ private slots:
|
|||
void setWantsMonochrome(bool wantsMonochrome);
|
||||
void setWantsResIn(bool wantsResIn);
|
||||
void setWantsDelta(bool wantsDelta);
|
||||
void chooseVoxelPaintColor();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -135,6 +136,7 @@ private:
|
|||
QAction* _oculusOn; // Whether to configure the display for the Oculus Rift
|
||||
QAction* _renderStatsOn; // Whether to show onscreen text overlay with stats
|
||||
QAction* _logOn; // Whether to show on-screen log
|
||||
QAction* _voxelPaintColor; // The color with which to paint voxels
|
||||
QAction* _frustumOn; // Whether or not to display the debug view frustum
|
||||
QAction* _viewFrustumFromOffset; // Whether or not to offset the view of the frustum
|
||||
QAction* _cameraFrustum; // which frustum to look at
|
||||
|
|
|
@ -103,7 +103,13 @@ VoxelNode* VoxelTree::createMissingNode(VoxelNode* lastParentNode, unsigned char
|
|||
int indexOfNewChild = branchIndexWithDescendant(lastParentNode->getOctalCode(), codeToReach);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue