From 342c9fb3a8783357ad65a5eda32a8c7893b0c7d5 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 19 Feb 2014 11:04:58 -0800 Subject: [PATCH 01/32] Fixing bad brace formatting. --- interface/src/avatar/Hand.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/interface/src/avatar/Hand.cpp b/interface/src/avatar/Hand.cpp index efbdfa2438..00708c05d0 100644 --- a/interface/src/avatar/Hand.cpp +++ b/interface/src/avatar/Hand.cpp @@ -125,8 +125,7 @@ void Hand::simulate(float deltaTime, bool isMine) { } } -void Hand::playSlaps(PalmData& palm, Avatar* avatar) -{ +void Hand::playSlaps(PalmData& palm, Avatar* avatar) { // Check for palm collisions glm::vec3 myPalmPosition = palm.getPosition(); float palmCollisionDistance = 0.1f; From caba4f9b9b36a9ad2c315f5633a795ff6719fa3f Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 20 Feb 2014 07:58:30 -0800 Subject: [PATCH 02/32] Fix for crash when CollisionList gets full. --- libraries/shared/src/CollisionInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/shared/src/CollisionInfo.cpp b/libraries/shared/src/CollisionInfo.cpp index 5d74d591c6..f20ffe83e0 100644 --- a/libraries/shared/src/CollisionInfo.cpp +++ b/libraries/shared/src/CollisionInfo.cpp @@ -16,7 +16,7 @@ CollisionList::CollisionList(int maxSize) : CollisionInfo* CollisionList::getNewCollision() { // return pointer to existing CollisionInfo, or NULL of list is full - return (_size < _maxSize) ? &(_collisions[++_size]) : NULL; + return (_size < _maxSize) ? &(_collisions[_size++]) : NULL; } CollisionInfo* CollisionList::getCollision(int index) { From 5252f22d82f31a2c15605eb1165fd7f698f53b0f Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 10:42:10 -0800 Subject: [PATCH 03/32] fix warning about signed/unsigned comparison --- libraries/avatars/src/HandData.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/avatars/src/HandData.cpp b/libraries/avatars/src/HandData.cpp index e4bb187f28..0355a4c86b 100644 --- a/libraries/avatars/src/HandData.cpp +++ b/libraries/avatars/src/HandData.cpp @@ -178,7 +178,7 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) { unsigned int numPalms = *sourceBuffer++; for (unsigned int handIndex = 0; handIndex < numPalms; ++handIndex) { - if (handIndex >= getNumPalms()) + if (handIndex >= (unsigned int)getNumPalms()) addNewPalm(); PalmData& palm = getPalms()[handIndex]; @@ -196,7 +196,7 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) { palm.setSixenseID(handIndex); for (unsigned int fingerIndex = 0; fingerIndex < numFingers; ++fingerIndex) { - if (fingerIndex < palm.getNumFingers()) { + if (fingerIndex < (unsigned int)palm.getNumFingers()) { FingerData& finger = palm.getFingers()[fingerIndex]; glm::vec3 tipPosition; From 78b92516d9ec50b58bfab626c27fd7ffef0fa1aa Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 10:43:49 -0800 Subject: [PATCH 04/32] fix warning about signed/unsigned comparison --- libraries/octree/src/AABox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/octree/src/AABox.cpp b/libraries/octree/src/AABox.cpp index 1313111765..97fd706c21 100644 --- a/libraries/octree/src/AABox.cpp +++ b/libraries/octree/src/AABox.cpp @@ -335,7 +335,7 @@ glm::vec3 AABox::getClosestPointOnFace(const glm::vec4& origin, const glm::vec4& secondAxisMaxPlane + thirdAxisMaxPlane + offset }; float minDistance = FLT_MAX; - for (int i = 0; i < sizeof(diagonals) / sizeof(diagonals[0]); i++) { + for (size_t i = 0; i < sizeof(diagonals) / sizeof(diagonals[0]); i++) { float divisor = glm::dot(direction, diagonals[i]); if (fabs(divisor) < EPSILON) { continue; // segment is parallel to diagonal plane From c8149f95a36a737dd7d3660126f50f07260a9184 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 11:06:23 -0800 Subject: [PATCH 05/32] fix warning for unused variable (we forgot to use it) --- libraries/particles/src/ParticleCollisionSystem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/particles/src/ParticleCollisionSystem.cpp b/libraries/particles/src/ParticleCollisionSystem.cpp index 2d272a8f1f..75125a396a 100644 --- a/libraries/particles/src/ParticleCollisionSystem.cpp +++ b/libraries/particles/src/ParticleCollisionSystem.cpp @@ -222,6 +222,7 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) { // while ramping it up to 1 when attenuationFactor = 0 damping = DAMPING + (1.f - attenuationFactor) * (1.f - DAMPING); } + collision->_damping = damping; } // HACK END From 1b2db1f7ab5cb129928808e6c1752ba27d305b34 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 11:07:15 -0800 Subject: [PATCH 06/32] fix for warnings about signed/unsigned comparison --- libraries/octree/src/JurisdictionMap.cpp | 10 +++++----- libraries/octree/src/OctreeElement.cpp | 2 +- libraries/shared/src/OctalCode.cpp | 16 ++++++++-------- libraries/shared/src/OctalCode.h | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libraries/octree/src/JurisdictionMap.cpp b/libraries/octree/src/JurisdictionMap.cpp index 6dc5a22e73..0271c77012 100644 --- a/libraries/octree/src/JurisdictionMap.cpp +++ b/libraries/octree/src/JurisdictionMap.cpp @@ -50,7 +50,7 @@ void JurisdictionMap::copyContents(unsigned char* rootCodeIn, const std::vector< unsigned char* rootCode; std::vector endNodes; if (rootCodeIn) { - int bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(rootCodeIn)); + size_t bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(rootCodeIn)); rootCode = new unsigned char[bytes]; memcpy(rootCode, rootCodeIn, bytes); } else { @@ -60,7 +60,7 @@ void JurisdictionMap::copyContents(unsigned char* rootCodeIn, const std::vector< for (size_t i = 0; i < endNodesIn.size(); i++) { if (endNodesIn[i]) { - int bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(endNodesIn[i])); + size_t bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(endNodesIn[i])); unsigned char* endNodeCode = new unsigned char[bytes]; memcpy(endNodeCode, endNodesIn[i], bytes); endNodes.push_back(endNodeCode); @@ -133,7 +133,7 @@ void myDebugPrintOctalCode(const unsigned char* octalCode, bool withNewLine) { if (!octalCode) { printf("NULL"); } else { - for (int i = 0; i < bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); i++) { + for (size_t i = 0; i < bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); i++) { myDebugoutputBits(octalCode[i],false); } } @@ -293,7 +293,7 @@ int JurisdictionMap::packIntoMessage(unsigned char* destinationBuffer, int avail // add the root jurisdiction if (_rootOctalCode) { - int bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(_rootOctalCode)); + size_t bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(_rootOctalCode)); memcpy(destinationBuffer, &bytes, sizeof(bytes)); destinationBuffer += sizeof(bytes); memcpy(destinationBuffer, _rootOctalCode, bytes); @@ -306,7 +306,7 @@ int JurisdictionMap::packIntoMessage(unsigned char* destinationBuffer, int avail for (int i=0; i < endNodeCount; i++) { unsigned char* endNodeCode = _endNodes[i]; - int bytes = 0; + size_t bytes = 0; if (endNodeCode) { bytes = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(endNodeCode)); } diff --git a/libraries/octree/src/OctreeElement.cpp b/libraries/octree/src/OctreeElement.cpp index 67b96b4047..72ac5b14d6 100644 --- a/libraries/octree/src/OctreeElement.cpp +++ b/libraries/octree/src/OctreeElement.cpp @@ -44,7 +44,7 @@ void OctreeElement::init(unsigned char * octalCode) { _voxelNodeLeafCount++; // all nodes start as leaf nodes - int octalCodeLength = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); + size_t octalCodeLength = bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); if (octalCodeLength > sizeof(_octalCode)) { _octalCode.pointer = octalCode; _octcodePointer = true; diff --git a/libraries/shared/src/OctalCode.cpp b/libraries/shared/src/OctalCode.cpp index ff30dad47e..4edf7be1ed 100644 --- a/libraries/shared/src/OctalCode.cpp +++ b/libraries/shared/src/OctalCode.cpp @@ -35,7 +35,7 @@ void printOctalCode(const unsigned char* octalCode) { qDebug("NULL"); } else { QDebug continuedDebug = qDebug().nospace(); - for (int i = 0; i < bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); i++) { + for (size_t i = 0; i < bytesRequiredForCodeLength(numberOfThreeBitSectionsInCode(octalCode)); i++) { outputBits(octalCode[i], &continuedDebug); } } @@ -51,11 +51,11 @@ char sectionValue(const unsigned char* startByte, char startIndexInByte) { } } -int bytesRequiredForCodeLength(unsigned char threeBitCodes) { +size_t bytesRequiredForCodeLength(unsigned char threeBitCodes) { if (threeBitCodes == 0) { return 1; } else { - return 1 + (int)ceilf((threeBitCodes * 3) / 8.0f); + return 1 + ceilf((threeBitCodes * 3) / 8.0f); } } @@ -78,10 +78,10 @@ unsigned char* childOctalCode(const unsigned char* parentOctalCode, char childNu : 0; // get the number of bytes used by the parent octal code - int parentCodeBytes = bytesRequiredForCodeLength(parentCodeSections); + size_t parentCodeBytes = bytesRequiredForCodeLength(parentCodeSections); // child code will have one more section than the parent - int childCodeBytes = bytesRequiredForCodeLength(parentCodeSections + 1); + size_t childCodeBytes = bytesRequiredForCodeLength(parentCodeSections + 1); // create a new buffer to hold the new octal code unsigned char* newCode = new unsigned char[childCodeBytes]; @@ -175,8 +175,8 @@ OctalCodeComparison compareOctalCodes(const unsigned char* codeA, const unsigned OctalCodeComparison result = LESS_THAN; // assume it's shallower - int numberOfBytes = std::min(bytesRequiredForCodeLength(*codeA), bytesRequiredForCodeLength(*codeB)); - int compare = memcmp(codeA, codeB, numberOfBytes); + size_t numberOfBytes = std::min(bytesRequiredForCodeLength(*codeA), bytesRequiredForCodeLength(*codeB)); + size_t compare = memcmp(codeA, codeB, numberOfBytes); if (compare < 0) { result = LESS_THAN; @@ -367,7 +367,7 @@ QString octalCodeToHexString(const unsigned char* octalCode) { if (!octalCode) { output = "00"; } else { - for (int i = 0; i < bytesRequiredForCodeLength(*octalCode); i++) { + for (size_t i = 0; i < bytesRequiredForCodeLength(*octalCode); i++) { output.append(QString("%1").arg(octalCode[i], HEX_BYTE_SIZE, HEX_NUMBER_BASE, QChar('0')).toUpper()); } } diff --git a/libraries/shared/src/OctalCode.h b/libraries/shared/src/OctalCode.h index 36f3e74f63..c80aa82a2d 100644 --- a/libraries/shared/src/OctalCode.h +++ b/libraries/shared/src/OctalCode.h @@ -20,7 +20,7 @@ const int GREEN_INDEX = 1; const int BLUE_INDEX = 2; void printOctalCode(const unsigned char* octalCode); -int bytesRequiredForCodeLength(unsigned char threeBitCodes); +size_t bytesRequiredForCodeLength(unsigned char threeBitCodes); int branchIndexWithDescendant(const unsigned char* ancestorOctalCode, const unsigned char* descendantOctalCode); unsigned char* childOctalCode(const unsigned char* parentOctalCode, char childNumber); From 918cd39f5d1e78967d41f60128862b5b4cb6dad2 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 11:18:58 -0800 Subject: [PATCH 07/32] adding warnings to linux build --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2560c6498f..135bfacb7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,10 @@ IF (WIN32) include_directories(SYSTEM "externals/winsdk") add_definitions( -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS ) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1 ") +ELSEIF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic") + #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") ENDIF(WIN32) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} $ENV{QT_CMAKE_PREFIX_PATH} ) From 16a5af1a8ef184f40b0d617e48d9e595ed53a5d0 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 11:53:08 -0800 Subject: [PATCH 08/32] fix warning about signed/unsigned comparison --- interface/src/Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index b21d660452..db5ba17578 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2161,7 +2161,7 @@ void Application::updateShadowMap() { rotation * (glm::mix(_viewFrustum.getNearBottomLeft(), _viewFrustum.getFarBottomLeft(), farScale) + translation), rotation * (glm::mix(_viewFrustum.getNearBottomRight(), _viewFrustum.getFarBottomRight(), farScale) + translation) }; glm::vec3 minima(FLT_MAX, FLT_MAX, FLT_MAX), maxima(-FLT_MAX, -FLT_MAX, -FLT_MAX); - for (int i = 0; i < sizeof(points) / sizeof(points[0]); i++) { + for (size_t i = 0; i < sizeof(points) / sizeof(points[0]); i++) { minima = glm::min(minima, points[i]); maxima = glm::max(maxima, points[i]); } From 2faaa5beefb84c636ed8000939af0b8f3375d9c4 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 11:54:58 -0800 Subject: [PATCH 09/32] fix warnings about signed/unsigned comparison --- interface/src/BandwidthMeter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/BandwidthMeter.cpp b/interface/src/BandwidthMeter.cpp index d8081e186f..117d0b8ed1 100644 --- a/interface/src/BandwidthMeter.cpp +++ b/interface/src/BandwidthMeter.cpp @@ -129,7 +129,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) { // Determine total float totalIn = 0.0f, totalOut = 0.0f; - for (int i = 0; i < N_CHANNELS; ++i) { + for (size_t i = 0; i < N_CHANNELS; ++i) { totalIn += inputStream(ChannelIndex(i)).getValue(); totalOut += outputStream(ChannelIndex(i)).getValue(); @@ -205,7 +205,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) { // Render bars int xIn = 0, xOut = 0; - for (int i = 0; i < N_CHANNELS; ++i) { + for (size_t i = 0; i < N_CHANNELS; ++i) { ChannelIndex chIdx = ChannelIndex(i); int wIn = int(barWidth * inputStream(chIdx).getValue() * UNIT_SCALE / scaleMax); @@ -240,7 +240,7 @@ void BandwidthMeter::render(int screenWidth, int screenHeight) { // After rendering, indicate that no data has been sent/received since the last feed. // This way, the meters fall when not continuously fed. - for (int i = 0; i < N_CHANNELS; ++i) { + for (size_t i = 0; i < N_CHANNELS; ++i) { inputStream(ChannelIndex(i)).updateValue(0); outputStream(ChannelIndex(i)).updateValue(0); } From eec8affd84b962fd647638470589185f63bc92e5 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 11:56:22 -0800 Subject: [PATCH 10/32] fix warning about unused variable --- interface/src/avatar/MyAvatar.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 51fcad20ae..5b208aac7d 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -103,9 +103,8 @@ void MyAvatar::update(float deltaTime) { // Update head mouse from faceshift if active Faceshift* faceshift = Application::getInstance()->getFaceshift(); if (faceshift->isActive()) { - glm::vec3 headVelocity = faceshift->getHeadAngularVelocity(); - // TODO? resurrect headMouse stuff? + //glm::vec3 headVelocity = faceshift->getHeadAngularVelocity(); //// sets how quickly head angular rotation moves the head mouse //const float HEADMOUSE_FACESHIFT_YAW_SCALE = 40.f; //const float HEADMOUSE_FACESHIFT_PITCH_SCALE = 30.f; From 0f586cc0fbae36400648842ebff00bc9af71cf9a Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 12:03:48 -0800 Subject: [PATCH 11/32] fix warning about unused variable --- libraries/octree/src/Octree.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index 05760ef675..7ff4c75622 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -224,10 +224,8 @@ int Octree::readNodeData(OctreeElement* destinationNode, const unsigned char* no } OctreeElement* childNodeAt = destinationNode->getChildAtIndex(i); - bool nodeWasDirty = false; bool nodeIsDirty = false; if (childNodeAt) { - nodeWasDirty = childNodeAt->isDirty(); bytesRead += childNodeAt->readElementDataFromBuffer(nodeData + bytesRead, bytesLeftToRead, args); childNodeAt->setSourceUUID(args.sourceUUID); From 455ef15754f613667d8fcf3a9178986125b59948 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 4 Mar 2014 12:05:00 -0800 Subject: [PATCH 12/32] fix warning about signed/unsigned comparison --- libraries/particles/src/ParticleTreeElement.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libraries/particles/src/ParticleTreeElement.cpp b/libraries/particles/src/ParticleTreeElement.cpp index 4930263d64..ee916dcf2f 100644 --- a/libraries/particles/src/ParticleTreeElement.cpp +++ b/libraries/particles/src/ParticleTreeElement.cpp @@ -234,7 +234,6 @@ void ParticleTreeElement::getParticles(const glm::vec3& searchPosition, float se uint16_t numberOfParticles = _particles->size(); for (uint16_t i = 0; i < numberOfParticles; i++) { const Particle* particle = &(*_particles)[i]; - glm::vec3 particlePosition = particle->getPosition(); float distance = glm::length(particle->getPosition() - searchPosition); if (distance < searchRadius + particle->getRadius()) { foundParticles.push_back(particle); @@ -294,15 +293,14 @@ int ParticleTreeElement::readElementDataFromBuffer(const unsigned char* data, in uint16_t numberOfParticles = 0; int expectedBytesPerParticle = Particle::expectedBytes(); - if (bytesLeftToRead >= sizeof(numberOfParticles)) { - + if (bytesLeftToRead >= (int)sizeof(numberOfParticles)) { // read our particles in.... numberOfParticles = *(uint16_t*)dataAt; dataAt += sizeof(numberOfParticles); - bytesLeftToRead -= sizeof(numberOfParticles); + bytesLeftToRead -= (int)sizeof(numberOfParticles); bytesRead += sizeof(numberOfParticles); - if (bytesLeftToRead >= (numberOfParticles * expectedBytesPerParticle)) { + if (bytesLeftToRead >= (int)(numberOfParticles * expectedBytesPerParticle)) { for (uint16_t i = 0; i < numberOfParticles; i++) { Particle tempParticle; int bytesForThisParticle = tempParticle.readParticleDataFromBuffer(dataAt, bytesLeftToRead, args); From 7a8d26247a6e734a85c57ffffd4d6624afb55e72 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 5 Mar 2014 21:03:32 -0800 Subject: [PATCH 13/32] remove piemenu --- interface/src/Application.cpp | 14 ---- interface/src/Application.h | 3 - interface/src/PieMenu.cpp | 137 ---------------------------------- interface/src/PieMenu.h | 59 --------------- 4 files changed, 213 deletions(-) delete mode 100644 interface/src/PieMenu.cpp delete mode 100644 interface/src/PieMenu.h diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6f3e745f21..8b4eb2d2be 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1008,10 +1008,6 @@ void Application::mouseMoveEvent(QMouseEvent* event) { _mouseX = event->x(); _mouseY = event->y(); - - if (activeWindow() == _window) { - _pieMenu.mouseMoveEvent(_mouseX, _mouseY); - } } void Application::mousePressEvent(QMouseEvent* event) { @@ -1064,8 +1060,6 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) { checkStatsClick(); } - - _pieMenu.mouseReleaseEvent(_mouseX, _mouseY); } } } @@ -1571,10 +1565,6 @@ void Application::init() { ScriptEngine::getParticlesScriptingInterface(), SLOT(forwardParticleCollisionWithParticle(const ParticleID&, const ParticleID&, const glm::vec3&))); - _pieMenu.init("./resources/images/hifi-interface-tools-v2-pie.svg", - _glWidget->width(), - _glWidget->height()); - _audio.init(_glWidget); _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings); @@ -2508,10 +2498,6 @@ void Application::displayOverlay() { drawText(_glWidget->width() - 100, _glWidget->height() - timerBottom, 0.30f, 1.0f, 0, frameTimer, WHITE_TEXT); } - if (_pieMenu.isDisplayed()) { - _pieMenu.render(); - } - _overlays.render2D(); glPopMatrix(); diff --git a/interface/src/Application.h b/interface/src/Application.h index 8c64da86b6..16776a857c 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -43,7 +43,6 @@ #include "MetavoxelSystem.h" #include "PacketHeaders.h" #include "ParticleTreeRenderer.h" -#include "PieMenu.h" #include "Stars.h" #include "ViewFrustum.h" #include "VoxelFade.h" @@ -452,8 +451,6 @@ private: StDev _idleLoopStdev; float _idleLoopMeasuredJitter; - PieMenu _pieMenu; - int parseOctreeStats(const QByteArray& packet, const SharedNodePointer& sendingNode); void trackIncomingVoxelPacket(const QByteArray& packet, const SharedNodePointer& sendingNode, bool wasStatsPacket); diff --git a/interface/src/PieMenu.cpp b/interface/src/PieMenu.cpp deleted file mode 100644 index d62d0447e1..0000000000 --- a/interface/src/PieMenu.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// -// PieMenu.cpp -// hifi -// -// Created by Clement Brisset on 7/18/13. -// Copyright (c) 2013 High Fidelity, Inc. All rights reserved. -// - -#include "PieMenu.h" - -#include - -#include -#include -#include -#include -#include - -PieMenu::PieMenu() : - _radiusIntern(30), - _radiusExtern(70), - _magnification(1.2f), - _isDisplayed(false) { -} - -void PieMenu::init(const char *fileName, int screenWidth, int screenHeight) { - // Load SVG - switchToResourcesParentIfRequired(); - QSvgRenderer renderer((QString) QString(fileName)); - - // Prepare a QImage with desired characteritisc - QImage image(2 * _radiusExtern, 2 * _radiusExtern, QImage::Format_ARGB32); - image.fill(0x0); - - // Get QPainter that paints to the image - QPainter painter(&image); - renderer.render(&painter); - - //get the OpenGL-friendly image - _textureImage = QGLWidget::convertToGLFormat(image); - - glGenTextures(1, &_textureID); - glBindTexture(GL_TEXTURE_2D, _textureID); - - //generate the texture - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, - _textureImage.width(), - _textureImage.height(), - 0, GL_RGBA, GL_UNSIGNED_BYTE, - _textureImage.bits()); - - //texture parameters - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -} - -void PieMenu::addAction(QAction* action){ - _actions.push_back(action); -} - -void PieMenu::render() { - if (_actions.size() == 0) { - return; - } - - float start = (float)M_PI / 2.0f; - float end = start + 2.0f * (float)M_PI; - float step = 2.0f * (float)M_PI / 100.0f; - float distance = sqrt((float)(_mouseX - _x) * (_mouseX - _x) + (_mouseY - _y) * (_mouseY - _y)); - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, _textureID); - - glColor3f(1.0f, 1.0f, 1.0f); - - if (_radiusIntern < distance) { - float angle = atan2((float)(_mouseY - _y), (float)(_mouseX - _x)) - start; - angle = (0.0f < angle) ? angle : angle + 2.0f * M_PI; - - _selectedAction = floor(angle / (2.0f * M_PI / _actions.size())); - - start = start + _selectedAction * 2.0f * M_PI / _actions.size(); - end = start + 2.0f * M_PI / _actions.size(); - glBegin(GL_TRIANGLE_FAN); - glTexCoord2f(0.5f, 0.5f); - glVertex2f(_x, _y); - for (float i = start; i < end; i += step) { - glTexCoord2f(0.5f + 0.5f * cos(i), 0.5f - 0.5f * sin(i)); - glVertex2f(_x + _magnification * _radiusExtern * cos(i), - _y + _magnification * _radiusExtern * sin(i)); - } - glTexCoord2f(0.5f + 0.5f * cos(end), 0.5f + - 0.5f * sin(end)); - glVertex2f(_x + _magnification * _radiusExtern * cos(end), - _y + _magnification * _radiusExtern * sin(end)); - glEnd(); - } else { - _selectedAction = -1; - - glBegin(GL_QUADS); - glTexCoord2f(1, 1); - glVertex2f(_x + _radiusExtern, _y - _radiusExtern); - - glTexCoord2f(1, 0); - glVertex2f(_x + _radiusExtern, _y + _radiusExtern); - - glTexCoord2f(0, 0); - glVertex2f(_x - _radiusExtern, _y + _radiusExtern); - - glTexCoord2f(0, 1); - glVertex2f(_x - _radiusExtern, _y - _radiusExtern); - glEnd(); - } - glDisable(GL_TEXTURE_2D); -} - -void PieMenu::resize(int screenWidth, int screenHeight) { -} - -void PieMenu::mouseMoveEvent(int x, int y) { - _mouseX = x; - _mouseY = y; -} - -void PieMenu::mousePressEvent(int x, int y) { - _x = _mouseX = x; - _y = _mouseY = y; - _selectedAction = -1; - _isDisplayed = true; -} - -void PieMenu::mouseReleaseEvent(int x, int y) { - if (0 <= _selectedAction && _selectedAction < (int)_actions.size() && _actions[_selectedAction]) { - _actions[_selectedAction]->trigger(); - } - - _isDisplayed = false; -} diff --git a/interface/src/PieMenu.h b/interface/src/PieMenu.h deleted file mode 100644 index f80f94f5d4..0000000000 --- a/interface/src/PieMenu.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// PieMenu.h -// hifi -// -// Created by Clement Brisset on 7/18/13. -// Copyright (c) 2013 High Fidelity, Inc. All rights reserved. -// - -#ifndef __hifi__PieMenu__ -#define __hifi__PieMenu__ - -#include - -#include "InterfaceConfig.h" -#include "Util.h" - -#include - -class QAction; - -class PieMenu { -public: - PieMenu(); - - void init(const char* fileName, int screenWidth, int screenHeight); - void addAction(QAction* action); - void render(); - void resize(int screenWidth, int screenHeight); - - bool isDisplayed() const {return _isDisplayed;} - int getX () const {return _x;} - int getY () const {return _y;} - - void mouseMoveEvent (int x, int y); - void mousePressEvent (int x, int y); - void mouseReleaseEvent(int x, int y); - -private: - QImage _textureImage; - GLuint _textureID; - - // position of the menu - int _x; - int _y; - int _radiusIntern; - int _radiusExtern; - float _magnification; - - int _mouseX; - int _mouseY; - - int _selectedAction; - - bool _isDisplayed; - - std::vector _actions; -}; - -#endif /* defined(__hifi__PieMenu__) */ From 13985f814935dda3d7d1c09cc068aa86ff22e212 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 5 Mar 2014 21:17:25 -0800 Subject: [PATCH 14/32] fix crash in Menu.removeSeparator() if the menu item doesn't exist or isn't a separator --- interface/src/Menu.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 8c6cdacae1..0586382cb9 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -1320,17 +1320,25 @@ void Menu::addSeparator(const QString& menuName, const QString& separatorName) { void Menu::removeSeparator(const QString& menuName, const QString& separatorName) { QMenu* menu = getMenu(menuName); + bool separatorRemoved = false; if (menu) { int textAt = findPositionOfMenuItem(menu, separatorName); QList menuActions = menu->actions(); QAction* separatorText = menuActions[textAt]; - QAction* separatorLine = menuActions[textAt - 1]; - if (separatorLine->isSeparator()) { - menu->removeAction(separatorText); - menu->removeAction(separatorLine); + if (textAt > 0 && textAt < menuActions.size()) { + QAction* separatorLine = menuActions[textAt - 1]; + if (separatorLine) { + if (separatorLine->isSeparator()) { + menu->removeAction(separatorText); + menu->removeAction(separatorLine); + separatorRemoved = true; + } + } } } - QMenuBar::repaint(); + if (separatorRemoved) { + QMenuBar::repaint(); + } } void Menu::addMenuItem(const MenuItemProperties& properties) { From a887baf081125e834855b745e6da8eb1acde55a6 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 5 Mar 2014 21:22:08 -0800 Subject: [PATCH 15/32] fix warning --- interface/src/avatar/MyAvatar.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index e981078892..954b68beea 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -923,10 +923,13 @@ void MyAvatar::updateCollisionWithAvatars(float deltaTime) { // HACK: body-body collision uses two coaxial capsules with axes parallel to y-axis // TODO: make the collision work without assuming avatar orientation - Extents myStaticExtents = _skeletonModel.getStaticExtents(); - glm::vec3 staticScale = myStaticExtents.maximum - myStaticExtents.minimum; - float myCapsuleRadius = 0.25f * (staticScale.x + staticScale.z); - float myCapsuleHeight = staticScale.y; + + // TODO: these local variables are not used in the live code, only in the + // commented-outTODO code below. + //Extents myStaticExtents = _skeletonModel.getStaticExtents(); + //glm::vec3 staticScale = myStaticExtents.maximum - myStaticExtents.minimum; + //float myCapsuleRadius = 0.25f * (staticScale.x + staticScale.z); + //float myCapsuleHeight = staticScale.y; CollisionInfo collisionInfo; foreach (const AvatarSharedPointer& avatarPointer, avatars) { From d5c18a54faa564eacdb2792f95a477a36bc3f299 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 6 Mar 2014 01:32:58 -0800 Subject: [PATCH 16/32] removed dead code --- interface/src/Field.cpp | 100 ---------------------------------------- interface/src/Field.h | 46 ------------------ 2 files changed, 146 deletions(-) delete mode 100644 interface/src/Field.cpp delete mode 100644 interface/src/Field.h diff --git a/interface/src/Field.cpp b/interface/src/Field.cpp deleted file mode 100644 index 1f4024653b..0000000000 --- a/interface/src/Field.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// -// Field.cpp -// interface -// -// Created by Philip Rosedale on 8/23/12. -// Copyright (c) 2012 High Fidelity, Inc. All rights reserved. -// -// A vector-valued field over an array of elements arranged as a 3D lattice - -#include "Field.h" - -int Field::value(float *value, float *pos) { - int index = (int)(pos[0] / _worldSize * 10.0) + - (int)(pos[1] / _worldSize * 10.0) * 10 + - (int)(pos[2] / _worldSize * 10.0) * 100; - - if ((index >= 0) && (index < FIELD_ELEMENTS)) { - value[0] = _field[index].val.x; - value[1] = _field[index].val.y; - value[2] = _field[index].val.z; - return 1; - } else { - return 0; - } -} - -Field::Field(float worldSize, float coupling) { - _worldSize = worldSize; - _coupling = coupling; - //float fx, fy, fz; - for (int i = 0; i < FIELD_ELEMENTS; i++) { - const float FIELD_INITIAL_MAG = 0.0f; - _field[i].val = randVector() * FIELD_INITIAL_MAG * _worldSize; - _field[i].center.x = ((float)(i % 10) + 0.5f); - _field[i].center.y = ((float)(i % 100 / 10) + 0.5f); - _field[i].center.z = ((float)(i / 100) + 0.5f); - _field[i].center *= _worldSize / 10.f; - - } -} - -void Field::add(float* add, float *pos) { - int index = (int)(pos[0] / _worldSize * 10.0) + - (int)(pos[1] / _worldSize * 10.0) * 10 + - (int)(pos[2] / _worldSize * 10.0) * 100; - - if ((index >= 0) && (index < FIELD_ELEMENTS)) { - _field[index].val.x += add[0]; - _field[index].val.y += add[1]; - _field[index].val.z += add[2]; - } -} - -void Field::interact(float deltaTime, const glm::vec3& pos, glm::vec3& vel) { - - int index = (int)(pos.x / _worldSize * 10.0) + - (int)(pos.y / _worldSize*10.0) * 10 + - (int)(pos.z / _worldSize*10.0) * 100; - if ((index >= 0) && (index < FIELD_ELEMENTS)) { - vel += _field[index].val * deltaTime; // Particle influenced by field - _field[index].val += vel * deltaTime * _coupling; // Field influenced by particle - } -} - -void Field::simulate(float deltaTime) { - glm::vec3 neighbors, add, diff; - - for (int i = 0; i < FIELD_ELEMENTS; i++) { - const float CONSTANT_DAMPING = 0.5f; - _field[i].val *= (1.f - CONSTANT_DAMPING * deltaTime); - } -} - -void Field::render() { - int i; - float scale_view = 0.05f * _worldSize; - - glDisable(GL_LIGHTING); - glBegin(GL_LINES); - for (i = 0; i < FIELD_ELEMENTS; i++) { - glColor3f(0, 1, 0); - glVertex3fv(&_field[i].center.x); - glVertex3f(_field[i].center.x + _field[i].val.x * scale_view, - _field[i].center.y + _field[i].val.y * scale_view, - _field[i].center.z + _field[i].val.z * scale_view); - } - glEnd(); - - glColor3f(0, 1, 0); - glPointSize(4.0); - glEnable(GL_POINT_SMOOTH); - glBegin(GL_POINTS); - for (i = 0; i < FIELD_ELEMENTS; i++) { - glVertex3fv(&_field[i].center.x); - } - glEnd(); -} - - - diff --git a/interface/src/Field.h b/interface/src/Field.h deleted file mode 100644 index c85c3d33a4..0000000000 --- a/interface/src/Field.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// Field.h -// interface -// -// Created by Philip Rosedale on 8/23/12. -// Copyright (c) 2012 High Fidelity, Inc. All rights reserved. -// - -#ifndef __interface__Field__ -#define __interface__Field__ - -#include -#include -#include "InterfaceConfig.h" -#include "world.h" -#include "Util.h" - -const int FIELD_ELEMENTS = 1000; - -/// Field is a lattice of vectors uniformly distributed in 3D with FIELD_ELEMENTS^(1/3) per side -class Field { -public: - struct FieldElement { - glm::vec3 val; - glm::vec3 center; - glm::vec3 fld; - } _field[FIELD_ELEMENTS]; - - Field(float worldSize, float coupling); - /// The field value at a position in space, given simply as the value of the enclosing cell - int value(float *ret, float *pos); - /// Visualize the field as vector lines drawn at each center - void render(); - /// Add to the field value cell enclosing a location - void add(float* add, float *loc); - /// A particle with a position and velocity interacts with the field given the coupling - /// constant passed when creating the field. - void interact(float deltaTime, const glm::vec3& pos, glm::vec3& vel); - /// Field evolves over timestep - void simulate(float deltaTime); -private: - float _worldSize; - float _coupling; -}; - -#endif From cc554c53f1ca7f5e86b347a4a964809b294ee8af Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 10:25:15 -0800 Subject: [PATCH 17/32] use Qt Resource System to compile in resources --- interface/CMakeLists.txt | 6 ++- interface/resources/interface.qrc | 70 +++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 interface/resources/interface.qrc diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index b1268e331e..d3a241c675 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -82,11 +82,13 @@ file (GLOB_RECURSE QT_UI_FILES ui/*.ui) # have qt5 wrap them and generate the appropriate header files qt5_wrap_ui(QT_UI_HEADERS "${QT_UI_FILES}") +# use the Qt Resource System to bundle in our resources +qt5_add_resources(QRC_RESOURCE_FILE resources/interface.qrc) + # add them to the interface source files -set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}") +set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}" "${QRC_RESOURCE_FILE}") if (APPLE) - # configure CMake to use a custom Info.plist SET_TARGET_PROPERTIES( ${this_target} PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.in ) diff --git a/interface/resources/interface.qrc b/interface/resources/interface.qrc new file mode 100644 index 0000000000..c0e214509d --- /dev/null +++ b/interface/resources/interface.qrc @@ -0,0 +1,70 @@ + + + config/config.json + html/interface-welcome-allsvg.html + icons/backButton.svg + icons/computer.svg + icons/desktop.svg + icons/documents.svg + icons/file.svg + icons/folder.svg + icons/forwardButton.svg + icons/home.svg + icons/raster.svg + icons/toParentButton.svg + icons/voxel.svg + images/body.png + images/close.png + images/close.svg + images/head.png + images/hifi-interface-tools-v2-pie.svg + images/hifi-interface-tools.svg + images/mic.svg + images/mute.svg + images/reset.png + info/ApplicationInfo.ini + meshes/defaultAvatar_body.fst + meshes/defaultAvatar_head.fst + meshes/defaultAvatar/body.fbx + meshes/defaultAvatar/body.jpg + meshes/defaultAvatar/head.fbx + meshes/defaultAvatar/tail.jpg + meshes/defaultAvatar/visor.png + shaders/ambient_occlusion.frag + shaders/ambient_occlusion.vert + shaders/diffuse.frag + shaders/glow_add_separate.frag + shaders/glow_add.frag + shaders/grid.frag + shaders/horizontal_blur.frag + shaders/metavoxel_point.vert + shaders/model_normal_map.frag + shaders/model_normal_map.vert + shaders/model.frag + shaders/model.vert + shaders/occlusion_blur.frag + shaders/oculus.frag + shaders/passthrough.vert + shaders/perlin_modulate.frag + shaders/perlin_modulate.vert + shaders/point_size.vert + shaders/shadow_map.frag + shaders/skin_model_normal_map.vert + shaders/skin_model.vert + shaders/SkyFromAtmosphere.frag + shaders/SkyFromAtmosphere.vert + shaders/SkyFromSpace.frag + shaders/SkyFromSpace.vert + shaders/vertical_blur_add.frag + shaders/vertical_blur.frag + shaders/voxels.geom + sounds/snap.wav + styles/checked.svg + styles/import_dialog.qss + styles/Inconsolata.otf + styles/log_dialog.qss + styles/search.svg + styles/txt-file.svg + styles/unchecked.svg + + \ No newline at end of file From 403f91c988034d50c4975b9b48549a33043d0d74 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 10:41:11 -0800 Subject: [PATCH 18/32] update resource references to use Qt resource system --- interface/resources/images/close.svg | 16 -- .../resources/images/hifi-interface-tools.svg | 177 ------------------ interface/resources/interface.qrc | 3 - interface/resources/shaders/voxel.geom | 77 -------- interface/resources/styles/import_dialog.qss | 6 +- interface/resources/styles/log_dialog.qss | 8 +- interface/src/Application.cpp | 14 +- interface/src/Audio.cpp | 5 +- interface/src/Environment.cpp | 3 +- interface/src/ImportDialog.cpp | 24 +-- interface/src/InfoView.cpp | 7 +- interface/src/MetavoxelSystem.cpp | 3 +- interface/src/PieMenu.cpp | 1 - interface/src/VoxelSystem.cpp | 7 +- interface/src/avatar/Avatar.cpp | 4 +- interface/src/devices/OculusManager.cpp | 3 +- interface/src/devices/Visage.cpp | 5 +- .../src/renderer/AmbientOcclusionEffect.cpp | 9 +- interface/src/renderer/GlowEffect.cpp | 4 +- interface/src/renderer/Model.cpp | 17 +- interface/src/renderer/PointShader.cpp | 3 +- interface/src/renderer/TextureCache.cpp | 1 - interface/src/renderer/VoxelShader.cpp | 6 +- interface/src/ui/LogDialog.cpp | 3 +- interface/src/ui/MetavoxelEditor.cpp | 4 +- interface/src/ui/RearMirrorTools.cpp | 11 +- libraries/shared/src/SharedUtil.cpp | 15 -- libraries/shared/src/SharedUtil.h | 2 - 28 files changed, 60 insertions(+), 378 deletions(-) delete mode 100644 interface/resources/images/close.svg delete mode 100644 interface/resources/images/hifi-interface-tools.svg delete mode 100644 interface/resources/shaders/voxel.geom diff --git a/interface/resources/images/close.svg b/interface/resources/images/close.svg deleted file mode 100644 index 9c573564e6..0000000000 --- a/interface/resources/images/close.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - close - Created with Sketch (http://www.bohemiancoding.com/sketch) - - - - - - - - - - - - \ No newline at end of file diff --git a/interface/resources/images/hifi-interface-tools.svg b/interface/resources/images/hifi-interface-tools.svg deleted file mode 100644 index 311514581f..0000000000 --- a/interface/resources/images/hifi-interface-tools.svg +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/interface/resources/interface.qrc b/interface/resources/interface.qrc index c0e214509d..5834bceff7 100644 --- a/interface/resources/interface.qrc +++ b/interface/resources/interface.qrc @@ -15,10 +15,8 @@ icons/voxel.svg images/body.png images/close.png - images/close.svg images/head.png images/hifi-interface-tools-v2-pie.svg - images/hifi-interface-tools.svg images/mic.svg images/mute.svg images/reset.png @@ -57,7 +55,6 @@ shaders/SkyFromSpace.vert shaders/vertical_blur_add.frag shaders/vertical_blur.frag - shaders/voxels.geom sounds/snap.wav styles/checked.svg styles/import_dialog.qss diff --git a/interface/resources/shaders/voxel.geom b/interface/resources/shaders/voxel.geom deleted file mode 100644 index ca8f729542..0000000000 --- a/interface/resources/shaders/voxel.geom +++ /dev/null @@ -1,77 +0,0 @@ -#version 120 -#extension GL_ARB_geometry_shader4 : enable - -// -// VOXEL GEOMETRY SHADER -// -// Input: gl_VerticesIn/gl_PositionIn -// GL_POINTS -// Assumes vertex shader has not transformed coordinates -// Each gl_PositionIn is the corner of voxel -// varying voxelSize - which is the voxel size -// -// Note: In vertex shader doesn't do any transform. Therefore passing the 3D world coordinates xyz to us -// -// Output: GL_TRIANGLE_STRIP -// -// Issues: -// how do we need to handle lighting of these colors?? -// how do we handle normals? -// check for size=0 and don't output the primitive -// - -varying in float voxelSize[1]; - -const int VERTICES_PER_FACE = 4; -const int COORD_PER_VERTEX = 3; -const int COORD_PER_FACE = COORD_PER_VERTEX * VERTICES_PER_FACE; - -void faceOfVoxel(vec4 corner, float scale, float[COORD_PER_FACE] facePoints, vec4 color, vec4 normal) { - for (int v = 0; v < VERTICES_PER_FACE; v++ ) { - vec4 vertex = corner; - for (int c = 0; c < COORD_PER_VERTEX; c++ ) { - int cIndex = c + (v * COORD_PER_VERTEX); - vertex[c] += (facePoints[cIndex] * scale); - } - - gl_FrontColor = color * (gl_LightModel.ambient + gl_LightSource[0].ambient + - gl_LightSource[0].diffuse * max(0.0, dot(normal, gl_LightSource[0].position))); - - gl_Position = gl_ModelViewProjectionMatrix * vertex; - EmitVertex(); - } - EndPrimitive(); -} - - -void main() { - //increment variable - int i; - vec4 corner; - float scale; - - float bottomFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1 ); - float topFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ); - float rightFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1 ); - float leftFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1 ); - float frontFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 ); - float backFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1 ); - - vec4 bottomNormal = vec4(0.0, -1, 0.0, 0.0); - vec4 topNormal = vec4(0.0, 1, 0.0, 0.0); - vec4 rightNormal = vec4( -1, 0.0, 0.0, 0.0); - vec4 leftNormal = vec4( 1, 0.0, 0.0, 0.0); - vec4 frontNormal = vec4(0.0, 0.0, -1, 0.0); - vec4 backNormal = vec4(0.0, 0.0, 1, 0.0); - - for(i = 0; i < gl_VerticesIn; i++) { - corner = gl_PositionIn[i]; - scale = voxelSize[i]; - faceOfVoxel(corner, scale, bottomFace, gl_FrontColorIn[i], bottomNormal); - faceOfVoxel(corner, scale, topFace, gl_FrontColorIn[i], topNormal ); - faceOfVoxel(corner, scale, rightFace, gl_FrontColorIn[i], rightNormal ); - faceOfVoxel(corner, scale, leftFace, gl_FrontColorIn[i], leftNormal ); - faceOfVoxel(corner, scale, frontFace, gl_FrontColorIn[i], frontNormal ); - faceOfVoxel(corner, scale, backFace, gl_FrontColorIn[i], backNormal ); - } -} \ No newline at end of file diff --git a/interface/resources/styles/import_dialog.qss b/interface/resources/styles/import_dialog.qss index bb83ce70ed..eaf87b5d4e 100644 --- a/interface/resources/styles/import_dialog.qss +++ b/interface/resources/styles/import_dialog.qss @@ -63,17 +63,17 @@ QPushButton#cancelButton { } #backButton { - background-image: url(resources/icons/backButton.svg); + background-image: url(qrc://icons/backButton.svg); border-radius: 0px; } #forwardButton { - background-image: url(resources/icons/forwardButton.svg); + background-image: url(qrc://icons/forwardButton.svg); border-radius: 0px; } #toParentButton { - background-image: url(resources/icons/toParentButton.svg); + background-image: url(qrc://icons/toParentButton.svg); border-radius: 0px; } diff --git a/interface/resources/styles/log_dialog.qss b/interface/resources/styles/log_dialog.qss index 00f90ca5ed..d3ed5d44fb 100644 --- a/interface/resources/styles/log_dialog.qss +++ b/interface/resources/styles/log_dialog.qss @@ -21,7 +21,7 @@ QLineEdit { } QPushButton#searchButton { - background: url(resources/styles/search.svg); + background: url(qrc://styles/search.svg); background-repeat: none; background-position: left center; background-origin: content; @@ -33,7 +33,7 @@ QPushButton#searchButton { } QPushButton#revealLogButton { - background: url(resources/styles/txt-file.svg); + background: url(qrc://styles/txt-file.svg); background-repeat: none; background-position: left center; background-origin: content; @@ -50,9 +50,9 @@ QCheckBox { } QCheckBox::indicator:unchecked { - image: url(resources/styles/unchecked.svg); + image: url(qrc://styles/unchecked.svg); } QCheckBox::indicator:checked { - image: url(resources/styles/checked.svg); + image: url(qrc://styles/checked.svg); } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6f3e745f21..d610564565 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -153,10 +153,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _resetRecentMaxPacketsSoon(true), _logger(new FileLogger(this)) { - switchToResourcesParentIfRequired(); - // read the ApplicationInfo.ini file for Name/Version/Domain information - QSettings applicationInfo("resources/info/ApplicationInfo.ini", QSettings::IniFormat); + QSettings applicationInfo(":/info/ApplicationInfo.ini", QSettings::IniFormat); // set the associated application properties applicationInfo.beginGroup("INFO"); @@ -174,7 +172,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _applicationStartupTime = startup_time; - QFontDatabase::addApplicationFont("resources/styles/Inconsolata.otf"); + QFontDatabase::addApplicationFont(":/styles/Inconsolata.otf"); _window->setWindowTitle("Interface"); qInstallMessageHandler(messageHandler); @@ -284,9 +282,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : restoreSizeAndPosition(); - QFontDatabase fontDatabase; - fontDatabase.addApplicationFont("resources/styles/Inconsolata.otf"); - _window->setVisible(true); _glWidget->setFocusPolicy(Qt::StrongFocus); _glWidget->setFocus(); @@ -1571,7 +1566,7 @@ void Application::init() { ScriptEngine::getParticlesScriptingInterface(), SLOT(forwardParticleCollisionWithParticle(const ParticleID&, const ParticleID&, const glm::vec3&))); - _pieMenu.init("./resources/images/hifi-interface-tools-v2-pie.svg", + _pieMenu.init(":/images/hifi-interface-tools-v2-pie.svg", _glWidget->width(), _glWidget->height()); @@ -3652,9 +3647,8 @@ void Application::skipVersion(QString latestVersion) { } void Application::takeSnapshot() { - switchToResourcesParentIfRequired(); QMediaPlayer* player = new QMediaPlayer(); - QFileInfo inf = QFileInfo("resources/sounds/snap.wav"); + QFileInfo inf = QFileInfo(":/sounds/snap.wav"); player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); player->play(); diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 66c8dbd5d0..ef2f62509c 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -88,9 +88,8 @@ Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* p } void Audio::init(QGLWidget *parent) { - switchToResourcesParentIfRequired(); - _micTextureId = parent->bindTexture(QImage("./resources/images/mic.svg")); - _muteTextureId = parent->bindTexture(QImage("./resources/images/mute.svg")); + _micTextureId = parent->bindTexture(QImage(":/images/mic.svg")); + _muteTextureId = parent->bindTexture(QImage(":/images/mute.svg")); } void Audio::reset() { diff --git a/interface/src/Environment.cpp b/interface/src/Environment.cpp index 59f16fc5eb..40c6510231 100644 --- a/interface/src/Environment.cpp +++ b/interface/src/Environment.cpp @@ -44,7 +44,6 @@ void Environment::init() { return; } - switchToResourcesParentIfRequired(); _skyFromAtmosphereProgram = createSkyProgram("Atmosphere", _skyFromAtmosphereUniformLocations); _skyFromSpaceProgram = createSkyProgram("Space", _skyFromSpaceUniformLocations); @@ -174,7 +173,7 @@ int Environment::parseData(const HifiSockAddr& senderAddress, const QByteArray& ProgramObject* Environment::createSkyProgram(const char* from, int* locations) { ProgramObject* program = new ProgramObject(); - QByteArray prefix = QByteArray("resources/shaders/SkyFrom") + from; + QByteArray prefix = QByteArray(":/shaders/SkyFrom") + from; program->addShaderFromSourceFile(QGLShader::Vertex, prefix + ".vert"); program->addShaderFromSourceFile(QGLShader::Fragment, prefix + ".frag"); program->link(); diff --git a/interface/src/ImportDialog.cpp b/interface/src/ImportDialog.cpp index 59c8c93f26..9468148831 100644 --- a/interface/src/ImportDialog.cpp +++ b/interface/src/ImportDialog.cpp @@ -27,8 +27,6 @@ const int SECOND_INDEX_LETTER = 1; QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const { - switchToResourcesParentIfRequired(); - // types // Computer, Desktop, Trashcan, Network, Drive, Folder, File QString typeString; @@ -54,30 +52,29 @@ QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const { break; } - return QIcon("resources/icons/" + typeString + ".svg"); + return QIcon(":/icons/" + typeString + ".svg"); } QIcon HiFiIconProvider::icon(const QFileInfo &info) const { - switchToResourcesParentIfRequired(); const QString ext = info.suffix().toLower(); if (info.isDir()) { if (info.absoluteFilePath() == QDir::homePath()) { - return QIcon("resources/icons/home.svg"); + return QIcon(":/icons/home.svg"); } else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) { - return QIcon("resources/icons/desktop.svg"); + return QIcon(":/icons/desktop.svg"); } else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) { - return QIcon("resources/icons/documents.svg"); + return QIcon(":/icons/documents.svg"); } - return QIcon("resources/icons/folder.svg"); + return QIcon(":/icons/folder.svg"); } - QFileInfo iconFile("resources/icons/" + iconsMap[ext]); + QFileInfo iconFile(":/icons/" + iconsMap[ext]); if (iconFile.exists() && iconFile.isFile()) { return QIcon(iconFile.filePath()); } - return QIcon("resources/icons/file.svg"); + return QIcon(":/icons/file.svg"); } QString HiFiIconProvider::type(const QFileInfo &info) const { @@ -245,8 +242,7 @@ void ImportDialog::setLayout() { widget = findChild("treeView"); widget->setAttribute(Qt::WA_MacShowFocusRect, false); - switchToResourcesParentIfRequired(); - QFile styleSheet("resources/styles/import_dialog.qss"); + QFile styleSheet(":/styles/import_dialog.qss"); if (styleSheet.open(QIODevice::ReadOnly)) { setStyleSheet(styleSheet.readAll()); } @@ -254,9 +250,7 @@ void ImportDialog::setLayout() { } void ImportDialog::setImportTypes() { - - switchToResourcesParentIfRequired(); - QFile config("resources/config/config.json"); + QFile config(":/config/config.json"); config.open(QFile::ReadOnly | QFile::Text); QJsonDocument document = QJsonDocument::fromJson(config.readAll()); if (!document.isNull() && !document.isEmpty()) { diff --git a/interface/src/InfoView.cpp b/interface/src/InfoView.cpp index 8de171deef..9336d4f957 100644 --- a/interface/src/InfoView.cpp +++ b/interface/src/InfoView.cpp @@ -18,12 +18,11 @@ #define MAX_DIALOG_HEIGHT_RATIO 0.9 InfoView::InfoView(bool forced) : - _forced(forced) { - + _forced(forced) +{ setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint); - switchToResourcesParentIfRequired(); - QString absPath = QFileInfo("resources/html/interface-welcome-allsvg.html").absoluteFilePath(); + QString absPath = QFileInfo(":/html/interface-welcome-allsvg.html").absoluteFilePath(); QUrl url = QUrl::fromLocalFile(absPath); load(url); diff --git a/interface/src/MetavoxelSystem.cpp b/interface/src/MetavoxelSystem.cpp index eeb92be5ec..fa393a8cfe 100644 --- a/interface/src/MetavoxelSystem.cpp +++ b/interface/src/MetavoxelSystem.cpp @@ -30,8 +30,7 @@ MetavoxelSystem::MetavoxelSystem() : void MetavoxelSystem::init() { if (!_program.isLinked()) { - switchToResourcesParentIfRequired(); - _program.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/metavoxel_point.vert"); + _program.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/metavoxel_point.vert"); _program.link(); _pointScaleLocation = _program.uniformLocation("pointScale"); diff --git a/interface/src/PieMenu.cpp b/interface/src/PieMenu.cpp index d62d0447e1..1a6b775f01 100644 --- a/interface/src/PieMenu.cpp +++ b/interface/src/PieMenu.cpp @@ -25,7 +25,6 @@ PieMenu::PieMenu() : void PieMenu::init(const char *fileName, int screenWidth, int screenHeight) { // Load SVG - switchToResourcesParentIfRequired(); QSvgRenderer renderer((QString) QString(fileName)); // Prepare a QImage with desired characteritisc diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index 1d5a238622..df0147250f 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -496,16 +496,15 @@ void VoxelSystem::initVoxelMemory() { // create our simple fragment shader if we're the first system to init if (!_perlinModulateProgram.isLinked()) { - switchToResourcesParentIfRequired(); - _perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/perlin_modulate.vert"); - _perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/perlin_modulate.frag"); + _perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/perlin_modulate.vert"); + _perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/perlin_modulate.frag"); _perlinModulateProgram.link(); _perlinModulateProgram.bind(); _perlinModulateProgram.setUniformValue("permutationNormalTexture", 0); _perlinModulateProgram.release(); - _shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/shadow_map.frag"); + _shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/shadow_map.frag"); _shadowMapProgram.link(); _shadowMapProgram.bind(); diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 389791e89b..5d01c2acbf 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -577,13 +577,13 @@ bool Avatar::findParticleCollisions(const glm::vec3& particleCenter, float parti void Avatar::setFaceModelURL(const QUrl& faceModelURL) { AvatarData::setFaceModelURL(faceModelURL); - const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile("resources/meshes/defaultAvatar_head.fst"); + const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(":/meshes/defaultAvatar_head.fst"); getHead()->getFaceModel().setURL(_faceModelURL, DEFAULT_FACE_MODEL_URL, true, !isMyAvatar()); } void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) { AvatarData::setSkeletonModelURL(skeletonModelURL); - const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile("resources/meshes/defaultAvatar_body.fst"); + const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile(":/meshes/defaultAvatar_body.fst"); _skeletonModel.setURL(_skeletonModelURL, DEFAULT_SKELETON_MODEL_URL, true, !isMyAvatar()); } diff --git a/interface/src/devices/OculusManager.cpp b/interface/src/devices/OculusManager.cpp index 65c0d9332f..099f195eac 100644 --- a/interface/src/devices/OculusManager.cpp +++ b/interface/src/devices/OculusManager.cpp @@ -57,8 +57,7 @@ void OculusManager::connect() { _hmdDevice->GetDeviceInfo(&info); _stereoConfig.SetHMDInfo(info); - switchToResourcesParentIfRequired(); - _program.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/oculus.frag"); + _program.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/oculus.frag"); _program.link(); _textureLocation = _program.uniformLocation("texture"); diff --git a/interface/src/devices/Visage.cpp b/interface/src/devices/Visage.cpp index f9d3f89552..05607f9ab8 100644 --- a/interface/src/devices/Visage.cpp +++ b/interface/src/devices/Visage.cpp @@ -36,10 +36,9 @@ Visage::Visage() : _estimatedEyeYaw(0.0f) { #ifdef HAVE_VISAGE - switchToResourcesParentIfRequired(); - QByteArray licensePath = "resources/visage/license.vlc"; + QByteArray licensePath = ":/visage/license.vlc"; initializeLicenseManager(licensePath.data()); - _tracker = new VisageTracker2("resources/visage/Facial Features Tracker - Asymmetric.cfg"); + _tracker = new VisageTracker2(":/visage/Facial Features Tracker - Asymmetric.cfg"); if (_tracker->trackFromCam()) { _data = new FaceData(); diff --git a/interface/src/renderer/AmbientOcclusionEffect.cpp b/interface/src/renderer/AmbientOcclusionEffect.cpp index d6848453ec..51c92c9268 100644 --- a/interface/src/renderer/AmbientOcclusionEffect.cpp +++ b/interface/src/renderer/AmbientOcclusionEffect.cpp @@ -25,11 +25,10 @@ const int ROTATION_WIDTH = 4; const int ROTATION_HEIGHT = 4; void AmbientOcclusionEffect::init() { - switchToResourcesParentIfRequired(); _occlusionProgram = new ProgramObject(); - _occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/ambient_occlusion.vert"); - _occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/ambient_occlusion.frag"); + _occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/ambient_occlusion.vert"); + _occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/ambient_occlusion.frag"); _occlusionProgram->link(); // create the sample kernel: an array of spherically distributed offset vectors @@ -78,8 +77,8 @@ void AmbientOcclusionEffect::init() { glBindTexture(GL_TEXTURE_2D, 0); _blurProgram = new ProgramObject(); - _blurProgram->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/ambient_occlusion.vert"); - _blurProgram->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/occlusion_blur.frag"); + _blurProgram->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/ambient_occlusion.vert"); + _blurProgram->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/occlusion_blur.frag"); _blurProgram->link(); _blurProgram->bind(); diff --git a/interface/src/renderer/GlowEffect.cpp b/interface/src/renderer/GlowEffect.cpp index 967f803d61..707ec059e2 100644 --- a/interface/src/renderer/GlowEffect.cpp +++ b/interface/src/renderer/GlowEffect.cpp @@ -42,7 +42,7 @@ QOpenGLFramebufferObject* GlowEffect::getFreeFramebufferObject() const { static ProgramObject* createProgram(const QString& name) { ProgramObject* program = new ProgramObject(); - program->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/" + name + ".frag"); + program->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/" + name + ".frag"); program->link(); program->bind(); @@ -57,8 +57,6 @@ void GlowEffect::init() { qDebug("[ERROR] GlowEffeect is already initialized."); return; } - - switchToResourcesParentIfRequired(); _addProgram = createProgram("glow_add"); _horizontalBlurProgram = createProgram("horizontal_blur"); diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index e1fede84d1..cfeda2d214 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -64,17 +64,16 @@ QVector Model::createJointStates(const FBXGeometry& geometry) void Model::init() { if (!_program.isLinked()) { - switchToResourcesParentIfRequired(); - _program.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/model.vert"); - _program.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/model.frag"); + _program.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/model.vert"); + _program.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model.frag"); _program.link(); _program.bind(); _program.setUniformValue("texture", 0); _program.release(); - _normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/model_normal_map.vert"); - _normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/model_normal_map.frag"); + _normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/model_normal_map.vert"); + _normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model_normal_map.frag"); _normalMapProgram.link(); _normalMapProgram.bind(); @@ -83,14 +82,14 @@ void Model::init() { _normalMapTangentLocation = _normalMapProgram.attributeLocation("tangent"); _normalMapProgram.release(); - _skinProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/skin_model.vert"); - _skinProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/model.frag"); + _skinProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/skin_model.vert"); + _skinProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model.frag"); _skinProgram.link(); initSkinProgram(_skinProgram, _skinLocations); - _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/skin_model_normal_map.vert"); - _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/model_normal_map.frag"); + _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/skin_model_normal_map.vert"); + _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model_normal_map.frag"); _skinNormalMapProgram.link(); initSkinProgram(_skinNormalMapProgram, _skinNormalMapLocations); diff --git a/interface/src/renderer/PointShader.cpp b/interface/src/renderer/PointShader.cpp index ed4225fbcd..6eb0b11212 100644 --- a/interface/src/renderer/PointShader.cpp +++ b/interface/src/renderer/PointShader.cpp @@ -29,7 +29,7 @@ PointShader::~PointShader() { ProgramObject* PointShader::createPointShaderProgram(const QString& name) { ProgramObject* program = new ProgramObject(); - program->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/" + name + ".vert" ); + program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/" + name + ".vert" ); program->link(); return program; } @@ -39,7 +39,6 @@ void PointShader::init() { qDebug("[ERROR] PointShader is already initialized."); return; } - switchToResourcesParentIfRequired(); _program = createPointShaderProgram("point_size"); _initialized = true; } diff --git a/interface/src/renderer/TextureCache.cpp b/interface/src/renderer/TextureCache.cpp index 1c58f93510..00b34b539b 100644 --- a/interface/src/renderer/TextureCache.cpp +++ b/interface/src/renderer/TextureCache.cpp @@ -106,7 +106,6 @@ GLuint TextureCache::getBlueTextureID() { GLuint TextureCache::getFileTextureID(const QString& filename) { GLuint id = _fileTextureIDs.value(filename); if (id == 0) { - switchToResourcesParentIfRequired(); QImage image = QImage(filename).convertToFormat(QImage::Format_ARGB32); glGenTextures(1, &id); diff --git a/interface/src/renderer/VoxelShader.cpp b/interface/src/renderer/VoxelShader.cpp index b630006b4b..56bb99b97f 100644 --- a/interface/src/renderer/VoxelShader.cpp +++ b/interface/src/renderer/VoxelShader.cpp @@ -29,8 +29,8 @@ VoxelShader::~VoxelShader() { ProgramObject* VoxelShader::createGeometryShaderProgram(const QString& name) { ProgramObject* program = new ProgramObject(); - program->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/passthrough.vert" ); - program->addShaderFromSourceFile(QGLShader::Geometry, "resources/shaders/" + name + ".geom" ); + program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/passthrough.vert" ); + program->addShaderFromSourceFile(QGLShader::Geometry, ":/shaders/" + name + ".geom" ); program->setGeometryInputType(GL_POINTS); program->setGeometryOutputType(GL_TRIANGLE_STRIP); const int VERTICES_PER_FACE = 4; @@ -46,7 +46,7 @@ void VoxelShader::init() { qDebug("[ERROR] TestProgram is already initialized."); return; } - switchToResourcesParentIfRequired(); + _program = createGeometryShaderProgram("voxel"); _initialized = true; } diff --git a/interface/src/ui/LogDialog.cpp b/interface/src/ui/LogDialog.cpp index 474b4f034e..f5d6d1d0da 100644 --- a/interface/src/ui/LogDialog.cpp +++ b/interface/src/ui/LogDialog.cpp @@ -36,8 +36,7 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : QDialog setWindowTitle("Log"); setAttribute(Qt::WA_DeleteOnClose); - switchToResourcesParentIfRequired(); - QFile styleSheet("resources/styles/log_dialog.qss"); + QFile styleSheet(":/styles/log_dialog.qss"); if (styleSheet.open(QIODevice::ReadOnly)) { setStyleSheet(styleSheet.readAll()); } diff --git a/interface/src/ui/MetavoxelEditor.cpp b/interface/src/ui/MetavoxelEditor.cpp index 832c6b5d39..46fb7f166b 100644 --- a/interface/src/ui/MetavoxelEditor.cpp +++ b/interface/src/ui/MetavoxelEditor.cpp @@ -113,8 +113,8 @@ MetavoxelEditor::MetavoxelEditor() : if (_gridProgram.isLinked()) { return; } - switchToResourcesParentIfRequired(); - _gridProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/grid.frag"); + + _gridProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/grid.frag"); _gridProgram.link(); } diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index b090987fa0..eaf26a21eb 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -23,12 +23,11 @@ RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* se _windowed(false), _fullScreen(false) { - _zoomLevel = HEAD, - switchToResourcesParentIfRequired(); - _closeTextureId = _parent->bindTexture(QImage("./resources/images/close.png")); - _resetTextureId = _parent->bindTexture(QImage("./resources/images/reset.png")); - _zoomHeadTextureId = _parent->bindTexture(QImage("./resources/images/head.png")); - _zoomBodyTextureId = _parent->bindTexture(QImage("./resources/images/body.png")); + _zoomLevel = HEAD; + _closeTextureId = _parent->bindTexture(QImage(":/images/close.png")); + _resetTextureId = _parent->bindTexture(QImage(":/images/reset.png")); + _zoomHeadTextureId = _parent->bindTexture(QImage(":/images/head.png")); + _zoomBodyTextureId = _parent->bindTexture(QImage(":/images/body.png")); _shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE); _closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE); diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp index 2c531bab91..f80c56fd0c 100644 --- a/libraries/shared/src/SharedUtil.cpp +++ b/libraries/shared/src/SharedUtil.cpp @@ -198,21 +198,6 @@ bool isInEnvironment(const char* environment) { } } -void switchToResourcesParentIfRequired() { -#ifdef __APPLE__ - CFBundleRef mainBundle = CFBundleGetMainBundle(); - CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); - char path[PATH_MAX]; - if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) { - // error! - } - CFRelease(resourcesURL); - - chdir(path); - chdir(".."); -#endif -} - void loadRandomIdentifier(unsigned char* identifierBuffer, int numBytes) { // seed the the random number generator srand(time(NULL)); diff --git a/libraries/shared/src/SharedUtil.h b/libraries/shared/src/SharedUtil.h index c18b2fca08..b08e0413a6 100644 --- a/libraries/shared/src/SharedUtil.h +++ b/libraries/shared/src/SharedUtil.h @@ -93,8 +93,6 @@ int getNthBit(unsigned char byte, int ordinal); /// determines the bit placement bool isInEnvironment(const char* environment); -void switchToResourcesParentIfRequired(); - void loadRandomIdentifier(unsigned char* identifierBuffer, int numBytes); const char* getCmdOption(int argc, const char * argv[],const char* option); From 94a0db04f97c01324eeaa0bea6a5e6a64d0bde9a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 10:41:44 -0800 Subject: [PATCH 19/32] don't copy resources into OS X bundle --- interface/CMakeLists.txt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index d3a241c675..9f7d0f28c3 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -102,17 +102,6 @@ if (APPLE) SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/interface.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/interface.icns") - - # grab the directories in resources and put them in the right spot in Resources - file(GLOB RESOURCE_SUBDIRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/resources" "${CMAKE_CURRENT_SOURCE_DIR}/resources/*") - foreach(DIR ${RESOURCE_SUBDIRS}) - if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/resources/${DIR}") - FILE(GLOB DIR_CONTENTS "resources/${DIR}/*") - SET_SOURCE_FILES_PROPERTIES(${DIR_CONTENTS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${DIR}") - - SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${DIR_CONTENTS}") - endif() - endforeach() endif (APPLE) # create the executable, make it a bundle on OS X From c737283935990cce9199b3a6ba64fc907ac9c8d5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 10:45:47 -0800 Subject: [PATCH 20/32] qrc references should only use a single slash --- interface/resources/styles/import_dialog.qss | 6 +++--- interface/resources/styles/log_dialog.qss | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interface/resources/styles/import_dialog.qss b/interface/resources/styles/import_dialog.qss index eaf87b5d4e..32630fe0e0 100644 --- a/interface/resources/styles/import_dialog.qss +++ b/interface/resources/styles/import_dialog.qss @@ -63,17 +63,17 @@ QPushButton#cancelButton { } #backButton { - background-image: url(qrc://icons/backButton.svg); + background-image: url(qrc:/icons/backButton.svg); border-radius: 0px; } #forwardButton { - background-image: url(qrc://icons/forwardButton.svg); + background-image: url(qrc:/icons/forwardButton.svg); border-radius: 0px; } #toParentButton { - background-image: url(qrc://icons/toParentButton.svg); + background-image: url(qrc:/icons/toParentButton.svg); border-radius: 0px; } diff --git a/interface/resources/styles/log_dialog.qss b/interface/resources/styles/log_dialog.qss index d3ed5d44fb..73582a8518 100644 --- a/interface/resources/styles/log_dialog.qss +++ b/interface/resources/styles/log_dialog.qss @@ -21,7 +21,7 @@ QLineEdit { } QPushButton#searchButton { - background: url(qrc://styles/search.svg); + background: url(qrc:/styles/search.svg); background-repeat: none; background-position: left center; background-origin: content; @@ -33,7 +33,7 @@ QPushButton#searchButton { } QPushButton#revealLogButton { - background: url(qrc://styles/txt-file.svg); + background: url(qrc:/styles/txt-file.svg); background-repeat: none; background-position: left center; background-origin: content; @@ -50,9 +50,9 @@ QCheckBox { } QCheckBox::indicator:unchecked { - image: url(qrc://styles/unchecked.svg); + image: url(qrc:/styles/unchecked.svg); } QCheckBox::indicator:checked { - image: url(qrc://styles/checked.svg); -} + image: url(qrc:/styles/checked.svg); +} \ No newline at end of file From b705ec560f0af08489adab914d9081a43c4a4e92 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 11:46:49 -0800 Subject: [PATCH 21/32] cleanup resources directory references by copying beside the executable --- interface/CMakeLists.txt | 27 +++++-- interface/resources/interface.qrc | 67 ---------------- interface/resources/shaders/voxel.geom | 77 +++++++++++++++++++ interface/resources/styles/import_dialog.qss | 6 +- interface/resources/styles/log_dialog.qss | 8 +- interface/src/Application.cpp | 18 +++-- interface/src/Application.h | 1 + interface/src/Audio.cpp | 4 +- interface/src/Environment.cpp | 3 +- interface/src/ImportDialog.cpp | 23 +++--- interface/src/InfoView.cpp | 2 +- interface/src/MetavoxelSystem.cpp | 2 +- interface/src/PieMenu.cpp | 4 +- interface/src/PieMenu.h | 2 +- interface/src/VoxelSystem.cpp | 9 ++- interface/src/avatar/Avatar.cpp | 4 +- interface/src/devices/OculusManager.cpp | 2 +- interface/src/devices/Visage.cpp | 4 +- .../src/renderer/AmbientOcclusionEffect.cpp | 10 ++- interface/src/renderer/GlowEffect.cpp | 2 +- interface/src/renderer/Model.cpp | 22 ++++-- interface/src/renderer/PointShader.cpp | 2 +- interface/src/renderer/VoxelShader.cpp | 4 +- interface/src/ui/LogDialog.cpp | 4 +- interface/src/ui/MetavoxelEditor.cpp | 2 +- interface/src/ui/RearMirrorTools.cpp | 16 ++-- 26 files changed, 190 insertions(+), 135 deletions(-) delete mode 100644 interface/resources/interface.qrc create mode 100644 interface/resources/shaders/voxel.geom diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 9f7d0f28c3..97e1461df6 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -82,11 +82,8 @@ file (GLOB_RECURSE QT_UI_FILES ui/*.ui) # have qt5 wrap them and generate the appropriate header files qt5_wrap_ui(QT_UI_HEADERS "${QT_UI_FILES}") -# use the Qt Resource System to bundle in our resources -qt5_add_resources(QRC_RESOURCE_FILE resources/interface.qrc) - # add them to the interface source files -set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}" "${QRC_RESOURCE_FILE}") +set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}") if (APPLE) # configure CMake to use a custom Info.plist @@ -100,9 +97,29 @@ if (APPLE) # set where in the bundle to put the resources file SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/interface.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + + # grab the directories in resources and put them in the right spot in Resources + file(GLOB RESOURCE_SUBDIRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/resources" "${CMAKE_CURRENT_SOURCE_DIR}/resources/*") + foreach(DIR ${RESOURCE_SUBDIRS}) + if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/resources/${DIR}") + FILE(GLOB DIR_CONTENTS "resources/${DIR}/*") + SET_SOURCE_FILES_PROPERTIES(${DIR_CONTENTS} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${DIR}") + + SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${DIR_CONTENTS}") + endif() + endforeach() SET(INTERFACE_SRCS ${INTERFACE_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/interface.icns") -endif (APPLE) +elseif() + # remove and then copy the resources files beside the executable + add_custom_command(TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E remove_directory + $/resources) + add_custom_command(TARGET ${TARGET_NAME} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_directory + "${PROJECT_SOURCE_DIR}/resources" + $/resources) +endif() # create the executable, make it a bundle on OS X add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS}) diff --git a/interface/resources/interface.qrc b/interface/resources/interface.qrc deleted file mode 100644 index 5834bceff7..0000000000 --- a/interface/resources/interface.qrc +++ /dev/null @@ -1,67 +0,0 @@ - - - config/config.json - html/interface-welcome-allsvg.html - icons/backButton.svg - icons/computer.svg - icons/desktop.svg - icons/documents.svg - icons/file.svg - icons/folder.svg - icons/forwardButton.svg - icons/home.svg - icons/raster.svg - icons/toParentButton.svg - icons/voxel.svg - images/body.png - images/close.png - images/head.png - images/hifi-interface-tools-v2-pie.svg - images/mic.svg - images/mute.svg - images/reset.png - info/ApplicationInfo.ini - meshes/defaultAvatar_body.fst - meshes/defaultAvatar_head.fst - meshes/defaultAvatar/body.fbx - meshes/defaultAvatar/body.jpg - meshes/defaultAvatar/head.fbx - meshes/defaultAvatar/tail.jpg - meshes/defaultAvatar/visor.png - shaders/ambient_occlusion.frag - shaders/ambient_occlusion.vert - shaders/diffuse.frag - shaders/glow_add_separate.frag - shaders/glow_add.frag - shaders/grid.frag - shaders/horizontal_blur.frag - shaders/metavoxel_point.vert - shaders/model_normal_map.frag - shaders/model_normal_map.vert - shaders/model.frag - shaders/model.vert - shaders/occlusion_blur.frag - shaders/oculus.frag - shaders/passthrough.vert - shaders/perlin_modulate.frag - shaders/perlin_modulate.vert - shaders/point_size.vert - shaders/shadow_map.frag - shaders/skin_model_normal_map.vert - shaders/skin_model.vert - shaders/SkyFromAtmosphere.frag - shaders/SkyFromAtmosphere.vert - shaders/SkyFromSpace.frag - shaders/SkyFromSpace.vert - shaders/vertical_blur_add.frag - shaders/vertical_blur.frag - sounds/snap.wav - styles/checked.svg - styles/import_dialog.qss - styles/Inconsolata.otf - styles/log_dialog.qss - styles/search.svg - styles/txt-file.svg - styles/unchecked.svg - - \ No newline at end of file diff --git a/interface/resources/shaders/voxel.geom b/interface/resources/shaders/voxel.geom new file mode 100644 index 0000000000..ca8f729542 --- /dev/null +++ b/interface/resources/shaders/voxel.geom @@ -0,0 +1,77 @@ +#version 120 +#extension GL_ARB_geometry_shader4 : enable + +// +// VOXEL GEOMETRY SHADER +// +// Input: gl_VerticesIn/gl_PositionIn +// GL_POINTS +// Assumes vertex shader has not transformed coordinates +// Each gl_PositionIn is the corner of voxel +// varying voxelSize - which is the voxel size +// +// Note: In vertex shader doesn't do any transform. Therefore passing the 3D world coordinates xyz to us +// +// Output: GL_TRIANGLE_STRIP +// +// Issues: +// how do we need to handle lighting of these colors?? +// how do we handle normals? +// check for size=0 and don't output the primitive +// + +varying in float voxelSize[1]; + +const int VERTICES_PER_FACE = 4; +const int COORD_PER_VERTEX = 3; +const int COORD_PER_FACE = COORD_PER_VERTEX * VERTICES_PER_FACE; + +void faceOfVoxel(vec4 corner, float scale, float[COORD_PER_FACE] facePoints, vec4 color, vec4 normal) { + for (int v = 0; v < VERTICES_PER_FACE; v++ ) { + vec4 vertex = corner; + for (int c = 0; c < COORD_PER_VERTEX; c++ ) { + int cIndex = c + (v * COORD_PER_VERTEX); + vertex[c] += (facePoints[cIndex] * scale); + } + + gl_FrontColor = color * (gl_LightModel.ambient + gl_LightSource[0].ambient + + gl_LightSource[0].diffuse * max(0.0, dot(normal, gl_LightSource[0].position))); + + gl_Position = gl_ModelViewProjectionMatrix * vertex; + EmitVertex(); + } + EndPrimitive(); +} + + +void main() { + //increment variable + int i; + vec4 corner; + float scale; + + float bottomFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1 ); + float topFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ); + float rightFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1 ); + float leftFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1 ); + float frontFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 ); + float backFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1 ); + + vec4 bottomNormal = vec4(0.0, -1, 0.0, 0.0); + vec4 topNormal = vec4(0.0, 1, 0.0, 0.0); + vec4 rightNormal = vec4( -1, 0.0, 0.0, 0.0); + vec4 leftNormal = vec4( 1, 0.0, 0.0, 0.0); + vec4 frontNormal = vec4(0.0, 0.0, -1, 0.0); + vec4 backNormal = vec4(0.0, 0.0, 1, 0.0); + + for(i = 0; i < gl_VerticesIn; i++) { + corner = gl_PositionIn[i]; + scale = voxelSize[i]; + faceOfVoxel(corner, scale, bottomFace, gl_FrontColorIn[i], bottomNormal); + faceOfVoxel(corner, scale, topFace, gl_FrontColorIn[i], topNormal ); + faceOfVoxel(corner, scale, rightFace, gl_FrontColorIn[i], rightNormal ); + faceOfVoxel(corner, scale, leftFace, gl_FrontColorIn[i], leftNormal ); + faceOfVoxel(corner, scale, frontFace, gl_FrontColorIn[i], frontNormal ); + faceOfVoxel(corner, scale, backFace, gl_FrontColorIn[i], backNormal ); + } +} \ No newline at end of file diff --git a/interface/resources/styles/import_dialog.qss b/interface/resources/styles/import_dialog.qss index 32630fe0e0..8fe04ae1b7 100644 --- a/interface/resources/styles/import_dialog.qss +++ b/interface/resources/styles/import_dialog.qss @@ -63,17 +63,17 @@ QPushButton#cancelButton { } #backButton { - background-image: url(qrc:/icons/backButton.svg); + background-image: url(icons/backButton.svg); border-radius: 0px; } #forwardButton { - background-image: url(qrc:/icons/forwardButton.svg); + background-image: url(icons/forwardButton.svg); border-radius: 0px; } #toParentButton { - background-image: url(qrc:/icons/toParentButton.svg); + background-image: url(icons/toParentButton.svg); border-radius: 0px; } diff --git a/interface/resources/styles/log_dialog.qss b/interface/resources/styles/log_dialog.qss index 73582a8518..b7387c1ee7 100644 --- a/interface/resources/styles/log_dialog.qss +++ b/interface/resources/styles/log_dialog.qss @@ -21,7 +21,7 @@ QLineEdit { } QPushButton#searchButton { - background: url(qrc:/styles/search.svg); + background: url(styles/search.svg); background-repeat: none; background-position: left center; background-origin: content; @@ -33,7 +33,7 @@ QPushButton#searchButton { } QPushButton#revealLogButton { - background: url(qrc:/styles/txt-file.svg); + background: url(styles/txt-file.svg); background-repeat: none; background-position: left center; background-origin: content; @@ -50,9 +50,9 @@ QCheckBox { } QCheckBox::indicator:unchecked { - image: url(qrc:/styles/unchecked.svg); + image: url(:/styles/unchecked.svg); } QCheckBox::indicator:checked { - image: url(qrc:/styles/checked.svg); + image: url(:/styles/checked.svg); } \ No newline at end of file diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d610564565..43082b6660 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -15,7 +15,6 @@ #include #include - #include #include #include @@ -118,6 +117,15 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt } } +QString& Application::resourcesPath() { +#ifdef Q_OS_MAC + static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/../Resources/"; +#else + static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/resources/"; +#endif + return staticResourcePath; +} + Application::Application(int& argc, char** argv, timeval &startup_time) : QApplication(argc, argv), _window(new QMainWindow(desktop())), @@ -154,7 +162,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _logger(new FileLogger(this)) { // read the ApplicationInfo.ini file for Name/Version/Domain information - QSettings applicationInfo(":/info/ApplicationInfo.ini", QSettings::IniFormat); + QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); // set the associated application properties applicationInfo.beginGroup("INFO"); @@ -172,7 +180,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _applicationStartupTime = startup_time; - QFontDatabase::addApplicationFont(":/styles/Inconsolata.otf"); + QFontDatabase::addApplicationFont(Application::resourcesPath() + "styles/Inconsolata.otf"); _window->setWindowTitle("Interface"); qInstallMessageHandler(messageHandler); @@ -1566,7 +1574,7 @@ void Application::init() { ScriptEngine::getParticlesScriptingInterface(), SLOT(forwardParticleCollisionWithParticle(const ParticleID&, const ParticleID&, const glm::vec3&))); - _pieMenu.init(":/images/hifi-interface-tools-v2-pie.svg", + _pieMenu.init(Application::resourcesPath() + "images/hifi-interface-tools-v2-pie.svg", _glWidget->width(), _glWidget->height()); @@ -3648,7 +3656,7 @@ void Application::skipVersion(QString latestVersion) { void Application::takeSnapshot() { QMediaPlayer* player = new QMediaPlayer(); - QFileInfo inf = QFileInfo(":/sounds/snap.wav"); + QFileInfo inf = QFileInfo(Application::resourcesPath() + "sounds/snap.wav"); player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); player->play(); diff --git a/interface/src/Application.h b/interface/src/Application.h index 8c64da86b6..d95bcc9153 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -108,6 +108,7 @@ class Application : public QApplication { public: static Application* getInstance() { return static_cast(QCoreApplication::instance()); } + static QString& resourcesPath(); Application(int& argc, char** argv, timeval &startup_time); ~Application(); diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index ef2f62509c..7f6f1bcb05 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -88,8 +88,8 @@ Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* p } void Audio::init(QGLWidget *parent) { - _micTextureId = parent->bindTexture(QImage(":/images/mic.svg")); - _muteTextureId = parent->bindTexture(QImage(":/images/mute.svg")); + _micTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mic.svg")); + _muteTextureId = parent->bindTexture(QImage(Application::resourcesPath() + "images/mute.svg")); } void Audio::reset() { diff --git a/interface/src/Environment.cpp b/interface/src/Environment.cpp index 40c6510231..7609608a2a 100644 --- a/interface/src/Environment.cpp +++ b/interface/src/Environment.cpp @@ -13,6 +13,7 @@ #include #include +#include "Application.h" #include "Camera.h" #include "Environment.h" #include "renderer/ProgramObject.h" @@ -173,7 +174,7 @@ int Environment::parseData(const HifiSockAddr& senderAddress, const QByteArray& ProgramObject* Environment::createSkyProgram(const char* from, int* locations) { ProgramObject* program = new ProgramObject(); - QByteArray prefix = QByteArray(":/shaders/SkyFrom") + from; + QByteArray prefix = QString(Application::resourcesPath() + "/shaders/SkyFrom" + from).toUtf8(); program->addShaderFromSourceFile(QGLShader::Vertex, prefix + ".vert"); program->addShaderFromSourceFile(QGLShader::Fragment, prefix + ".frag"); program->link(); diff --git a/interface/src/ImportDialog.cpp b/interface/src/ImportDialog.cpp index 9468148831..aa6d7e003e 100644 --- a/interface/src/ImportDialog.cpp +++ b/interface/src/ImportDialog.cpp @@ -5,7 +5,6 @@ // Created by Clement Brisset on 8/12/13. // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. // -#include "ImportDialog.h" #include #include @@ -14,6 +13,9 @@ #include #include +#include "Application.h" +#include "ImportDialog.h" + const QString WINDOW_NAME = QObject::tr("Import Voxels"); const QString IMPORT_BUTTON_NAME = QObject::tr("Import Voxels"); const QString LOADING_BUTTON_NAME = QObject::tr("Loading ..."); @@ -52,7 +54,7 @@ QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const { break; } - return QIcon(":/icons/" + typeString + ".svg"); + return QIcon(Application::resourcesPath() + "icons/" + typeString + ".svg"); } QIcon HiFiIconProvider::icon(const QFileInfo &info) const { @@ -60,21 +62,21 @@ QIcon HiFiIconProvider::icon(const QFileInfo &info) const { if (info.isDir()) { if (info.absoluteFilePath() == QDir::homePath()) { - return QIcon(":/icons/home.svg"); + return QIcon(Application::resourcesPath() + "icons/home.svg"); } else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) { - return QIcon(":/icons/desktop.svg"); + return QIcon(Application::resourcesPath() + "icons/desktop.svg"); } else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) { - return QIcon(":/icons/documents.svg"); + return QIcon(Application::resourcesPath() + "icons/documents.svg"); } - return QIcon(":/icons/folder.svg"); + return QIcon(Application::resourcesPath() + "icons/folder.svg"); } - QFileInfo iconFile(":/icons/" + iconsMap[ext]); + QFileInfo iconFile(Application::resourcesPath() + "icons/" + iconsMap[ext]); if (iconFile.exists() && iconFile.isFile()) { return QIcon(iconFile.filePath()); } - return QIcon(":/icons/file.svg"); + return QIcon(Application::resourcesPath() + "icons/file.svg"); } QString HiFiIconProvider::type(const QFileInfo &info) const { @@ -242,15 +244,16 @@ void ImportDialog::setLayout() { widget = findChild("treeView"); widget->setAttribute(Qt::WA_MacShowFocusRect, false); - QFile styleSheet(":/styles/import_dialog.qss"); + QFile styleSheet(Application::resourcesPath() + "styles/import_dialog.qss"); if (styleSheet.open(QIODevice::ReadOnly)) { + QDir::setCurrent(Application::resourcesPath()); setStyleSheet(styleSheet.readAll()); } } void ImportDialog::setImportTypes() { - QFile config(":/config/config.json"); + QFile config(Application::resourcesPath() + "config/config.json"); config.open(QFile::ReadOnly | QFile::Text); QJsonDocument document = QJsonDocument::fromJson(config.readAll()); if (!document.isNull() && !document.isEmpty()) { diff --git a/interface/src/InfoView.cpp b/interface/src/InfoView.cpp index 9336d4f957..fbf63666d8 100644 --- a/interface/src/InfoView.cpp +++ b/interface/src/InfoView.cpp @@ -22,7 +22,7 @@ InfoView::InfoView(bool forced) : { setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint); - QString absPath = QFileInfo(":/html/interface-welcome-allsvg.html").absoluteFilePath(); + QString absPath = QFileInfo(Application::resourcesPath() + "html/interface-welcome-allsvg.html").absoluteFilePath(); QUrl url = QUrl::fromLocalFile(absPath); load(url); diff --git a/interface/src/MetavoxelSystem.cpp b/interface/src/MetavoxelSystem.cpp index fa393a8cfe..41b4dde73e 100644 --- a/interface/src/MetavoxelSystem.cpp +++ b/interface/src/MetavoxelSystem.cpp @@ -30,7 +30,7 @@ MetavoxelSystem::MetavoxelSystem() : void MetavoxelSystem::init() { if (!_program.isLinked()) { - _program.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/metavoxel_point.vert"); + _program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/metavoxel_point.vert"); _program.link(); _pointScaleLocation = _program.uniformLocation("pointScale"); diff --git a/interface/src/PieMenu.cpp b/interface/src/PieMenu.cpp index 1a6b775f01..f832de4f98 100644 --- a/interface/src/PieMenu.cpp +++ b/interface/src/PieMenu.cpp @@ -23,9 +23,9 @@ PieMenu::PieMenu() : _isDisplayed(false) { } -void PieMenu::init(const char *fileName, int screenWidth, int screenHeight) { +void PieMenu::init(const QString& fileName, int screenWidth, int screenHeight) { // Load SVG - QSvgRenderer renderer((QString) QString(fileName)); + QSvgRenderer renderer(fileName); // Prepare a QImage with desired characteritisc QImage image(2 * _radiusExtern, 2 * _radiusExtern, QImage::Format_ARGB32); diff --git a/interface/src/PieMenu.h b/interface/src/PieMenu.h index f80f94f5d4..c9ed6c54c6 100644 --- a/interface/src/PieMenu.h +++ b/interface/src/PieMenu.h @@ -22,7 +22,7 @@ class PieMenu { public: PieMenu(); - void init(const char* fileName, int screenWidth, int screenHeight); + void init(const QString& fileName, int screenWidth, int screenHeight); void addAction(QAction* action); void render(); void resize(int screenWidth, int screenHeight); diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index df0147250f..aa628bac7b 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -496,15 +496,18 @@ void VoxelSystem::initVoxelMemory() { // create our simple fragment shader if we're the first system to init if (!_perlinModulateProgram.isLinked()) { - _perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/perlin_modulate.vert"); - _perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/perlin_modulate.frag"); + _perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + + "shaders/perlin_modulate.vert"); + _perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + + "shaders/perlin_modulate.frag"); _perlinModulateProgram.link(); _perlinModulateProgram.bind(); _perlinModulateProgram.setUniformValue("permutationNormalTexture", 0); _perlinModulateProgram.release(); - _shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/shadow_map.frag"); + _shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + + "shaders/shadow_map.frag"); _shadowMapProgram.link(); _shadowMapProgram.bind(); diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 5d01c2acbf..d00716ced7 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -577,13 +577,13 @@ bool Avatar::findParticleCollisions(const glm::vec3& particleCenter, float parti void Avatar::setFaceModelURL(const QUrl& faceModelURL) { AvatarData::setFaceModelURL(faceModelURL); - const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(":/meshes/defaultAvatar_head.fst"); + const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(Application::resourcesPath() + "meshes/defaultAvatar_head.fst"); getHead()->getFaceModel().setURL(_faceModelURL, DEFAULT_FACE_MODEL_URL, true, !isMyAvatar()); } void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) { AvatarData::setSkeletonModelURL(skeletonModelURL); - const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile(":/meshes/defaultAvatar_body.fst"); + const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile(Application::resourcesPath() + "meshes/defaultAvatar_body.fst"); _skeletonModel.setURL(_skeletonModelURL, DEFAULT_SKELETON_MODEL_URL, true, !isMyAvatar()); } diff --git a/interface/src/devices/OculusManager.cpp b/interface/src/devices/OculusManager.cpp index 099f195eac..0f937995b9 100644 --- a/interface/src/devices/OculusManager.cpp +++ b/interface/src/devices/OculusManager.cpp @@ -57,7 +57,7 @@ void OculusManager::connect() { _hmdDevice->GetDeviceInfo(&info); _stereoConfig.SetHMDInfo(info); - _program.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/oculus.frag"); + _program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/oculus.frag"); _program.link(); _textureLocation = _program.uniformLocation("texture"); diff --git a/interface/src/devices/Visage.cpp b/interface/src/devices/Visage.cpp index 05607f9ab8..348858bf3b 100644 --- a/interface/src/devices/Visage.cpp +++ b/interface/src/devices/Visage.cpp @@ -36,9 +36,9 @@ Visage::Visage() : _estimatedEyeYaw(0.0f) { #ifdef HAVE_VISAGE - QByteArray licensePath = ":/visage/license.vlc"; + QByteArray licensePath = Application::resourcesPath() + "visage/license.vlc"; initializeLicenseManager(licensePath.data()); - _tracker = new VisageTracker2(":/visage/Facial Features Tracker - Asymmetric.cfg"); + _tracker = new VisageTracker2(Application::resourcesPath() + "visage/Facial Features Tracker - Asymmetric.cfg"); if (_tracker->trackFromCam()) { _data = new FaceData(); diff --git a/interface/src/renderer/AmbientOcclusionEffect.cpp b/interface/src/renderer/AmbientOcclusionEffect.cpp index 51c92c9268..4a4df762cc 100644 --- a/interface/src/renderer/AmbientOcclusionEffect.cpp +++ b/interface/src/renderer/AmbientOcclusionEffect.cpp @@ -27,8 +27,10 @@ const int ROTATION_HEIGHT = 4; void AmbientOcclusionEffect::init() { _occlusionProgram = new ProgramObject(); - _occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/ambient_occlusion.vert"); - _occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/ambient_occlusion.frag"); + _occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + + "shaders/ambient_occlusion.vert"); + _occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + + "shaders/ambient_occlusion.frag"); _occlusionProgram->link(); // create the sample kernel: an array of spherically distributed offset vectors @@ -77,8 +79,8 @@ void AmbientOcclusionEffect::init() { glBindTexture(GL_TEXTURE_2D, 0); _blurProgram = new ProgramObject(); - _blurProgram->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/ambient_occlusion.vert"); - _blurProgram->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/occlusion_blur.frag"); + _blurProgram->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/ambient_occlusion.vert"); + _blurProgram->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/occlusion_blur.frag"); _blurProgram->link(); _blurProgram->bind(); diff --git a/interface/src/renderer/GlowEffect.cpp b/interface/src/renderer/GlowEffect.cpp index 707ec059e2..f926a81941 100644 --- a/interface/src/renderer/GlowEffect.cpp +++ b/interface/src/renderer/GlowEffect.cpp @@ -42,7 +42,7 @@ QOpenGLFramebufferObject* GlowEffect::getFreeFramebufferObject() const { static ProgramObject* createProgram(const QString& name) { ProgramObject* program = new ProgramObject(); - program->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/" + name + ".frag"); + program->addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/" + name + ".frag"); program->link(); program->bind(); diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index cfeda2d214..c4e927dce5 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -64,16 +64,18 @@ QVector Model::createJointStates(const FBXGeometry& geometry) void Model::init() { if (!_program.isLinked()) { - _program.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/model.vert"); - _program.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model.frag"); + _program.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/model.vert"); + _program.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/model.frag"); _program.link(); _program.bind(); _program.setUniformValue("texture", 0); _program.release(); - _normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/model_normal_map.vert"); - _normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model_normal_map.frag"); + _normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + + "shaders/model_normal_map.vert"); + _normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + + "shaders/model_normal_map.frag"); _normalMapProgram.link(); _normalMapProgram.bind(); @@ -82,14 +84,18 @@ void Model::init() { _normalMapTangentLocation = _normalMapProgram.attributeLocation("tangent"); _normalMapProgram.release(); - _skinProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/skin_model.vert"); - _skinProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model.frag"); + _skinProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + + "shaders/skin_model.vert"); + _skinProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + + "shaders/model.frag"); _skinProgram.link(); initSkinProgram(_skinProgram, _skinLocations); - _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/skin_model_normal_map.vert"); - _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model_normal_map.frag"); + _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + + "shaders/skin_model_normal_map.vert"); + _skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + + "shaders/model_normal_map.frag"); _skinNormalMapProgram.link(); initSkinProgram(_skinNormalMapProgram, _skinNormalMapLocations); diff --git a/interface/src/renderer/PointShader.cpp b/interface/src/renderer/PointShader.cpp index 6eb0b11212..6dd4aae485 100644 --- a/interface/src/renderer/PointShader.cpp +++ b/interface/src/renderer/PointShader.cpp @@ -29,7 +29,7 @@ PointShader::~PointShader() { ProgramObject* PointShader::createPointShaderProgram(const QString& name) { ProgramObject* program = new ProgramObject(); - program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/" + name + ".vert" ); + program->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/" + name + ".vert" ); program->link(); return program; } diff --git a/interface/src/renderer/VoxelShader.cpp b/interface/src/renderer/VoxelShader.cpp index 56bb99b97f..fab40fc338 100644 --- a/interface/src/renderer/VoxelShader.cpp +++ b/interface/src/renderer/VoxelShader.cpp @@ -29,8 +29,8 @@ VoxelShader::~VoxelShader() { ProgramObject* VoxelShader::createGeometryShaderProgram(const QString& name) { ProgramObject* program = new ProgramObject(); - program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/passthrough.vert" ); - program->addShaderFromSourceFile(QGLShader::Geometry, ":/shaders/" + name + ".geom" ); + program->addShaderFromSourceFile(QGLShader::Vertex, Application::resourcesPath() + "shaders/passthrough.vert" ); + program->addShaderFromSourceFile(QGLShader::Geometry, Application::resourcesPath() + "shaders/" + name + ".geom" ); program->setGeometryInputType(GL_POINTS); program->setGeometryOutputType(GL_TRIANGLE_STRIP); const int VERTICES_PER_FACE = 4; diff --git a/interface/src/ui/LogDialog.cpp b/interface/src/ui/LogDialog.cpp index f5d6d1d0da..f5930fc5a3 100644 --- a/interface/src/ui/LogDialog.cpp +++ b/interface/src/ui/LogDialog.cpp @@ -10,6 +10,7 @@ #include #include +#include "Application.h" #include "SharedUtil.h" #include "ui/LogDialog.h" @@ -36,8 +37,9 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : QDialog setWindowTitle("Log"); setAttribute(Qt::WA_DeleteOnClose); - QFile styleSheet(":/styles/log_dialog.qss"); + QFile styleSheet(Application::resourcesPath() + "styles/log_dialog.qss"); if (styleSheet.open(QIODevice::ReadOnly)) { + QDir::setCurrent(Application::resourcesPath()); setStyleSheet(styleSheet.readAll()); } diff --git a/interface/src/ui/MetavoxelEditor.cpp b/interface/src/ui/MetavoxelEditor.cpp index 46fb7f166b..43d48da12a 100644 --- a/interface/src/ui/MetavoxelEditor.cpp +++ b/interface/src/ui/MetavoxelEditor.cpp @@ -114,7 +114,7 @@ MetavoxelEditor::MetavoxelEditor() : return; } - _gridProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/grid.frag"); + _gridProgram.addShaderFromSourceFile(QGLShader::Fragment, Application::resourcesPath() + "shaders/grid.frag"); _gridProgram.link(); } diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index eaf26a21eb..0ea53c0138 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -5,11 +5,13 @@ // Created by stojce on 23.10.2013. // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. -#include "RearMirrorTools.h" -#include "Util.h" +#include #include -#include + +#include "Application.h" +#include "RearMirrorTools.h" +#include "Util.h" const char SETTINGS_GROUP_NAME[] = "Rear View Tools"; const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel"; @@ -24,10 +26,10 @@ RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* se _fullScreen(false) { _zoomLevel = HEAD; - _closeTextureId = _parent->bindTexture(QImage(":/images/close.png")); - _resetTextureId = _parent->bindTexture(QImage(":/images/reset.png")); - _zoomHeadTextureId = _parent->bindTexture(QImage(":/images/head.png")); - _zoomBodyTextureId = _parent->bindTexture(QImage(":/images/body.png")); + _closeTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/close.png")); + _resetTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/reset.png")); + _zoomHeadTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/head.png")); + _zoomBodyTextureId = _parent->bindTexture(QImage(Application::resourcesPath() + "images/body.png")); _shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE); _closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE); From dde2b199c961663acb89e7b6236443f5296ae1fd Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 12:14:14 -0800 Subject: [PATCH 22/32] include InterfaceConfig before Application to fix win build --- interface/src/Environment.cpp | 1 + interface/src/ImportDialog.cpp | 1 + interface/src/ui/LogDialog.cpp | 1 + interface/src/ui/RearMirrorTools.cpp | 2 ++ 4 files changed, 5 insertions(+) diff --git a/interface/src/Environment.cpp b/interface/src/Environment.cpp index 7609608a2a..818accc393 100644 --- a/interface/src/Environment.cpp +++ b/interface/src/Environment.cpp @@ -13,6 +13,7 @@ #include #include +#include "InterfaceConfig.h" #include "Application.h" #include "Camera.h" #include "Environment.h" diff --git a/interface/src/ImportDialog.cpp b/interface/src/ImportDialog.cpp index aa6d7e003e..e50e71e96c 100644 --- a/interface/src/ImportDialog.cpp +++ b/interface/src/ImportDialog.cpp @@ -13,6 +13,7 @@ #include #include +#include "InterfaceConfig.h" #include "Application.h" #include "ImportDialog.h" diff --git a/interface/src/ui/LogDialog.cpp b/interface/src/ui/LogDialog.cpp index f5930fc5a3..94c2719bef 100644 --- a/interface/src/ui/LogDialog.cpp +++ b/interface/src/ui/LogDialog.cpp @@ -10,6 +10,7 @@ #include #include +#include "InterfaceConfig.h" #include "Application.h" #include "SharedUtil.h" #include "ui/LogDialog.h" diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index 0ea53c0138..f6f8e8857d 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -9,6 +9,8 @@ #include +#include "InterfaceConfig.h" + #include "Application.h" #include "RearMirrorTools.h" #include "Util.h" From e7b166a3048b6559322bf3aa6bcbaa3889043c88 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 12:35:20 -0800 Subject: [PATCH 23/32] Revert "include InterfaceConfig before Application to fix win build" This reverts commit dde2b199c961663acb89e7b6236443f5296ae1fd. --- interface/src/Environment.cpp | 1 - interface/src/ImportDialog.cpp | 1 - interface/src/ui/LogDialog.cpp | 1 - interface/src/ui/RearMirrorTools.cpp | 2 -- 4 files changed, 5 deletions(-) diff --git a/interface/src/Environment.cpp b/interface/src/Environment.cpp index 818accc393..7609608a2a 100644 --- a/interface/src/Environment.cpp +++ b/interface/src/Environment.cpp @@ -13,7 +13,6 @@ #include #include -#include "InterfaceConfig.h" #include "Application.h" #include "Camera.h" #include "Environment.h" diff --git a/interface/src/ImportDialog.cpp b/interface/src/ImportDialog.cpp index e50e71e96c..aa6d7e003e 100644 --- a/interface/src/ImportDialog.cpp +++ b/interface/src/ImportDialog.cpp @@ -13,7 +13,6 @@ #include #include -#include "InterfaceConfig.h" #include "Application.h" #include "ImportDialog.h" diff --git a/interface/src/ui/LogDialog.cpp b/interface/src/ui/LogDialog.cpp index 94c2719bef..f5930fc5a3 100644 --- a/interface/src/ui/LogDialog.cpp +++ b/interface/src/ui/LogDialog.cpp @@ -10,7 +10,6 @@ #include #include -#include "InterfaceConfig.h" #include "Application.h" #include "SharedUtil.h" #include "ui/LogDialog.h" diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index f6f8e8857d..0ea53c0138 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -9,8 +9,6 @@ #include -#include "InterfaceConfig.h" - #include "Application.h" #include "RearMirrorTools.h" #include "Util.h" From b670859aaa5e7044459b216ee84151dfcf73b431 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 12:46:06 -0800 Subject: [PATCH 24/32] reference SharedUtil from LogDialog as a library header --- interface/src/ui/LogDialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/ui/LogDialog.cpp b/interface/src/ui/LogDialog.cpp index f5930fc5a3..1cff7b24f0 100644 --- a/interface/src/ui/LogDialog.cpp +++ b/interface/src/ui/LogDialog.cpp @@ -10,8 +10,9 @@ #include #include +#include + #include "Application.h" -#include "SharedUtil.h" #include "ui/LogDialog.h" const int TOP_BAR_HEIGHT = 46; From 06743f771f312a1a49df8fdd9d3def7ad268df95 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 12:49:01 -0800 Subject: [PATCH 25/32] remove a double InterfaceConfig incldue in AmbientOcclusionEffect --- interface/src/renderer/AmbientOcclusionEffect.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/renderer/AmbientOcclusionEffect.cpp b/interface/src/renderer/AmbientOcclusionEffect.cpp index 4a4df762cc..8a150a3eba 100644 --- a/interface/src/renderer/AmbientOcclusionEffect.cpp +++ b/interface/src/renderer/AmbientOcclusionEffect.cpp @@ -17,7 +17,6 @@ #include "AmbientOcclusionEffect.h" #include "Application.h" -#include "InterfaceConfig.h" #include "ProgramObject.h" #include "RenderUtil.h" From 1bcb595f57975f720a35ccd02d10d973c5e086b6 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 13:52:06 -0800 Subject: [PATCH 26/32] add missing interface config includes for windows --- interface/src/Environment.h | 3 ++- interface/src/ImportDialog.h | 2 ++ interface/src/ui/LogDialog.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/interface/src/Environment.h b/interface/src/Environment.h index 273ee54cee..8f9522cd8e 100644 --- a/interface/src/Environment.h +++ b/interface/src/Environment.h @@ -9,13 +9,14 @@ #ifndef __interface__Environment__ #define __interface__Environment__ +#include "InterfaceConfig.h" + #include #include #include #include "EnvironmentData.h" -#include "InterfaceConfig.h" class Camera; class ProgramObject; diff --git a/interface/src/ImportDialog.h b/interface/src/ImportDialog.h index 910cd8f789..278fac932d 100644 --- a/interface/src/ImportDialog.h +++ b/interface/src/ImportDialog.h @@ -9,6 +9,8 @@ #ifndef __hifi__ImportDialog__ #define __hifi__ImportDialog__ +#include "InterfaceConfig.h" + #include #include #include diff --git a/interface/src/ui/LogDialog.h b/interface/src/ui/LogDialog.h index 17216db0c4..5138e231c7 100644 --- a/interface/src/ui/LogDialog.h +++ b/interface/src/ui/LogDialog.h @@ -9,6 +9,8 @@ #ifndef __interface__LogDialog__ #define __interface__LogDialog__ +#include "InterfaceConfig.h" + #include #include #include From 1468bd1b497d0e9df2d7696ef95301a2b66ac1d9 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 6 Mar 2014 14:31:13 -0800 Subject: [PATCH 27/32] Add a five second download timeout timer: if that much time passes without any progress, consider it an error. --- libraries/shared/src/ResourceCache.cpp | 40 +++++++++++++++++++------- libraries/shared/src/ResourceCache.h | 6 ++++ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/libraries/shared/src/ResourceCache.cpp b/libraries/shared/src/ResourceCache.cpp index bd08b240c5..869f503175 100644 --- a/libraries/shared/src/ResourceCache.cpp +++ b/libraries/shared/src/ResourceCache.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include @@ -156,25 +155,51 @@ void Resource::finishedLoading(bool success) { _loadPriorities.clear(); } +const int REPLY_TIMEOUT_MS = 5000; + void Resource::handleDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) { if (!_reply->isFinished()) { + _replyTimer->start(REPLY_TIMEOUT_MS); return; } _reply->disconnect(this); QNetworkReply* reply = _reply; _reply = NULL; + _replyTimer->disconnect(this); + _replyTimer->deleteLater(); + _replyTimer = NULL; ResourceCache::requestCompleted(); downloadFinished(reply); } void Resource::handleReplyError() { - QDebug debug = qDebug() << _reply->errorString(); + handleReplyError(_reply->error(), qDebug() << _reply->errorString()); +} + +void Resource::handleReplyTimeout() { + handleReplyError(QNetworkReply::TimeoutError, qDebug() << "Timed out loading" << _reply->url()); +} + +void Resource::makeRequest() { + _reply = ResourceCache::getNetworkAccessManager()->get(_request); - QNetworkReply::NetworkError error = _reply->error(); + connect(_reply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(handleDownloadProgress(qint64,qint64))); + connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleReplyError())); + + _replyTimer = new QTimer(this); + connect(_replyTimer, SIGNAL(timeout()), SLOT(handleReplyTimeout())); + _replyTimer->setSingleShot(true); + _replyTimer->start(REPLY_TIMEOUT_MS); +} + +void Resource::handleReplyError(QNetworkReply::NetworkError error, QDebug debug) { _reply->disconnect(this); _reply->deleteLater(); _reply = NULL; + _replyTimer->disconnect(this); + _replyTimer->deleteLater(); + _replyTimer = NULL; ResourceCache::requestCompleted(); // retry for certain types of failures @@ -193,7 +218,7 @@ void Resource::handleReplyError() { const int BASE_DELAY_MS = 1000; if (++_attempts < MAX_ATTEMPTS) { QTimer::singleShot(BASE_DELAY_MS * (int)pow(2.0, _attempts), this, SLOT(attemptRequest())); - debug << " -- retrying..."; + debug << "-- retrying..."; return; } // fall through to final failure @@ -204,13 +229,6 @@ void Resource::handleReplyError() { } } -void Resource::makeRequest() { - _reply = ResourceCache::getNetworkAccessManager()->get(_request); - - connect(_reply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(handleDownloadProgress(qint64,qint64))); - connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleReplyError())); -} - uint qHash(const QPointer& value, uint seed) { return qHash(value.data(), seed); } diff --git a/libraries/shared/src/ResourceCache.h b/libraries/shared/src/ResourceCache.h index c77318aac2..398f4afb29 100644 --- a/libraries/shared/src/ResourceCache.h +++ b/libraries/shared/src/ResourceCache.h @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -20,6 +21,7 @@ class QNetworkAccessManager; class QNetworkReply; +class QTimer; class Resource; @@ -116,14 +118,18 @@ private slots: void handleDownloadProgress(qint64 bytesReceived, qint64 bytesTotal); void handleReplyError(); + void handleReplyTimeout(); private: void makeRequest(); + void handleReplyError(QNetworkReply::NetworkError error, QDebug debug); + friend class ResourceCache; QNetworkReply* _reply; + QTimer* _replyTimer; int _attempts; }; From 0b2c3997134fd54e76e781c68fd79702a3670153 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 6 Mar 2014 14:33:59 -0800 Subject: [PATCH 28/32] memcmp() returns a signed int! --- libraries/shared/src/OctalCode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/shared/src/OctalCode.cpp b/libraries/shared/src/OctalCode.cpp index 4edf7be1ed..ba0a001fb9 100644 --- a/libraries/shared/src/OctalCode.cpp +++ b/libraries/shared/src/OctalCode.cpp @@ -176,7 +176,7 @@ OctalCodeComparison compareOctalCodes(const unsigned char* codeA, const unsigned OctalCodeComparison result = LESS_THAN; // assume it's shallower size_t numberOfBytes = std::min(bytesRequiredForCodeLength(*codeA), bytesRequiredForCodeLength(*codeB)); - size_t compare = memcmp(codeA, codeB, numberOfBytes); + int compare = memcmp(codeA, codeB, numberOfBytes); if (compare < 0) { result = LESS_THAN; From 8ec7a5e60078b233bd084a23a49c6a84112b11fd Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 6 Mar 2014 15:08:34 -0800 Subject: [PATCH 29/32] When we time out, report the last received/total counts. --- libraries/shared/src/ResourceCache.cpp | 6 +++++- libraries/shared/src/ResourceCache.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/shared/src/ResourceCache.cpp b/libraries/shared/src/ResourceCache.cpp index 869f503175..a7c0302a9c 100644 --- a/libraries/shared/src/ResourceCache.cpp +++ b/libraries/shared/src/ResourceCache.cpp @@ -159,6 +159,8 @@ const int REPLY_TIMEOUT_MS = 5000; void Resource::handleDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) { if (!_reply->isFinished()) { + _bytesReceived = bytesReceived; + _bytesTotal = bytesTotal; _replyTimer->start(REPLY_TIMEOUT_MS); return; } @@ -178,7 +180,8 @@ void Resource::handleReplyError() { } void Resource::handleReplyTimeout() { - handleReplyError(QNetworkReply::TimeoutError, qDebug() << "Timed out loading" << _reply->url()); + handleReplyError(QNetworkReply::TimeoutError, qDebug() << "Timed out loading" << _reply->url() << + "received" << _bytesReceived << "total" << _bytesTotal); } void Resource::makeRequest() { @@ -191,6 +194,7 @@ void Resource::makeRequest() { connect(_replyTimer, SIGNAL(timeout()), SLOT(handleReplyTimeout())); _replyTimer->setSingleShot(true); _replyTimer->start(REPLY_TIMEOUT_MS); + _bytesReceived = _bytesTotal = 0; } void Resource::handleReplyError(QNetworkReply::NetworkError error, QDebug debug) { diff --git a/libraries/shared/src/ResourceCache.h b/libraries/shared/src/ResourceCache.h index 398f4afb29..8aed2bfcb0 100644 --- a/libraries/shared/src/ResourceCache.h +++ b/libraries/shared/src/ResourceCache.h @@ -130,6 +130,8 @@ private: QNetworkReply* _reply; QTimer* _replyTimer; + qint64 _bytesReceived; + qint64 _bytesTotal; int _attempts; }; From 4a1cb63d7bb73dd85f72e9cbb47c8614da4575ee Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 15:09:35 -0800 Subject: [PATCH 30/32] remove an blank line in Application headers --- interface/src/Application.h | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/Application.h b/interface/src/Application.h index 280aa09679..0837ea92e3 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -30,7 +30,6 @@ #include #include "Audio.h" - #include "BandwidthMeter.h" #include "BuckyBalls.h" #include "Camera.h" From 7ef882c525f94b9ff75c1cf6d03ccf63dacc34f8 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 16:14:18 -0800 Subject: [PATCH 31/32] make sure InterfaceConfig is included before Qt headers --- interface/src/Environment.cpp | 3 ++- interface/src/ImportDialog.cpp | 3 ++- interface/src/renderer/AmbientOcclusionEffect.h | 2 -- interface/src/ui/LogDialog.cpp | 3 ++- interface/src/ui/RearMirrorTools.cpp | 3 ++- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/interface/src/Environment.cpp b/interface/src/Environment.cpp index 7609608a2a..4378af827a 100644 --- a/interface/src/Environment.cpp +++ b/interface/src/Environment.cpp @@ -5,6 +5,8 @@ // Created by Andrzej Kapolka on 5/6/13. // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. +#include "Environment.h" + #include #include #include @@ -15,7 +17,6 @@ #include "Application.h" #include "Camera.h" -#include "Environment.h" #include "renderer/ProgramObject.h" #include "world.h" diff --git a/interface/src/ImportDialog.cpp b/interface/src/ImportDialog.cpp index aa6d7e003e..b18dd77bb7 100644 --- a/interface/src/ImportDialog.cpp +++ b/interface/src/ImportDialog.cpp @@ -6,6 +6,8 @@ // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. // +#include "ImportDialog.h" + #include #include #include @@ -14,7 +16,6 @@ #include #include "Application.h" -#include "ImportDialog.h" const QString WINDOW_NAME = QObject::tr("Import Voxels"); const QString IMPORT_BUTTON_NAME = QObject::tr("Import Voxels"); diff --git a/interface/src/renderer/AmbientOcclusionEffect.h b/interface/src/renderer/AmbientOcclusionEffect.h index dba9a97202..e56164bad4 100644 --- a/interface/src/renderer/AmbientOcclusionEffect.h +++ b/interface/src/renderer/AmbientOcclusionEffect.h @@ -9,8 +9,6 @@ #ifndef __interface__AmbientOcclusionEffect__ #define __interface__AmbientOcclusionEffect__ -#include "InterfaceConfig.h" - class ProgramObject; /// A screen space ambient occlusion effect. See John Chapman's tutorial at diff --git a/interface/src/ui/LogDialog.cpp b/interface/src/ui/LogDialog.cpp index 1cff7b24f0..129c77af01 100644 --- a/interface/src/ui/LogDialog.cpp +++ b/interface/src/ui/LogDialog.cpp @@ -6,6 +6,8 @@ // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. // +#include "ui/LogDialog.h" + #include #include #include @@ -13,7 +15,6 @@ #include #include "Application.h" -#include "ui/LogDialog.h" const int TOP_BAR_HEIGHT = 46; const int INITIAL_WIDTH = 720; diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index 0ea53c0138..084528d408 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -5,12 +5,13 @@ // Created by stojce on 23.10.2013. // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. +#include "RearMirrorTools.h" + #include #include #include "Application.h" -#include "RearMirrorTools.h" #include "Util.h" const char SETTINGS_GROUP_NAME[] = "Rear View Tools"; From 1ef780c6cb7ea1b5858f0a71576947ce0ef5bcee Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 6 Mar 2014 16:24:58 -0800 Subject: [PATCH 32/32] make headers coding standard compliant --- interface/src/Environment.cpp | 4 +++- interface/src/Environment.h | 2 -- interface/src/ImportDialog.cpp | 4 +++- interface/src/renderer/AmbientOcclusionEffect.cpp | 3 ++- interface/src/ui/LogDialog.cpp | 4 +++- interface/src/ui/RearMirrorTools.cpp | 4 +++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/interface/src/Environment.cpp b/interface/src/Environment.cpp index 4378af827a..9efaa274c0 100644 --- a/interface/src/Environment.cpp +++ b/interface/src/Environment.cpp @@ -5,7 +5,7 @@ // Created by Andrzej Kapolka on 5/6/13. // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. -#include "Environment.h" +#include "InterfaceConfig.h" #include #include @@ -20,6 +20,8 @@ #include "renderer/ProgramObject.h" #include "world.h" +#include "Environment.h" + uint qHash(const HifiSockAddr& sockAddr) { if (sockAddr.getAddress().isNull()) { return 0; // shouldn't happen, but if it does, zero is a perfectly valid hash diff --git a/interface/src/Environment.h b/interface/src/Environment.h index 8f9522cd8e..1c9ee578c3 100644 --- a/interface/src/Environment.h +++ b/interface/src/Environment.h @@ -9,8 +9,6 @@ #ifndef __interface__Environment__ #define __interface__Environment__ -#include "InterfaceConfig.h" - #include #include diff --git a/interface/src/ImportDialog.cpp b/interface/src/ImportDialog.cpp index b18dd77bb7..2741fada0a 100644 --- a/interface/src/ImportDialog.cpp +++ b/interface/src/ImportDialog.cpp @@ -6,7 +6,7 @@ // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. // -#include "ImportDialog.h" +#include "InterfaceConfig.h" #include #include @@ -17,6 +17,8 @@ #include "Application.h" +#include "ImportDialog.h" + const QString WINDOW_NAME = QObject::tr("Import Voxels"); const QString IMPORT_BUTTON_NAME = QObject::tr("Import Voxels"); const QString LOADING_BUTTON_NAME = QObject::tr("Loading ..."); diff --git a/interface/src/renderer/AmbientOcclusionEffect.cpp b/interface/src/renderer/AmbientOcclusionEffect.cpp index 8a150a3eba..a492552e7c 100644 --- a/interface/src/renderer/AmbientOcclusionEffect.cpp +++ b/interface/src/renderer/AmbientOcclusionEffect.cpp @@ -15,11 +15,12 @@ #include -#include "AmbientOcclusionEffect.h" #include "Application.h" #include "ProgramObject.h" #include "RenderUtil.h" +#include "AmbientOcclusionEffect.h" + const int ROTATION_WIDTH = 4; const int ROTATION_HEIGHT = 4; diff --git a/interface/src/ui/LogDialog.cpp b/interface/src/ui/LogDialog.cpp index 129c77af01..d219c08698 100644 --- a/interface/src/ui/LogDialog.cpp +++ b/interface/src/ui/LogDialog.cpp @@ -6,7 +6,7 @@ // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. // -#include "ui/LogDialog.h" +#include "InterfaceConfig.h" #include #include @@ -16,6 +16,8 @@ #include "Application.h" +#include "ui/LogDialog.h" + const int TOP_BAR_HEIGHT = 46; const int INITIAL_WIDTH = 720; const int MINIMAL_WIDTH = 570; diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index 084528d408..314fd7157b 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -5,7 +5,7 @@ // Created by stojce on 23.10.2013. // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. -#include "RearMirrorTools.h" +#include "InterfaceConfig.h" #include @@ -14,6 +14,8 @@ #include "Application.h" #include "Util.h" +#include "RearMirrorTools.h" + const char SETTINGS_GROUP_NAME[] = "Rear View Tools"; const char ZOOM_LEVEL_SETTINGS[] = "ZoomLevel"; const int ICON_SIZE = 20;