History

Merge branch 'master' of https://github.com/worklist/hifi into occlusion_culling

ZappoMan committed 13 years ago

Commit 4afda272 parents 78c62f2 790a48b28 files · +2236 −453Browse files

Showing the changes to interface/src/Application.cpp (1 of 28 files). Show all

Unified · Split

interface/src/Application.cpp+163−65
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <sstream>
99
1010 #include <stdlib.h>
11+#include <cmath>
1112
1213 #ifdef _WIN32
1314 #include "Syssocket.h"
@@ -63,6 +64,7 @@ · 49 unmodified lines
6364 #include "Util.h"
6465 #include "renderer/ProgramObject.h"
6566 #include "ui/TextRenderer.h"
67+#include "Swatch.h"
6668 #include "fvupdater.h"
6769
6870 using namespace std;
@@ -198,7 +200,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 129 unmodified lines
198200 _packetCount(0),
199201 _packetsPerSecond(0),
200202 _bytesPerSecond(0),
201− _bytesCount(0)
203+ _bytesCount(0),
204+ _swatch(NULL)
202205 {
203206 _applicationStartupTime = startup_time;
204207 _window->setWindowTitle("Interface");
@@ -274,7 +277,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 69 unmodified lines
274277 FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml");
275278 FvUpdater::sharedUpdater()->CheckForUpdatesSilent();
276279 #endif
277−
280+
278281 initMenu();
279282
280283 QRect available = desktop()->availableGeometry();
@@ -483,30 +486,41 @@ void Application::resizeGL(int width, int height) { · 202 unmodified lines
483486 glLoadIdentity();
484487 }
485488
486−void Application::broadcastToNodes(unsigned char* data, size_t bytes, const char type) {
489+void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_t dataBytes,
490+ const char* nodeTypes, int numNodeTypes) {
491+ Application* self = getInstance();
492+ for (int i = 0; i < numNodeTypes; ++i) {
487493
488− int n = NodeList::getInstance()->broadcastToNodes(data, bytes, &type, 1);
494+ // Intercept data to voxel server when voxels are disabled
495+ if (nodeTypes[i] == NODE_TYPE_VOXEL_SERVER && ! self->_renderVoxels->isChecked()) {
496+ continue;
497+ }
489498
490− BandwidthMeter::ChannelIndex channel;
491− switch (type) {
492− case NODE_TYPE_AGENT:
493− case NODE_TYPE_AVATAR_MIXER:
494− channel = BandwidthMeter::AVATARS;
495− break;
496− case NODE_TYPE_VOXEL_SERVER:
497− channel = BandwidthMeter::VOXELS;
498− break;
499− default:
500− return;
499+ // Perform the broadcast for one type
500+ int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(broadcastData, dataBytes, & nodeTypes[i], 1);
501+
502+ // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)
503+ BandwidthMeter::ChannelIndex channel;
504+ switch (nodeTypes[i]) {
505+ case NODE_TYPE_AGENT:
506+ case NODE_TYPE_AVATAR_MIXER:
507+ channel = BandwidthMeter::AVATARS;
508+ break;
509+ case NODE_TYPE_VOXEL_SERVER:
510+ channel = BandwidthMeter::VOXELS;
511+ break;
512+ default:
513+ continue;
514+ }
515+ self->_bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * dataBytes);
501516 }
502− getInstance()->_bandwidthMeter.outputStream(channel).updateValue(n * bytes);
503517 }
504518
505519 void Application::sendVoxelServerAddScene() {
506520 char message[100];
507521 sprintf(message,"%c%s",'Z',"add scene");
508522 int messageSize = strlen(message) + 1;
509− broadcastToNodes((unsigned char*)message, messageSize, NODE_TYPE_VOXEL_SERVER);
523+ controlledBroadcastToNodes((unsigned char*)message, messageSize, & NODE_TYPE_VOXEL_SERVER, 1);
510524 }
511525
512526 void Application::keyPressEvent(QKeyEvent* event) {
@@ -716,7 +730,16 @@ void Application::keyPressEvent(QKeyEvent* event) { · 203 unmodified lines
716730 deleteVoxelUnderCursor();
717731 }
718732 break;
719−
733+ case Qt::Key_1:
734+ case Qt::Key_2:
735+ case Qt::Key_3:
736+ case Qt::Key_4:
737+ case Qt::Key_5:
738+ case Qt::Key_6:
739+ case Qt::Key_7:
740+ case Qt::Key_8:
741+ _swatch.handleEvent(event->key(), _eyedropperMode->isChecked());
742+ break;
720743 default:
721744 event->ignore();
722745 break;
@@ -877,16 +900,16 @@ void Application::wheelEvent(QWheelEvent* event) { · 154 unmodified lines
877900 }
878901 }
879902
880−void sendPingPackets() {
903+void Application::sendPingPackets() {
881904
882905 char nodeTypesOfInterest[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER};
883906 long long currentTime = usecTimestampNow();
884− char pingPacket[1 + sizeof(currentTime)];
907+ unsigned char pingPacket[1 + sizeof(currentTime)];
885908 pingPacket[0] = PACKET_HEADER_PING;
886909
887910 memcpy(&pingPacket[1], &currentTime, sizeof(currentTime));
888− NodeList::getInstance()->broadcastToNodes((unsigned char*)pingPacket, 1 + sizeof(currentTime), nodeTypesOfInterest, 3);
889−
911+ getInstance()->controlledBroadcastToNodes(pingPacket, 1 + sizeof(currentTime),
912+ nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
890913 }
891914
892915 // Every second, check the frame rates and other stuff
@@ -944,14 +967,17 @@ void Application::idle() { · 51 unmodified lines
944967 // Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time we ran
945968
946969 if (diffclock(&_lastTimeIdle, &check) > IDLE_SIMULATE_MSECS) {
947− // We call processEvents() here because the idle timer takes priority over
948− // event handling in Qt, so when the framerate gets low events will pile up
949− // unless we handle them here.
950−
951− // NOTE - this is commented out for now - causing event processing issues reported by Philip and Ryan
952− // birarda - July 3rd
953970
954− // processEvents();
971+ // If we're using multi-touch look, immediately process any
972+ // touch events, and no other events.
973+ // This is necessary because id the idle() call takes longer than the
974+ // interval between idle() calls, the event loop never gets to run,
975+ // and touch events get delayed.
976+ if (_touchLook->isChecked()) {
977+ sendPostedEvents(NULL, QEvent::TouchBegin);
978+ sendPostedEvents(NULL, QEvent::TouchUpdate);
979+ sendPostedEvents(NULL, QEvent::TouchEnd);
980+ }
955981
956982 update(1.0f / _fps);
957983
@@ -987,7 +1013,7 @@ void Application::sendAvatarVoxelURLMessage(const QUrl& url) { · 29 unmodified lines
9871013 message.append((const char*)&ownerID, sizeof(ownerID));
9881014 message.append(url.toEncoded());
9891015
990− broadcastToNodes((unsigned char*)message.data(), message.size(), NODE_TYPE_AVATAR_MIXER);
1016+ controlledBroadcastToNodes((unsigned char*)message.data(), message.size(), & NODE_TYPE_AVATAR_MIXER, 1);
9911017 }
9921018
9931019 void Application::processAvatarVoxelURLMessage(unsigned char *packetData, size_t dataBytes) {
@@ -1224,7 +1250,7 @@ void Application::sendVoxelEditMessage(PACKET_HEADER header, VoxelDetail& detail · 230 unmodified lines
12241250 int sizeOut;
12251251
12261252 if (createVoxelEditMessage(header, 0, 1, &detail, bufferOut, sizeOut)){
1227− Application::broadcastToNodes(bufferOut, sizeOut, NODE_TYPE_VOXEL_SERVER);
1253+ Application::controlledBroadcastToNodes(bufferOut, sizeOut, & NODE_TYPE_VOXEL_SERVER, 1);
12281254 delete[] bufferOut;
12291255 }
12301256 }
@@ -1242,7 +1268,11 @@ void Application::decreaseVoxelSize() { · 11 unmodified lines
12421268 void Application::increaseVoxelSize() {
12431269 _mouseVoxelScale *= 2;
12441270 }
1245−
1271+
1272+void Application::resetSwatchColors() {
1273+ _swatch.reset();
1274+}
1275+
12461276 static QIcon createSwatchIcon(const QColor& color) {
12471277 QPixmap map(16, 16);
12481278 map.fill(color);
@@ -1305,7 +1335,7 @@ bool Application::sendVoxelsOperation(VoxelNode* node, int level, void* extraDat · 56 unmodified lines
13051335
13061336 // if we have room don't have room in the buffer, then send the previously generated message first
13071337 if (args->bufferInUse + codeAndColorLength > MAXIMUM_EDIT_VOXEL_MESSAGE_SIZE) {
1308− broadcastToNodes(args->messageBuffer, args->bufferInUse, NODE_TYPE_VOXEL_SERVER);
1338+ controlledBroadcastToNodes(args->messageBuffer, args->bufferInUse, & NODE_TYPE_VOXEL_SERVER, 1);
13091339 args->bufferInUse = sizeof(PACKET_HEADER_SET_VOXEL_DESTRUCTIVE) + sizeof(unsigned short int); // reset
13101340 }
13111341
@@ -1337,8 +1367,10 @@ void Application::exportVoxels() { · 25 unmodified lines
13371367
13381368 void Application::importVoxels() {
13391369 QString desktopLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
1340− QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Import Voxels"), desktopLocation,
1341− tr("Sparse Voxel Octree Files, Square PNG (*.svo *.png)"));
1370+ QString fileNameString = QFileDialog::getOpenFileName(
1371+ _glWidget, tr("Import Voxels"), desktopLocation,
1372+ tr("Sparse Voxel Octree Files, Square PNG, Schematic Files (*.svo *.png *.schematic)"));
1373+
13421374 QByteArray fileNameAscii = fileNameString.toAscii();
13431375 const char* fileName = fileNameAscii.data();
13441376
@@ -1359,8 +1391,10 @@ void Application::importVoxels() { · 14 unmodified lines
13591391 }
13601392
13611393 importVoxels.readFromSquareARGB32Pixels(pixels, pngImage.height());
1362− } else {
1394+ } else if (fileNameString.endsWith(".svo", Qt::CaseInsensitive)) {
13631395 importVoxels.readFromSVOFile(fileName);
1396+ } else {
1397+ importVoxels.readFromSchematicFile(fileName);
13641398 }
13651399
13661400 VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
@@ -1386,7 +1420,7 @@ void Application::importVoxels() { · 19 unmodified lines
13861420
13871421 // If we have voxels left in the packet, then send the packet
13881422 if (args.bufferInUse > (sizeof(PACKET_HEADER_SET_VOXEL_DESTRUCTIVE) + sizeof(unsigned short int))) {
1389− broadcastToNodes(args.messageBuffer, args.bufferInUse, NODE_TYPE_VOXEL_SERVER);
1423+ controlledBroadcastToNodes(args.messageBuffer, args.bufferInUse, & NODE_TYPE_VOXEL_SERVER, 1);
13901424 }
13911425
13921426 if (calculatedOctCode) {
@@ -1438,7 +1472,7 @@ void Application::pasteVoxels() { · 45 unmodified lines
14381472
14391473 // If we have voxels left in the packet, then send the packet
14401474 if (args.bufferInUse > (sizeof(PACKET_HEADER_SET_VOXEL_DESTRUCTIVE) + sizeof(unsigned short int))) {
1441− broadcastToNodes(args.messageBuffer, args.bufferInUse, NODE_TYPE_VOXEL_SERVER);
1475+ controlledBroadcastToNodes(args.messageBuffer, args.bufferInUse, & NODE_TYPE_VOXEL_SERVER, 1);
14421476 }
14431477
14441478 if (calculatedOctCode) {
@@ -1480,12 +1514,13 @@ void Application::initMenu() { · 35 unmodified lines
14801514 (_testPing = optionsMenu->addAction("Test Ping"))->setCheckable(true);
14811515 _testPing->setChecked(true);
14821516 (_fullScreenMode = optionsMenu->addAction("Fullscreen", this, SLOT(setFullscreen(bool)), Qt::Key_F))->setCheckable(true);
1483− optionsMenu->addAction("Webcam", &_webcam, SLOT(setEnabled(bool)))->setCheckable(true);
1517+ optionsMenu->addAction("Webcam", &_webcam, SLOT(setEnabled(bool)))->setCheckable(true);
1518+ optionsMenu->addAction("Go Home", this, SLOT(goHome()));
14841519
14851520 QMenu* renderMenu = menuBar->addMenu("Render");
14861521 (_renderVoxels = renderMenu->addAction("Voxels"))->setCheckable(true);
14871522 _renderVoxels->setChecked(true);
1488− _renderVoxels->setShortcut(Qt::Key_V);
1523+ _renderVoxels->setShortcut(Qt::SHIFT | Qt::Key_V);
14891524 (_renderVoxelTextures = renderMenu->addAction("Voxel Textures"))->setCheckable(true);
14901525 (_renderStarsOn = renderMenu->addAction("Stars"))->setCheckable(true);
14911526 _renderStarsOn->setChecked(true);
@@ -1515,6 +1550,8 @@ void Application::initMenu() { · 23 unmodified lines
15151550 (_logOn = toolsMenu->addAction("Log"))->setCheckable(true);
15161551 _logOn->setChecked(false);
15171552 _logOn->setShortcut(Qt::CTRL | Qt::Key_L);
1553+ (_oscilloscopeOn = toolsMenu->addAction("Audio Oscilloscope"))->setCheckable(true);
1554+ _oscilloscopeOn->setChecked(true);
15181555 (_bandwidthDisplayOn = toolsMenu->addAction("Bandwidth Display"))->setCheckable(true);
15191556 _bandwidthDisplayOn->setChecked(true);
15201557 toolsMenu->addAction("Bandwidth Details", this, SLOT(bandwidthDetails()));
@@ -1525,36 +1562,39 @@ void Application::initMenu() { · 4 unmodified lines
15251562 _voxelModeActions->setExclusive(false); // exclusivity implies one is always checked
15261563
15271564 (_addVoxelMode = voxelMenu->addAction(
1528− "Add Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::CTRL | Qt::Key_A))->setCheckable(true);
1565+ "Add Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_V))->setCheckable(true);
15291566 _voxelModeActions->addAction(_addVoxelMode);
15301567 (_deleteVoxelMode = voxelMenu->addAction(
1531− "Delete Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::CTRL | Qt::Key_D))->setCheckable(true);
1568+ "Delete Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_R))->setCheckable(true);
15321569 _voxelModeActions->addAction(_deleteVoxelMode);
15331570 (_colorVoxelMode = voxelMenu->addAction(
1534− "Color Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::CTRL | Qt::Key_B))->setCheckable(true);
1571+ "Color Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_B))->setCheckable(true);
15351572 _voxelModeActions->addAction(_colorVoxelMode);
15361573 (_selectVoxelMode = voxelMenu->addAction(
1537− "Select Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::CTRL | Qt::Key_S))->setCheckable(true);
1574+ "Select Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_O))->setCheckable(true);
15381575 _voxelModeActions->addAction(_selectVoxelMode);
15391576 (_eyedropperMode = voxelMenu->addAction(
1540− "Get Color Mode", this, SLOT(updateVoxelModeActions()), Qt::CTRL | Qt::Key_G))->setCheckable(true);
1577+ "Get Color Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_G))->setCheckable(true);
15411578 _voxelModeActions->addAction(_eyedropperMode);
1542−
1579+
15431580 voxelMenu->addAction("Decrease Voxel Size", this, SLOT(decreaseVoxelSize()), QKeySequence::ZoomOut);
15441581 voxelMenu->addAction("Increase Voxel Size", this, SLOT(increaseVoxelSize()), QKeySequence::ZoomIn);
1545−
1582+ voxelMenu->addAction("Reset Swatch Colors", this, SLOT(resetSwatchColors()));
1583+
15461584 _voxelPaintColor = voxelMenu->addAction("Voxel Paint Color", this,
15471585 SLOT(chooseVoxelPaintColor()), Qt::META | Qt::Key_C);
1586+ _swatch.setAction(_voxelPaintColor);
1587+
15481588 QColor paintColor(128, 128, 128);
15491589 _voxelPaintColor->setData(paintColor);
15501590 _voxelPaintColor->setIcon(createSwatchIcon(paintColor));
15511591 (_destructiveAddVoxel = voxelMenu->addAction("Create Voxel is Destructive"))->setCheckable(true);
15521592
1553− voxelMenu->addAction("Export Voxels", this, SLOT(exportVoxels()), Qt::CTRL | Qt::Key_E);
1554− voxelMenu->addAction("Import Voxels", this, SLOT(importVoxels()), Qt::CTRL | Qt::Key_I);
1555− voxelMenu->addAction("Cut Voxels", this, SLOT(cutVoxels()), Qt::CTRL | Qt::Key_X);
1556− voxelMenu->addAction("Copy Voxels", this, SLOT(copyVoxels()), Qt::CTRL | Qt::Key_C);
1557− voxelMenu->addAction("Paste Voxels", this, SLOT(pasteVoxels()), Qt::CTRL | Qt::Key_V);
1593+ voxelMenu->addAction("Export Voxels", this, SLOT(exportVoxels()), Qt::CTRL | Qt::Key_E);
1594+ voxelMenu->addAction("Import Voxels", this, SLOT(importVoxels()), Qt::CTRL | Qt::Key_I);
1595+ voxelMenu->addAction("Cut Voxels", this, SLOT(cutVoxels()), Qt::CTRL | Qt::Key_X);
1596+ voxelMenu->addAction("Copy Voxels", this, SLOT(copyVoxels()), Qt::CTRL | Qt::Key_C);
1597+ voxelMenu->addAction("Paste Voxels", this, SLOT(pasteVoxels()), Qt::CTRL | Qt::Key_V);
15581598
15591599 QMenu* debugMenu = menuBar->addMenu("Debug");
15601600
@@ -1680,6 +1720,14 @@ void Application::init() { · 119 unmodified lines
16801720 printLog("Loaded settings.\n");
16811721
16821722 sendAvatarVoxelURLMessage(_myAvatar.getVoxels()->getVoxelURL());
1723+
1724+ _palette.init(_glWidget->width(), _glWidget->height());
1725+ _palette.addAction(_addVoxelMode, 0, 0);
1726+ _palette.addAction(_deleteVoxelMode, 0, 1);
1727+ _palette.addTool(&_swatch);
1728+ _palette.addAction(_colorVoxelMode, 0, 2);
1729+ _palette.addAction(_eyedropperMode, 0, 3);
1730+ _palette.addAction(_selectVoxelMode, 0, 4);
16831731 }
16841732
16851733 const float MAX_AVATAR_EDIT_VELOCITY = 1.0f;
@@ -1912,7 +1960,7 @@ void Application::update(float deltaTime) { · 226 unmodified lines
19121960 if (_bandwidthDialog) {
19131961 _bandwidthDialog->update();
19141962 }
1915−
1963+
19161964 // Update audio stats for procedural sounds
19171965 #ifndef _WIN32
19181966 _audio.setLastAcceleration(_myAvatar.getThrust());
@@ -1923,11 +1971,11 @@ void Application::update(float deltaTime) { · 4 unmodified lines
19231971
19241972 void Application::updateAvatar(float deltaTime) {
19251973
1926− // Update my avatar's head position from gyros and/or webcam
1927− _myAvatar.updateHeadFromGyrosAndOrWebcam(_gyroLook->isChecked(),
1928− glm::vec3(_headCameraPitchYawScale,
1929− _headCameraPitchYawScale,
1930− _headCameraPitchYawScale));
1974+ // Update my avatar's state from gyros and/or webcam
1975+ _myAvatar.updateFromGyrosAndOrWebcam(_gyroLook->isChecked(),
1976+ glm::vec3(_headCameraPitchYawScale,
1977+ _headCameraPitchYawScale,
1978+ _headCameraPitchYawScale));
19311979
19321980 if (_serialHeadSensor.isActive()) {
19331981
@@ -1989,9 +2037,10 @@ void Application::updateAvatar(float deltaTime) { · 55 unmodified lines
19892037 endOfBroadcastStringWrite += packNodeId(endOfBroadcastStringWrite, nodeList->getOwnerID());
19902038
19912039 endOfBroadcastStringWrite += _myAvatar.getBroadcastData(endOfBroadcastStringWrite);
1992−
1993− broadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString, NODE_TYPE_VOXEL_SERVER);
1994− broadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString, NODE_TYPE_AVATAR_MIXER);
2040+
2041+ const char nodeTypesOfInterest[] = { NODE_TYPE_VOXEL_SERVER, NODE_TYPE_AVATAR_MIXER };
2042+ controlledBroadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString,
2043+ nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
19952044
19962045 // once in a while, send my voxel url
19972046 const float AVATAR_VOXEL_URL_SEND_INTERVAL = 1.0f; // seconds
@@ -2350,8 +2399,9 @@ void Application::displayOverlay() { · 352 unmodified lines
23502399
23512400 #ifndef _WIN32
23522401 _audio.render(_glWidget->width(), _glWidget->height());
2353− _audioScope.render(20, _glWidget->height() - 200);
2354− //_audio.renderEchoCompare(); // PER: Will turn back on to further test echo
2402+ if (_oscilloscopeOn->isChecked()) {
2403+ _audioScope.render(20, _glWidget->height() - 200);
2404+ }
23552405 #endif
23562406
23572407 //noiseTest(_glWidget->width(), _glWidget->height());
@@ -2431,7 +2481,52 @@ void Application::displayOverlay() { · 73 unmodified lines
24312481
24322482 // render the webcam input frame
24332483 _webcam.renderPreview(_glWidget->width(), _glWidget->height());
2434−
2484+
2485+ _palette.render(_glWidget->width(), _glWidget->height());
2486+
2487+ if (_eyedropperMode->isChecked() && _voxelPaintColor->data().value<QColor>() != _swatch.getColor()) {
2488+ QColor color = _voxelPaintColor->data().value<QColor>();
2489+ TextRenderer textRenderer(SANS_FONT_FAMILY, 11, 50);
2490+ const char line1[] = "Assign this color to a swatch";
2491+ const char line2[] = "by choosing a key from 1 to 8.";
2492+
2493+ int left = (_glWidget->width() - POPUP_WIDTH - 2 * POPUP_MARGIN) / 2;
2494+ int top = _glWidget->height() / 40;
2495+
2496+ glBegin(GL_POLYGON);
2497+ glColor3f(0.0f, 0.0f, 0.0f);
2498+ for (double a = M_PI; a < 1.5f * M_PI; a += POPUP_STEP) {
2499+ glVertex2f(left + POPUP_MARGIN * cos(a) , top + POPUP_MARGIN * sin(a));
2500+ }
2501+ for (double a = 1.5f * M_PI; a < 2.0f * M_PI; a += POPUP_STEP) {
2502+ glVertex2f(left + POPUP_WIDTH + POPUP_MARGIN * cos(a), top + POPUP_MARGIN * sin(a));
2503+ }
2504+ for (double a = 0.0f; a < 0.5f * M_PI; a += POPUP_STEP) {
2505+ glVertex2f(left + POPUP_WIDTH + POPUP_MARGIN * cos(a), top + POPUP_HEIGHT + POPUP_MARGIN * sin(a));
2506+ }
2507+ for (double a = 0.5f * M_PI; a < 1.0f * M_PI; a += POPUP_STEP) {
2508+ glVertex2f(left + POPUP_MARGIN * cos(a) , top + POPUP_HEIGHT + POPUP_MARGIN * sin(a));
2509+ }
2510+ glEnd();
2511+
2512+ glBegin(GL_QUADS);
2513+ glColor3f(color.redF(),
2514+ color.greenF(),
2515+ color.blueF());
2516+ glVertex2f(left , top);
2517+ glVertex2f(left + SWATCH_WIDTH, top);
2518+ glVertex2f(left + SWATCH_WIDTH, top + SWATCH_HEIGHT);
2519+ glVertex2f(left , top + SWATCH_HEIGHT);
2520+ glEnd();
2521+
2522+ glColor3f(1.0f, 1.0f, 1.0f);
2523+ textRenderer.draw(left + SWATCH_WIDTH + POPUP_MARGIN, top + FIRST_LINE_OFFSET , line1);
2524+ textRenderer.draw(left + SWATCH_WIDTH + POPUP_MARGIN, top + SECOND_LINE_OFFSET, line2);
2525+ }
2526+ else {
2527+ _swatch.checkColor();
2528+ }
2529+
24352530 glPopMatrix();
24362531 }
24372532
@@ -2953,6 +3048,7 @@ void Application::eyedropperVoxelUnderCursor() { · 515 unmodified lines
29533048 }
29543049
29553050 void Application::goHome() {
3051+ printLog("Going Home!\n");
29563052 _myAvatar.setPosition(START_LOCATION);
29573053 }
29583054
@@ -3127,7 +3223,8 @@ void Application::loadSettings(QSettings* settings) { · 168 unmodified lines
31273223 settings->endGroup();
31283224
31293225 scanMenuBar(&Application::loadAction, settings);
3130− getAvatar()->loadData(settings);
3226+ getAvatar()->loadData(settings);
3227+ _swatch.loadData(settings);
31313228 }
31323229
31333230
@@ -3149,6 +3246,7 @@ void Application::saveSettings(QSettings* settings) { · 15 unmodified lines
31493246
31503247 scanMenuBar(&Application::saveAction, settings);
31513248 getAvatar()->saveData(settings);
3249+ _swatch.saveData(settings);
31523250 }
31533251
31543252 void Application::importSettings() {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t