From eab7dd60067ff18bab4a3c2f7d7b6c618bcf2945 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 25 Apr 2018 10:25:34 +0200 Subject: [PATCH 01/30] Fixed procedural shaders --- libraries/render-utils/src/simple.slf | 10 ++++++++++ libraries/render-utils/src/simple_fade.slf | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/libraries/render-utils/src/simple.slf b/libraries/render-utils/src/simple.slf index ed77777184..338f8607ee 100644 --- a/libraries/render-utils/src/simple.slf +++ b/libraries/render-utils/src/simple.slf @@ -16,7 +16,17 @@ // the interpolated normal in vec3 _normalWS; +in vec3 _normalMS; in vec4 _color; +in vec2 _texCoord0; +in vec4 _positionMS; +in vec4 _positionES; + +// For retro-compatibility +#define _normal _normalWS +#define _modelNormal _normalMS +#define _position _positionMS +#define _eyePosition _positionES //PROCEDURAL_COMMON_BLOCK diff --git a/libraries/render-utils/src/simple_fade.slf b/libraries/render-utils/src/simple_fade.slf index 6e7aee2894..1cb4127e7b 100644 --- a/libraries/render-utils/src/simple_fade.slf +++ b/libraries/render-utils/src/simple_fade.slf @@ -19,9 +19,19 @@ // the interpolated normal in vec3 _normalWS; +in vec3 _normalMS; in vec4 _color; +in vec2 _texCoord0; +in vec4 _positionMS; +in vec4 _positionES; in vec4 _positionWS; +// For retro-compatibility +#define _normal _normalWS +#define _modelNormal _normalMS +#define _position _positionMS +#define _eyePosition _positionES + //PROCEDURAL_COMMON_BLOCK #line 1001 From 328f1dec9be27258b154130f51681ece09b76c97 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 25 Apr 2018 18:56:18 +0200 Subject: [PATCH 02/30] Extended to other shaders --- libraries/render-utils/src/forward_simple.slf | 10 ++++++++++ .../render-utils/src/forward_simple_transparent.slf | 9 +++++++++ libraries/render-utils/src/simple.slf | 8 ++++---- libraries/render-utils/src/simple_fade.slf | 8 ++++---- libraries/render-utils/src/simple_transparent.slf | 10 ++++++++++ 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/libraries/render-utils/src/forward_simple.slf b/libraries/render-utils/src/forward_simple.slf index 587fcbde73..1ac44750a7 100644 --- a/libraries/render-utils/src/forward_simple.slf +++ b/libraries/render-utils/src/forward_simple.slf @@ -16,11 +16,21 @@ <@include ForwardGlobalLight.slh@> <$declareEvalSkyboxGlobalColor()$> + // the interpolated normal in vec3 _normalWS; +in vec3 _normalMS; in vec4 _color; +in vec2 _texCoord0; +in vec4 _positionMS; in vec4 _positionES; +// For retro-compatibility +#define _normal _normalWS +#define _modelNormal _normalMS +#define _position _positionMS +#define _eyePosition _positionES + layout(location = 0) out vec4 _fragColor0; //PROCEDURAL_COMMON_BLOCK diff --git a/libraries/render-utils/src/forward_simple_transparent.slf b/libraries/render-utils/src/forward_simple_transparent.slf index f40ba2ed4f..8be2759571 100644 --- a/libraries/render-utils/src/forward_simple_transparent.slf +++ b/libraries/render-utils/src/forward_simple_transparent.slf @@ -18,9 +18,18 @@ // the interpolated normal in vec3 _normalWS; +in vec3 _normalMS; in vec4 _color; +in vec2 _texCoord0; +in vec4 _positionMS; in vec4 _positionES; +// For retro-compatibility +#define _normal _normalWS +#define _modelNormal _normalMS +#define _position _positionMS +#define _eyePosition _positionES + layout(location = 0) out vec4 _fragColor0; //PROCEDURAL_COMMON_BLOCK diff --git a/libraries/render-utils/src/simple.slf b/libraries/render-utils/src/simple.slf index 338f8607ee..7591dc1882 100644 --- a/libraries/render-utils/src/simple.slf +++ b/libraries/render-utils/src/simple.slf @@ -23,10 +23,10 @@ in vec4 _positionMS; in vec4 _positionES; // For retro-compatibility -#define _normal _normalWS -#define _modelNormal _normalMS -#define _position _positionMS -#define _eyePosition _positionES +#define _normal _normalWS +#define _modelNormal _normalMS +#define _position _positionMS +#define _eyePosition _positionES //PROCEDURAL_COMMON_BLOCK diff --git a/libraries/render-utils/src/simple_fade.slf b/libraries/render-utils/src/simple_fade.slf index 1cb4127e7b..0710c3e10b 100644 --- a/libraries/render-utils/src/simple_fade.slf +++ b/libraries/render-utils/src/simple_fade.slf @@ -27,10 +27,10 @@ in vec4 _positionES; in vec4 _positionWS; // For retro-compatibility -#define _normal _normalWS -#define _modelNormal _normalMS -#define _position _positionMS -#define _eyePosition _positionES +#define _normal _normalWS +#define _modelNormal _normalMS +#define _position _positionMS +#define _eyePosition _positionES //PROCEDURAL_COMMON_BLOCK diff --git a/libraries/render-utils/src/simple_transparent.slf b/libraries/render-utils/src/simple_transparent.slf index c9815e8a80..ee79d2c0c4 100644 --- a/libraries/render-utils/src/simple_transparent.slf +++ b/libraries/render-utils/src/simple_transparent.slf @@ -16,7 +16,17 @@ // the interpolated normal in vec3 _normalWS; +in vec3 _normalMS; in vec4 _color; +in vec2 _texCoord0; +in vec4 _positionMS; +in vec4 _positionES; + +// For retro-compatibility +#define _normal _normalWS +#define _modelNormal _normalMS +#define _position _positionMS +#define _eyePosition _positionES //PROCEDURAL_COMMON_BLOCK From 44816941fce7644083171ca8c5b98f0005de3061 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Wed, 25 Apr 2018 10:57:57 -0700 Subject: [PATCH 03/30] Fix debug assert in manipulating thread local data to store GL surfaces --- libraries/gl/src/gl/OffscreenGLCanvas.cpp | 45 +++++++++++++++++++---- libraries/gl/src/gl/OffscreenGLCanvas.h | 2 + 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/libraries/gl/src/gl/OffscreenGLCanvas.cpp b/libraries/gl/src/gl/OffscreenGLCanvas.cpp index 4a2c5fd7f7..91f7954943 100644 --- a/libraries/gl/src/gl/OffscreenGLCanvas.cpp +++ b/libraries/gl/src/gl/OffscreenGLCanvas.cpp @@ -17,15 +17,18 @@ #include #include #include +#include +#include #include #include #include +#include + #include "Context.h" #include "GLHelpers.h" #include "GLLogging.h" - OffscreenGLCanvas::OffscreenGLCanvas() : _context(new QOpenGLContext), _offscreenSurface(new QOffscreenSurface) @@ -33,6 +36,8 @@ OffscreenGLCanvas::OffscreenGLCanvas() : } OffscreenGLCanvas::~OffscreenGLCanvas() { + clearThreadContext(); + // A context with logging enabled needs to be current when it's destroyed _context->makeCurrent(_offscreenSurface); delete _context; @@ -117,25 +122,51 @@ QObject* OffscreenGLCanvas::getContextObject() { } void OffscreenGLCanvas::moveToThreadWithContext(QThread* thread) { + clearThreadContext(); moveToThread(thread); _context->moveToThread(thread); } -static const char* THREAD_CONTEXT_PROPERTY = "offscreenGlCanvas"; +struct ThreadContextStorage : public Dependency { + QThreadStorage> threadContext; +}; void OffscreenGLCanvas::setThreadContext() { - QThread::currentThread()->setProperty(THREAD_CONTEXT_PROPERTY, QVariant::fromValue(this)); + if (!DependencyManager::isSet()) { + DependencyManager::set(); + } + auto threadContextStorage = DependencyManager::get(); + QPointer p(this); + threadContextStorage->threadContext.setLocalData(p); +} + +void OffscreenGLCanvas::clearThreadContext() { + if (!DependencyManager::isSet()) { + return; + } + auto threadContextStorage = DependencyManager::get(); + if (!threadContextStorage->threadContext.hasLocalData()) { + return; + } + auto& threadContext = threadContextStorage->threadContext.localData(); + if (this != threadContext.operator OffscreenGLCanvas *()) { + return; + } + threadContextStorage->threadContext.setLocalData(nullptr); } bool OffscreenGLCanvas::restoreThreadContext() { // Restore the rendering context for this thread - auto threadCanvasVariant = QThread::currentThread()->property(THREAD_CONTEXT_PROPERTY); - if (!threadCanvasVariant.isValid()) { + if (!DependencyManager::isSet()) { return false; } - auto threadCanvasObject = qvariant_cast(threadCanvasVariant); - auto threadCanvas = static_cast(threadCanvasObject); + auto threadContextStorage = DependencyManager::get(); + if (!threadContextStorage->threadContext.hasLocalData()) { + return false; + } + + auto threadCanvas = threadContextStorage->threadContext.localData(); if (!threadCanvas) { return false; } diff --git a/libraries/gl/src/gl/OffscreenGLCanvas.h b/libraries/gl/src/gl/OffscreenGLCanvas.h index ed644b98fb..a4960ae234 100644 --- a/libraries/gl/src/gl/OffscreenGLCanvas.h +++ b/libraries/gl/src/gl/OffscreenGLCanvas.h @@ -39,6 +39,8 @@ private slots: void onMessageLogged(const QOpenGLDebugMessage &debugMessage); protected: + void clearThreadContext(); + std::once_flag _reportOnce; QOpenGLContext* _context{ nullptr }; QOffscreenSurface* _offscreenSurface{ nullptr }; From 24ac342c6bc3cc5feeed186a2f55c4631d1b5128 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 10 Apr 2018 11:41:59 -0700 Subject: [PATCH 04/30] Add support for client texture selection --- interface/src/Application.cpp | 1 + libraries/baking/src/FBXBaker.cpp | 87 +++++++----- libraries/baking/src/FBXBaker.h | 4 +- libraries/baking/src/ModelBaker.cpp | 126 +++++++++++++++--- libraries/baking/src/ModelBaker.h | 8 +- libraries/baking/src/OBJBaker.cpp | 57 +++----- libraries/baking/src/OBJBaker.h | 5 +- libraries/baking/src/TextureBaker.cpp | 63 +++++++-- libraries/baking/src/TextureBaker.h | 14 +- libraries/fbx/src/FBXReader.cpp | 1 + libraries/fbx/src/FBXReader_Material.cpp | 4 + libraries/gpu-gl/src/gpu/gl41/GL41Backend.h | 4 +- libraries/gpu-gl/src/gpu/gl45/GL45Backend.h | 2 + .../src/gpu/gl45/GL45BackendTexture.cpp | 18 +++ libraries/gpu-gles/src/gpu/gles/GLESBackend.h | 3 +- libraries/gpu/src/gpu/Context.h | 2 + libraries/gpu/src/gpu/Texture.h | 5 + libraries/gpu/src/gpu/Texture_ktx.cpp | 77 ++++++----- libraries/ktx/src/TextureMeta.cpp | 58 ++++++++ libraries/ktx/src/TextureMeta.h | 42 ++++++ libraries/ktx/src/khronos/KHR.h | 59 ++++++++ .../src/model-networking/ModelCache.cpp | 5 +- .../src/model-networking/TextureCache.cpp | 114 +++++++++++++--- .../src/model-networking/TextureCache.h | 22 ++- libraries/networking/src/ResourceCache.cpp | 6 +- tools/oven/src/DomainBaker.cpp | 2 +- 26 files changed, 614 insertions(+), 175 deletions(-) create mode 100644 libraries/ktx/src/TextureMeta.cpp create mode 100644 libraries/ktx/src/TextureMeta.h diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index c38caca090..6756fbe255 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1296,6 +1296,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo // Create the main thread context, the GPU backend, and the display plugins initializeGL(); + DependencyManager::get()->setGPUContext(_gpuContext); qCDebug(interfaceapp, "Initialized Display."); // Create the rendering engine. This can be slow on some machines due to lots of // GPU pipeline creation. diff --git a/libraries/baking/src/FBXBaker.cpp b/libraries/baking/src/FBXBaker.cpp index 0407c8508c..175698eeea 100644 --- a/libraries/baking/src/FBXBaker.cpp +++ b/libraries/baking/src/FBXBaker.cpp @@ -70,17 +70,66 @@ void FBXBaker::bakeSourceCopy() { return; } - // export the FBX with re-written texture references - exportScene(); - - if (shouldStop()) { - return; - } - // check if we're already done with textures (in case we had none to re-write) checkIfTexturesFinished(); } +void FBXBaker::embedTextureMetaData() { + std::vector embeddedTextureNodes; + + for (FBXNode& rootChild : _rootNode.children) { + if (rootChild.name == "Objects") { + qlonglong maxId = 0; + for (auto &child : rootChild.children) { + if (child.properties.length() == 3) { + maxId = std::max(maxId, child.properties[0].toLongLong()); + } + } + + for (auto& object : rootChild.children) { + if (object.name == "Texture") { + QVariant relativeFilename; + for (auto& child : object.children) { + if (child.name == "RelativeFilename") { + relativeFilename = child.properties[0]; + break; + } + } + + if (relativeFilename.isNull() || !relativeFilename.toString().endsWith(BAKED_META_TEXTURE_SUFFIX)) { + continue; + } + + FBXNode videoNode; + videoNode.name = "Video"; + videoNode.properties.append(++maxId); + videoNode.properties.append(object.properties[1]); + videoNode.properties.append("Clip"); + + QString bakedTextureFilePath { + _bakedOutputDir + "/" + relativeFilename.toString() + }; + qDebug() << "Location of texture: " << bakedTextureFilePath; + + QFile textureFile { bakedTextureFilePath }; + if (!textureFile.open(QIODevice::ReadOnly)) { + qWarning() << "Failed to open: " << bakedTextureFilePath; + continue; + } + + videoNode.children.append({ "RelativeFilename", { relativeFilename }, { } }); + videoNode.children.append({ "Content", { textureFile.readAll() }, { } }); + + rootChild.children.append(videoNode); + + textureFile.close(); + } + } + } + } + +} + void FBXBaker::setupOutputFolder() { // make sure there isn't already an output directory using the same name if (QDir(_bakedOutputDir).exists()) { @@ -352,27 +401,3 @@ void FBXBaker::rewriteAndBakeSceneTextures() { } } } - -void FBXBaker::exportScene() { - // save the relative path to this FBX inside our passed output folder - auto fileName = _modelURL.fileName(); - auto baseName = fileName.left(fileName.lastIndexOf('.')); - auto bakedFilename = baseName + BAKED_FBX_EXTENSION; - - _bakedModelFilePath = _bakedOutputDir + "/" + bakedFilename; - - auto fbxData = FBXWriter::encodeFBX(_rootNode); - - QFile bakedFile(_bakedModelFilePath); - - if (!bakedFile.open(QIODevice::WriteOnly)) { - handleError("Error opening " + _bakedModelFilePath + " for writing"); - return; - } - - bakedFile.write(fbxData); - - _outputFiles.push_back(_bakedModelFilePath); - - qCDebug(model_baking) << "Exported" << _modelURL << "with re-written paths to" << _bakedModelFilePath; -} diff --git a/libraries/baking/src/FBXBaker.h b/libraries/baking/src/FBXBaker.h index 2888a60f73..58a7bffa18 100644 --- a/libraries/baking/src/FBXBaker.h +++ b/libraries/baking/src/FBXBaker.h @@ -26,8 +26,6 @@ #include -static const QString BAKED_FBX_EXTENSION = ".baked.fbx"; - using TextureBakerThreadGetter = std::function; class FBXBaker : public ModelBaker { @@ -51,11 +49,11 @@ private: void loadSourceFBX(); void importScene(); + void embedTextureMetaData(); void rewriteAndBakeSceneModels(); void rewriteAndBakeSceneTextures(); void exportScene(); - FBXNode _rootNode; FBXGeometry* _geometry; QHash _textureNameMatchCount; QHash _remappedTexturePaths; diff --git a/libraries/baking/src/ModelBaker.cpp b/libraries/baking/src/ModelBaker.cpp index 16a0c89c7f..020a0dbfc2 100644 --- a/libraries/baking/src/ModelBaker.cpp +++ b/libraries/baking/src/ModelBaker.cpp @@ -248,7 +248,7 @@ QString ModelBaker::compressTexture(QString modelTextureFileName, image::Texture QFileInfo modelTextureFileInfo{ modelTextureFileName.replace("\\", "/") }; - if (modelTextureFileInfo.suffix() == BAKED_TEXTURE_EXT.mid(1)) { + if (modelTextureFileInfo.suffix() == BAKED_TEXTURE_KTX_EXT.mid(1)) { // re-baking a model that already references baked textures // this is an error - return from here handleError("Cannot re-bake a file that already references compressed textures"); @@ -273,31 +273,31 @@ QString ModelBaker::compressTexture(QString modelTextureFileName, image::Texture } auto urlToTexture = getTextureURL(modelTextureFileInfo, modelTextureFileName, !textureContent.isNull()); - QString bakedTextureFileName; + QString baseTextureFileName; if (_remappedTexturePaths.contains(urlToTexture)) { - bakedTextureFileName = _remappedTexturePaths[urlToTexture]; + baseTextureFileName = _remappedTexturePaths[urlToTexture]; } else { // construct the new baked texture file name and file path // ensuring that the baked texture will have a unique name // even if there was another texture with the same name at a different path - bakedTextureFileName = createBakedTextureFileName(modelTextureFileInfo); - _remappedTexturePaths[urlToTexture] = bakedTextureFileName; + baseTextureFileName = createBaseTextureFileName(modelTextureFileInfo); + _remappedTexturePaths[urlToTexture] = baseTextureFileName; } qCDebug(model_baking).noquote() << "Re-mapping" << modelTextureFileName - << "to" << bakedTextureFileName; + << "to" << baseTextureFileName; - QString bakedTextureFilePath{ - _bakedOutputDir + "/" + bakedTextureFileName + QString bakedTextureFilePath { + _bakedOutputDir + "/" + baseTextureFileName + BAKED_META_TEXTURE_SUFFIX }; - textureChild = bakedTextureFileName; + textureChild = baseTextureFileName + BAKED_META_TEXTURE_SUFFIX; if (!_bakingTextures.contains(urlToTexture)) { _outputFiles.push_back(bakedTextureFilePath); // bake this texture asynchronously - bakeTexture(urlToTexture, textureType, _bakedOutputDir, bakedTextureFileName, textureContent); + bakeTexture(urlToTexture, textureType, _bakedOutputDir, baseTextureFileName, textureContent); } } @@ -309,7 +309,7 @@ void ModelBaker::bakeTexture(const QUrl& textureURL, image::TextureUsage::Type t // start a bake for this texture and add it to our list to keep track of QSharedPointer bakingTexture{ - new TextureBaker(textureURL, textureType, outputDir, bakedFilename, textureContent), + new TextureBaker(textureURL, textureType, outputDir, "../", bakedFilename, textureContent), &TextureBaker::deleteLater }; @@ -484,30 +484,30 @@ void ModelBaker::checkIfTexturesFinished() { } else { qCDebug(model_baking) << "Finished baking, emitting finished" << _modelURL; + texturesFinished(); + setIsFinished(true); } } } -QString ModelBaker::createBakedTextureFileName(const QFileInfo& textureFileInfo) { +QString ModelBaker::createBaseTextureFileName(const QFileInfo& textureFileInfo) { // first make sure we have a unique base name for this texture // in case another texture referenced by this model has the same base name auto& nameMatches = _textureNameMatchCount[textureFileInfo.baseName()]; - QString bakedTextureFileName{ textureFileInfo.completeBaseName() }; + QString baseTextureFileName{ textureFileInfo.completeBaseName() }; if (nameMatches > 0) { // there are already nameMatches texture with this name // append - and that number to our baked texture file name so that it is unique - bakedTextureFileName += "-" + QString::number(nameMatches); + baseTextureFileName += "-" + QString::number(nameMatches); } - bakedTextureFileName += BAKED_TEXTURE_EXT; - // increment the number of name matches ++nameMatches; - return bakedTextureFileName; + return baseTextureFileName; } void ModelBaker::setWasAborted(bool wasAborted) { @@ -519,3 +519,95 @@ void ModelBaker::setWasAborted(bool wasAborted) { } } } + +void ModelBaker::texturesFinished() { + embedTextureMetaData(); + exportScene(); +} + +void ModelBaker::embedTextureMetaData() { + std::vector embeddedTextureNodes; + + for (FBXNode& rootChild : _rootNode.children) { + if (rootChild.name == "Objects") { + qlonglong maxId = 0; + for (auto &child : rootChild.children) { + if (child.properties.length() == 3) { + maxId = std::max(maxId, child.properties[0].toLongLong()); + } + } + + qDebug() << "Max id found was: " << maxId; + + for (auto& object : rootChild.children) { + if (object.name == "Texture") { + QVariant relativeFilename; + for (auto& child : object.children) { + if (child.name == "RelativeFilename") { + relativeFilename = child.properties[0]; + break; + } + } + + if (relativeFilename.isNull() + || !relativeFilename.toString().endsWith(BAKED_META_TEXTURE_SUFFIX)) { + continue; + } + if (object.properties.length() < 2) { + qWarning() << "Found texture with unexpected number of properties: " << object.name; + continue; + } + + FBXNode videoNode; + videoNode.name = "Video"; + videoNode.properties.append(++maxId); + videoNode.properties.append(object.properties[1]); + videoNode.properties.append("Clip"); + + QString bakedTextureFilePath { + _bakedOutputDir + "/" + relativeFilename.toString() + }; + qDebug() << "Location of texture: " << bakedTextureFilePath; + + QFile textureFile { bakedTextureFilePath }; + if (!textureFile.open(QIODevice::ReadOnly)) { + qWarning() << "Failed to open: " << bakedTextureFilePath; + continue; + } + + videoNode.children.append({ "RelativeFilename", { relativeFilename }, { } }); + videoNode.children.append({ "Content", { textureFile.readAll() }, { } }); + + rootChild.children.append(videoNode); + + textureFile.close(); + } + } + } + } + +} + +void ModelBaker::exportScene() { + // save the relative path to this FBX inside our passed output folder + auto fileName = _modelURL.fileName(); + auto baseName = fileName.left(fileName.lastIndexOf('.')); + auto bakedFilename = baseName + BAKED_FBX_EXTENSION; + + _bakedModelFilePath = _bakedOutputDir + "/" + bakedFilename; + + auto fbxData = FBXWriter::encodeFBX(_rootNode); + + QFile bakedFile(_bakedModelFilePath); + + if (!bakedFile.open(QIODevice::WriteOnly)) { + handleError("Error opening " + _bakedModelFilePath + " for writing"); + return; + } + + bakedFile.write(fbxData); + + _outputFiles.push_back(_bakedModelFilePath); + + qCDebug(model_baking) << "Exported" << _modelURL << "with re-written paths to" << _bakedModelFilePath; +} diff --git a/libraries/baking/src/ModelBaker.h b/libraries/baking/src/ModelBaker.h index 6fd529af92..1fd77ab761 100644 --- a/libraries/baking/src/ModelBaker.h +++ b/libraries/baking/src/ModelBaker.h @@ -29,6 +29,8 @@ using TextureBakerThreadGetter = std::function; using GetMaterialIDCallback = std::function ; +static const QString BAKED_FBX_EXTENSION = ".baked.fbx"; + class ModelBaker : public Baker { Q_OBJECT @@ -49,7 +51,11 @@ public slots: protected: void checkIfTexturesFinished(); + void texturesFinished(); + void embedTextureMetaData(); + void exportScene(); + FBXNode _rootNode; QHash _textureContentMap; QUrl _modelURL; QString _bakedOutputDir; @@ -63,7 +69,7 @@ private slots: void handleAbortedTexture(); private: - QString createBakedTextureFileName(const QFileInfo & textureFileInfo); + QString createBaseTextureFileName(const QFileInfo & textureFileInfo); QUrl getTextureURL(const QFileInfo& textureFileInfo, QString relativeFileName, bool isEmbedded = false); void bakeTexture(const QUrl & textureURL, image::TextureUsage::Type textureType, const QDir & outputDir, const QString & bakedFilename, const QByteArray & textureContent); diff --git a/libraries/baking/src/OBJBaker.cpp b/libraries/baking/src/OBJBaker.cpp index 85771ff2e3..1fe53f26eb 100644 --- a/libraries/baking/src/OBJBaker.cpp +++ b/libraries/baking/src/OBJBaker.cpp @@ -147,31 +147,7 @@ void OBJBaker::bakeOBJ() { auto geometry = reader.readOBJ(objData, QVariantHash(), combineParts, _modelURL); // Write OBJ Data as FBX tree nodes - FBXNode rootNode; - createFBXNodeTree(rootNode, *geometry); - - // Serialize the resultant FBX tree - auto encodedFBX = FBXWriter::encodeFBX(rootNode); - - // Export as baked FBX - auto fileName = _modelURL.fileName(); - auto baseName = fileName.left(fileName.lastIndexOf('.')); - auto bakedFilename = baseName + ".baked.fbx"; - - _bakedModelFilePath = _bakedOutputDir + "/" + bakedFilename; - - QFile bakedFile; - bakedFile.setFileName(_bakedModelFilePath); - if (!bakedFile.open(QIODevice::WriteOnly)) { - handleError("Error opening " + _bakedModelFilePath + " for writing"); - return; - } - - bakedFile.write(encodedFBX); - - // Export successful - _outputFiles.push_back(_bakedModelFilePath); - qCDebug(model_baking) << "Exported" << _modelURL << "to" << _bakedModelFilePath; + createFBXNodeTree(_rootNode, *geometry); checkIfTexturesFinished(); } @@ -203,15 +179,17 @@ void OBJBaker::createFBXNodeTree(FBXNode& rootNode, FBXGeometry& geometry) { globalSettingsNode.children = { properties70Node }; // Generating Object node - _objectNode.name = OBJECTS_NODE_NAME; + FBXNode objectNode; + objectNode.name = OBJECTS_NODE_NAME; // Generating Object node's child - Geometry node FBXNode geometryNode; geometryNode.name = GEOMETRY_NODE_NAME; + NodeID geometryID; { - _geometryID = nextNodeID(); + geometryID = nextNodeID(); geometryNode.properties = { - _geometryID, + geometryID, GEOMETRY_NODE_NAME, MESH }; @@ -226,12 +204,13 @@ void OBJBaker::createFBXNodeTree(FBXNode& rootNode, FBXGeometry& geometry) { // Generating Object node's child - Model node FBXNode modelNode; modelNode.name = MODEL_NODE_NAME; + NodeID modelID; { - _modelID = nextNodeID(); - modelNode.properties = { _modelID, MODEL_NODE_NAME, MESH }; + modelID = nextNodeID(); + modelNode.properties = { modelID, MODEL_NODE_NAME, MESH }; } - _objectNode.children = { geometryNode, modelNode }; + objectNode.children = { geometryNode, modelNode }; // Generating Objects node's child - Material node auto& meshParts = geometry.meshes[0].parts; @@ -247,7 +226,7 @@ void OBJBaker::createFBXNodeTree(FBXNode& rootNode, FBXGeometry& geometry) { setMaterialNodeProperties(materialNode, meshPart.materialID, geometry); } - _objectNode.children.append(materialNode); + objectNode.children.append(materialNode); } // Generating Texture Node @@ -257,13 +236,13 @@ void OBJBaker::createFBXNodeTree(FBXNode& rootNode, FBXGeometry& geometry) { QString material = meshParts[i].materialID; FBXMaterial currentMaterial = geometry.materials[material]; if (!currentMaterial.albedoTexture.filename.isEmpty() || !currentMaterial.specularTexture.filename.isEmpty()) { - _textureID = nextNodeID(); - _mapTextureMaterial.emplace_back(_textureID, i); + auto textureID = nextNodeID(); + _mapTextureMaterial.emplace_back(textureID, i); FBXNode textureNode; { textureNode.name = TEXTURE_NODE_NAME; - textureNode.properties = { _textureID }; + textureNode.properties = { textureID, "texture" + QString::number(textureID) }; } // Texture node child - TextureName node @@ -295,7 +274,7 @@ void OBJBaker::createFBXNodeTree(FBXNode& rootNode, FBXGeometry& geometry) { textureNode.children = { textureNameNode, relativeFilenameNode }; - _objectNode.children.append(textureNode); + objectNode.children.append(textureNode); } } @@ -306,14 +285,14 @@ void OBJBaker::createFBXNodeTree(FBXNode& rootNode, FBXGeometry& geometry) { // connect Geometry to Model FBXNode cNode; cNode.name = C_NODE_NAME; - cNode.properties = { CONNECTIONS_NODE_PROPERTY, _geometryID, _modelID }; + cNode.properties = { CONNECTIONS_NODE_PROPERTY, geometryID, modelID }; connectionsNode.children = { cNode }; // connect all materials to model for (auto& materialID : _materialIDs) { FBXNode cNode; cNode.name = C_NODE_NAME; - cNode.properties = { CONNECTIONS_NODE_PROPERTY, materialID, _modelID }; + cNode.properties = { CONNECTIONS_NODE_PROPERTY, materialID, modelID }; connectionsNode.children.append(cNode); } @@ -341,7 +320,7 @@ void OBJBaker::createFBXNodeTree(FBXNode& rootNode, FBXGeometry& geometry) { } // Make all generated nodes children of rootNode - rootNode.children = { globalSettingsNode, _objectNode, connectionsNode }; + rootNode.children = { globalSettingsNode, objectNode, connectionsNode }; } // Set properties for material nodes diff --git a/libraries/baking/src/OBJBaker.h b/libraries/baking/src/OBJBaker.h index e888c7b1d8..8e49692d35 100644 --- a/libraries/baking/src/OBJBaker.h +++ b/libraries/baking/src/OBJBaker.h @@ -43,12 +43,9 @@ private: void setMaterialNodeProperties(FBXNode& materialNode, QString material, FBXGeometry& geometry); NodeID nextNodeID() { return _nodeID++; } + NodeID _nodeID { 0 }; - NodeID _geometryID; - NodeID _modelID; std::vector _materialIDs; - NodeID _textureID; std::vector> _mapTextureMaterial; - FBXNode _objectNode; }; #endif // hifi_OBJBaker_h diff --git a/libraries/baking/src/TextureBaker.cpp b/libraries/baking/src/TextureBaker.cpp index b6edd07965..7a5dc85a61 100644 --- a/libraries/baking/src/TextureBaker.cpp +++ b/libraries/baking/src/TextureBaker.cpp @@ -18,26 +18,30 @@ #include #include #include +#include #include "ModelBakingLoggingCategory.h" #include "TextureBaker.h" -const QString BAKED_TEXTURE_EXT = ".ktx"; +const QString BAKED_TEXTURE_KTX_EXT = ".ktx"; +const QString BAKED_TEXTURE_BCN_SUFFIX = "_bcn.ktx"; +const QString BAKED_META_TEXTURE_SUFFIX = ".texmeta.json"; TextureBaker::TextureBaker(const QUrl& textureURL, image::TextureUsage::Type textureType, - const QDir& outputDirectory, const QString& bakedFilename, - const QByteArray& textureContent) : + const QDir& outputDirectory, const QString& metaTexturePathPrefix, + const QString& baseFilename, const QByteArray& textureContent) : _textureURL(textureURL), _originalTexture(textureContent), _textureType(textureType), + _baseFilename(baseFilename), _outputDirectory(outputDirectory), - _bakedTextureFileName(bakedFilename) + _metaTexturePathPrefix(metaTexturePathPrefix) { - if (bakedFilename.isEmpty()) { + if (baseFilename.isEmpty()) { // figure out the baked texture filename auto originalFilename = textureURL.fileName(); - _bakedTextureFileName = originalFilename.left(originalFilename.lastIndexOf('.')) + BAKED_TEXTURE_EXT; + _baseFilename = originalFilename.left(originalFilename.lastIndexOf('.')); } } @@ -118,6 +122,19 @@ void TextureBaker::processTexture() { auto hashData = QCryptographicHash::hash(_originalTexture, QCryptographicHash::Md5); std::string hash = hashData.toHex().toStdString(); + TextureMeta meta; + + { + auto filePath = _outputDirectory.absoluteFilePath(_textureURL.fileName()); + QFile file { filePath }; + if (!file.open(QIODevice::WriteOnly) || file.write(_originalTexture) == -1) { + handleError("Could not write meta texture for " + _textureURL.toString()); + return; + } + _outputFiles.push_back(filePath); + meta.original =_metaTexturePathPrefix +_textureURL.fileName(); + } + // IMPORTANT: _originalTexture is empty past this point auto processedTexture = image::processImage(std::move(_originalTexture), _textureURL.toString().toStdString(), ABSOLUTE_MAX_TEXTURE_NUM_PIXELS, _textureType, _abortProcessing); @@ -142,15 +159,37 @@ void TextureBaker::processTexture() { const char* data = reinterpret_cast(memKTX->_storage->data()); const size_t length = memKTX->_storage->size(); + const char* name = khronos::gl::texture::toString(memKTX->_header.getGLInternaFormat()); + if (name == nullptr) { + handleError("Could not determine internal format for compressed KTX: " + _textureURL.toString()); + return; + } + + qDebug() << "Found type: " << name; // attempt to write the baked texture to the destination file path - auto filePath = _outputDirectory.absoluteFilePath(_bakedTextureFileName); - QFile bakedTextureFile { filePath }; - - if (!bakedTextureFile.open(QIODevice::WriteOnly) || bakedTextureFile.write(data, length) == -1) { - handleError("Could not write baked texture for " + _textureURL.toString()); - } else { + { + auto fileName = _baseFilename + BAKED_TEXTURE_BCN_SUFFIX; + auto filePath = _outputDirectory.absoluteFilePath(fileName); + QFile bakedTextureFile { filePath }; + if (!bakedTextureFile.open(QIODevice::WriteOnly) || bakedTextureFile.write(data, length) == -1) { + handleError("Could not write baked texture for " + _textureURL.toString()); + return; + } _outputFiles.push_back(filePath); + meta.availableTextureTypes[memKTX->_header.getGLInternaFormat()] = _metaTexturePathPrefix + fileName; + } + + + { + auto data = meta.serialize(); + _metaTextureFileName = _outputDirectory.absoluteFilePath(_baseFilename + BAKED_META_TEXTURE_SUFFIX); + QFile file { _metaTextureFileName }; + if (!file.open(QIODevice::WriteOnly) || file.write(data) == -1) { + handleError("Could not write meta texture for " + _textureURL.toString()); + } else { + _outputFiles.push_back(_metaTextureFileName); + } } qCDebug(model_baking) << "Baked texture" << _textureURL; diff --git a/libraries/baking/src/TextureBaker.h b/libraries/baking/src/TextureBaker.h index 90ecfe52f7..93b01080cd 100644 --- a/libraries/baking/src/TextureBaker.h +++ b/libraries/baking/src/TextureBaker.h @@ -21,22 +21,22 @@ #include "Baker.h" -extern const QString BAKED_TEXTURE_EXT; +extern const QString BAKED_TEXTURE_KTX_EXT; +extern const QString BAKED_META_TEXTURE_SUFFIX; class TextureBaker : public Baker { Q_OBJECT public: TextureBaker(const QUrl& textureURL, image::TextureUsage::Type textureType, - const QDir& outputDirectory, const QString& bakedFilename = QString(), - const QByteArray& textureContent = QByteArray()); + const QDir& outputDirectory, const QString& metaTexturePathPrefix = "", + const QString& baseFilename = QString(), const QByteArray& textureContent = QByteArray()); const QByteArray& getOriginalTexture() const { return _originalTexture; } QUrl getTextureURL() const { return _textureURL; } - QString getDestinationFilePath() const { return _outputDirectory.absoluteFilePath(_bakedTextureFileName); } - QString getBakedTextureFileName() const { return _bakedTextureFileName; } + QString getMetaTextureFileName() const { return _metaTextureFileName; } virtual void setWasAborted(bool wasAborted) override; @@ -58,8 +58,10 @@ private: QByteArray _originalTexture; image::TextureUsage::Type _textureType; + QString _baseFilename; QDir _outputDirectory; - QString _bakedTextureFileName; + QString _metaTextureFileName; + QString _metaTexturePathPrefix; std::atomic _abortProcessing { false }; }; diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 1e59646795..1f237edfb0 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -1101,6 +1101,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS } if (!content.isEmpty()) { _textureContent.insert(filepath, content); + qDebug() << "Adding content: " << filepath << content.length(); } } else if (object.name == "Material") { FBXMaterial material; diff --git a/libraries/fbx/src/FBXReader_Material.cpp b/libraries/fbx/src/FBXReader_Material.cpp index 4aa3044934..88dc7f599d 100644 --- a/libraries/fbx/src/FBXReader_Material.cpp +++ b/libraries/fbx/src/FBXReader_Material.cpp @@ -85,12 +85,16 @@ FBXTexture FBXReader::getTexture(const QString& textureID) { FBXTexture texture; const QByteArray& filepath = _textureFilepaths.value(textureID); texture.content = _textureContent.value(filepath); + qDebug() << "Getting texture: " << textureID << filepath << texture.content.length(); if (texture.content.isEmpty()) { // the content is not inlined + qDebug() << "Texture is not inlined"; texture.filename = _textureFilenames.value(textureID); } else { // use supplied filepath for inlined content + qDebug() << "Texture is inlined"; texture.filename = filepath; } + qDebug() << "Path: " << texture.filename; texture.id = textureID; texture.name = _textureNames.value(textureID); diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41Backend.h b/libraries/gpu-gl/src/gpu/gl41/GL41Backend.h index 9479321747..f3b452b1f9 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41Backend.h +++ b/libraries/gpu-gl/src/gpu/gl41/GL41Backend.h @@ -52,6 +52,8 @@ public: static const std::string GL41_VERSION; const std::string& getVersion() const override { return GL41_VERSION; } + bool supportedTextureFormat(const gpu::Element& format) override; + class GL41Texture : public GLTexture { using Parent = GLTexture; friend class GL41Backend; @@ -173,8 +175,6 @@ protected: void makeProgramBindings(ShaderObject& shaderObject) override; int makeResourceBufferSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,Shader::SlotSet& resourceBuffers) override; - static bool supportedTextureFormat(const gpu::Element& format); - }; } } diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h b/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h index c23a83eaf9..616b6d1075 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h +++ b/libraries/gpu-gl/src/gpu/gl45/GL45Backend.h @@ -54,6 +54,8 @@ public: static const std::string GL45_VERSION; const std::string& getVersion() const override { return GL45_VERSION; } + bool supportedTextureFormat(const gpu::Element& format) override; + class GL45Texture : public GLTexture { using Parent = GLTexture; friend class GL45Backend; diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp index 4d5ffefa67..6b3c99ccc3 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp @@ -32,6 +32,24 @@ using namespace gpu::gl45; #define FORCE_STRICT_TEXTURE 0 #define ENABLE_SPARSE_TEXTURE 0 +bool GL45Backend::supportedTextureFormat(const gpu::Element& format) { + switch (format.getSemantic()) { + case gpu::Semantic::COMPRESSED_ETC2_RGB: + case gpu::Semantic::COMPRESSED_ETC2_SRGB: + case gpu::Semantic::COMPRESSED_ETC2_RGB_PUNCHTHROUGH_ALPHA: + case gpu::Semantic::COMPRESSED_ETC2_SRGB_PUNCHTHROUGH_ALPHA: + case gpu::Semantic::COMPRESSED_ETC2_RGBA: + case gpu::Semantic::COMPRESSED_ETC2_SRGBA: + case gpu::Semantic::COMPRESSED_EAC_RED: + case gpu::Semantic::COMPRESSED_EAC_RED_SIGNED: + case gpu::Semantic::COMPRESSED_EAC_XY: + case gpu::Semantic::COMPRESSED_EAC_XY_SIGNED: + return false; + default: + return true; + } +} + GLTexture* GL45Backend::syncGPUObject(const TexturePointer& texturePointer) { if (!texturePointer) { return nullptr; diff --git a/libraries/gpu-gles/src/gpu/gles/GLESBackend.h b/libraries/gpu-gles/src/gpu/gles/GLESBackend.h index 38e28e630a..47a123718a 100644 --- a/libraries/gpu-gles/src/gpu/gles/GLESBackend.h +++ b/libraries/gpu-gles/src/gpu/gles/GLESBackend.h @@ -32,7 +32,6 @@ public: static const GLint RESOURCE_TRANSFER_EXTRA_TEX_UNIT { 33 }; static const GLint RESOURCE_BUFFER_TEXBUF_TEX_UNIT { 34 }; static const GLint RESOURCE_BUFFER_SLOT0_TEX_UNIT { 35 }; - static bool supportedTextureFormat(const gpu::Element& format); explicit GLESBackend(bool syncCache) : Parent(syncCache) {} GLESBackend() : Parent() {} virtual ~GLESBackend() { @@ -40,6 +39,8 @@ public: // which is pure virtual from GLBackend's dtor. resetStages(); } + + bool supportedTextureFormat(const gpu::Element& format) override; static const std::string GLES_VERSION; const std::string& getVersion() const override { return GLES_VERSION; } diff --git a/libraries/gpu/src/gpu/Context.h b/libraries/gpu/src/gpu/Context.h index eda8fee596..8c5a4d493e 100644 --- a/libraries/gpu/src/gpu/Context.h +++ b/libraries/gpu/src/gpu/Context.h @@ -64,6 +64,8 @@ public: virtual void recycle() const = 0; virtual void downloadFramebuffer(const FramebufferPointer& srcFramebuffer, const Vec4i& region, QImage& destImage) = 0; + virtual bool supportedTextureFormat(const gpu::Element& format) = 0; + // Shared header between C++ and GLSL #include "TransformCamera_shared.slh" diff --git a/libraries/gpu/src/gpu/Texture.h b/libraries/gpu/src/gpu/Texture.h index 4d82aba595..09b2bc9475 100755 --- a/libraries/gpu/src/gpu/Texture.h +++ b/libraries/gpu/src/gpu/Texture.h @@ -37,6 +37,10 @@ namespace ktx { using KeyValues = std::list; } +namespace khronos { namespace gl { namespace texture { + enum class InternalFormat: uint32_t; +}}} + namespace gpu { @@ -565,6 +569,7 @@ public: static bool evalKTXFormat(const Element& mipFormat, const Element& texelFormat, ktx::Header& header); static bool evalTextureFormat(const ktx::Header& header, Element& mipFormat, Element& texelFormat); + static bool getCompressedFormat(khronos::gl::texture::InternalFormat format, Element& elFormat); protected: const TextureUsageType _usageType; diff --git a/libraries/gpu/src/gpu/Texture_ktx.cpp b/libraries/gpu/src/gpu/Texture_ktx.cpp index 5e354c0a5c..0822af3cfb 100644 --- a/libraries/gpu/src/gpu/Texture_ktx.cpp +++ b/libraries/gpu/src/gpu/Texture_ktx.cpp @@ -619,6 +619,47 @@ bool Texture::evalKTXFormat(const Element& mipFormat, const Element& texelFormat return true; } +bool Texture::getCompressedFormat(ktx::GLInternalFormat format, Element& elFormat) { + if (format == ktx::GLInternalFormat::COMPRESSED_SRGB_S3TC_DXT1_EXT) { + elFormat = Format::COLOR_COMPRESSED_BCX_SRGB; + } else if (format == ktx::GLInternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT) { + elFormat = Format::COLOR_COMPRESSED_BCX_SRGBA_MASK; + } else if (format == ktx::GLInternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT) { + elFormat = Format::COLOR_COMPRESSED_BCX_SRGBA; + } else if (format == ktx::GLInternalFormat::COMPRESSED_RED_RGTC1) { + elFormat = Format::COLOR_COMPRESSED_BCX_RED; + } else if (format == ktx::GLInternalFormat::COMPRESSED_RG_RGTC2) { + elFormat = Format::COLOR_COMPRESSED_BCX_XY; + } else if (format == ktx::GLInternalFormat::COMPRESSED_SRGB_ALPHA_BPTC_UNORM) { + elFormat = Format::COLOR_COMPRESSED_BCX_SRGBA_HIGH; + } else if (format == ktx::GLInternalFormat::COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT) { + elFormat = Format::COLOR_COMPRESSED_BCX_HDR_RGB; + } else if (format == ktx::GLInternalFormat::COMPRESSED_RGB8_ETC2) { + elFormat = Format::COLOR_COMPRESSED_ETC2_RGB; + } else if (format == ktx::GLInternalFormat::COMPRESSED_SRGB8_ETC2) { + elFormat = Format::COLOR_COMPRESSED_ETC2_SRGB; + } else if (format == ktx::GLInternalFormat::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2) { + elFormat = Format::COLOR_COMPRESSED_ETC2_RGB_PUNCHTHROUGH_ALPHA; + } else if (format == ktx::GLInternalFormat::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2) { + elFormat = Format::COLOR_COMPRESSED_ETC2_SRGB_PUNCHTHROUGH_ALPHA; + } else if (format == ktx::GLInternalFormat::COMPRESSED_RGBA8_ETC2_EAC) { + elFormat = Format::COLOR_COMPRESSED_ETC2_RGBA; + } else if (format == ktx::GLInternalFormat::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC) { + elFormat = Format::COLOR_COMPRESSED_ETC2_SRGBA; + } else if (format == ktx::GLInternalFormat::COMPRESSED_R11_EAC) { + elFormat = Format::COLOR_COMPRESSED_EAC_RED; + } else if (format == ktx::GLInternalFormat::COMPRESSED_SIGNED_R11_EAC) { + elFormat = Format::COLOR_COMPRESSED_EAC_RED_SIGNED; + } else if (format == ktx::GLInternalFormat::COMPRESSED_RG11_EAC) { + elFormat = Format::COLOR_COMPRESSED_EAC_XY; + } else if (format == ktx::GLInternalFormat::COMPRESSED_SIGNED_RG11_EAC) { + elFormat = Format::COLOR_COMPRESSED_EAC_XY_SIGNED; + } else { + return false; + } + return true; +} + bool Texture::evalTextureFormat(const ktx::Header& header, Element& mipFormat, Element& texelFormat) { if (header.getGLFormat() == ktx::GLFormat::BGRA && header.getGLType() == ktx::GLType::UNSIGNED_BYTE && header.getTypeSize() == 1) { if (header.getGLInternaFormat() == ktx::GLInternalFormat::RGBA8) { @@ -661,41 +702,7 @@ bool Texture::evalTextureFormat(const ktx::Header& header, Element& mipFormat, E mipFormat = Format::COLOR_RGB9E5; texelFormat = Format::COLOR_RGB9E5; } else if (header.isCompressed()) { - if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SRGB_S3TC_DXT1_EXT) { - texelFormat = Format::COLOR_COMPRESSED_BCX_SRGB; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT) { - texelFormat = Format::COLOR_COMPRESSED_BCX_SRGBA_MASK; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT) { - texelFormat = Format::COLOR_COMPRESSED_BCX_SRGBA; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_RED_RGTC1) { - texelFormat = Format::COLOR_COMPRESSED_BCX_RED; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_RG_RGTC2) { - texelFormat = Format::COLOR_COMPRESSED_BCX_XY; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SRGB_ALPHA_BPTC_UNORM) { - texelFormat = Format::COLOR_COMPRESSED_BCX_SRGBA_HIGH; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT) { - texelFormat = Format::COLOR_COMPRESSED_BCX_HDR_RGB; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_RGB8_ETC2) { - texelFormat = Format::COLOR_COMPRESSED_ETC2_RGB; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SRGB8_ETC2) { - texelFormat = Format::COLOR_COMPRESSED_ETC2_SRGB; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2) { - texelFormat = Format::COLOR_COMPRESSED_ETC2_RGB_PUNCHTHROUGH_ALPHA; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2) { - texelFormat = Format::COLOR_COMPRESSED_ETC2_SRGB_PUNCHTHROUGH_ALPHA; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_RGBA8_ETC2_EAC) { - texelFormat = Format::COLOR_COMPRESSED_ETC2_RGBA; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC) { - texelFormat = Format::COLOR_COMPRESSED_ETC2_SRGBA; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_R11_EAC) { - texelFormat = Format::COLOR_COMPRESSED_EAC_RED; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SIGNED_R11_EAC) { - texelFormat = Format::COLOR_COMPRESSED_EAC_RED_SIGNED; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_RG11_EAC) { - texelFormat = Format::COLOR_COMPRESSED_EAC_XY; - } else if (header.getGLInternaFormat() == ktx::GLInternalFormat::COMPRESSED_SIGNED_RG11_EAC) { - texelFormat = Format::COLOR_COMPRESSED_EAC_XY_SIGNED; - } else { + if (!getCompressedFormat(header.getGLInternaFormat(), texelFormat)) { return false; } mipFormat = texelFormat; diff --git a/libraries/ktx/src/TextureMeta.cpp b/libraries/ktx/src/TextureMeta.cpp new file mode 100644 index 0000000000..88235d8a4b --- /dev/null +++ b/libraries/ktx/src/TextureMeta.cpp @@ -0,0 +1,58 @@ +// +// TextureMeta.cpp +// libraries/shared/src +// +// Created by Ryan Huffman on 04/10/18. +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "TextureMeta.h" + +#include +#include + +const QString TEXTURE_META_EXTENSION = ".texmeta.json"; + +bool TextureMeta::deserialize(const QByteArray& data, TextureMeta* meta) { + QJsonParseError error; + auto doc = QJsonDocument::fromJson(data, &error); + if (!doc.isObject()) { + return false; + } + + auto root = doc.object(); + if (root.contains("original")) { + meta->original = root["original"].toString(); + } + if (root.contains("compressed")) { + auto compressed = root["compressed"].toObject(); + for (auto it = compressed.constBegin(); it != compressed.constEnd(); it++) { + khronos::gl::texture::InternalFormat format; + auto formatName = it.key().toLatin1(); + if (khronos::gl::texture::fromString(formatName.constData(), &format)) { + meta->availableTextureTypes[format] = it.value().toString(); + } + } + } + + return true; +} + +QByteArray TextureMeta::serialize() { + QJsonDocument doc; + QJsonObject root; + QJsonObject compressed; + + for (auto kv : availableTextureTypes) { + const char* name = khronos::gl::texture::toString(kv.first); + compressed[name] = kv.second.toString(); + } + root["original"] = original.toString(); + root["compressed"] = compressed; + doc.setObject(root); + + return doc.toJson(); +} diff --git a/libraries/ktx/src/TextureMeta.h b/libraries/ktx/src/TextureMeta.h new file mode 100644 index 0000000000..6582c29e70 --- /dev/null +++ b/libraries/ktx/src/TextureMeta.h @@ -0,0 +1,42 @@ +// +// TextureMeta.h +// libraries/shared/src +// +// Created by Ryan Huffman on 04/10/18. +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_TextureMeta_h +#define hifi_TextureMeta_h + +#include +#include +#include + +#include "khronos/KHR.h" + +extern const QString TEXTURE_META_EXTENSION; + +namespace std { + template<> struct hash { + using enum_type = std::underlying_type::type; + typedef std::size_t result_type; + result_type operator()(khronos::gl::texture::InternalFormat const& v) const noexcept { + return std::hash()(static_cast(v)); + } + }; +} + +struct TextureMeta { + static bool deserialize(const QByteArray& data, TextureMeta* meta); + QByteArray serialize(); + + QUrl original; + std::unordered_map availableTextureTypes; +}; + + +#endif // hifi_TextureMeta_h diff --git a/libraries/ktx/src/khronos/KHR.h b/libraries/ktx/src/khronos/KHR.h index 4ee893e4fc..617e40ce06 100644 --- a/libraries/ktx/src/khronos/KHR.h +++ b/libraries/ktx/src/khronos/KHR.h @@ -10,6 +10,8 @@ #ifndef khronos_khr_hpp #define khronos_khr_hpp +#include + namespace khronos { namespace gl { @@ -209,6 +211,63 @@ namespace khronos { COMPRESSED_SIGNED_RG11_EAC = 0x9273, }; + static std::unordered_map nameToFormat { + { "COMPRESSED_RED", InternalFormat::COMPRESSED_RED }, + { "COMPRESSED_RG", InternalFormat::COMPRESSED_RG }, + { "COMPRESSED_RGB", InternalFormat::COMPRESSED_RGB }, + { "COMPRESSED_RGBA", InternalFormat::COMPRESSED_RGBA }, + + { "COMPRESSED_SRGB", InternalFormat::COMPRESSED_SRGB }, + { "COMPRESSED_SRGB_ALPHA", InternalFormat::COMPRESSED_SRGB_ALPHA }, + + { "COMPRESSED_ETC1_RGB8_OES", InternalFormat::COMPRESSED_ETC1_RGB8_OES }, + + { "COMPRESSED_SRGB_S3TC_DXT1_EXT", InternalFormat::COMPRESSED_SRGB_S3TC_DXT1_EXT }, + { "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", InternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT }, + { "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", InternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT }, + { "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", InternalFormat::COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT }, + + { "COMPRESSED_RED_RGTC1", InternalFormat::COMPRESSED_RED_RGTC1 }, + { "COMPRESSED_SIGNED_RED_RGTC1", InternalFormat::COMPRESSED_SIGNED_RED_RGTC1 }, + { "COMPRESSED_RG_RGTC2", InternalFormat::COMPRESSED_RG_RGTC2 }, + { "COMPRESSED_SIGNED_RG_RGTC2", InternalFormat::COMPRESSED_SIGNED_RG_RGTC2 }, + + { "COMPRESSED_RGBA_BPTC_UNORM", InternalFormat::COMPRESSED_RGBA_BPTC_UNORM }, + { "COMPRESSED_SRGB_ALPHA_BPTC_UNORM", InternalFormat::COMPRESSED_SRGB_ALPHA_BPTC_UNORM }, + { "COMPRESSED_RGB_BPTC_SIGNED_FLOAT", InternalFormat::COMPRESSED_RGB_BPTC_SIGNED_FLOAT }, + { "COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT", InternalFormat::COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT }, + + { "COMPRESSED_RGB8_ETC2", InternalFormat::COMPRESSED_RGB8_ETC2 }, + { "COMPRESSED_SRGB8_ETC2", InternalFormat::COMPRESSED_SRGB8_ETC2 }, + { "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", InternalFormat::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 }, + { "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", InternalFormat::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 }, + { "COMPRESSED_RGBA8_ETC2_EAC", InternalFormat::COMPRESSED_RGBA8_ETC2_EAC }, + { "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", InternalFormat::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC }, + + { "COMPRESSED_R11_EAC", InternalFormat::COMPRESSED_R11_EAC }, + { "COMPRESSED_SIGNED_R11_EAC", InternalFormat::COMPRESSED_SIGNED_R11_EAC }, + { "COMPRESSED_RG11_EAC", InternalFormat::COMPRESSED_RG11_EAC }, + { "COMPRESSED_SIGNED_RG11_EAC", InternalFormat::COMPRESSED_SIGNED_RG11_EAC } + }; + + inline const char* toString(InternalFormat format) { + for (auto& pair : nameToFormat) { + if (pair.second == format) { + return pair.first.data(); + } + } + return nullptr; + } + + inline bool fromString(const char* name, InternalFormat* format) { + auto it = nameToFormat.find(name); + if (it == nameToFormat.end()) { + return false; + } + *format = it->second; + return true; + } + inline uint8_t evalUncompressedBlockBitSize(InternalFormat format) { switch (format) { case InternalFormat::R8: diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index f17cdbb7e8..6756941520 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -517,10 +517,11 @@ QUrl NetworkMaterial::getTextureUrl(const QUrl& baseUrl, const FBXTexture& textu // Inlined file: cache under the fbx file to avoid namespace clashes // NOTE: We cannot resolve the path because filename may be an absolute path assert(texture.filename.size() > 0); + auto baseUrlStripped = baseUrl.toDisplayString(QUrl::RemoveFragment | QUrl::RemoveQuery | QUrl::RemoveUserInfo); if (texture.filename.at(0) == '/') { - return baseUrl.toString() + texture.filename; + return baseUrlStripped + texture.filename; } else { - return baseUrl.toString() + '/' + texture.filename; + return baseUrlStripped + '/' + texture.filename; } } } diff --git a/libraries/model-networking/src/model-networking/TextureCache.cpp b/libraries/model-networking/src/model-networking/TextureCache.cpp index 04696cea1a..54b654c56b 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.cpp +++ b/libraries/model-networking/src/model-networking/TextureCache.cpp @@ -48,6 +48,8 @@ #include #include +#include + Q_LOGGING_CATEGORY(trace_resource_parse_image, "trace.resource.parse.image") Q_LOGGING_CATEGORY(trace_resource_parse_image_raw, "trace.resource.parse.image.raw") Q_LOGGING_CATEGORY(trace_resource_parse_image_ktx, "trace.resource.parse.image.ktx") @@ -293,7 +295,6 @@ int networkTexturePointerMetaTypeId = qRegisterMetaType(url); @@ -309,17 +310,25 @@ static bool isLocalUrl(const QUrl& url) { NetworkTexture::NetworkTexture(const QUrl& url, image::TextureUsage::Type type, const QByteArray& content, int maxNumPixels) : Resource(url), _type(type), - _sourceIsKTX(url.path().endsWith(".ktx")), _maxNumPixels(maxNumPixels) { _textureSource = std::make_shared(url, (int)type); _lowestRequestedMipLevel = 0; - _shouldFailOnRedirect = !_sourceIsKTX; + qDebug() << "Creating networktexture: " << url; + if (url.fileName().endsWith(TEXTURE_META_EXTENSION)) { + _currentlyLoadingResourceType = ResourceType::META; + } else if (url.fileName().endsWith(".ktx")) { + _currentlyLoadingResourceType = ResourceType::KTX; + } else { + _currentlyLoadingResourceType = ResourceType::ORIGINAL; + } + + _shouldFailOnRedirect = _currentlyLoadingResourceType != ResourceType::KTX; if (type == image::TextureUsage::CUBE_TEXTURE) { setLoadPriority(this, SKYBOX_LOAD_PRIORITY); - } else if (_sourceIsKTX) { + } else if (_currentlyLoadingResourceType == ResourceType::KTX) { setLoadPriority(this, HIGH_MIPS_LOAD_PRIORITY); } @@ -330,7 +339,7 @@ NetworkTexture::NetworkTexture(const QUrl& url, image::TextureUsage::Type type, // if we have content, load it after we have our self pointer if (!content.isEmpty()) { _startedLoading = true; - QMetaObject::invokeMethod(this, "loadContent", Qt::QueuedConnection, Q_ARG(const QByteArray&, content)); + QMetaObject::invokeMethod(this, "downloadFinished", Qt::QueuedConnection, Q_ARG(const QByteArray&, content)); } } @@ -393,12 +402,13 @@ NetworkTexture::~NetworkTexture() { const uint16_t NetworkTexture::NULL_MIP_LEVEL = std::numeric_limits::max(); void NetworkTexture::makeRequest() { - if (!_sourceIsKTX) { + qDebug() << "In makeRequest for " << _activeUrl << (int)_currentlyLoadingResourceType; + if (_currentlyLoadingResourceType != ResourceType::KTX) { Resource::makeRequest(); return; } - if (isLocalUrl(_url)) { + if (isLocalUrl(_activeUrl)) { auto self = _self; QtConcurrent::run(QThreadPool::globalInstance(), [self] { auto resource = self.lock(); @@ -444,6 +454,7 @@ void NetworkTexture::makeRequest() { _ktxHeaderRequest->send(); + qDebug() << "Starting mip range request"; startMipRangeRequest(NULL_MIP_LEVEL, NULL_MIP_LEVEL); } else if (_ktxResourceState == PENDING_MIP_REQUEST) { if (_lowestKnownPopulatedMip > 0) { @@ -466,12 +477,12 @@ void NetworkTexture::handleLocalRequestCompleted() { } void NetworkTexture::makeLocalRequest() { - const QString scheme = _url.scheme(); + const QString scheme = _activeUrl.scheme(); QString path; if (scheme == URL_SCHEME_FILE) { - path = PathUtils::expandToLocalDataAbsolutePath(_url).toLocalFile(); + path = PathUtils::expandToLocalDataAbsolutePath(_activeUrl).toLocalFile(); } else { - path = ":" + _url.path(); + path = ":" + _activeUrl.path(); } connect(this, &Resource::finished, this, &NetworkTexture::handleLocalRequestCompleted); @@ -497,7 +508,7 @@ void NetworkTexture::makeLocalRequest() { }); if (found == ktxDescriptor->keyValues.end() || found->_value.size() != gpu::SOURCE_HASH_BYTES) { - hash = _url.toString().toLocal8Bit().toHex().toStdString(); + hash = _activeUrl.toString().toLocal8Bit().toHex().toStdString(); } else { // at this point the source hash is in binary 16-byte form // and we need it in a hexadecimal string @@ -536,11 +547,13 @@ void NetworkTexture::makeLocalRequest() { } bool NetworkTexture::handleFailedRequest(ResourceRequest::Result result) { - if (!_sourceIsKTX && result == ResourceRequest::Result::RedirectFail) { + if (_currentlyLoadingResourceType != ResourceType::KTX + && result == ResourceRequest::Result::RedirectFail) { + auto newPath = _request->getRelativePathUrl(); if (newPath.fileName().endsWith(".ktx")) { qDebug() << "Redirecting to" << newPath << "from" << _url; - _sourceIsKTX = true; + _currentlyLoadingResourceType = ResourceType::KTX; _activeUrl = newPath; _shouldFailOnRedirect = false; makeRequest(); @@ -581,6 +594,7 @@ void NetworkTexture::startMipRangeRequest(uint16_t low, uint16_t high) { bool isHighMipRequest = low == NULL_MIP_LEVEL && high == NULL_MIP_LEVEL; + qDebug() << "Making ktx mip request to: " << _activeUrl; _ktxMipRequest = DependencyManager::get()->createResourceRequest(this, _activeUrl); if (!_ktxMipRequest) { @@ -930,11 +944,79 @@ void NetworkTexture::handleFinishedInitialLoad() { } void NetworkTexture::downloadFinished(const QByteArray& data) { - loadContent(data); + qDebug() << "Loading content: " << _activeUrl; + if (_currentlyLoadingResourceType == ResourceType::META) { + qDebug() << "Loading meta content: " << _activeUrl; + loadMetaContent(data); + } else if (_currentlyLoadingResourceType == ResourceType::ORIGINAL) { + loadTextureContent(data); + } else { + TextureCache::requestCompleted(_self); + Resource::handleFailedRequest(ResourceRequest::Error); + } } -void NetworkTexture::loadContent(const QByteArray& content) { - if (_sourceIsKTX) { +void NetworkTexture::loadMetaContent(const QByteArray& content) { + if (_currentlyLoadingResourceType != ResourceType::META) { + qWarning() << "Trying to load meta content when current resource type is not META"; + assert(false); + return; + } + + TextureMeta meta; + if (!TextureMeta::deserialize(content, &meta)) { + qWarning() << "Failed to read texture meta from " << _url; + return; + } + + + auto& backend = DependencyManager::get()->getGPUContext()->getBackend(); + for (auto pair : meta.availableTextureTypes) { + gpu::Element elFormat; + + if (gpu::Texture::getCompressedFormat(pair.first, elFormat)) { + if (backend->supportedTextureFormat(elFormat)) { + auto url = pair.second; + if (url.fileName().endsWith(TEXTURE_META_EXTENSION)) { + qWarning() << "Found a texture meta URL inside of the texture meta file at" << _activeUrl; + continue; + } + + _currentlyLoadingResourceType = ResourceType::KTX; + _activeUrl = _activeUrl.resolved(url); + qDebug() << "Active url is now: " << _activeUrl; + auto textureCache = DependencyManager::get(); + auto self = _self.lock(); + if (!self) { + return; + } + QMetaObject::invokeMethod(this, "attemptRequest", Qt::QueuedConnection); + return; + } + } + } + + if (!meta.original.isEmpty()) { + _currentlyLoadingResourceType = ResourceType::ORIGINAL; + _activeUrl = _activeUrl.resolved(meta.original); + + auto textureCache = DependencyManager::get(); + auto self = _self.lock(); + if (!self) { + return; + } + QMetaObject::invokeMethod(this, "attemptRequest", Qt::QueuedConnection); + return; + } + + qWarning() << "Failed to find supported texture type in " << _activeUrl; + //TextureCache::requestCompleted(_self); + Resource::handleFailedRequest(ResourceRequest::NotFound); +} + +void NetworkTexture::loadTextureContent(const QByteArray& content) { + if (_currentlyLoadingResourceType != ResourceType::ORIGINAL) { + qWarning() << "Trying to load texture content when currentl resource type is not ORIGINAL"; assert(false); return; } diff --git a/libraries/model-networking/src/model-networking/TextureCache.h b/libraries/model-networking/src/model-networking/TextureCache.h index 3f46dc3074..d93ddb461e 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.h +++ b/libraries/model-networking/src/model-networking/TextureCache.h @@ -24,7 +24,9 @@ #include #include #include +#include +#include #include "KTXCache.h" namespace gpu { @@ -75,11 +77,13 @@ protected: virtual bool isCacheable() const override { return _loaded; } - virtual void downloadFinished(const QByteArray& data) override; + Q_INVOKABLE virtual void downloadFinished(const QByteArray& data) override; bool handleFailedRequest(ResourceRequest::Result result) override; - Q_INVOKABLE void loadContent(const QByteArray& content); + Q_INVOKABLE void loadMetaContent(const QByteArray& content); + Q_INVOKABLE void loadTextureContent(const QByteArray& content); + Q_INVOKABLE void setImage(gpu::TexturePointer texture, int originalWidth, int originalHeight); Q_INVOKABLE void startRequestForNextMipLevel(); @@ -93,6 +97,14 @@ private: image::TextureUsage::Type _type; + enum class ResourceType { + META, + ORIGINAL, + KTX + }; + + ResourceType _currentlyLoadingResourceType { ResourceType::META }; + static const uint16_t NULL_MIP_LEVEL; enum KTXResourceState { PENDING_INITIAL_LOAD = 0, @@ -103,7 +115,6 @@ private: FAILED_TO_LOAD }; - bool _sourceIsKTX { false }; KTXResourceState _ktxResourceState { PENDING_INITIAL_LOAD }; // The current mips that are currently being requested w/ _ktxMipRequest @@ -236,6 +247,9 @@ public: static const int DEFAULT_SPECTATOR_CAM_WIDTH { 2048 }; static const int DEFAULT_SPECTATOR_CAM_HEIGHT { 1024 }; + void setGPUContext(const gpu::ContextPointer& context) { _gpuContext = context; } + gpu::ContextPointer getGPUContext() const { return _gpuContext; } + signals: /**jsdoc * @function TextureCache.spectatorCameraFramebufferReset @@ -268,6 +282,8 @@ private: static const std::string KTX_DIRNAME; static const std::string KTX_EXT; + gpu::ContextPointer _gpuContext { nullptr }; + std::shared_ptr _ktxCache { std::make_shared(KTX_DIRNAME, KTX_EXT) }; // Map from image hashes to texture weak pointers diff --git a/libraries/networking/src/ResourceCache.cpp b/libraries/networking/src/ResourceCache.cpp index 7ba7cca96d..4d3ba9da25 100644 --- a/libraries/networking/src/ResourceCache.cpp +++ b/libraries/networking/src/ResourceCache.cpp @@ -581,6 +581,7 @@ void Resource::refresh() { ResourceCache::requestCompleted(_self); } + _activeUrl = _url; init(); ensureLoading(); emit onRefresh(); @@ -618,7 +619,7 @@ void Resource::init(bool resetLoaded) { _loaded = false; } _attempts = 0; - _activeUrl = _url; + qDebug() << "Initting resource: " << _url; if (_url.isEmpty()) { _startedLoading = _loaded = true; @@ -671,6 +672,7 @@ void Resource::makeRequest() { PROFILE_ASYNC_BEGIN(resource, "Resource:" + getType(), QString::number(_requestID), { { "url", _url.toString() }, { "activeURL", _activeUrl.toString() } }); + qDebug() << "Making request to " << _activeUrl; _request = DependencyManager::get()->createResourceRequest(this, _activeUrl); if (!_request) { @@ -724,7 +726,7 @@ void Resource::handleReplyFinished() { auto result = _request->getResult(); if (result == ResourceRequest::Success) { auto extraInfo = _url == _activeUrl ? "" : QString(", %1").arg(_activeUrl.toDisplayString()); - qCDebug(networking).noquote() << QString("Request finished for %1%2").arg(_url.toDisplayString(), extraInfo); + qCDebug(networking).noquote() << QString("Request finished for %1%2").arg(_activeUrl.toDisplayString(), extraInfo); auto relativePathURL = _request->getRelativePathUrl(); if (!relativePathURL.isEmpty()) { diff --git a/tools/oven/src/DomainBaker.cpp b/tools/oven/src/DomainBaker.cpp index 3c6799db88..0a75c72f9a 100644 --- a/tools/oven/src/DomainBaker.cpp +++ b/tools/oven/src/DomainBaker.cpp @@ -464,7 +464,7 @@ bool DomainBaker::rewriteSkyboxURL(QJsonValueRef urlValue, TextureBaker* baker) if (oldSkyboxURL.matches(baker->getTextureURL(), QUrl::RemoveQuery | QUrl::RemoveFragment)) { // change the URL to point to the baked texture with its original query and fragment - auto newSkyboxURL = _destinationPath.resolved(baker->getBakedTextureFileName()); + auto newSkyboxURL = _destinationPath.resolved(baker->getMetaTextureFileName()); newSkyboxURL.setQuery(oldSkyboxURL.query()); newSkyboxURL.setFragment(oldSkyboxURL.fragment()); newSkyboxURL.setUserInfo(oldSkyboxURL.userInfo()); From 12d4cf12cf6790a5d9549df29bc3718648a32994 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 1 May 2018 14:11:50 -0700 Subject: [PATCH 05/30] Bump model and texture baking versions in AssetServer --- assignment-client/src/assets/AssetServer.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.h b/assignment-client/src/assets/AssetServer.h index fb88df0171..c4b1ff07e5 100644 --- a/assignment-client/src/assets/AssetServer.h +++ b/assignment-client/src/assets/AssetServer.h @@ -36,10 +36,11 @@ enum class BakedAssetType : int { Undefined }; -// ATTENTION! If you change the current version for an asset type, you will also -// need to update the function currentBakeVersionForAssetType() inside of AssetServer.cpp. +// ATTENTION! Do not remove baking versions, and do not reorder them. If you add +// a new value, it will immediately become the "current" version. enum class ModelBakeVersion : BakeVersion { Initial = INITIAL_BAKE_VERSION, + MetaTextureJson, COUNT }; @@ -47,6 +48,7 @@ enum class ModelBakeVersion : BakeVersion { // ATTENTION! See above. enum class TextureBakeVersion : BakeVersion { Initial = INITIAL_BAKE_VERSION, + MetaTextureJson, COUNT }; From 5a064d3499681c6b1376007e550fb7cea8526010 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 2 May 2018 14:13:15 +1200 Subject: [PATCH 06/30] Remove selection handles and list highlight when entity deletes --- scripts/system/edit.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index c99c8d401a..9b6b70b954 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -471,6 +471,10 @@ var toolBar = (function () { } } + function checkDeletedEntityAndUpdate(entityID) { + selectionManager.removeEntity(entityID); + } + function initialize() { Script.scriptEnding.connect(cleanup); Window.domainChanged.connect(function () { @@ -493,8 +497,10 @@ var toolBar = (function () { Entities.canRezTmpChanged.connect(checkEditPermissionsAndUpdate); Entities.canRezCertifiedChanged.connect(checkEditPermissionsAndUpdate); Entities.canRezTmpCertifiedChanged.connect(checkEditPermissionsAndUpdate); - var hasRezPermissions = (Entities.canRez() || Entities.canRezTmp() || Entities.canRezCertified() || Entities.canRezTmpCertified()); + + Entities.deletingEntity.connect(checkDeletedEntityAndUpdate); + var createButtonIconRsrc = (hasRezPermissions ? CREATE_ENABLED_ICON : CREATE_DISABLED_ICON); tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); activeButton = tablet.addButton({ From f27e363b6879d6a3e064ee45e91fafcb770ad465 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 2 May 2018 15:23:13 +1200 Subject: [PATCH 07/30] Remove entity from list when it deletes; handle multiple deletions --- scripts/system/edit.js | 17 ++++++++++++++++- scripts/system/libraries/entitySelectionTool.js | 11 +++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 9b6b70b954..6bb815a597 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -471,8 +471,23 @@ var toolBar = (function () { } } + var entitiesToDelete = []; + var deletedEntityTimer = null; + var DELETE_ENTITY_TIMER_TIMEOUT = 100; + function checkDeletedEntityAndUpdate(entityID) { - selectionManager.removeEntity(entityID); + // Allow for multiple entity deletes before updating the entity list. + entitiesToDelete.push(entityID); + if (deletedEntityTimer !== null) { + Script.clearTimeout(deletedEntityTimer); + } + deletedEntityTimer = Script.setTimeout(function () { + selectionManager.removeEntities(entitiesToDelete); + entityListTool.clearEntityList(); + entityListTool.sendUpdate(); + entitiesToDelete = []; + deletedEntityTimer = null; + }, DELETE_ENTITY_TIMER_TIMEOUT); } function initialize() { diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 2322210522..4996579799 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -149,6 +149,17 @@ SelectionManager = (function() { that._update(true); }; + that.removeEntities = function (entityIDs) { + for (var i = 0, length = entityIDs.length; i < length; i++) { + var idx = that.selections.indexOf(entityIDs[i]); + if (idx >= 0) { + that.selections.splice(idx, 1); + Selection.removeFromSelectedItemsList(HIGHLIGHT_LIST_NAME, "entity", entityIDs[i]); + } + } + that._update(true); + }; + that.clearSelections = function() { that.selections = []; that._update(true); From 697fde4a1a247437ea730cdb642f470e395b0ecd Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 2 May 2018 13:31:32 -0700 Subject: [PATCH 08/30] Cleanup meta texture related changes --- libraries/baking/src/FBXBaker.cpp | 56 ------------------- libraries/baking/src/ModelBaker.cpp | 4 -- libraries/baking/src/TextureBaker.cpp | 11 ++-- libraries/fbx/src/FBXReader.cpp | 1 - libraries/fbx/src/FBXReader_Material.cpp | 4 -- .../src/model-networking/TextureCache.cpp | 10 +--- libraries/networking/src/ResourceCache.cpp | 2 - 7 files changed, 6 insertions(+), 82 deletions(-) diff --git a/libraries/baking/src/FBXBaker.cpp b/libraries/baking/src/FBXBaker.cpp index 175698eeea..c8ba98f0b1 100644 --- a/libraries/baking/src/FBXBaker.cpp +++ b/libraries/baking/src/FBXBaker.cpp @@ -74,62 +74,6 @@ void FBXBaker::bakeSourceCopy() { checkIfTexturesFinished(); } -void FBXBaker::embedTextureMetaData() { - std::vector embeddedTextureNodes; - - for (FBXNode& rootChild : _rootNode.children) { - if (rootChild.name == "Objects") { - qlonglong maxId = 0; - for (auto &child : rootChild.children) { - if (child.properties.length() == 3) { - maxId = std::max(maxId, child.properties[0].toLongLong()); - } - } - - for (auto& object : rootChild.children) { - if (object.name == "Texture") { - QVariant relativeFilename; - for (auto& child : object.children) { - if (child.name == "RelativeFilename") { - relativeFilename = child.properties[0]; - break; - } - } - - if (relativeFilename.isNull() || !relativeFilename.toString().endsWith(BAKED_META_TEXTURE_SUFFIX)) { - continue; - } - - FBXNode videoNode; - videoNode.name = "Video"; - videoNode.properties.append(++maxId); - videoNode.properties.append(object.properties[1]); - videoNode.properties.append("Clip"); - - QString bakedTextureFilePath { - _bakedOutputDir + "/" + relativeFilename.toString() - }; - qDebug() << "Location of texture: " << bakedTextureFilePath; - - QFile textureFile { bakedTextureFilePath }; - if (!textureFile.open(QIODevice::ReadOnly)) { - qWarning() << "Failed to open: " << bakedTextureFilePath; - continue; - } - - videoNode.children.append({ "RelativeFilename", { relativeFilename }, { } }); - videoNode.children.append({ "Content", { textureFile.readAll() }, { } }); - - rootChild.children.append(videoNode); - - textureFile.close(); - } - } - } - } - -} - void FBXBaker::setupOutputFolder() { // make sure there isn't already an output directory using the same name if (QDir(_bakedOutputDir).exists()) { diff --git a/libraries/baking/src/ModelBaker.cpp b/libraries/baking/src/ModelBaker.cpp index 020a0dbfc2..ee26b94b81 100644 --- a/libraries/baking/src/ModelBaker.cpp +++ b/libraries/baking/src/ModelBaker.cpp @@ -537,8 +537,6 @@ void ModelBaker::embedTextureMetaData() { } } - qDebug() << "Max id found was: " << maxId; - for (auto& object : rootChild.children) { if (object.name == "Texture") { QVariant relativeFilename; @@ -567,7 +565,6 @@ void ModelBaker::embedTextureMetaData() { QString bakedTextureFilePath { _bakedOutputDir + "/" + relativeFilename.toString() }; - qDebug() << "Location of texture: " << bakedTextureFilePath; QFile textureFile { bakedTextureFilePath }; if (!textureFile.open(QIODevice::ReadOnly)) { @@ -585,7 +582,6 @@ void ModelBaker::embedTextureMetaData() { } } } - } void ModelBaker::exportScene() { diff --git a/libraries/baking/src/TextureBaker.cpp b/libraries/baking/src/TextureBaker.cpp index 7a5dc85a61..45895494a0 100644 --- a/libraries/baking/src/TextureBaker.cpp +++ b/libraries/baking/src/TextureBaker.cpp @@ -128,11 +128,11 @@ void TextureBaker::processTexture() { auto filePath = _outputDirectory.absoluteFilePath(_textureURL.fileName()); QFile file { filePath }; if (!file.open(QIODevice::WriteOnly) || file.write(_originalTexture) == -1) { - handleError("Could not write meta texture for " + _textureURL.toString()); + handleError("Could not write original texture for " + _textureURL.toString()); return; } _outputFiles.push_back(filePath); - meta.original =_metaTexturePathPrefix +_textureURL.fileName(); + meta.original = _metaTexturePathPrefix +_textureURL.fileName(); } // IMPORTANT: _originalTexture is empty past this point @@ -157,18 +157,17 @@ void TextureBaker::processTexture() { return; } - const char* data = reinterpret_cast(memKTX->_storage->data()); - const size_t length = memKTX->_storage->size(); const char* name = khronos::gl::texture::toString(memKTX->_header.getGLInternaFormat()); if (name == nullptr) { handleError("Could not determine internal format for compressed KTX: " + _textureURL.toString()); return; } - qDebug() << "Found type: " << name; - // attempt to write the baked texture to the destination file path { + const char* data = reinterpret_cast(memKTX->_storage->data()); + const size_t length = memKTX->_storage->size(); + auto fileName = _baseFilename + BAKED_TEXTURE_BCN_SUFFIX; auto filePath = _outputDirectory.absoluteFilePath(fileName); QFile bakedTextureFile { filePath }; diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 1f237edfb0..1e59646795 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -1101,7 +1101,6 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS } if (!content.isEmpty()) { _textureContent.insert(filepath, content); - qDebug() << "Adding content: " << filepath << content.length(); } } else if (object.name == "Material") { FBXMaterial material; diff --git a/libraries/fbx/src/FBXReader_Material.cpp b/libraries/fbx/src/FBXReader_Material.cpp index 88dc7f599d..4aa3044934 100644 --- a/libraries/fbx/src/FBXReader_Material.cpp +++ b/libraries/fbx/src/FBXReader_Material.cpp @@ -85,16 +85,12 @@ FBXTexture FBXReader::getTexture(const QString& textureID) { FBXTexture texture; const QByteArray& filepath = _textureFilepaths.value(textureID); texture.content = _textureContent.value(filepath); - qDebug() << "Getting texture: " << textureID << filepath << texture.content.length(); if (texture.content.isEmpty()) { // the content is not inlined - qDebug() << "Texture is not inlined"; texture.filename = _textureFilenames.value(textureID); } else { // use supplied filepath for inlined content - qDebug() << "Texture is inlined"; texture.filename = filepath; } - qDebug() << "Path: " << texture.filename; texture.id = textureID; texture.name = _textureNames.value(textureID); diff --git a/libraries/model-networking/src/model-networking/TextureCache.cpp b/libraries/model-networking/src/model-networking/TextureCache.cpp index 54b654c56b..241c4eef3b 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.cpp +++ b/libraries/model-networking/src/model-networking/TextureCache.cpp @@ -315,7 +315,6 @@ NetworkTexture::NetworkTexture(const QUrl& url, image::TextureUsage::Type type, _textureSource = std::make_shared(url, (int)type); _lowestRequestedMipLevel = 0; - qDebug() << "Creating networktexture: " << url; if (url.fileName().endsWith(TEXTURE_META_EXTENSION)) { _currentlyLoadingResourceType = ResourceType::META; } else if (url.fileName().endsWith(".ktx")) { @@ -402,7 +401,6 @@ NetworkTexture::~NetworkTexture() { const uint16_t NetworkTexture::NULL_MIP_LEVEL = std::numeric_limits::max(); void NetworkTexture::makeRequest() { - qDebug() << "In makeRequest for " << _activeUrl << (int)_currentlyLoadingResourceType; if (_currentlyLoadingResourceType != ResourceType::KTX) { Resource::makeRequest(); return; @@ -454,7 +452,6 @@ void NetworkTexture::makeRequest() { _ktxHeaderRequest->send(); - qDebug() << "Starting mip range request"; startMipRangeRequest(NULL_MIP_LEVEL, NULL_MIP_LEVEL); } else if (_ktxResourceState == PENDING_MIP_REQUEST) { if (_lowestKnownPopulatedMip > 0) { @@ -594,7 +591,6 @@ void NetworkTexture::startMipRangeRequest(uint16_t low, uint16_t high) { bool isHighMipRequest = low == NULL_MIP_LEVEL && high == NULL_MIP_LEVEL; - qDebug() << "Making ktx mip request to: " << _activeUrl; _ktxMipRequest = DependencyManager::get()->createResourceRequest(this, _activeUrl); if (!_ktxMipRequest) { @@ -944,9 +940,7 @@ void NetworkTexture::handleFinishedInitialLoad() { } void NetworkTexture::downloadFinished(const QByteArray& data) { - qDebug() << "Loading content: " << _activeUrl; if (_currentlyLoadingResourceType == ResourceType::META) { - qDebug() << "Loading meta content: " << _activeUrl; loadMetaContent(data); } else if (_currentlyLoadingResourceType == ResourceType::ORIGINAL) { loadTextureContent(data); @@ -984,7 +978,6 @@ void NetworkTexture::loadMetaContent(const QByteArray& content) { _currentlyLoadingResourceType = ResourceType::KTX; _activeUrl = _activeUrl.resolved(url); - qDebug() << "Active url is now: " << _activeUrl; auto textureCache = DependencyManager::get(); auto self = _self.lock(); if (!self) { @@ -1010,13 +1003,12 @@ void NetworkTexture::loadMetaContent(const QByteArray& content) { } qWarning() << "Failed to find supported texture type in " << _activeUrl; - //TextureCache::requestCompleted(_self); Resource::handleFailedRequest(ResourceRequest::NotFound); } void NetworkTexture::loadTextureContent(const QByteArray& content) { if (_currentlyLoadingResourceType != ResourceType::ORIGINAL) { - qWarning() << "Trying to load texture content when currentl resource type is not ORIGINAL"; + qWarning() << "Trying to load texture content when current resource type is not ORIGINAL"; assert(false); return; } diff --git a/libraries/networking/src/ResourceCache.cpp b/libraries/networking/src/ResourceCache.cpp index 4d3ba9da25..4d1bfdea66 100644 --- a/libraries/networking/src/ResourceCache.cpp +++ b/libraries/networking/src/ResourceCache.cpp @@ -619,7 +619,6 @@ void Resource::init(bool resetLoaded) { _loaded = false; } _attempts = 0; - qDebug() << "Initting resource: " << _url; if (_url.isEmpty()) { _startedLoading = _loaded = true; @@ -672,7 +671,6 @@ void Resource::makeRequest() { PROFILE_ASYNC_BEGIN(resource, "Resource:" + getType(), QString::number(_requestID), { { "url", _url.toString() }, { "activeURL", _activeUrl.toString() } }); - qDebug() << "Making request to " << _activeUrl; _request = DependencyManager::get()->createResourceRequest(this, _activeUrl); if (!_request) { From 529869e80c79bd281d60e526d0a3fce219132c55 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 2 May 2018 13:41:52 -0700 Subject: [PATCH 09/30] Make NetworkTexture extension comparisons case-insensitive --- .../model-networking/src/model-networking/TextureCache.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/model-networking/src/model-networking/TextureCache.cpp b/libraries/model-networking/src/model-networking/TextureCache.cpp index 241c4eef3b..ed21fd35bc 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.cpp +++ b/libraries/model-networking/src/model-networking/TextureCache.cpp @@ -315,9 +315,10 @@ NetworkTexture::NetworkTexture(const QUrl& url, image::TextureUsage::Type type, _textureSource = std::make_shared(url, (int)type); _lowestRequestedMipLevel = 0; - if (url.fileName().endsWith(TEXTURE_META_EXTENSION)) { + auto fileNameLowercase = url.fileName().toLower(); + if (fileNameLowercase.endsWith(TEXTURE_META_EXTENSION)) { _currentlyLoadingResourceType = ResourceType::META; - } else if (url.fileName().endsWith(".ktx")) { + } else if (fileNameLowercase.endsWith(".ktx")) { _currentlyLoadingResourceType = ResourceType::KTX; } else { _currentlyLoadingResourceType = ResourceType::ORIGINAL; From 4a96dc2fdc4b4c722d8f342d1c33876273b08fc5 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 3 May 2018 08:48:17 +1200 Subject: [PATCH 10/30] Refactor --- scripts/system/libraries/entitySelectionTool.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 4996579799..36cc98a80b 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -140,22 +140,22 @@ SelectionManager = (function() { that._update(true); }; - that.removeEntity = function(entityID) { + function removeEntityByID(entityID) { var idx = that.selections.indexOf(entityID); if (idx >= 0) { that.selections.splice(idx, 1); Selection.removeFromSelectedItemsList(HIGHLIGHT_LIST_NAME, "entity", entityID); } + } + + that.removeEntity = function (entityID) { + removeEntityByID(entityID); that._update(true); }; that.removeEntities = function (entityIDs) { for (var i = 0, length = entityIDs.length; i < length; i++) { - var idx = that.selections.indexOf(entityIDs[i]); - if (idx >= 0) { - that.selections.splice(idx, 1); - Selection.removeFromSelectedItemsList(HIGHLIGHT_LIST_NAME, "entity", entityIDs[i]); - } + removeEntityByID(entityIDs[i]); } that._update(true); }; From 5312c81a6fe7be0ca5b5c90bbab24d91e2d14963 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 3 May 2018 08:49:18 +1200 Subject: [PATCH 11/30] Match style of surrounding code --- scripts/system/libraries/entitySelectionTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 36cc98a80b..e84600a64a 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -153,7 +153,7 @@ SelectionManager = (function() { that._update(true); }; - that.removeEntities = function (entityIDs) { + that.removeEntities = function(entityIDs) { for (var i = 0, length = entityIDs.length; i < length; i++) { removeEntityByID(entityIDs[i]); } From fc9bd7f905d2f0c6dd92ac539e2dbbb4afb75f17 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Thu, 3 May 2018 13:51:50 -0700 Subject: [PATCH 12/30] Fix for crash deep in QML after useFullAvatarURL Here we avoid calling FSTReader::downloadMapping() from within MyAvatar::useFullAvatarURL(). This prevents the error case where a QEventLoop is entered during QML execution. --- interface/src/avatar/MyAvatar.cpp | 18 +++++++++++------- .../src/model-networking/ModelCache.cpp | 19 +++++++++++-------- .../src/model-networking/ModelCache.h | 2 ++ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index e116b3830e..15b220c63b 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1486,6 +1486,15 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) { std::shared_ptr skeletonConnection = std::make_shared(); *skeletonConnection = QObject::connect(_skeletonModel.get(), &SkeletonModel::skeletonLoaded, [this, skeletonModelChangeCount, skeletonConnection]() { if (skeletonModelChangeCount == _skeletonModelChangeCount) { + + if (_fullAvatarModelName.isEmpty()) { + // Store the FST file name into preferences + const auto& mapping = _skeletonModel->getGeometry()->getMapping(); + if (mapping.value("name").isValid()) { + _fullAvatarModelName = mapping.value("name").toString(); + } + } + initHeadBones(); _skeletonModel->setCauterizeBoneSet(_headBoneSet); _fstAnimGraphOverrideUrl = _skeletonModel->getGeometry()->getAnimGraphOverrideUrl(); @@ -1548,12 +1557,7 @@ void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelN if (_fullAvatarURLFromPreferences != fullAvatarURL) { _fullAvatarURLFromPreferences = fullAvatarURL; - if (modelName.isEmpty()) { - QVariantHash fullAvatarFST = FSTReader::downloadMapping(_fullAvatarURLFromPreferences.toString()); - _fullAvatarModelName = fullAvatarFST["name"].toString(); - } else { - _fullAvatarModelName = modelName; - } + _fullAvatarModelName = modelName; } const QString& urlString = fullAvatarURL.toString(); @@ -1561,8 +1565,8 @@ void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelN setSkeletonModelURL(fullAvatarURL); UserActivityLogger::getInstance().changedModel("skeleton", urlString); } + markIdentityDataChanged(); - } void MyAvatar::setAttachmentData(const QVector& attachmentData) { diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index 416920d43f..45f2462f57 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -63,9 +63,10 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) { PROFILE_ASYNC_BEGIN(resource_parse_geometry, "GeometryMappingResource::downloadFinished", _url.toString(), { { "url", _url.toString() } }); - auto mapping = FSTReader::readMapping(data); + // store parsed contents of FST file + _mapping = FSTReader::readMapping(data); - QString filename = mapping.value("filename").toString(); + QString filename = _mapping.value("filename").toString(); if (filename.isNull()) { qCDebug(modelnetworking) << "Mapping file" << _url << "has no \"filename\" field"; @@ -73,7 +74,7 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) { } else { QUrl url = _url.resolved(filename); - QString texdir = mapping.value(TEXDIR_FIELD).toString(); + QString texdir = _mapping.value(TEXDIR_FIELD).toString(); if (!texdir.isNull()) { if (!texdir.endsWith('/')) { texdir += '/'; @@ -83,15 +84,16 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) { _textureBaseUrl = url.resolved(QUrl(".")); } - auto scripts = FSTReader::getScripts(_url, mapping); + auto scripts = FSTReader::getScripts(_url, _mapping); if (scripts.size() > 0) { - mapping.remove(SCRIPT_FIELD); + _mapping.remove(SCRIPT_FIELD); for (auto &scriptPath : scripts) { - mapping.insertMulti(SCRIPT_FIELD, scriptPath); + _mapping.insertMulti(SCRIPT_FIELD, scriptPath); } } - auto animGraphVariant = mapping.value("animGraphUrl"); + auto animGraphVariant = _mapping.value("animGraphUrl"); + if (animGraphVariant.isValid()) { QUrl fstUrl(animGraphVariant.toString()); if (fstUrl.isValid()) { @@ -104,7 +106,7 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) { } auto modelCache = DependencyManager::get(); - GeometryExtra extra{ mapping, _textureBaseUrl, false }; + GeometryExtra extra{ _mapping, _textureBaseUrl, false }; // Get the raw GeometryResource _geometryResource = modelCache->getResource(url, QUrl(), &extra).staticCast(); @@ -379,6 +381,7 @@ Geometry::Geometry(const Geometry& geometry) { } _animGraphOverrideUrl = geometry._animGraphOverrideUrl; + _mapping = geometry._mapping; } void Geometry::setTextures(const QVariantMap& textureMap) { diff --git a/libraries/model-networking/src/model-networking/ModelCache.h b/libraries/model-networking/src/model-networking/ModelCache.h index cda825e5fb..7cb11587c9 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.h +++ b/libraries/model-networking/src/model-networking/ModelCache.h @@ -55,6 +55,7 @@ public: virtual bool areTexturesLoaded() const; const QUrl& getAnimGraphOverrideUrl() const { return _animGraphOverrideUrl; } + const QVariantHash& getMapping() const { return _mapping; } protected: friend class GeometryMappingResource; @@ -68,6 +69,7 @@ protected: NetworkMaterials _materials; QUrl _animGraphOverrideUrl; + QVariantHash _mapping; // parsed contents of FST file. private: mutable bool _areTexturesLoaded { false }; From 79576e0f48f9dd7b080d333d9d4b5113853e89e7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 3 May 2018 17:16:35 -0700 Subject: [PATCH 13/30] update request and dependency hoek for CVE --- server-console/package-lock.json | 355 +++++++++++++------------------ server-console/package.json | 2 +- 2 files changed, 147 insertions(+), 210 deletions(-) diff --git a/server-console/package-lock.json b/server-console/package-lock.json index 4311fde51a..4f12f2fa00 100644 --- a/server-console/package-lock.json +++ b/server-console/package-lock.json @@ -20,7 +20,6 @@ "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "dev": true, "requires": { "co": "4.6.0", "fast-deep-equal": "1.0.0", @@ -41,11 +40,6 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz", "integrity": "sha1-xQYbbg74qBd15Q9dZhUb9r83EQc=" }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, "array-find-index": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.1.tgz", @@ -118,16 +112,10 @@ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "author-regex": { "version": "1.0.0", @@ -136,17 +124,14 @@ "dev": true }, "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.3.2.tgz", - "integrity": "sha1-054L7kEs7Q6O2Uoj4xTzE6lbn9E=", - "requires": { - "lru-cache": "4.0.1" - } + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" }, "base64-js": { "version": "1.2.0", @@ -204,11 +189,11 @@ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" }, "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "requires": { - "hoek": "2.16.3" + "hoek": "4.2.1" } }, "buffers": { @@ -239,9 +224,9 @@ } }, "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=" + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, "chainsaw": { "version": "0.1.0", @@ -252,18 +237,6 @@ "traverse": "0.3.9" } }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, "cheerio": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.19.0.tgz", @@ -295,8 +268,7 @@ "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" }, "code-point-at": { "version": "1.0.0", @@ -318,6 +290,7 @@ "version": "2.9.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, "requires": { "graceful-readlink": "1.0.1" } @@ -373,11 +346,21 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", "requires": { - "boom": "2.10.1" + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.2.1" + } + } } }, "css-select": { @@ -728,7 +711,7 @@ "minimist": "1.2.0", "pretty-bytes": "1.0.4", "progress-stream": "1.2.0", - "request": "2.71.0", + "request": "2.85.0", "single-line-log": "1.1.2", "throttleit": "0.0.2" }, @@ -828,11 +811,6 @@ "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==", "dev": true }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, "extend": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", @@ -875,14 +853,12 @@ "fast-deep-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", - "dev": true + "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, "fd-slicer": { "version": "1.0.1", @@ -976,13 +952,23 @@ "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, "form-data": { - "version": "1.0.0-rc4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc4.tgz", - "integrity": "sha1-BaxrwiIntD5EYfSIFhVUaZ1Pi14=", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "requires": { - "async": "1.5.2", - "combined-stream": "1.0.5", - "mime-types": "2.1.10" + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "1.0.0" + } + } } }, "fs-extra": { @@ -1058,19 +1044,6 @@ } } }, - "generate-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=" - }, - "generate-object-property": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", - "requires": { - "is-property": "1.0.2" - } - }, "get-package-info": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-package-info/-/get-package-info-1.0.0.tgz", @@ -1212,7 +1185,8 @@ "graceful-readlink": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true }, "growly": { "version": "1.3.0", @@ -1222,43 +1196,32 @@ "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" }, "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "requires": { - "chalk": "1.1.3", - "commander": "2.9.0", - "is-my-json-valid": "2.13.1", - "pinkie-promise": "2.0.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "requires": { - "ansi-regex": "2.0.0" + "ajv": "5.5.2", + "har-schema": "2.0.0" } }, "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.1", + "sntp": "2.1.0" } }, "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==" }, "home-path": { "version": "1.0.5", @@ -1301,13 +1264,20 @@ } }, "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "requires": { - "assert-plus": "0.2.0", + "assert-plus": "1.0.0", "jsprim": "1.2.2", "sshpk": "1.7.4" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } } }, "indent-string": { @@ -1388,28 +1358,12 @@ "number-is-nan": "1.0.0" } }, - "is-my-json-valid": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.13.1.tgz", - "integrity": "sha1-1Vd4qC/rawlj/0vhEdXRaE6JBwc=", - "requires": { - "generate-function": "2.0.0", - "generate-object-property": "1.2.0", - "jsonpointer": "2.0.0", - "xtend": "4.0.1" - } - }, "is-promise": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-1.0.1.tgz", "integrity": "sha1-MVc3YcBX4zwukaq56W2gjO++duU=", "dev": true }, - "is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" - }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -1465,8 +1419,7 @@ "json-schema-traverse": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, "json-stringify-safe": { "version": "5.0.1", @@ -1478,11 +1431,6 @@ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.2.3.tgz", "integrity": "sha1-4lK5mmr5AdPsQfMyWJyQUJp7xgU=" }, - "jsonpointer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz", - "integrity": "sha1-OvHdIP6FRjkQ1GmjheMwF9KgMNk=" - }, "jsprim": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.2.2.tgz", @@ -1569,15 +1517,6 @@ "signal-exit": "2.1.2" } }, - "lru-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.1.tgz", - "integrity": "sha1-E0OVXtry432bnn7nJB4nxLn7cr4=", - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.0.0" - } - }, "map-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", @@ -1603,16 +1542,16 @@ } }, "mime-db": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.22.0.tgz", - "integrity": "sha1-qyOmNy3J2G09yRIb0OvTgQWhkEo=" + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" }, "mime-types": { - "version": "2.1.10", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.10.tgz", - "integrity": "sha1-uTx8tDYuFtQQcqflRTj7TUMHCDc=", + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", "requires": { - "mime-db": "1.22.0" + "mime-db": "1.33.0" } }, "minimist": { @@ -1891,11 +1830,6 @@ } } }, - "node-uuid": { - "version": "1.4.7", - "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz", - "integrity": "sha1-baWhdmjEs91ZYjvaEc9/pMH2Cm8=" - }, "nodeify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/nodeify/-/nodeify-1.0.1.tgz", @@ -1945,7 +1879,7 @@ "minimist": "1.2.0", "pretty-bytes": "1.0.4", "progress-stream": "1.2.0", - "request": "2.71.0", + "request": "2.85.0", "single-line-log": "1.1.2", "throttleit": "0.0.2" }, @@ -1973,9 +1907,9 @@ "integrity": "sha1-wCD1KcUoKt/dIz2R1LGBw9aG3Es=" }, "oauth-sign": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.1.tgz", - "integrity": "sha1-GCQ5vbkTeL90YOdcZOpD5kSN7wY=" + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" }, "object-assign": { "version": "4.0.1", @@ -2099,8 +2033,7 @@ "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, "pify": { "version": "2.3.0", @@ -2111,12 +2044,14 @@ "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true }, "pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, "requires": { "pinkie": "2.0.4" } @@ -2166,11 +2101,6 @@ "is-promise": "1.0.1" } }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" - }, "pump": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.1.tgz", @@ -2183,8 +2113,7 @@ "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" }, "q": { "version": "1.5.1", @@ -2193,9 +2122,9 @@ "dev": true }, "qs": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.1.0.tgz", - "integrity": "sha1-7B0WJrJCeNmfD99FSeUk4k7O6yY=" + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "rc": { "version": "1.1.6", @@ -2252,31 +2181,39 @@ } }, "request": { - "version": "2.71.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.71.0.tgz", - "integrity": "sha1-bxRkPJxaZ8ruapXPjvBHfVYDvZE=", + "version": "2.85.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", + "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.3.2", - "bl": "1.1.2", - "caseless": "0.11.0", + "aws-sign2": "0.7.0", + "aws4": "1.7.0", + "caseless": "0.12.0", "combined-stream": "1.0.5", - "extend": "3.0.0", + "extend": "3.0.1", "forever-agent": "0.6.1", - "form-data": "1.0.0-rc4", - "har-validator": "2.0.6", - "hawk": "3.1.3", - "http-signature": "1.1.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", - "mime-types": "2.1.10", - "node-uuid": "1.4.7", - "oauth-sign": "0.8.1", - "qs": "6.1.0", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", "stringstream": "0.0.5", - "tough-cookie": "2.2.2", - "tunnel-agent": "0.4.2" + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" + }, + "dependencies": { + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + } } }, "request-progress": { @@ -2308,8 +2245,7 @@ "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "sanitize-filename": { "version": "1.6.1", @@ -2347,11 +2283,11 @@ } }, "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "requires": { - "hoek": "2.16.3" + "hoek": "4.2.1" } }, "spdx-correct": { @@ -2483,11 +2419,6 @@ } } }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - }, "tar-fs": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.12.0.tgz", @@ -2585,9 +2516,12 @@ } }, "tough-cookie": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.2.tgz", - "integrity": "sha1-yDoYMPTl7wuT7yo0iOck+N4Basc=" + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "requires": { + "punycode": "1.4.1" + } }, "traverse": { "version": "0.3.9", @@ -2611,9 +2545,12 @@ } }, "tunnel-agent": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.2.tgz", - "integrity": "sha1-EQTj82rIcSXChycAZ9WC0YEzv+4=" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "5.1.1" + } }, "tweetnacl": { "version": "0.14.3", @@ -2644,6 +2581,11 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" + }, "validate-npm-package-license": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", @@ -2710,11 +2652,6 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" }, - "yallist": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.0.0.tgz", - "integrity": "sha1-MGxUODXwnuGkyyO3vOmrNByRzdQ=" - }, "yargs": { "version": "3.32.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", diff --git a/server-console/package.json b/server-console/package.json index 2428d2574e..6dd39ea6f8 100644 --- a/server-console/package.json +++ b/server-console/package.json @@ -30,7 +30,7 @@ "fs-extra": "^1.0.0", "node-notifier": "^5.2.1", "os-homedir": "^1.0.1", - "request": "^2.67.0", + "request": "^2.85.0", "request-progress": "1.0.2", "tar-fs": "^1.12.0", "yargs": "^3.30.0" From d774dc2060e546612526cf7df7877ee39ad87812 Mon Sep 17 00:00:00 2001 From: Clement Date: Thu, 26 Apr 2018 18:34:38 -0700 Subject: [PATCH 14/30] WIP Only use conical frustums on the server --- .../src/entities/EntityPriorityQueue.cpp | 76 -------- .../src/entities/EntityTreeSendThread.cpp | 87 ++------- .../src/entities/EntityTreeSendThread.h | 4 +- libraries/entities/src/DiffTraversal.cpp | 179 ++++++++---------- libraries/entities/src/DiffTraversal.h | 14 +- .../entities/src}/EntityPriorityQueue.h | 38 +--- libraries/shared/src/GLMHelpers.cpp | 6 + libraries/shared/src/GLMHelpers.h | 2 + libraries/shared/src/ViewFrustum.cpp | 7 - .../shared/src/shared/ConicalViewFrustum.cpp | 125 ++++++++++++ .../shared/src/shared/ConicalViewFrustum.h | 64 +++++++ 11 files changed, 306 insertions(+), 296 deletions(-) delete mode 100644 assignment-client/src/entities/EntityPriorityQueue.cpp rename {assignment-client/src/entities => libraries/entities/src}/EntityPriorityQueue.h (70%) create mode 100644 libraries/shared/src/shared/ConicalViewFrustum.cpp create mode 100644 libraries/shared/src/shared/ConicalViewFrustum.h diff --git a/assignment-client/src/entities/EntityPriorityQueue.cpp b/assignment-client/src/entities/EntityPriorityQueue.cpp deleted file mode 100644 index 88dee58f9d..0000000000 --- a/assignment-client/src/entities/EntityPriorityQueue.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// -// EntityPriorityQueue.cpp -// assignment-client/src/entities -// -// Created by Andrew Meadows 2017.08.08 -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include "EntityPriorityQueue.h" - -const float PrioritizedEntity::DO_NOT_SEND = -1.0e-6f; -const float PrioritizedEntity::FORCE_REMOVE = -1.0e-5f; -const float PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY = 1.0f; - -void ConicalViewFrustum::set(const ViewFrustum& viewFrustum) { - // The ConicalView has two parts: a central sphere (same as ViewFrustum) and a circular cone that bounds the frustum part. - // Why? Because approximate intersection tests are much faster to compute for a cone than for a frustum. - _position = viewFrustum.getPosition(); - _direction = viewFrustum.getDirection(); - - // We cache the sin and cos of the half angle of the cone that bounds the frustum. - // (the math here is left as an exercise for the reader) - float A = viewFrustum.getAspectRatio(); - float t = tanf(0.5f * viewFrustum.getFieldOfView()); - _cosAngle = 1.0f / sqrtf(1.0f + (A * A + 1.0f) * (t * t)); - _sinAngle = sqrtf(1.0f - _cosAngle * _cosAngle); - - _radius = viewFrustum.getCenterRadius(); -} - -float ConicalViewFrustum::computePriority(const AACube& cube) const { - glm::vec3 p = cube.calcCenter() - _position; // position of bounding sphere in view-frame - float d = glm::length(p); // distance to center of bounding sphere - float r = 0.5f * cube.getScale(); // radius of bounding sphere - if (d < _radius + r) { - return r; - } - // We check the angle between the center of the cube and the _direction of the view. - // If it is less than the sum of the half-angle from center of cone to outer edge plus - // the half apparent angle of the bounding sphere then it is in view. - // - // The math here is left as an exercise for the reader with the following hints: - // (1) We actually check the dot product of the cube's local position rather than the angle and - // (2) we take advantage of this trig identity: cos(A+B) = cos(A)*cos(B) - sin(A)*sin(B) - if (glm::dot(p, _direction) > sqrtf(d * d - r * r) * _cosAngle - r * _sinAngle) { - const float AVOID_DIVIDE_BY_ZERO = 0.001f; - return r / (d + AVOID_DIVIDE_BY_ZERO); - } - return PrioritizedEntity::DO_NOT_SEND; -} - - -void ConicalView::set(const DiffTraversal::View& view) { - auto size = view.viewFrustums.size(); - _conicalViewFrustums.resize(size); - for (size_t i = 0; i < size; ++i) { - _conicalViewFrustums[i].set(view.viewFrustums[i]); - } -} - -float ConicalView::computePriority(const AACube& cube) const { - if (_conicalViewFrustums.empty()) { - return PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY; - } - - float priority = PrioritizedEntity::DO_NOT_SEND; - - for (const auto& view : _conicalViewFrustums) { - priority = std::max(priority, view.computePriority(cube)); - } - - return priority; -} diff --git a/assignment-client/src/entities/EntityTreeSendThread.cpp b/assignment-client/src/entities/EntityTreeSendThread.cpp index 2e57f2e00f..0d943055f4 100644 --- a/assignment-client/src/entities/EntityTreeSendThread.cpp +++ b/assignment-client/src/entities/EntityTreeSendThread.cpp @@ -141,16 +141,8 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O if (forceRemove) { priority = PrioritizedEntity::FORCE_REMOVE; } else { - bool success = false; - AACube cube = entity->getQueryAACube(success); - if (success) { - const auto& view = _traversal.getCurrentView(); - if (view.intersects(cube) && view.isBigEnough(cube)) { - priority = _conicalView.computePriority(cube); - } - } else { - priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY; - } + const auto& view = _traversal.getCurrentView(); + priority = view.computePriority(entity); } if (priority != PrioritizedEntity::DO_NOT_SEND) { @@ -235,11 +227,6 @@ void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, En // (3) Differential = view has changed --> find what has changed or in new view but not old // // The "scanCallback" we provide to the traversal depends on the type: - // - // The _conicalView is updated here as a cached view approximation used by the lambdas for efficient - // computation of entity sorting priorities. - // - _conicalView.set(_traversal.getCurrentView()); switch (type) { case DiffTraversal::First: @@ -251,25 +238,8 @@ void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, En if (_sendQueue.contains(entity.get())) { return; } - float priority = PrioritizedEntity::DO_NOT_SEND; - - - bool success = false; - AACube cube = entity->getQueryAACube(success); - if (success) { - const auto& view = _traversal.getCurrentView(); - // Check the size of the entity, it's possible that a "too small to see" entity is included in a - // larger octree cell because of its position (for example if it crosses the boundary of a cell it - // pops to the next higher cell. So we want to check to see that the entity is large enough to be seen - // before we consider including it. - if ((next.intersection == ViewFrustum::INSIDE || view.intersects(cube)) && - view.isBigEnough(cube)) { - priority = _conicalView.computePriority(cube); - } - } else { - priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY; - } - + const auto& view = _traversal.getCurrentView(); + float priority = view.computePriority(entity); if (priority != PrioritizedEntity::DO_NOT_SEND) { _sendQueue.emplace(entity, priority); @@ -288,21 +258,11 @@ void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, En } float priority = PrioritizedEntity::DO_NOT_SEND; - auto knownTimestamp = _knownState.find(entity.get()); if (knownTimestamp == _knownState.end()) { - bool success = false; - AACube cube = entity->getQueryAACube(success); - if (success) { - const auto& view = _traversal.getCurrentView(); - // See the DiffTraversal::First case for an explanation of the "entity is too small" check - if ((next.intersection == ViewFrustum::INSIDE || view.intersects(cube)) && - view.isBigEnough(cube)) { - priority = _conicalView.computePriority(cube); - } - } else { - priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY; - } + const auto& view = _traversal.getCurrentView(); + priority = view.computePriority(entity); + } else if (entity->getLastEdited() > knownTimestamp->second || entity->getLastChangedOnServer() > knownTimestamp->second) { // it is known and it changed --> put it on the queue with any priority @@ -310,7 +270,6 @@ void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, En priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY; } - if (priority != PrioritizedEntity::DO_NOT_SEND) { _sendQueue.emplace(entity, priority); } @@ -328,21 +287,11 @@ void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, En } float priority = PrioritizedEntity::DO_NOT_SEND; - auto knownTimestamp = _knownState.find(entity.get()); if (knownTimestamp == _knownState.end()) { - bool success = false; - AACube cube = entity->getQueryAACube(success); - if (success) { - const auto& view = _traversal.getCurrentView(); - // See the DiffTraversal::First case for an explanation of the "entity is too small" check - if ((next.intersection == ViewFrustum::INSIDE || view.intersects(cube)) && - view.isBigEnough(cube)) { - priority = _conicalView.computePriority(cube); - } - } else { - priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY; - } + const auto& view = _traversal.getCurrentView(); + priority = view.computePriority(entity); + } else if (entity->getLastEdited() > knownTimestamp->second || entity->getLastChangedOnServer() > knownTimestamp->second) { // it is known and it changed --> put it on the queue with any priority @@ -350,7 +299,6 @@ void EntityTreeSendThread::startNewTraversal(const DiffTraversal::View& view, En priority = PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY; } - if (priority != PrioritizedEntity::DO_NOT_SEND) { _sendQueue.emplace(entity, priority); } @@ -463,14 +411,13 @@ bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstream void EntityTreeSendThread::editingEntityPointer(const EntityItemPointer& entity) { if (entity) { if (!_sendQueue.contains(entity.get()) && _knownState.find(entity.get()) != _knownState.end()) { - bool success = false; - AACube cube = entity->getQueryAACube(success); - if (success) { - // We can force a removal from _knownState if the current view is used and entity is out of view - if (_traversal.doesCurrentUseViewFrustum() && !_traversal.getCurrentView().intersects(cube)) { - _sendQueue.emplace(entity, PrioritizedEntity::FORCE_REMOVE, true); - } - } else { + const auto& view = _traversal.getCurrentView(); + float priority = view.computePriority(entity); + + // We can force a removal from _knownState if the current view is used and entity is out of view + if (priority == PrioritizedEntity::DO_NOT_SEND) { + _sendQueue.emplace(entity, PrioritizedEntity::FORCE_REMOVE, true); + } else if (priority == PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY) { _sendQueue.emplace(entity, PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY, true); } } diff --git a/assignment-client/src/entities/EntityTreeSendThread.h b/assignment-client/src/entities/EntityTreeSendThread.h index 9eea98b7fd..1305d7bfc7 100644 --- a/assignment-client/src/entities/EntityTreeSendThread.h +++ b/assignment-client/src/entities/EntityTreeSendThread.h @@ -17,8 +17,9 @@ #include "../octree/OctreeSendThread.h" #include +#include +#include -#include "EntityPriorityQueue.h" class EntityNodeData; class EntityItem; @@ -51,7 +52,6 @@ private: DiffTraversal _traversal; EntityPriorityQueue _sendQueue; std::unordered_map _knownState; - ConicalView _conicalView; // cached optimized view for fast priority calculations // packet construction stuff EntityTreeElementExtraEncodeDataPointer _extraEncodeData { new EntityTreeElementExtraEncodeData() }; diff --git a/libraries/entities/src/DiffTraversal.cpp b/libraries/entities/src/DiffTraversal.cpp index 39328e11ad..36d1f41267 100644 --- a/libraries/entities/src/DiffTraversal.cpp +++ b/libraries/entities/src/DiffTraversal.cpp @@ -13,6 +13,8 @@ #include +#include "EntityPriorityQueue.h" + DiffTraversal::Waypoint::Waypoint(EntityTreeElementPointer& element) : _nextIndex(0) { assert(element); _weakElement = element; @@ -35,19 +37,9 @@ void DiffTraversal::Waypoint::getNextVisibleElementFirstTime(DiffTraversal::Visi while (_nextIndex < NUMBER_OF_CHILDREN) { EntityTreeElementPointer nextElement = element->getChildAtIndex(_nextIndex); ++_nextIndex; - if (nextElement) { - const auto& cube = nextElement->getAACube(); - if (!view.usesViewFrustums()) { - // No LOD truncation if we aren't using the view frustum - next.element = nextElement; - return; - } else if (view.intersects(cube)) { - // check for LOD truncation - if (view.isBigEnough(cube, MIN_ELEMENT_ANGULAR_DIAMETER)) { - next.element = nextElement; - return; - } - } + if (nextElement && view.shouldTraverseElement(*nextElement)) { + next.element = nextElement; + return; } } } @@ -63,7 +55,6 @@ void DiffTraversal::Waypoint::getNextVisibleElementRepeat( EntityTreeElementPointer element = _weakElement.lock(); if (element->getLastChangedContent() > lastTime) { next.element = element; - next.intersection = ViewFrustum::INTERSECT; return; } } @@ -73,30 +64,17 @@ void DiffTraversal::Waypoint::getNextVisibleElementRepeat( while (_nextIndex < NUMBER_OF_CHILDREN) { EntityTreeElementPointer nextElement = element->getChildAtIndex(_nextIndex); ++_nextIndex; - if (nextElement && nextElement->getLastChanged() > lastTime) { - if (!view.usesViewFrustums()) { - // No LOD truncation if we aren't using the view frustum - next.element = nextElement; - next.intersection = ViewFrustum::INSIDE; - return; - } else { - // check for LOD truncation - const auto& cube = nextElement->getAACube(); - if (view.isBigEnough(cube, MIN_ELEMENT_ANGULAR_DIAMETER)) { - ViewFrustum::intersection intersection = view.calculateIntersection(cube); - if (intersection != ViewFrustum::OUTSIDE) { - next.element = nextElement; - next.intersection = intersection; - return; - } - } - } + if (nextElement && + nextElement->getLastChanged() > lastTime && + view.shouldTraverseElement(*nextElement)) { + + next.element = nextElement; + return; } } } } next.element.reset(); - next.intersection = ViewFrustum::OUTSIDE; } void DiffTraversal::Waypoint::getNextVisibleElementDifferential(DiffTraversal::VisibleElement& next, @@ -106,7 +84,6 @@ void DiffTraversal::Waypoint::getNextVisibleElementDifferential(DiffTraversal::V ++_nextIndex; EntityTreeElementPointer element = _weakElement.lock(); next.element = element; - next.intersection = ViewFrustum::INTERSECT; return; } else if (_nextIndex < NUMBER_OF_CHILDREN) { EntityTreeElementPointer element = _weakElement.lock(); @@ -114,74 +91,14 @@ void DiffTraversal::Waypoint::getNextVisibleElementDifferential(DiffTraversal::V while (_nextIndex < NUMBER_OF_CHILDREN) { EntityTreeElementPointer nextElement = element->getChildAtIndex(_nextIndex); ++_nextIndex; - if (nextElement) { - // check for LOD truncation - const auto& cube = nextElement->getAACube(); - if (view.isBigEnough(cube, MIN_ELEMENT_ANGULAR_DIAMETER)) { - ViewFrustum::intersection intersection = view.calculateIntersection(cube); - if (intersection != ViewFrustum::OUTSIDE) { - next.element = nextElement; - next.intersection = intersection; - return; - } - } + if (nextElement && view.shouldTraverseElement(*nextElement)) { + next.element = nextElement; + return; } } } } next.element.reset(); - next.intersection = ViewFrustum::OUTSIDE; -} - -bool DiffTraversal::View::isBigEnough(const AACube& cube, float minDiameter) const { - if (viewFrustums.empty()) { - // Everything is big enough when not using view frustums - return true; - } - - bool isBigEnough = std::any_of(std::begin(viewFrustums), std::end(viewFrustums), - [&](const ViewFrustum& viewFrustum) { - return isAngularSizeBigEnough(viewFrustum.getPosition(), cube, lodScaleFactor, minDiameter); - }); - - return isBigEnough; -} - -bool DiffTraversal::View::intersects(const AACube& cube) const { - if (viewFrustums.empty()) { - // Everything intersects when not using view frustums - return true; - } - - bool intersects = std::any_of(std::begin(viewFrustums), std::end(viewFrustums), - [&](const ViewFrustum& viewFrustum) { - return viewFrustum.cubeIntersectsKeyhole(cube); - }); - - return intersects; -} - -ViewFrustum::intersection DiffTraversal::View::calculateIntersection(const AACube& cube) const { - if (viewFrustums.empty()) { - // Everything is inside when not using view frustums - return ViewFrustum::INSIDE; - } - - ViewFrustum::intersection intersection = ViewFrustum::OUTSIDE; - - for (const auto& viewFrustum : viewFrustums) { - switch (viewFrustum.calculateCubeKeyholeIntersection(cube)) { - case ViewFrustum::INSIDE: - return ViewFrustum::INSIDE; - case ViewFrustum::INTERSECT: - intersection = ViewFrustum::INTERSECT; - break; - default: - // DO NOTHING - break; - } - } - return intersection; } bool DiffTraversal::View::usesViewFrustums() const { @@ -204,6 +121,73 @@ bool DiffTraversal::View::isVerySimilar(const View& view) const { return true; } +float DiffTraversal::View::computePriority(const EntityItemPointer& entity) const { + if (!entity) { + return PrioritizedEntity::DO_NOT_SEND; + } + + if (!usesViewFrustums()) { + return PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY; + } + + bool success = false; + auto cube = entity->getQueryAACube(success); + if (!success) { + return PrioritizedEntity::WHEN_IN_DOUBT_PRIORITY; + } + + auto center = cube.calcCenter(); // center of bounding sphere + auto radius = 0.5f * SQRT_THREE * cube.getScale(); // radius of bounding sphere + + auto priority = PrioritizedEntity::DO_NOT_SEND; + + for (const auto& frustum : viewFrustums) { + auto position = center - frustum.getPosition(); // position of bounding sphere in view-frame + float distance = glm::length(position); // distance to center of bounding sphere + + // Check the size of the entity, it's possible that a "too small to see" entity is included in a + // larger octree cell because of its position (for example if it crosses the boundary of a cell it + // pops to the next higher cell. So we want to check to see that the entity is large enough to be seen + // before we consider including it. + float angularSize = frustum.getAngularSize(distance, radius); + if (angularSize > lodScaleFactor * MIN_ENTITY_ANGULAR_DIAMETER && + frustum.intersects(position, distance, radius)) { + + // use the angular size as priority + // we compute the max priority for all frustums + priority = std::max(priority, angularSize); + } + } + + return priority; +} + +bool DiffTraversal::View::shouldTraverseElement(const EntityTreeElement& element) const { + if (!usesViewFrustums()) { + return true; + } + + const auto& cube = element.getAACube(); + + auto center = cube.calcCenter(); // center of bounding sphere + auto radius = 0.5f * SQRT_THREE * cube.getScale(); // radius of bounding sphere + + + return any_of(begin(viewFrustums), end(viewFrustums), [&](const ConicalViewFrustum& frustum) { + auto position = center - frustum.getPosition(); // position of bounding sphere in view-frame + float distance = glm::length(position); // distance to center of bounding sphere + + // Check the size of the entity, it's possible that a "too small to see" entity is included in a + // larger octree cell because of its position (for example if it crosses the boundary of a cell it + // pops to the next higher cell. So we want to check to see that the entity is large enough to be seen + // before we consider including it. + float angularSize = frustum.getAngularSize(distance, radius); + + return angularSize > lodScaleFactor * MIN_ELEMENT_ANGULAR_DIAMETER && + frustum.intersects(position, distance, radius); + }); +} + DiffTraversal::DiffTraversal() { const int32_t MIN_PATH_DEPTH = 16; _path.reserve(MIN_PATH_DEPTH); @@ -262,7 +246,6 @@ DiffTraversal::Type DiffTraversal::prepareNewTraversal(const DiffTraversal::View void DiffTraversal::getNextVisibleElement(DiffTraversal::VisibleElement& next) { if (_path.empty()) { next.element.reset(); - next.intersection = ViewFrustum::OUTSIDE; return; } _getNextVisibleElementCallback(next); diff --git a/libraries/entities/src/DiffTraversal.h b/libraries/entities/src/DiffTraversal.h index 0fd014ac23..d62c7b8ee1 100644 --- a/libraries/entities/src/DiffTraversal.h +++ b/libraries/entities/src/DiffTraversal.h @@ -12,7 +12,7 @@ #ifndef hifi_DiffTraversal_h #define hifi_DiffTraversal_h -#include +#include #include "EntityTreeElement.h" @@ -24,19 +24,18 @@ public: class VisibleElement { public: EntityTreeElementPointer element; - ViewFrustum::intersection intersection { ViewFrustum::OUTSIDE }; }; // View is a struct with a ViewFrustum and LOD parameters class View { public: - bool isBigEnough(const AACube& cube, float minDiameter = MIN_ENTITY_ANGULAR_DIAMETER) const; - bool intersects(const AACube& cube) const; bool usesViewFrustums() const; bool isVerySimilar(const View& view) const; - ViewFrustum::intersection calculateIntersection(const AACube& cube) const; - ViewFrustums viewFrustums; + bool shouldTraverseElement(const EntityTreeElement& element) const; + float computePriority(const EntityItemPointer& entity) const; + + ConicalViewFrustums viewFrustums; uint64_t startTime { 0 }; float lodScaleFactor { 1.0f }; }; @@ -65,9 +64,6 @@ public: Type prepareNewTraversal(const DiffTraversal::View& view, EntityTreeElementPointer root); const View& getCurrentView() const { return _currentView; } - const View& getCompletedView() const { return _completedView; } - - bool doesCurrentUseViewFrustum() const { return _currentView.usesViewFrustums(); } uint64_t getStartOfCompletedTraversal() const { return _completedView.startTime; } bool finished() const { return _path.empty(); } diff --git a/assignment-client/src/entities/EntityPriorityQueue.h b/libraries/entities/src/EntityPriorityQueue.h similarity index 70% rename from assignment-client/src/entities/EntityPriorityQueue.h rename to libraries/entities/src/EntityPriorityQueue.h index 9210ac549f..354cd70af3 100644 --- a/assignment-client/src/entities/EntityPriorityQueue.h +++ b/libraries/entities/src/EntityPriorityQueue.h @@ -15,44 +15,14 @@ #include #include -#include -#include -#include - -const float SQRT_TWO_OVER_TWO = 0.7071067811865f; -const float DEFAULT_VIEW_RADIUS = 10.0f; - -// ConicalViewFrustum is an approximation of a ViewFrustum for fast calculation of sort priority. -class ConicalViewFrustum { -public: - ConicalViewFrustum() {} - ConicalViewFrustum(const ViewFrustum& viewFrustum) { set(viewFrustum); } - void set(const ViewFrustum& viewFrustum); - float computePriority(const AACube& cube) const; -private: - glm::vec3 _position { 0.0f, 0.0f, 0.0f }; - glm::vec3 _direction { 0.0f, 0.0f, 1.0f }; - float _sinAngle { SQRT_TWO_OVER_TWO }; - float _cosAngle { SQRT_TWO_OVER_TWO }; - float _radius { DEFAULT_VIEW_RADIUS }; -}; - -// Simple wrapper around a set of conical view frustums -class ConicalView { -public: - ConicalView() {} - void set(const DiffTraversal::View& view); - float computePriority(const AACube& cube) const; -private: - std::vector _conicalViewFrustums; -}; +#include "EntityItem.h" // PrioritizedEntity is a placeholder in a sorted queue. class PrioritizedEntity { public: - static const float DO_NOT_SEND; - static const float FORCE_REMOVE; - static const float WHEN_IN_DOUBT_PRIORITY; + static constexpr float DO_NOT_SEND { -1.0e-6f }; + static constexpr float FORCE_REMOVE { -1.0e-5f }; + static constexpr float WHEN_IN_DOUBT_PRIORITY { 1.0f }; PrioritizedEntity(EntityItemPointer entity, float priority, bool forceRemove = false) : _weakEntity(entity), _rawEntityPointer(entity.get()), _priority(priority), _forceRemove(forceRemove) {} EntityItemPointer getEntity() const { return _weakEntity.lock(); } diff --git a/libraries/shared/src/GLMHelpers.cpp b/libraries/shared/src/GLMHelpers.cpp index 72710a6a7d..1776d63173 100644 --- a/libraries/shared/src/GLMHelpers.cpp +++ b/libraries/shared/src/GLMHelpers.cpp @@ -222,6 +222,12 @@ int unpackOrientationQuatFromSixBytes(const unsigned char* buffer, glm::quat& qu return 6; } +bool closeEnough(float a, float b, float relativeError) { + assert(relativeError >= 0.0f); + // NOTE: we add EPSILON to the denominator so we can avoid checking for division by zero. + // This method works fine when: fabsf(a + b) >> EPSILON + return fabsf(a - b) / (0.5f * fabsf(a + b) + EPSILON) < relativeError; +} // Safe version of glm::eulerAngles; uses the factorization method described in David Eberly's // http://www.geometrictools.com/Documentation/EulerAngles.pdf (via Clyde, diff --git a/libraries/shared/src/GLMHelpers.h b/libraries/shared/src/GLMHelpers.h index 5c9a8b5ca1..0e1af27cd2 100644 --- a/libraries/shared/src/GLMHelpers.h +++ b/libraries/shared/src/GLMHelpers.h @@ -137,6 +137,8 @@ int unpackFloatScalarFromSignedTwoByteFixed(const int16_t* byteFixedPointer, flo int packFloatVec3ToSignedTwoByteFixed(unsigned char* destBuffer, const glm::vec3& srcVector, int radix); int unpackFloatVec3FromSignedTwoByteFixed(const unsigned char* sourceBuffer, glm::vec3& destination, int radix); +bool closeEnough(float a, float b, float relativeError); + /// \return vec3 with euler angles in radians glm::vec3 safeEulerAngles(const glm::quat& q); diff --git a/libraries/shared/src/ViewFrustum.cpp b/libraries/shared/src/ViewFrustum.cpp index c2b92aac5f..c89a9fbd60 100644 --- a/libraries/shared/src/ViewFrustum.cpp +++ b/libraries/shared/src/ViewFrustum.cpp @@ -338,13 +338,6 @@ bool ViewFrustum::boxIntersectsKeyhole(const AABox& box) const { return true; } -bool closeEnough(float a, float b, float relativeError) { - assert(relativeError >= 0.0f); - // NOTE: we add EPSILON to the denominator so we can avoid checking for division by zero. - // This method works fine when: fabsf(a + b) >> EPSILON - return fabsf(a - b) / (0.5f * fabsf(a + b) + EPSILON) < relativeError; -} - // TODO: the slop and relative error should be passed in by argument rather than hard-coded. bool ViewFrustum::isVerySimilar(const ViewFrustum& other) const { const float MIN_POSITION_SLOP_SQUARED = 25.0f; // 5 meters squared diff --git a/libraries/shared/src/shared/ConicalViewFrustum.cpp b/libraries/shared/src/shared/ConicalViewFrustum.cpp new file mode 100644 index 0000000000..906bbc48a3 --- /dev/null +++ b/libraries/shared/src/shared/ConicalViewFrustum.cpp @@ -0,0 +1,125 @@ +// +// ConicalViewFrustum.cpp +// libraries/shared/src/shared +// +// Created by Clement Brisset 4/26/18 +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "ConicalViewFrustum.h" + +#include "../ViewFrustum.h" + +void ConicalViewFrustum::set(const ViewFrustum& viewFrustum) { + // The ConicalViewFrustum has two parts: a central sphere (same as ViewFrustum) and a circular cone that bounds the frustum part. + // Why? Because approximate intersection tests are much faster to compute for a cone than for a frustum. + _position = viewFrustum.getPosition(); + _direction = viewFrustum.getDirection(); + _radius = viewFrustum.getCenterRadius(); + _farClip = viewFrustum.getFarClip(); + + // Considering the rectangle intersection the frustum and the perpendicular plane 1 unit + // away from the frustum's origin + // We are looking for the angle between the ray that goes through the center of the rectangle + // and the ray that goes through one of the corners of the rectangle + // (Both rays coming from the frustum's origin) + // This angle will let us construct a cone in which the frustum is inscribed + // Let's define: + // A = aspect ratio = width / height + // fov = vertical field of view + // y = half height of the rectangle + // x = half width of the rectangle + // r = half diagonal of the rectangle + // then, we have: + // y / 1 = tan(fov / 2) + // x = A * y = A * tan(fov / 2) + // r^2 = x^2 + y^2 = (A^2 + 1) * tan^2(fov / 2) + // r / 1 = tan(angle) = sqrt((A^2 + 1) * tan^2(fov / 2)) + // angle = atan(sqrt((A^2 + 1) * tan^2(fov / 2))) + float A = viewFrustum.getAspectRatio(); + float t = tanf(0.5f * viewFrustum.getFieldOfView()); + + auto tan2Angle = (A * A + 1.0f) * (t * t); + _angle = atanf(sqrt(tan2Angle)); + + calculate(); +} + +void ConicalViewFrustum::calculate() { + _cosAngle = cosf(_angle); + _sinAngle = sqrtf(1.0f - _cosAngle * _cosAngle); +} + +bool ConicalViewFrustum::isVerySimilar(const ConicalViewFrustum& other) const { + const float MIN_POSITION_SLOP_SQUARED = 25.0f; // 5 meters squared + const float MIN_ANGLE_BETWEEN = 0.174533f; // radian angle between 2 vectors 10 degrees apart + const float MIN_RELATIVE_ERROR = 0.01f; // 1% + + return glm::distance2(_position, other._position) < MIN_POSITION_SLOP_SQUARED && + angleBetween(_direction, other._direction) > MIN_ANGLE_BETWEEN && + closeEnough(_angle, other._angle, MIN_RELATIVE_ERROR) && + closeEnough(_farClip, other._farClip, MIN_RELATIVE_ERROR) && + closeEnough(_radius, other._radius, MIN_RELATIVE_ERROR); +} + +bool ConicalViewFrustum::intersects(const glm::vec3& position, float distance, float radius) const { + if (distance < _radius + radius) { + // Inside keyhole radius + return true; + } + if (distance > _farClip + radius) { + // Past far clip + return false; + } + + // We check the angle between the center of the cube and the _direction of the view. + // If it is less than the sum of the half-angle from center of cone to outer edge plus + // the half apparent angle of the bounding sphere then it is in view. + // + // The math here is left as an exercise for the reader with the following hints: + // (1) We actually check the dot product of the cube's local position rather than the angle and + // (2) we take advantage of this trig identity: cos(A+B) = cos(A)*cos(B) - sin(A)*sin(B) + return glm::dot(position, _direction) > + sqrtf(distance * distance - radius * radius) * _cosAngle - radius * _sinAngle; +} + +bool ConicalViewFrustum::getAngularSize(float distance, float radius) const { + const float AVOID_DIVIDE_BY_ZERO = 0.001f; + float angularSize = radius / (distance + AVOID_DIVIDE_BY_ZERO); + return angularSize; +} + +int ConicalViewFrustum::serialize(unsigned char* destinationBuffer) const { + const unsigned char* startPosition = destinationBuffer; + + memcpy(destinationBuffer, &_position, sizeof(_position)); + destinationBuffer += sizeof(_position); + memcpy(destinationBuffer, &_direction, sizeof(_direction)); + destinationBuffer += sizeof(_direction); + destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _angle); + destinationBuffer += packClipValueToTwoByte(destinationBuffer, _farClip); + memcpy(destinationBuffer, &_radius, sizeof(_radius)); + destinationBuffer += sizeof(_radius); + + return destinationBuffer - startPosition; +} + +int ConicalViewFrustum::deserialize(const unsigned char* sourceBuffer) { + const unsigned char* startPosition = sourceBuffer; + + memcpy(&_position, sourceBuffer, sizeof(_position)); + sourceBuffer += sizeof(_position); + memcpy(&_direction, sourceBuffer, sizeof(_direction)); + sourceBuffer += sizeof(_direction); + sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*)sourceBuffer, &_angle); + sourceBuffer += unpackClipValueFromTwoByte(sourceBuffer, _farClip); + memcpy(&_radius, sourceBuffer, sizeof(_radius)); + sourceBuffer += sizeof(_radius); + + calculate(); + + return sourceBuffer - startPosition; +} diff --git a/libraries/shared/src/shared/ConicalViewFrustum.h b/libraries/shared/src/shared/ConicalViewFrustum.h new file mode 100644 index 0000000000..3cadedda9d --- /dev/null +++ b/libraries/shared/src/shared/ConicalViewFrustum.h @@ -0,0 +1,64 @@ +// +// ConicalViewFrustum.h +// libraries/shared/src/shared +// +// Created by Clement Brisset 4/26/18 +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_ConicalViewFrustum_h +#define hifi_ConicalViewFrustum_h + +#include + +#include + +class AACube; +class ViewFrustum; +using ViewFrustums = std::vector; + +const float SQRT_TWO_OVER_TWO = 0.7071067811865f; +const float DEFAULT_VIEW_ANGLE = 1.0f; +const float DEFAULT_VIEW_RADIUS = 10.0f; +const float DEFAULT_VIEW_FAR_CLIP = 100.0f; + +// ConicalViewFrustum is an approximation of a ViewFrustum for fast calculation of sort priority. +class ConicalViewFrustum { +public: + ConicalViewFrustum() = default; + ConicalViewFrustum(const ViewFrustum& viewFrustum) { set(viewFrustum); } + + void set(const ViewFrustum& viewFrustum); + void calculate(); + + const glm::vec3& getPosition() const { return _position; } + const glm::vec3& getDirection() const { return _direction; } + float getAngle() const { return _angle; } + float getRadius() const { return _radius; } + float getFarClip() const { return _farClip; } + + bool isVerySimilar(const ConicalViewFrustum& other) const; + + bool intersects(const glm::vec3& position, float distance, float radius) const; + bool getAngularSize(float distance, float radius) const; + + int serialize(unsigned char* destinationBuffer) const; + int deserialize(const unsigned char* sourceBuffer); + +private: + glm::vec3 _position { 0.0f, 0.0f, 0.0f }; + glm::vec3 _direction { 0.0f, 0.0f, 1.0f }; + float _angle { DEFAULT_VIEW_ANGLE }; + float _radius { DEFAULT_VIEW_RADIUS }; + float _farClip { DEFAULT_VIEW_FAR_CLIP }; + + float _sinAngle { SQRT_TWO_OVER_TWO }; + float _cosAngle { SQRT_TWO_OVER_TWO }; +}; +using ConicalViewFrustums = std::vector; + + +#endif /* hifi_ConicalViewFrustum_h */ From e400eb4ed2c86f6132896404849b70193c63c4ae Mon Sep 17 00:00:00 2001 From: Clement Date: Mon, 30 Apr 2018 19:50:00 -0700 Subject: [PATCH 15/30] Rename ViewFrustum packets to AvatarQuery --- assignment-client/src/Agent.cpp | 2 +- assignment-client/src/avatars/AvatarMixer.cpp | 6 +++--- assignment-client/src/avatars/AvatarMixer.h | 2 +- interface/src/Application.cpp | 2 +- libraries/networking/src/udt/PacketHeaders.cpp | 6 +++--- libraries/networking/src/udt/PacketHeaders.h | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 0b373e511b..0183248648 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -618,7 +618,7 @@ void Agent::sendAvatarViewFrustum() { uint8_t numFrustums = 1; auto viewFrustumByteArray = view.toByteArray(); - auto avatarPacket = NLPacket::create(PacketType::ViewFrustum, viewFrustumByteArray.size() + sizeof(numFrustums)); + auto avatarPacket = NLPacket::create(PacketType::AvatarQuery, viewFrustumByteArray.size() + sizeof(numFrustums)); avatarPacket->writePrimitive(numFrustums); avatarPacket->write(viewFrustumByteArray); diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp index 6353a1664f..d74c76032d 100644 --- a/assignment-client/src/avatars/AvatarMixer.cpp +++ b/assignment-client/src/avatars/AvatarMixer.cpp @@ -47,7 +47,7 @@ AvatarMixer::AvatarMixer(ReceivedMessage& message) : auto& packetReceiver = DependencyManager::get()->getPacketReceiver(); packetReceiver.registerListener(PacketType::AvatarData, this, "queueIncomingPacket"); packetReceiver.registerListener(PacketType::AdjustAvatarSorting, this, "handleAdjustAvatarSorting"); - packetReceiver.registerListener(PacketType::ViewFrustum, this, "handleViewFrustumPacket"); + packetReceiver.registerListener(PacketType::AvatarQuery, this, "handleAvatarQueryPacket"); packetReceiver.registerListener(PacketType::AvatarIdentity, this, "handleAvatarIdentityPacket"); packetReceiver.registerListener(PacketType::KillAvatar, this, "handleKillAvatarPacket"); packetReceiver.registerListener(PacketType::NodeIgnoreRequest, this, "handleNodeIgnoreRequestPacket"); @@ -517,7 +517,7 @@ void AvatarMixer::handleAdjustAvatarSorting(QSharedPointer mess } -void AvatarMixer::handleViewFrustumPacket(QSharedPointer message, SharedNodePointer senderNode) { +void AvatarMixer::handleAvatarQueryPacket(QSharedPointer message, SharedNodePointer senderNode) { auto start = usecTimestampNow(); getOrCreateClientData(senderNode); @@ -683,7 +683,7 @@ void AvatarMixer::sendStatsPacket() { incomingPacketStats["handleNodeIgnoreRequestPacket"] = TIGHT_LOOP_STAT_UINT64(_handleNodeIgnoreRequestPacketElapsedTime); incomingPacketStats["handleRadiusIgnoreRequestPacket"] = TIGHT_LOOP_STAT_UINT64(_handleRadiusIgnoreRequestPacketElapsedTime); incomingPacketStats["handleRequestsDomainListDataPacket"] = TIGHT_LOOP_STAT_UINT64(_handleRequestsDomainListDataPacketElapsedTime); - incomingPacketStats["handleViewFrustumPacket"] = TIGHT_LOOP_STAT_UINT64(_handleViewFrustumPacketElapsedTime); + incomingPacketStats["handleAvatarQueryPacket"] = TIGHT_LOOP_STAT_UINT64(_handleViewFrustumPacketElapsedTime); singleCoreTasks["incoming_packets"] = incomingPacketStats; singleCoreTasks["sendStats"] = (float)_sendStatsElapsedTime; diff --git a/assignment-client/src/avatars/AvatarMixer.h b/assignment-client/src/avatars/AvatarMixer.h index 1fbfd7338b..9ef5903eec 100644 --- a/assignment-client/src/avatars/AvatarMixer.h +++ b/assignment-client/src/avatars/AvatarMixer.h @@ -46,7 +46,7 @@ public slots: private slots: void queueIncomingPacket(QSharedPointer message, SharedNodePointer node); void handleAdjustAvatarSorting(QSharedPointer message, SharedNodePointer senderNode); - void handleViewFrustumPacket(QSharedPointer message, SharedNodePointer senderNode); + void handleAvatarQueryPacket(QSharedPointer message, SharedNodePointer senderNode); void handleAvatarIdentityPacket(QSharedPointer message, SharedNodePointer senderNode); void handleKillAvatarPacket(QSharedPointer message, SharedNodePointer senderNode); void handleNodeIgnoreRequestPacket(QSharedPointer message, SharedNodePointer senderNode); diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 5e10d29505..a1301ff43e 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5852,7 +5852,7 @@ void Application::sendAvatarViewFrustum() { viewFrustumByteArray += _secondaryViewFrustum.toByteArray(); } - auto avatarPacket = NLPacket::create(PacketType::ViewFrustum, viewFrustumByteArray.size() + sizeof(numFrustums)); + auto avatarPacket = NLPacket::create(PacketType::AvatarQuery, viewFrustumByteArray.size() + sizeof(numFrustums)); avatarPacket->writePrimitive(numFrustums); avatarPacket->write(viewFrustumByteArray); diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index 17b0d90cfe..123e11b7c5 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -34,7 +34,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::EntityPhysics: return static_cast(EntityVersion::MaterialData); case PacketType::EntityQuery: - return static_cast(EntityQueryPacketVersion::MultiFrustumQuery); + return static_cast(EntityQueryPacketVersion::ConicalFrustums); case PacketType::AvatarIdentity: case PacketType::AvatarData: case PacketType::BulkAvatarData: @@ -90,8 +90,8 @@ PacketVersion versionForPacketType(PacketType packetType) { return 18; // replace min_avatar_scale and max_avatar_scale with min_avatar_height and max_avatar_height case PacketType::Ping: return static_cast(PingVersion::IncludeConnectionID); - case PacketType::ViewFrustum: - return static_cast(ViewFrustumVersion::SendMultipleFrustums); + case PacketType::AvatarQuery: + return static_cast(AvatarQueryVersion::SendMultipleFrustums); default: return 20; } diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index c72bbb0129..20fe23a19a 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -103,7 +103,7 @@ public: RadiusIgnoreRequest, UsernameFromIDRequest, UsernameFromIDReply, - ViewFrustum, + AvatarQuery, RequestsDomainListData, PerAvatarGainSet, EntityScriptGetStatus, @@ -328,7 +328,7 @@ enum class PingVersion : PacketVersion { IncludeConnectionID = 18 }; -enum class ViewFrustumVersion : PacketVersion { +enum class AvatarQueryVersion : PacketVersion { SendMultipleFrustums = 21 }; From 67c119cd2ef39c44e970bb9cedbb2e76a41bdfc5 Mon Sep 17 00:00:00 2001 From: Clement Date: Mon, 30 Apr 2018 19:50:51 -0700 Subject: [PATCH 16/30] Send Entity Query via conical frustums --- .../src/entities/EntityTreeSendThread.cpp | 2 +- libraries/networking/src/udt/PacketHeaders.h | 3 ++- libraries/octree/src/OctreeQuery.cpp | 16 ++++------------ libraries/octree/src/OctreeQuery.h | 9 +++------ libraries/octree/src/OctreeQueryNode.cpp | 4 ++-- libraries/octree/src/OctreeQueryNode.h | 12 ++++++------ 6 files changed, 18 insertions(+), 28 deletions(-) diff --git a/assignment-client/src/entities/EntityTreeSendThread.cpp b/assignment-client/src/entities/EntityTreeSendThread.cpp index 0d943055f4..1851714f0d 100644 --- a/assignment-client/src/entities/EntityTreeSendThread.cpp +++ b/assignment-client/src/entities/EntityTreeSendThread.cpp @@ -108,7 +108,7 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O DiffTraversal::View newView; - ViewFrustum viewFrustum; + ConicalViewFrustum viewFrustum; if (nodeData->hasMainViewFrustum()) { nodeData->copyCurrentMainViewFrustum(viewFrustum); newView.viewFrustums.push_back(viewFrustum); diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 20fe23a19a..1bedfdf3e6 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -245,7 +245,8 @@ enum class EntityQueryPacketVersion: PacketVersion { JSONFilterWithFamilyTree = 19, ConnectionIdentifier = 20, RemovedJurisdictions = 21, - MultiFrustumQuery = 22 + MultiFrustumQuery = 22, + ConicalFrustums = 23 }; enum class AssetServerPacketVersion: PacketVersion { diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index 18e907cb8c..6b3f7b8e05 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -50,15 +50,11 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) { destinationBuffer += sizeof(frustumFlags); if (_hasMainFrustum) { - auto byteArray = _mainViewFrustum.toByteArray(); - memcpy(destinationBuffer, byteArray.constData(), byteArray.size()); - destinationBuffer += byteArray.size(); + destinationBuffer += _mainViewFrustum.serialize(destinationBuffer); } if (_hasSecondaryFrustum) { - auto byteArray = _secondaryViewFrustum.toByteArray(); - memcpy(destinationBuffer, byteArray.constData(), byteArray.size()); - destinationBuffer += byteArray.size(); + destinationBuffer += _secondaryViewFrustum.serialize(destinationBuffer); } // desired Max Octree PPS @@ -131,15 +127,11 @@ int OctreeQuery::parseData(ReceivedMessage& message) { _hasSecondaryFrustum = frustumFlags & QUERY_HAS_SECONDARY_FRUSTUM; if (_hasMainFrustum) { - auto bytesLeft = endPosition - sourceBuffer; - auto byteArray = QByteArray::fromRawData(reinterpret_cast(sourceBuffer), bytesLeft); - sourceBuffer += _mainViewFrustum.fromByteArray(byteArray); + sourceBuffer += _mainViewFrustum.deserialize(sourceBuffer); } if (_hasSecondaryFrustum) { - auto bytesLeft = endPosition - sourceBuffer; - auto byteArray = QByteArray::fromRawData(reinterpret_cast(sourceBuffer), bytesLeft); - sourceBuffer += _secondaryViewFrustum.fromByteArray(byteArray); + sourceBuffer += _secondaryViewFrustum.deserialize(sourceBuffer); } // desired Max Octree PPS diff --git a/libraries/octree/src/OctreeQuery.h b/libraries/octree/src/OctreeQuery.h index ef52e29f51..f28d4c317e 100644 --- a/libraries/octree/src/OctreeQuery.h +++ b/libraries/octree/src/OctreeQuery.h @@ -16,8 +16,7 @@ #include #include - -#include +#include #include "OctreeConstants.h" @@ -37,12 +36,10 @@ public: bool hasMainViewFrustum() const { return _hasMainFrustum; } void setMainViewFrustum(const ViewFrustum& viewFrustum) { _hasMainFrustum = true; _mainViewFrustum = viewFrustum; } void clearMainViewFrustum() { _hasMainFrustum = false; } - const ViewFrustum& getMainViewFrustum() const { return _mainViewFrustum; } bool hasSecondaryViewFrustum() const { return _hasSecondaryFrustum; } void setSecondaryViewFrustum(const ViewFrustum& viewFrustum) { _hasSecondaryFrustum = true; _secondaryViewFrustum = viewFrustum; } void clearSecondaryViewFrustum() { _hasSecondaryFrustum = false; } - const ViewFrustum& getSecondaryViewFrustum() const { return _secondaryViewFrustum; } // getters/setters for JSON filter QJsonObject getJSONParameters() { QReadLocker locker { &_jsonParametersLock }; return _jsonParameters; } @@ -68,9 +65,9 @@ public slots: protected: bool _hasMainFrustum { false }; - ViewFrustum _mainViewFrustum; + ConicalViewFrustum _mainViewFrustum; bool _hasSecondaryFrustum { false }; - ViewFrustum _secondaryViewFrustum; + ConicalViewFrustum _secondaryViewFrustum; // octree server sending items int _maxQueryPPS = DEFAULT_MAX_OCTREE_PPS; diff --git a/libraries/octree/src/OctreeQueryNode.cpp b/libraries/octree/src/OctreeQueryNode.cpp index d6e9343896..568504a344 100644 --- a/libraries/octree/src/OctreeQueryNode.cpp +++ b/libraries/octree/src/OctreeQueryNode.cpp @@ -139,12 +139,12 @@ void OctreeQueryNode::writeToPacket(const unsigned char* buffer, unsigned int by } } -void OctreeQueryNode::copyCurrentMainViewFrustum(ViewFrustum& viewOut) const { +void OctreeQueryNode::copyCurrentMainViewFrustum(ConicalViewFrustum& viewOut) const { QMutexLocker viewLocker(&_viewMutex); viewOut = _currentMainViewFrustum; } -void OctreeQueryNode::copyCurrentSecondaryViewFrustum(ViewFrustum& viewOut) const { +void OctreeQueryNode::copyCurrentSecondaryViewFrustum(ConicalViewFrustum& viewOut) const { QMutexLocker viewLocker(&_viewMutex); viewOut = _currentSecondaryViewFrustum; } diff --git a/libraries/octree/src/OctreeQueryNode.h b/libraries/octree/src/OctreeQueryNode.h index d8f05c4043..13337c2c69 100644 --- a/libraries/octree/src/OctreeQueryNode.h +++ b/libraries/octree/src/OctreeQueryNode.h @@ -14,14 +14,14 @@ #include -#include +#include + #include "OctreeConstants.h" #include "OctreeElementBag.h" #include "OctreePacketData.h" #include "OctreeQuery.h" #include "OctreeSceneStats.h" #include "SentPacketHistory.h" -#include class OctreeSendThread; class OctreeServer; @@ -49,8 +49,8 @@ public: OctreeElementExtraEncodeData extraEncodeData; - void copyCurrentMainViewFrustum(ViewFrustum& viewOut) const; - void copyCurrentSecondaryViewFrustum(ViewFrustum& viewOut) const; + void copyCurrentMainViewFrustum(ConicalViewFrustum& viewOut) const; + void copyCurrentSecondaryViewFrustum(ConicalViewFrustum& viewOut) const; // These are not classic setters because they are calculating and maintaining state // which is set asynchronously through the network receive @@ -97,8 +97,8 @@ private: quint64 _firstSuppressedPacket { usecTimestampNow() }; mutable QMutex _viewMutex { QMutex::Recursive }; - ViewFrustum _currentMainViewFrustum; - ViewFrustum _currentSecondaryViewFrustum; + ConicalViewFrustum _currentMainViewFrustum; + ConicalViewFrustum _currentSecondaryViewFrustum; bool _viewFrustumChanging { false }; bool _viewFrustumJustStoppedChanging { true }; From b4ea32bbb6fb7884dbbe8dd0450ae98ac0b0cdfa Mon Sep 17 00:00:00 2001 From: Clement Date: Mon, 30 Apr 2018 19:51:18 -0700 Subject: [PATCH 17/30] Correctly compute conical frustum for irregular ones --- .../shared/src/shared/ConicalViewFrustum.cpp | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/libraries/shared/src/shared/ConicalViewFrustum.cpp b/libraries/shared/src/shared/ConicalViewFrustum.cpp index 906bbc48a3..c73a722f0e 100644 --- a/libraries/shared/src/shared/ConicalViewFrustum.cpp +++ b/libraries/shared/src/shared/ConicalViewFrustum.cpp @@ -17,38 +17,24 @@ void ConicalViewFrustum::set(const ViewFrustum& viewFrustum) { // The ConicalViewFrustum has two parts: a central sphere (same as ViewFrustum) and a circular cone that bounds the frustum part. // Why? Because approximate intersection tests are much faster to compute for a cone than for a frustum. _position = viewFrustum.getPosition(); - _direction = viewFrustum.getDirection(); _radius = viewFrustum.getCenterRadius(); _farClip = viewFrustum.getFarClip(); - // Considering the rectangle intersection the frustum and the perpendicular plane 1 unit - // away from the frustum's origin - // We are looking for the angle between the ray that goes through the center of the rectangle - // and the ray that goes through one of the corners of the rectangle - // (Both rays coming from the frustum's origin) - // This angle will let us construct a cone in which the frustum is inscribed - // Let's define: - // A = aspect ratio = width / height - // fov = vertical field of view - // y = half height of the rectangle - // x = half width of the rectangle - // r = half diagonal of the rectangle - // then, we have: - // y / 1 = tan(fov / 2) - // x = A * y = A * tan(fov / 2) - // r^2 = x^2 + y^2 = (A^2 + 1) * tan^2(fov / 2) - // r / 1 = tan(angle) = sqrt((A^2 + 1) * tan^2(fov / 2)) - // angle = atan(sqrt((A^2 + 1) * tan^2(fov / 2))) - float A = viewFrustum.getAspectRatio(); - float t = tanf(0.5f * viewFrustum.getFieldOfView()); + auto topLeft = viewFrustum.getNearTopLeft() - _position; + auto topRight = viewFrustum.getNearTopRight() - _position; + auto bottomLeft = viewFrustum.getNearBottomLeft() - _position; + auto bottomRight = viewFrustum.getNearBottomRight() - _position; + auto centerAxis = 0.25f * (topLeft + topRight + bottomLeft + bottomRight); // Take the average - auto tan2Angle = (A * A + 1.0f) * (t * t); - _angle = atanf(sqrt(tan2Angle)); - - calculate(); + _direction = glm::normalize(centerAxis); + _angle = std::max(std::max(angleBetween(_direction, topLeft), + angleBetween(_direction, topRight)), + std::max(angleBetween(_direction, bottomLeft), + angleBetween(_direction, bottomRight))); } void ConicalViewFrustum::calculate() { + // Pre-compute cos and sin for faster checks _cosAngle = cosf(_angle); _sinAngle = sqrtf(1.0f - _cosAngle * _cosAngle); } From 3283c5eaeca6bb13ddd70add0f93e88b91804916 Mon Sep 17 00:00:00 2001 From: Clement Date: Tue, 1 May 2018 12:37:51 -0700 Subject: [PATCH 18/30] Fix inverted comparaison --- libraries/octree/src/OctreeQuery.cpp | 1 - libraries/shared/src/shared/ConicalViewFrustum.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index 6b3f7b8e05..7aa702138f 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -95,7 +95,6 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) { int OctreeQuery::parseData(ReceivedMessage& message) { const unsigned char* startPosition = reinterpret_cast(message.getRawMessage()); - const unsigned char* endPosition = startPosition + message.getSize(); const unsigned char* sourceBuffer = startPosition; // unpack the connection ID diff --git a/libraries/shared/src/shared/ConicalViewFrustum.cpp b/libraries/shared/src/shared/ConicalViewFrustum.cpp index c73a722f0e..8538543da6 100644 --- a/libraries/shared/src/shared/ConicalViewFrustum.cpp +++ b/libraries/shared/src/shared/ConicalViewFrustum.cpp @@ -45,7 +45,7 @@ bool ConicalViewFrustum::isVerySimilar(const ConicalViewFrustum& other) const { const float MIN_RELATIVE_ERROR = 0.01f; // 1% return glm::distance2(_position, other._position) < MIN_POSITION_SLOP_SQUARED && - angleBetween(_direction, other._direction) > MIN_ANGLE_BETWEEN && + angleBetween(_direction, other._direction) < MIN_ANGLE_BETWEEN && closeEnough(_angle, other._angle, MIN_RELATIVE_ERROR) && closeEnough(_farClip, other._farClip, MIN_RELATIVE_ERROR) && closeEnough(_radius, other._radius, MIN_RELATIVE_ERROR); From 27c471ee9774f2fd98c0584402ad7a7242c5ad18 Mon Sep 17 00:00:00 2001 From: Clement Date: Tue, 1 May 2018 15:57:26 -0700 Subject: [PATCH 19/30] Move all wire frustums to conical frustums --- assignment-client/src/Agent.cpp | 14 +++- .../src/avatars/AvatarMixerClientData.cpp | 15 ++-- .../src/avatars/AvatarMixerClientData.h | 6 +- .../src/entities/EntityTreeSendThread.cpp | 11 +-- .../src/octree/OctreeHeadlessViewer.cpp | 5 +- .../src/octree/OctreeSendThread.cpp | 2 +- interface/src/Application.cpp | 80 ++++++++++--------- interface/src/Application.h | 14 ++-- interface/src/avatar/AvatarManager.cpp | 13 +-- .../src/EntityTreeRenderer.cpp | 19 +---- .../src/EntityTreeRenderer.h | 3 +- libraries/octree/src/OctreeQuery.cpp | 46 ++++------- libraries/octree/src/OctreeQuery.h | 15 +--- libraries/octree/src/OctreeQueryNode.cpp | 29 +++---- libraries/octree/src/OctreeQueryNode.h | 6 +- libraries/octree/src/OctreeUtils.h | 3 +- .../src/AbstractViewStateInterface.h | 6 +- libraries/shared/src/NumericalConstants.h | 2 + libraries/shared/src/PrioritySortUtil.h | 16 ++-- libraries/shared/src/ViewFrustum.cpp | 63 --------------- libraries/shared/src/ViewFrustum.h | 3 - .../shared/src/shared/ConicalViewFrustum.cpp | 47 +++++++++-- .../shared/src/shared/ConicalViewFrustum.h | 8 +- tests/render-perf/src/main.cpp | 12 +-- 24 files changed, 181 insertions(+), 257 deletions(-) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 0183248648..da811b8af5 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -614,13 +614,19 @@ void Agent::sendAvatarViewFrustum() { view.setPosition(scriptedAvatar->getWorldPosition()); view.setOrientation(scriptedAvatar->getHeadOrientation()); view.calculate(); + ConicalViewFrustum conicalView { view }; + + auto avatarPacket = NLPacket::create(PacketType::AvatarQuery); + auto destinationBuffer = reinterpret_cast(avatarPacket->getPayload()); + auto bufferStart = destinationBuffer; uint8_t numFrustums = 1; - auto viewFrustumByteArray = view.toByteArray(); + memcpy(destinationBuffer, &numFrustums, sizeof(numFrustums)); + destinationBuffer += sizeof(numFrustums); - auto avatarPacket = NLPacket::create(PacketType::AvatarQuery, viewFrustumByteArray.size() + sizeof(numFrustums)); - avatarPacket->writePrimitive(numFrustums); - avatarPacket->write(viewFrustumByteArray); + destinationBuffer += conicalView.serialize(destinationBuffer); + + avatarPacket->setPayloadSize(destinationBuffer - bufferStart); DependencyManager::get()->broadcastToNodes(std::move(avatarPacket), { NodeType::AvatarMixer }); diff --git a/assignment-client/src/avatars/AvatarMixerClientData.cpp b/assignment-client/src/avatars/AvatarMixerClientData.cpp index a8e5a7c541..aa93fc9e08 100644 --- a/assignment-client/src/avatars/AvatarMixerClientData.cpp +++ b/assignment-client/src/avatars/AvatarMixerClientData.cpp @@ -128,15 +128,16 @@ void AvatarMixerClientData::removeFromRadiusIgnoringSet(SharedNodePointer self, void AvatarMixerClientData::readViewFrustumPacket(QByteArray message) { _currentViewFrustums.clear(); + + auto sourceBuffer = reinterpret_cast(message.constData()); uint8_t numFrustums = 0; - memcpy(&numFrustums, message.constData(), sizeof(numFrustums)); - message.remove(0, sizeof(numFrustums)); + memcpy(&numFrustums, sourceBuffer, sizeof(numFrustums)); + sourceBuffer += sizeof(numFrustums); for (uint8_t i = 0; i < numFrustums; ++i) { - ViewFrustum frustum; - auto bytesRead = frustum.fromByteArray(message); - message.remove(0, bytesRead); + ConicalViewFrustum frustum; + sourceBuffer += frustum.deserialize(sourceBuffer); _currentViewFrustums.push_back(frustum); } @@ -144,8 +145,8 @@ void AvatarMixerClientData::readViewFrustumPacket(QByteArray message) { bool AvatarMixerClientData::otherAvatarInView(const AABox& otherAvatarBox) { return std::any_of(std::begin(_currentViewFrustums), std::end(_currentViewFrustums), - [&](const ViewFrustum& viewFrustum) { - return viewFrustum.boxIntersectsKeyhole(otherAvatarBox); + [&](const ConicalViewFrustum& viewFrustum) { + return viewFrustum.intersects(otherAvatarBox); }); } diff --git a/assignment-client/src/avatars/AvatarMixerClientData.h b/assignment-client/src/avatars/AvatarMixerClientData.h index f17404b79f..f3b2b587ee 100644 --- a/assignment-client/src/avatars/AvatarMixerClientData.h +++ b/assignment-client/src/avatars/AvatarMixerClientData.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include const QString OUTBOUND_AVATAR_DATA_STATS_KEY = "outbound_av_data_kbps"; const QString INBOUND_AVATAR_DATA_STATS_KEY = "inbound_av_data_kbps"; @@ -110,7 +110,7 @@ public: bool getRequestsDomainListData() { return _requestsDomainListData; } void setRequestsDomainListData(bool requesting) { _requestsDomainListData = requesting; } - const ViewFrustums& getViewFrustums() const { return _currentViewFrustums; } + const ConicalViewFrustums& getViewFrustums() const { return _currentViewFrustums; } uint64_t getLastOtherAvatarEncodeTime(QUuid otherAvatar) const; void setLastOtherAvatarEncodeTime(const QUuid& otherAvatar, uint64_t time); @@ -150,7 +150,7 @@ private: SimpleMovingAverage _avgOtherAvatarDataRate; std::unordered_set _radiusIgnoredOthers; - ViewFrustums _currentViewFrustums; + ConicalViewFrustums _currentViewFrustums; int _recentOtherAvatarsInView { 0 }; int _recentOtherAvatarsOutOfView { 0 }; diff --git a/assignment-client/src/entities/EntityTreeSendThread.cpp b/assignment-client/src/entities/EntityTreeSendThread.cpp index 1851714f0d..f008ef9925 100644 --- a/assignment-client/src/entities/EntityTreeSendThread.cpp +++ b/assignment-client/src/entities/EntityTreeSendThread.cpp @@ -107,16 +107,7 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O DiffTraversal::View newView; - - ConicalViewFrustum viewFrustum; - if (nodeData->hasMainViewFrustum()) { - nodeData->copyCurrentMainViewFrustum(viewFrustum); - newView.viewFrustums.push_back(viewFrustum); - } - if (nodeData->hasSecondaryViewFrustum()) { - nodeData->copyCurrentSecondaryViewFrustum(viewFrustum); - newView.viewFrustums.push_back(viewFrustum); - } + newView.viewFrustums = nodeData->getCurrentViews(); int32_t lodLevelOffset = nodeData->getBoundaryLevelAdjust() + (viewFrustumChanged ? LOW_RES_MOVING_ADJUST : NO_BOUNDARY_ADJUST); newView.lodScaleFactor = powf(2.0f, lodLevelOffset); diff --git a/assignment-client/src/octree/OctreeHeadlessViewer.cpp b/assignment-client/src/octree/OctreeHeadlessViewer.cpp index 6d91a134c2..039dbdab78 100644 --- a/assignment-client/src/octree/OctreeHeadlessViewer.cpp +++ b/assignment-client/src/octree/OctreeHeadlessViewer.cpp @@ -19,7 +19,10 @@ void OctreeHeadlessViewer::queryOctree() { PacketType packetType = getMyQueryMessageType(); if (_hasViewFrustum) { - _octreeQuery.setMainViewFrustum(_viewFrustum); + ConicalViewFrustums views { _viewFrustum }; + _octreeQuery.setConicalViews(views); + } else { + _octreeQuery.clearConicalViews(); } auto nodeList = DependencyManager::get(); diff --git a/assignment-client/src/octree/OctreeSendThread.cpp b/assignment-client/src/octree/OctreeSendThread.cpp index 40c052659d..482b20272a 100644 --- a/assignment-client/src/octree/OctreeSendThread.cpp +++ b/assignment-client/src/octree/OctreeSendThread.cpp @@ -330,7 +330,7 @@ int OctreeSendThread::packetDistributor(SharedNodePointer node, OctreeQueryNode* } else { // we aren't forcing a full scene, check if something else suggests we should isFullScene = nodeData->haveJSONParametersChanged() || - (nodeData->hasMainViewFrustum() && + (nodeData->hasConicalViews() && (nodeData->getViewFrustumJustStoppedChanging() || nodeData->hasLodChanged())); } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a1301ff43e..d14af685f0 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5230,10 +5230,10 @@ void Application::updateSecondaryCameraViewFrustum() { assert(camera); if (!camera->isEnabled()) { - _hasSecondaryViewFrustum = false; return; } + ViewFrustum secondaryViewFrustum; if (camera->mirrorProjection && !camera->attachedEntityId.isNull()) { auto entityScriptingInterface = DependencyManager::get(); auto entityProperties = entityScriptingInterface->getEntityProperties(camera->attachedEntityId); @@ -5258,36 +5258,37 @@ void Application::updateSecondaryCameraViewFrustum() { // set frustum position to be mirrored camera and set orientation to mirror's adjusted rotation glm::quat mirrorCameraOrientation = glm::quat_cast(worldFromMirrorRotation); - _secondaryViewFrustum.setPosition(mirrorCameraPositionWorld); - _secondaryViewFrustum.setOrientation(mirrorCameraOrientation); + secondaryViewFrustum.setPosition(mirrorCameraPositionWorld); + secondaryViewFrustum.setOrientation(mirrorCameraOrientation); // build frustum using mirror space translation of mirrored camera float nearClip = mirrorCameraPositionMirror.z + mirrorPropertiesDimensions.z * 2.0f; glm::vec3 upperRight = halfMirrorPropertiesDimensions - mirrorCameraPositionMirror; glm::vec3 bottomLeft = -halfMirrorPropertiesDimensions - mirrorCameraPositionMirror; glm::mat4 frustum = glm::frustum(bottomLeft.x, upperRight.x, bottomLeft.y, upperRight.y, nearClip, camera->farClipPlaneDistance); - _secondaryViewFrustum.setProjection(frustum); + secondaryViewFrustum.setProjection(frustum); } else { if (!camera->attachedEntityId.isNull()) { auto entityScriptingInterface = DependencyManager::get(); auto entityProperties = entityScriptingInterface->getEntityProperties(camera->attachedEntityId); - _secondaryViewFrustum.setPosition(entityProperties.getPosition()); - _secondaryViewFrustum.setOrientation(entityProperties.getRotation()); + secondaryViewFrustum.setPosition(entityProperties.getPosition()); + secondaryViewFrustum.setOrientation(entityProperties.getRotation()); } else { - _secondaryViewFrustum.setPosition(camera->position); - _secondaryViewFrustum.setOrientation(camera->orientation); + secondaryViewFrustum.setPosition(camera->position); + secondaryViewFrustum.setOrientation(camera->orientation); } float aspectRatio = (float)camera->textureWidth / (float)camera->textureHeight; - _secondaryViewFrustum.setProjection(camera->vFoV, + secondaryViewFrustum.setProjection(camera->vFoV, aspectRatio, camera->nearClipPlaneDistance, camera->farClipPlaneDistance); } // Without calculating the bound planes, the secondary camera will use the same culling frustum as the main camera, // which is not what we want here. - _secondaryViewFrustum.calculate(); - _hasSecondaryViewFrustum = true; + secondaryViewFrustum.calculate(); + + _conicalViews.push_back(secondaryViewFrustum); } static bool domainLoadingInProgress = false; @@ -5644,6 +5645,8 @@ void Application::update(float deltaTime) { QMutexLocker viewLocker(&_viewMutex); _myCamera.loadViewFrustum(_viewFrustum); + _conicalViews.clear(); + _conicalViews.push_back(_viewFrustum); // TODO: Fix this by modeling the way the secondary camera works on how the main camera works // ie. Use a camera object stored in the game logic and informs the Engine on where the secondary // camera should be. @@ -5660,18 +5663,29 @@ void Application::update(float deltaTime) { quint64 sinceLastQuery = now - _lastQueriedTime; const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND; bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY; - bool viewIsDifferentEnough = !_lastQueriedViewFrustum.isVerySimilar(_viewFrustum); - viewIsDifferentEnough |= _hasSecondaryViewFrustum && !_lastQueriedSecondaryViewFrustum.isVerySimilar(_secondaryViewFrustum); + + bool viewIsDifferentEnough = false; + if (_conicalViews.size() == _lastQueriedViews.size()) { + for (size_t i = 0; i < _conicalViews.size(); ++i) { + if (!_conicalViews[i].isVerySimilar(_lastQueriedViews[i])) { + viewIsDifferentEnough = true; + break; + } + } + } else { + viewIsDifferentEnough = true; + } + // if it's been a while since our last query or the view has significantly changed then send a query, otherwise suppress it if (queryIsDue || viewIsDifferentEnough) { - _lastQueriedTime = now; if (DependencyManager::get()->shouldRenderEntities()) { queryOctree(NodeType::EntityServer, PacketType::EntityQuery); } sendAvatarViewFrustum(); - _lastQueriedViewFrustum = _viewFrustum; - _lastQueriedSecondaryViewFrustum = _secondaryViewFrustum; + + _lastQueriedViews = _conicalViews; + _lastQueriedTime = now; } } @@ -5844,17 +5858,19 @@ void Application::update(float deltaTime) { } void Application::sendAvatarViewFrustum() { - uint8_t numFrustums = 1; - QByteArray viewFrustumByteArray = _viewFrustum.toByteArray(); + auto avatarPacket = NLPacket::create(PacketType::AvatarQuery); + auto destinationBuffer = reinterpret_cast(avatarPacket->getPayload()); + unsigned char* bufferStart = destinationBuffer; - if (_hasSecondaryViewFrustum) { - ++numFrustums; - viewFrustumByteArray += _secondaryViewFrustum.toByteArray(); + uint8_t numFrustums = _conicalViews.size(); + memcpy(destinationBuffer, &numFrustums, sizeof(numFrustums)); + destinationBuffer += sizeof(numFrustums); + + for (const auto& view : _conicalViews) { + destinationBuffer += view.serialize(destinationBuffer); } - auto avatarPacket = NLPacket::create(PacketType::AvatarQuery, viewFrustumByteArray.size() + sizeof(numFrustums)); - avatarPacket->writePrimitive(numFrustums); - avatarPacket->write(viewFrustumByteArray); + avatarPacket->setPayloadSize(destinationBuffer - bufferStart); DependencyManager::get()->broadcastToNodes(std::move(avatarPacket), NodeSet() << NodeType::AvatarMixer); } @@ -5916,16 +5932,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType) { return; // bail early if settings are not loaded } - ViewFrustum viewFrustum; - copyViewFrustum(viewFrustum); - _octreeQuery.setMainViewFrustum(viewFrustum); - - if (hasSecondaryViewFrustum()) { - copySecondaryViewFrustum(viewFrustum); - _octreeQuery.setSecondaryViewFrustum(viewFrustum); - } else { - _octreeQuery.clearSecondaryViewFrustum(); - } + _octreeQuery.setConicalViews(_conicalViews); auto lodManager = DependencyManager::get(); _octreeQuery.setOctreeSizeScale(lodManager->getOctreeSizeScale()); @@ -6010,11 +6017,6 @@ void Application::copyDisplayViewFrustum(ViewFrustum& viewOut) const { viewOut = _displayViewFrustum; } -void Application::copySecondaryViewFrustum(ViewFrustum& viewOut) const { - QMutexLocker viewLocker(&_viewMutex); - viewOut = _secondaryViewFrustum; -} - void Application::resetSensors(bool andReload) { DependencyManager::get()->reset(); DependencyManager::get()->reset(); diff --git a/interface/src/Application.h b/interface/src/Application.h index 83e719333d..6d749f9458 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -175,14 +176,14 @@ public: Camera& getCamera() { return _myCamera; } const Camera& getCamera() const { return _myCamera; } // Represents the current view frustum of the avatar. - void copyViewFrustum(ViewFrustum& viewOut) const override; - void copySecondaryViewFrustum(ViewFrustum& viewOut) const override; - bool hasSecondaryViewFrustum() const override { return _hasSecondaryViewFrustum; } + void copyViewFrustum(ViewFrustum& viewOut) const; // Represents the view frustum of the current rendering pass, // which might be different from the viewFrustum, i.e. shadowmap // passes, mirror window passes, etc void copyDisplayViewFrustum(ViewFrustum& viewOut) const; + const ConicalViewFrustums& getConicalViews() const override { return _conicalViews; } + const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; } QSharedPointer getEntities() const { return DependencyManager::get(); } QUndoStack* getUndoStack() { return &_undoStack; } @@ -574,11 +575,10 @@ private: mutable QMutex _viewMutex { QMutex::Recursive }; ViewFrustum _viewFrustum; // current state of view frustum, perspective, orientation, etc. - ViewFrustum _lastQueriedViewFrustum; // last view frustum used to query octree servers ViewFrustum _displayViewFrustum; - ViewFrustum _secondaryViewFrustum; - ViewFrustum _lastQueriedSecondaryViewFrustum; // last secondary view frustum used to query octree servers - bool _hasSecondaryViewFrustum; + + ConicalViewFrustums _conicalViews; + ConicalViewFrustums _lastQueriedViews; // last views used to query servers quint64 _lastQueriedTime; OctreeQuery _octreeQuery { true }; // NodeData derived class for querying octee cells from octree servers diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index 087e23a933..d24618fada 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "Application.h" #include "AvatarManager.h" @@ -156,17 +157,7 @@ void AvatarManager::updateOtherAvatars(float deltaTime) { }; - ViewFrustums views; - - ViewFrustum view; - qApp->copyCurrentViewFrustum(view); - views.push_back(view); - - if (qApp->hasSecondaryViewFrustum()) { - qApp->copySecondaryViewFrustum(view); - views.push_back(view); - } - + const auto& views = qApp->getConicalViews(); PrioritySortUtil::PriorityQueue sortedAvatars(views, AvatarData::_avatarSortCoefficientSize, AvatarData::_avatarSortCoefficientCenter, diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 6dd13c7332..600d1c32a8 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -296,8 +296,7 @@ void EntityTreeRenderer::addPendingEntities(const render::ScenePointer& scene, r } } -void EntityTreeRenderer::updateChangedEntities(const render::ScenePointer& scene, const ViewFrustums& views, - render::Transaction& transaction) { +void EntityTreeRenderer::updateChangedEntities(const render::ScenePointer& scene, render::Transaction& transaction) { PROFILE_RANGE_EX(simulation_physics, "ChangeInScene", 0xffff00ff, (uint64_t)_changedEntities.size()); PerformanceTimer pt("change"); std::unordered_set changedEntities; @@ -358,6 +357,8 @@ void EntityTreeRenderer::updateChangedEntities(const render::ScenePointer& scene // prioritize and sort the renderables uint64_t sortStart = usecTimestampNow(); + + const auto& views = _viewState->getConicalViews(); PrioritySortUtil::PriorityQueue sortedRenderables(views); { PROFILE_RANGE_EX(simulation_physics, "SortRenderables", 0xffff00ff, (uint64_t)_renderablesToUpdate.size()); @@ -417,19 +418,7 @@ void EntityTreeRenderer::update(bool simulate) { render::Transaction transaction; addPendingEntities(scene, transaction); - ViewFrustums views; - - ViewFrustum view; - _viewState->copyViewFrustum(view); - views.push_back(view); - - if (_viewState->hasSecondaryViewFrustum()) { - _viewState->copySecondaryViewFrustum(view); - views.push_back(view); - } - - - updateChangedEntities(scene, views, transaction); + updateChangedEntities(scene, transaction); scene->enqueueTransaction(transaction); } } diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.h b/libraries/entities-renderer/src/EntityTreeRenderer.h index 9ed4f9d21d..882ec2fd5b 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.h +++ b/libraries/entities-renderer/src/EntityTreeRenderer.h @@ -148,8 +148,7 @@ protected: private: void addPendingEntities(const render::ScenePointer& scene, render::Transaction& transaction); - void updateChangedEntities(const render::ScenePointer& scene, const ViewFrustums& views, - render::Transaction& transaction); + void updateChangedEntities(const render::ScenePointer& scene, render::Transaction& transaction); EntityRendererPointer renderableForEntity(const EntityItemPointer& entity) const { return renderableForEntityId(entity->getID()); } render::ItemID renderableIdForEntity(const EntityItemPointer& entity) const { return renderableIdForEntityId(entity->getID()); } diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index 7aa702138f..072774f0f5 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -18,10 +18,6 @@ #include #include -using QueryFlags = uint8_t; -const QueryFlags QUERY_HAS_MAIN_FRUSTUM = 1U << 0; -const QueryFlags QUERY_HAS_SECONDARY_FRUSTUM = 1U << 1; - OctreeQuery::OctreeQuery(bool randomizeConnectionID) { if (randomizeConnectionID) { // randomize our initial octree query connection ID using random_device @@ -38,23 +34,13 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) { memcpy(destinationBuffer, &_connectionID, sizeof(_connectionID)); destinationBuffer += sizeof(_connectionID); - // flags for wether the frustums are present - QueryFlags frustumFlags = 0; - if (_hasMainFrustum) { - frustumFlags |= QUERY_HAS_MAIN_FRUSTUM; - } - if (_hasSecondaryFrustum) { - frustumFlags |= QUERY_HAS_SECONDARY_FRUSTUM; - } - memcpy(destinationBuffer, &frustumFlags, sizeof(frustumFlags)); - destinationBuffer += sizeof(frustumFlags); + // Number of frustums + uint8_t numFrustums = _conicalViews.size(); + memcpy(destinationBuffer, &numFrustums, sizeof(numFrustums)); + destinationBuffer += sizeof(numFrustums); - if (_hasMainFrustum) { - destinationBuffer += _mainViewFrustum.serialize(destinationBuffer); - } - - if (_hasSecondaryFrustum) { - destinationBuffer += _secondaryViewFrustum.serialize(destinationBuffer); + for (const auto& view : _conicalViews) { + destinationBuffer += view.serialize(destinationBuffer); } // desired Max Octree PPS @@ -118,19 +104,15 @@ int OctreeQuery::parseData(ReceivedMessage& message) { } // check if this query uses a view frustum - QueryFlags frustumFlags { 0 }; - memcpy(&frustumFlags, sourceBuffer, sizeof(frustumFlags)); - sourceBuffer += sizeof(frustumFlags); + uint8_t numFrustums = 0; + memcpy(&numFrustums, sourceBuffer, sizeof(numFrustums)); + sourceBuffer += sizeof(numFrustums); - _hasMainFrustum = frustumFlags & QUERY_HAS_MAIN_FRUSTUM; - _hasSecondaryFrustum = frustumFlags & QUERY_HAS_SECONDARY_FRUSTUM; - - if (_hasMainFrustum) { - sourceBuffer += _mainViewFrustum.deserialize(sourceBuffer); - } - - if (_hasSecondaryFrustum) { - sourceBuffer += _secondaryViewFrustum.deserialize(sourceBuffer); + _conicalViews.clear(); + for (int i = 0; i < numFrustums; ++i) { + ConicalViewFrustum view; + sourceBuffer += view.deserialize(sourceBuffer); + _conicalViews.push_back(view); } // desired Max Octree PPS diff --git a/libraries/octree/src/OctreeQuery.h b/libraries/octree/src/OctreeQuery.h index f28d4c317e..7dfc1cfaaf 100644 --- a/libraries/octree/src/OctreeQuery.h +++ b/libraries/octree/src/OctreeQuery.h @@ -33,13 +33,9 @@ public: int getBroadcastData(unsigned char* destinationBuffer); int parseData(ReceivedMessage& message) override; - bool hasMainViewFrustum() const { return _hasMainFrustum; } - void setMainViewFrustum(const ViewFrustum& viewFrustum) { _hasMainFrustum = true; _mainViewFrustum = viewFrustum; } - void clearMainViewFrustum() { _hasMainFrustum = false; } - - bool hasSecondaryViewFrustum() const { return _hasSecondaryFrustum; } - void setSecondaryViewFrustum(const ViewFrustum& viewFrustum) { _hasSecondaryFrustum = true; _secondaryViewFrustum = viewFrustum; } - void clearSecondaryViewFrustum() { _hasSecondaryFrustum = false; } + bool hasConicalViews() const { return !_conicalViews.empty(); } + void setConicalViews(ConicalViewFrustums views) { _conicalViews = views; } + void clearConicalViews() { _conicalViews.clear(); } // getters/setters for JSON filter QJsonObject getJSONParameters() { QReadLocker locker { &_jsonParametersLock }; return _jsonParameters; } @@ -64,10 +60,7 @@ public slots: void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; } protected: - bool _hasMainFrustum { false }; - ConicalViewFrustum _mainViewFrustum; - bool _hasSecondaryFrustum { false }; - ConicalViewFrustum _secondaryViewFrustum; + ConicalViewFrustums _conicalViews; // octree server sending items int _maxQueryPPS = DEFAULT_MAX_OCTREE_PPS; diff --git a/libraries/octree/src/OctreeQueryNode.cpp b/libraries/octree/src/OctreeQueryNode.cpp index 568504a344..2d1d89a11c 100644 --- a/libraries/octree/src/OctreeQueryNode.cpp +++ b/libraries/octree/src/OctreeQueryNode.cpp @@ -139,23 +139,13 @@ void OctreeQueryNode::writeToPacket(const unsigned char* buffer, unsigned int by } } -void OctreeQueryNode::copyCurrentMainViewFrustum(ConicalViewFrustum& viewOut) const { - QMutexLocker viewLocker(&_viewMutex); - viewOut = _currentMainViewFrustum; -} - -void OctreeQueryNode::copyCurrentSecondaryViewFrustum(ConicalViewFrustum& viewOut) const { - QMutexLocker viewLocker(&_viewMutex); - viewOut = _currentSecondaryViewFrustum; -} - bool OctreeQueryNode::updateCurrentViewFrustum() { // if shutting down, return immediately if (_isShuttingDown) { return false; } - if (!_hasMainFrustum && !_hasSecondaryFrustum) { + if (!hasConicalViews()) { // this client does not use a view frustum so the view frustum for this query has not changed return false; } @@ -164,12 +154,17 @@ bool OctreeQueryNode::updateCurrentViewFrustum() { { // if there has been a change, then recalculate QMutexLocker viewLocker(&_viewMutex); - if (_hasMainFrustum && !_mainViewFrustum.isVerySimilar(_currentMainViewFrustum)) { - _currentMainViewFrustum = _mainViewFrustum; - currentViewFrustumChanged = true; - } - if (_hasSecondaryFrustum && !_secondaryViewFrustum.isVerySimilar(_currentSecondaryViewFrustum)) { - _currentSecondaryViewFrustum = _secondaryViewFrustum; + + if (_conicalViews.size() == _currentConicalViews.size()) { + for (size_t i = 0; i < _conicalViews.size(); ++i) { + if (!_conicalViews[i].isVerySimilar(_currentConicalViews[i])) { + _currentConicalViews = _conicalViews; + currentViewFrustumChanged = true; + break; + } + } + } else { + _currentConicalViews = _conicalViews; currentViewFrustumChanged = true; } } diff --git a/libraries/octree/src/OctreeQueryNode.h b/libraries/octree/src/OctreeQueryNode.h index 13337c2c69..d984e048c1 100644 --- a/libraries/octree/src/OctreeQueryNode.h +++ b/libraries/octree/src/OctreeQueryNode.h @@ -49,8 +49,7 @@ public: OctreeElementExtraEncodeData extraEncodeData; - void copyCurrentMainViewFrustum(ConicalViewFrustum& viewOut) const; - void copyCurrentSecondaryViewFrustum(ConicalViewFrustum& viewOut) const; + const ConicalViewFrustums& getCurrentViews() const { return _currentConicalViews; } // These are not classic setters because they are calculating and maintaining state // which is set asynchronously through the network receive @@ -97,8 +96,7 @@ private: quint64 _firstSuppressedPacket { usecTimestampNow() }; mutable QMutex _viewMutex { QMutex::Recursive }; - ConicalViewFrustum _currentMainViewFrustum; - ConicalViewFrustum _currentSecondaryViewFrustum; + ConicalViewFrustums _currentConicalViews; bool _viewFrustumChanging { false }; bool _viewFrustumJustStoppedChanging { true }; diff --git a/libraries/octree/src/OctreeUtils.h b/libraries/octree/src/OctreeUtils.h index 58ab366d8d..dff56cad64 100644 --- a/libraries/octree/src/OctreeUtils.h +++ b/libraries/octree/src/OctreeUtils.h @@ -12,6 +12,8 @@ #ifndef hifi_OctreeUtils_h #define hifi_OctreeUtils_h +#include + #include "OctreeConstants.h" class AABox; @@ -33,7 +35,6 @@ float getOrthographicAccuracySize(float octreeSizeScale, int boundaryLevelAdjust // MIN_ELEMENT_ANGULAR_DIAMETER = angular diameter of 1x1x1m cube at 400m = sqrt(3) / 400 = 0.0043301 radians ~= 0.25 degrees const float MIN_ELEMENT_ANGULAR_DIAMETER = 0.0043301f; // radians // NOTE: the entity bounding cube is larger than the smallest possible containing octree element by sqrt(3) -const float SQRT_THREE = 1.73205080f; const float MIN_ENTITY_ANGULAR_DIAMETER = MIN_ELEMENT_ANGULAR_DIAMETER * SQRT_THREE; const float MIN_VISIBLE_DISTANCE = 0.0001f; // helps avoid divide-by-zero check diff --git a/libraries/render-utils/src/AbstractViewStateInterface.h b/libraries/render-utils/src/AbstractViewStateInterface.h index 9d781b7d18..b90e291da5 100644 --- a/libraries/render-utils/src/AbstractViewStateInterface.h +++ b/libraries/render-utils/src/AbstractViewStateInterface.h @@ -24,6 +24,8 @@ class Transform; class QThread; class ViewFrustum; class PickRay; +class ConicalViewFrustum; +using ConicalViewFrustums = std::vector; /// Interface provided by Application to other objects that need access to the current view state details class AbstractViewStateInterface { @@ -31,9 +33,7 @@ public: /// copies the current view frustum for rendering the view state virtual void copyCurrentViewFrustum(ViewFrustum& viewOut) const = 0; - virtual void copyViewFrustum(ViewFrustum& viewOut) const = 0; - virtual void copySecondaryViewFrustum(ViewFrustum& viewOut) const = 0; - virtual bool hasSecondaryViewFrustum() const = 0; + virtual const ConicalViewFrustums& getConicalViews() const = 0; virtual QThread* getMainThread() = 0; diff --git a/libraries/shared/src/NumericalConstants.h b/libraries/shared/src/NumericalConstants.h index e2d2409d56..4c24a73226 100644 --- a/libraries/shared/src/NumericalConstants.h +++ b/libraries/shared/src/NumericalConstants.h @@ -48,6 +48,8 @@ const int BYTES_PER_KILOBYTE = 1000; const int BYTES_PER_KILOBIT = BYTES_PER_KILOBYTE / BITS_IN_BYTE; const int KILO_PER_MEGA = 1000; +const float SQRT_THREE = 1.73205080f; + #define KB_TO_BYTES_SHIFT 10 #define MB_TO_BYTES_SHIFT 20 #define GB_TO_BYTES_SHIFT 30 diff --git a/libraries/shared/src/PrioritySortUtil.h b/libraries/shared/src/PrioritySortUtil.h index ba15222611..34ec074d45 100644 --- a/libraries/shared/src/PrioritySortUtil.h +++ b/libraries/shared/src/PrioritySortUtil.h @@ -15,7 +15,7 @@ #include #include "NumericalConstants.h" -#include "ViewFrustum.h" +#include "shared/ConicalViewFrustum.h" /* PrioritySortUtil is a helper for sorting 3D things relative to a ViewFrustum. To use: @@ -84,12 +84,12 @@ namespace PrioritySortUtil { class PriorityQueue { public: PriorityQueue() = delete; - PriorityQueue(const ViewFrustums& views) : _views(views) { } - PriorityQueue(const ViewFrustums& views, float angularWeight, float centerWeight, float ageWeight) + PriorityQueue(const ConicalViewFrustums& views) : _views(views) { } + PriorityQueue(const ConicalViewFrustums& views, float angularWeight, float centerWeight, float ageWeight) : _views(views), _angularWeight(angularWeight), _centerWeight(centerWeight), _ageWeight(ageWeight) { } - void setViews(const ViewFrustums& views) { _views = views; } + void setViews(const ConicalViewFrustums& views) { _views = views; } void setWeights(float angularWeight, float centerWeight, float ageWeight) { _angularWeight = angularWeight; @@ -118,7 +118,7 @@ namespace PrioritySortUtil { return priority; } - float computePriority(const ViewFrustum& view, const T& thing) const { + float computePriority(const ConicalViewFrustum& view, const T& thing) const { // priority = weighted linear combination of multiple values: // (a) angular size // (b) proximity to center of view @@ -143,8 +143,8 @@ namespace PrioritySortUtil { + _ageWeight * cosineAngleFactor * age; // decrement priority of things outside keyhole - if (distance - radius > view.getCenterRadius()) { - if (!view.sphereIntersectsFrustum(position, radius)) { + if (distance - radius > view.getRadius()) { + if (!view.intersects(offset, distance, radius)) { constexpr float OUT_OF_VIEW_PENALTY = -10.0f; priority += OUT_OF_VIEW_PENALTY; } @@ -152,7 +152,7 @@ namespace PrioritySortUtil { return priority; } - ViewFrustums _views; + ConicalViewFrustums _views; std::priority_queue _queue; float _angularWeight { DEFAULT_ANGULAR_COEF }; float _centerWeight { DEFAULT_CENTER_COEF }; diff --git a/libraries/shared/src/ViewFrustum.cpp b/libraries/shared/src/ViewFrustum.cpp index c89a9fbd60..3aa70b0897 100644 --- a/libraries/shared/src/ViewFrustum.cpp +++ b/libraries/shared/src/ViewFrustum.cpp @@ -138,69 +138,6 @@ const char* ViewFrustum::debugPlaneName (int plane) const { return "Unknown"; } -int ViewFrustum::fromByteArray(const QByteArray& input) { - - // From the wire! - glm::vec3 cameraPosition; - glm::quat cameraOrientation; - float cameraCenterRadius; - float cameraFov; - float cameraAspectRatio; - float cameraNearClip; - float cameraFarClip; - - const unsigned char* startPosition = reinterpret_cast(input.constData()); - const unsigned char* sourceBuffer = startPosition; - - // camera details - memcpy(&cameraPosition, sourceBuffer, sizeof(cameraPosition)); - sourceBuffer += sizeof(cameraPosition); - sourceBuffer += unpackOrientationQuatFromBytes(sourceBuffer, cameraOrientation); - sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*)sourceBuffer, &cameraFov); - sourceBuffer += unpackFloatRatioFromTwoByte(sourceBuffer, cameraAspectRatio); - sourceBuffer += unpackClipValueFromTwoByte(sourceBuffer, cameraNearClip); - sourceBuffer += unpackClipValueFromTwoByte(sourceBuffer, cameraFarClip); - memcpy(&cameraCenterRadius, sourceBuffer, sizeof(cameraCenterRadius)); - sourceBuffer += sizeof(cameraCenterRadius); - - setPosition(cameraPosition); - setOrientation(cameraOrientation); - setCenterRadius(cameraCenterRadius); - - // Also make sure it's got the correct lens details from the camera - if (0.0f != cameraAspectRatio && - 0.0f != cameraNearClip && - 0.0f != cameraFarClip && - cameraNearClip != cameraFarClip) { - - setProjection(cameraFov, cameraAspectRatio, cameraNearClip, cameraFarClip); - calculate(); - } - - return sourceBuffer - startPosition; -} - - -QByteArray ViewFrustum::toByteArray() { - static const int LARGE_ENOUGH = 1024; - QByteArray viewFrustumDataByteArray(LARGE_ENOUGH, 0); - unsigned char* destinationBuffer = reinterpret_cast(viewFrustumDataByteArray.data()); - unsigned char* startPosition = destinationBuffer; - - // camera details - memcpy(destinationBuffer, &_position, sizeof(_position)); - destinationBuffer += sizeof(_position); - destinationBuffer += packOrientationQuatToBytes(destinationBuffer, _orientation); - destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _fieldOfView); - destinationBuffer += packFloatRatioToTwoByte(destinationBuffer, _aspectRatio); - destinationBuffer += packClipValueToTwoByte(destinationBuffer, _nearClip); - destinationBuffer += packClipValueToTwoByte(destinationBuffer, _farClip); - memcpy(destinationBuffer, &_centerSphereRadius, sizeof(_centerSphereRadius)); - destinationBuffer += sizeof(_centerSphereRadius); - - return viewFrustumDataByteArray.left(destinationBuffer - startPosition); -} - ViewFrustum::intersection ViewFrustum::calculateCubeFrustumIntersection(const AACube& cube) const { // only check against frustum ViewFrustum::intersection result = INSIDE; diff --git a/libraries/shared/src/ViewFrustum.h b/libraries/shared/src/ViewFrustum.h index 128a717df8..eada65468d 100644 --- a/libraries/shared/src/ViewFrustum.h +++ b/libraries/shared/src/ViewFrustum.h @@ -147,9 +147,6 @@ public: void invalidate(); // causes all reasonable intersection tests to fail - QByteArray toByteArray(); - int fromByteArray(const QByteArray& input); - private: glm::mat4 _view; glm::mat4 _projection; diff --git a/libraries/shared/src/shared/ConicalViewFrustum.cpp b/libraries/shared/src/shared/ConicalViewFrustum.cpp index 8538543da6..2ef096e3a8 100644 --- a/libraries/shared/src/shared/ConicalViewFrustum.cpp +++ b/libraries/shared/src/shared/ConicalViewFrustum.cpp @@ -11,6 +11,8 @@ #include "ConicalViewFrustum.h" + +#include "../NumericalConstants.h" #include "../ViewFrustum.h" void ConicalViewFrustum::set(const ViewFrustum& viewFrustum) { @@ -45,13 +47,46 @@ bool ConicalViewFrustum::isVerySimilar(const ConicalViewFrustum& other) const { const float MIN_RELATIVE_ERROR = 0.01f; // 1% return glm::distance2(_position, other._position) < MIN_POSITION_SLOP_SQUARED && - angleBetween(_direction, other._direction) < MIN_ANGLE_BETWEEN && - closeEnough(_angle, other._angle, MIN_RELATIVE_ERROR) && - closeEnough(_farClip, other._farClip, MIN_RELATIVE_ERROR) && - closeEnough(_radius, other._radius, MIN_RELATIVE_ERROR); + angleBetween(_direction, other._direction) < MIN_ANGLE_BETWEEN && + closeEnough(_angle, other._angle, MIN_RELATIVE_ERROR) && + closeEnough(_farClip, other._farClip, MIN_RELATIVE_ERROR) && + closeEnough(_radius, other._radius, MIN_RELATIVE_ERROR); } -bool ConicalViewFrustum::intersects(const glm::vec3& position, float distance, float radius) const { +bool ConicalViewFrustum::intersects(const AACube& cube) const { + auto radius = 0.5f * SQRT_THREE * cube.getScale(); // radius of bounding sphere + auto position = cube.calcCenter() - _position; // position of bounding sphere in view-frame + float distance = glm::length(position); + + return intersects(position, distance, radius); +} + +bool ConicalViewFrustum::intersects(const AABox& box) const { + auto radius = 0.5f * glm::length(box.getScale()); // radius of bounding sphere + auto position = box.calcCenter() - _position; // position of bounding sphere in view-frame + float distance = glm::length(position); + + return intersects(position, distance, radius); +} + +bool ConicalViewFrustum::getAngularSize(const AACube& cube) const { + auto radius = 0.5f * SQRT_THREE * cube.getScale(); // radius of bounding sphere + auto position = cube.calcCenter() - _position; // position of bounding sphere in view-frame + float distance = glm::length(position); + + return getAngularSize(distance, radius); +} + +bool ConicalViewFrustum::getAngularSize(const AABox& box) const { + auto radius = 0.5f * glm::length(box.getScale()); // radius of bounding sphere + auto position = box.calcCenter() - _position; // position of bounding sphere in view-frame + float distance = glm::length(position); + + return getAngularSize(distance, radius); +} + + +bool ConicalViewFrustum::intersects(const glm::vec3& relativePosition, float distance, float radius) const { if (distance < _radius + radius) { // Inside keyhole radius return true; @@ -68,7 +103,7 @@ bool ConicalViewFrustum::intersects(const glm::vec3& position, float distance, f // The math here is left as an exercise for the reader with the following hints: // (1) We actually check the dot product of the cube's local position rather than the angle and // (2) we take advantage of this trig identity: cos(A+B) = cos(A)*cos(B) - sin(A)*sin(B) - return glm::dot(position, _direction) > + return glm::dot(relativePosition, _direction) > sqrtf(distance * distance - radius * radius) * _cosAngle - radius * _sinAngle; } diff --git a/libraries/shared/src/shared/ConicalViewFrustum.h b/libraries/shared/src/shared/ConicalViewFrustum.h index 3cadedda9d..dc372d560e 100644 --- a/libraries/shared/src/shared/ConicalViewFrustum.h +++ b/libraries/shared/src/shared/ConicalViewFrustum.h @@ -17,6 +17,7 @@ #include class AACube; +class AABox; class ViewFrustum; using ViewFrustums = std::vector; @@ -42,7 +43,12 @@ public: bool isVerySimilar(const ConicalViewFrustum& other) const; - bool intersects(const glm::vec3& position, float distance, float radius) const; + bool intersects(const AACube& cube) const; + bool intersects(const AABox& box) const; + bool getAngularSize(const AACube& cube) const; + bool getAngularSize(const AABox& box) const; + + bool intersects(const glm::vec3& relativePosition, float distance, float radius) const; bool getAngularSize(float distance, float radius) const; int serialize(unsigned char* destinationBuffer) const; diff --git a/tests/render-perf/src/main.cpp b/tests/render-perf/src/main.cpp index 8c17d7c5c2..2e72d9cead 100644 --- a/tests/render-perf/src/main.cpp +++ b/tests/render-perf/src/main.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -441,14 +442,9 @@ protected: viewOut = _viewFrustum; } - void copyViewFrustum(ViewFrustum& viewOut) const override { - viewOut = _viewFrustum; - } - - void copySecondaryViewFrustum(ViewFrustum& viewOut) const override {} - - bool hasSecondaryViewFrustum() const override { - return false; + const ConicalViewFrustums& getConicalViews() const override { + assert(false); + return ConicalViewFrustums(); } QThread* getMainThread() override { From d7e9fdc6a42b0c2940399a6103d80e5d52f5d1e6 Mon Sep 17 00:00:00 2001 From: Clement Date: Tue, 1 May 2018 18:19:25 -0700 Subject: [PATCH 20/30] Bump Avatar Query packet version --- libraries/networking/src/udt/PacketHeaders.cpp | 2 +- libraries/networking/src/udt/PacketHeaders.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index 123e11b7c5..d6ab7d0f9c 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -91,7 +91,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::Ping: return static_cast(PingVersion::IncludeConnectionID); case PacketType::AvatarQuery: - return static_cast(AvatarQueryVersion::SendMultipleFrustums); + return static_cast(AvatarQueryVersion::ConicalFrustums); default: return 20; } diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 1bedfdf3e6..2252b09ae5 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -330,7 +330,8 @@ enum class PingVersion : PacketVersion { }; enum class AvatarQueryVersion : PacketVersion { - SendMultipleFrustums = 21 + SendMultipleFrustums = 21, + ConicalFrustums = 22 }; #endif // hifi_PacketHeaders_h From d87cd2af6e979f3010bb21a6ac4992a921233238 Mon Sep 17 00:00:00 2001 From: Clement Date: Tue, 1 May 2018 18:23:00 -0700 Subject: [PATCH 21/30] Update avatar query names --- assignment-client/src/Agent.cpp | 14 +++++++------- assignment-client/src/Agent.h | 4 ++-- interface/src/Application.cpp | 4 ++-- interface/src/Application.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index da811b8af5..42924a8487 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -548,18 +548,18 @@ void Agent::setIsAvatar(bool isAvatar) { if (_isAvatar && !_avatarIdentityTimer) { // set up the avatar timers _avatarIdentityTimer = new QTimer(this); - _avatarViewTimer = new QTimer(this); + _avatarQueryTimer = new QTimer(this); // connect our slot connect(_avatarIdentityTimer, &QTimer::timeout, this, &Agent::sendAvatarIdentityPacket); - connect(_avatarViewTimer, &QTimer::timeout, this, &Agent::sendAvatarViewFrustum); + connect(_avatarQueryTimer, &QTimer::timeout, this, &Agent::queryAvatars); static const int AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS = 1000; static const int AVATAR_VIEW_PACKET_SEND_INTERVAL_MSECS = 1000; // start the timers _avatarIdentityTimer->start(AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS); // FIXME - we shouldn't really need to constantly send identity packets - _avatarViewTimer->start(AVATAR_VIEW_PACKET_SEND_INTERVAL_MSECS); + _avatarQueryTimer->start(AVATAR_VIEW_PACKET_SEND_INTERVAL_MSECS); // tell the avatarAudioTimer to start ticking QMetaObject::invokeMethod(&_avatarAudioTimer, "start"); @@ -572,9 +572,9 @@ void Agent::setIsAvatar(bool isAvatar) { delete _avatarIdentityTimer; _avatarIdentityTimer = nullptr; - _avatarViewTimer->stop(); - delete _avatarViewTimer; - _avatarViewTimer = nullptr; + _avatarQueryTimer->stop(); + delete _avatarQueryTimer; + _avatarQueryTimer = nullptr; // The avatar mixer never times out a connection (e.g., based on identity or data packets) // but rather keeps avatars in its list as long as "connected". As a result, clients timeout @@ -607,7 +607,7 @@ void Agent::sendAvatarIdentityPacket() { } } -void Agent::sendAvatarViewFrustum() { +void Agent::queryAvatars() { auto scriptedAvatar = DependencyManager::get(); ViewFrustum view; diff --git a/assignment-client/src/Agent.h b/assignment-client/src/Agent.h index d144f0bc01..0cdc9e0029 100644 --- a/assignment-client/src/Agent.h +++ b/assignment-client/src/Agent.h @@ -97,7 +97,7 @@ private: void setAvatarSound(SharedSoundPointer avatarSound) { _avatarSound = avatarSound; } void sendAvatarIdentityPacket(); - void sendAvatarViewFrustum(); + void queryAvatars(); QString _scriptContents; QTimer* _scriptRequestTimeout { nullptr }; @@ -107,7 +107,7 @@ private: int _numAvatarSoundSentBytes = 0; bool _isAvatar = false; QTimer* _avatarIdentityTimer = nullptr; - QTimer* _avatarViewTimer = nullptr; + QTimer* _avatarQueryTimer = nullptr; QHash _outgoingScriptAudioSequenceNumbers; AudioGate _audioGate; diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d14af685f0..f9d048b6ac 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5682,7 +5682,7 @@ void Application::update(float deltaTime) { if (DependencyManager::get()->shouldRenderEntities()) { queryOctree(NodeType::EntityServer, PacketType::EntityQuery); } - sendAvatarViewFrustum(); + queryAvatars(); _lastQueriedViews = _conicalViews; _lastQueriedTime = now; @@ -5857,7 +5857,7 @@ void Application::update(float deltaTime) { } } -void Application::sendAvatarViewFrustum() { +void Application::queryAvatars() { auto avatarPacket = NLPacket::create(PacketType::AvatarQuery); auto destinationBuffer = reinterpret_cast(avatarPacket->getPayload()); unsigned char* bufferStart = destinationBuffer; diff --git a/interface/src/Application.h b/interface/src/Application.h index 6d749f9458..4a9c293237 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -492,9 +492,9 @@ private: void updateDialogs(float deltaTime) const; void queryOctree(NodeType_t serverType, PacketType packetType); + void queryAvatars(); int sendNackPackets(); - void sendAvatarViewFrustum(); std::shared_ptr getMyAvatar() const; From 487a63025f0681d52f032e85fd4530468392d6e0 Mon Sep 17 00:00:00 2001 From: Clement Date: Tue, 1 May 2018 19:11:00 -0700 Subject: [PATCH 22/30] Fix warning --- assignment-client/src/avatars/AvatarMixerClientData.cpp | 2 +- assignment-client/src/avatars/AvatarMixerClientData.h | 2 +- interface/src/Application.cpp | 2 +- libraries/octree/src/OctreeQuery.cpp | 2 +- tests/render-perf/src/main.cpp | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assignment-client/src/avatars/AvatarMixerClientData.cpp b/assignment-client/src/avatars/AvatarMixerClientData.cpp index aa93fc9e08..d5a8b37742 100644 --- a/assignment-client/src/avatars/AvatarMixerClientData.cpp +++ b/assignment-client/src/avatars/AvatarMixerClientData.cpp @@ -126,7 +126,7 @@ void AvatarMixerClientData::removeFromRadiusIgnoringSet(SharedNodePointer self, } } -void AvatarMixerClientData::readViewFrustumPacket(QByteArray message) { +void AvatarMixerClientData::readViewFrustumPacket(const QByteArray& message) { _currentViewFrustums.clear(); auto sourceBuffer = reinterpret_cast(message.constData()); diff --git a/assignment-client/src/avatars/AvatarMixerClientData.h b/assignment-client/src/avatars/AvatarMixerClientData.h index f3b2b587ee..e038e81505 100644 --- a/assignment-client/src/avatars/AvatarMixerClientData.h +++ b/assignment-client/src/avatars/AvatarMixerClientData.h @@ -98,7 +98,7 @@ public: void removeFromRadiusIgnoringSet(SharedNodePointer self, const QUuid& other); void ignoreOther(SharedNodePointer self, SharedNodePointer other); - void readViewFrustumPacket(QByteArray message); + void readViewFrustumPacket(const QByteArray& message); bool otherAvatarInView(const AABox& otherAvatarBox); diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f9d048b6ac..d3c75219c5 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5862,7 +5862,7 @@ void Application::queryAvatars() { auto destinationBuffer = reinterpret_cast(avatarPacket->getPayload()); unsigned char* bufferStart = destinationBuffer; - uint8_t numFrustums = _conicalViews.size(); + uint8_t numFrustums = (uint8_t)_conicalViews.size(); memcpy(destinationBuffer, &numFrustums, sizeof(numFrustums)); destinationBuffer += sizeof(numFrustums); diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index 072774f0f5..3f730d4458 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -35,7 +35,7 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) { destinationBuffer += sizeof(_connectionID); // Number of frustums - uint8_t numFrustums = _conicalViews.size(); + uint8_t numFrustums = (uint8_t)_conicalViews.size(); memcpy(destinationBuffer, &numFrustums, sizeof(numFrustums)); destinationBuffer += sizeof(numFrustums); diff --git a/tests/render-perf/src/main.cpp b/tests/render-perf/src/main.cpp index 2e72d9cead..33aea6dcc9 100644 --- a/tests/render-perf/src/main.cpp +++ b/tests/render-perf/src/main.cpp @@ -443,8 +443,7 @@ protected: } const ConicalViewFrustums& getConicalViews() const override { - assert(false); - return ConicalViewFrustums(); + return _view; } QThread* getMainThread() override { @@ -1122,6 +1121,7 @@ private: graphics::LightPointer _globalLight { std::make_shared() }; bool _ready { false }; EntitySimulationPointer _entitySimulation; + ConicalViewFrustums _view; QStringList _commands; QString _commandPath; From ac0fe620869535d3f49d2cc7d443432db174a409 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 4 May 2018 10:41:52 -0700 Subject: [PATCH 23/30] Make ModelBaker ktx extension check case-insensitive --- libraries/baking/src/ModelBaker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/baking/src/ModelBaker.cpp b/libraries/baking/src/ModelBaker.cpp index ee26b94b81..ac332f4ceb 100644 --- a/libraries/baking/src/ModelBaker.cpp +++ b/libraries/baking/src/ModelBaker.cpp @@ -246,9 +246,9 @@ bool ModelBaker::compressMesh(FBXMesh& mesh, bool hasDeformers, FBXNode& dracoMe QString ModelBaker::compressTexture(QString modelTextureFileName, image::TextureUsage::Type textureType) { - QFileInfo modelTextureFileInfo{ modelTextureFileName.replace("\\", "/") }; + QFileInfo modelTextureFileInfo { modelTextureFileName.replace("\\", "/") }; - if (modelTextureFileInfo.suffix() == BAKED_TEXTURE_KTX_EXT.mid(1)) { + if (modelTextureFileInfo.suffix().toLower() == BAKED_TEXTURE_KTX_EXT.mid(1)) { // re-baking a model that already references baked textures // this is an error - return from here handleError("Cannot re-bake a file that already references compressed textures"); From fc3fd75100fdf0d6a147492b911e1b937e73e1e6 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 4 May 2018 10:42:19 -0700 Subject: [PATCH 24/30] Fix TextureMeta::deserialize not handling json parse errors --- libraries/ktx/src/TextureMeta.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/ktx/src/TextureMeta.cpp b/libraries/ktx/src/TextureMeta.cpp index 88235d8a4b..3a2abf24c4 100644 --- a/libraries/ktx/src/TextureMeta.cpp +++ b/libraries/ktx/src/TextureMeta.cpp @@ -11,6 +11,7 @@ #include "TextureMeta.h" +#include #include #include @@ -19,7 +20,12 @@ const QString TEXTURE_META_EXTENSION = ".texmeta.json"; bool TextureMeta::deserialize(const QByteArray& data, TextureMeta* meta) { QJsonParseError error; auto doc = QJsonDocument::fromJson(data, &error); + if (error.error != QJsonParseError::NoError) { + qDebug() << "Failed to parse TextureMeta:" << error.errorString(); + return false; + } if (!doc.isObject()) { + qDebug() << "Unable to process TextureMeta: top-level value is not an Object"; return false; } From e1d218bb57d11ed2b83003ab005dbc6fcb30f6b9 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 4 May 2018 11:25:11 -0700 Subject: [PATCH 25/30] Bump asset packet version for texture meta --- libraries/networking/src/udt/PacketHeaders.cpp | 3 +-- libraries/networking/src/udt/PacketHeaders.h | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index 98b0e1d892..9eae01cefa 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -59,11 +59,10 @@ PacketVersion versionForPacketType(PacketType packetType) { return 17; case PacketType::AssetMappingOperation: case PacketType::AssetMappingOperationReply: - return static_cast(AssetServerPacketVersion::RedirectedMappings); case PacketType::AssetGetInfo: case PacketType::AssetGet: case PacketType::AssetUpload: - return static_cast(AssetServerPacketVersion::RangeRequestSupport); + return static_cast(AssetServerPacketVersion::BakingTextureMeta); case PacketType::NodeIgnoreRequest: return 18; // Introduction of node ignore request (which replaced an unused packet tpye) diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index e6b133c158..20d98ca2d1 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -250,7 +250,8 @@ enum class EntityQueryPacketVersion: PacketVersion { enum class AssetServerPacketVersion: PacketVersion { VegasCongestionControl = 19, RangeRequestSupport, - RedirectedMappings + RedirectedMappings, + BakingTextureMeta }; enum class AvatarMixerPacketVersion : PacketVersion { From 53fe0bc616c36ebece838e0e00cf84575addfcf7 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 4 May 2018 14:08:21 -0700 Subject: [PATCH 26/30] MS14699: Prevent Wallet passcode from being sticky in certain cases --- .../qml/hifi/commerce/wallet/PassphraseModal.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/interface/resources/qml/hifi/commerce/wallet/PassphraseModal.qml b/interface/resources/qml/hifi/commerce/wallet/PassphraseModal.qml index 1cada9789b..c4abd40d2a 100644 --- a/interface/resources/qml/hifi/commerce/wallet/PassphraseModal.qml +++ b/interface/resources/qml/hifi/commerce/wallet/PassphraseModal.qml @@ -47,6 +47,13 @@ Item { onWalletAuthenticatedStatusResult: { submitPassphraseInputButton.enabled = true; + + // It's not possible to auth with a blank passphrase, + // so bail early if we get this signal without anything in the passphrase field + if (passphraseField.text === "") { + return; + } + if (!isAuthenticated) { errorText.text = "Authentication failed - please try again."; passphraseField.error = true; @@ -211,6 +218,10 @@ Item { error = false; focus = true; forceActiveFocus(); + } else { + showPassphrase.checked = false; + passphraseField.text = ""; + error = false; } } From b04c5bd0db04688dfa965fe3aa90d79ab2bbf1fa Mon Sep 17 00:00:00 2001 From: Clement Date: Fri, 4 May 2018 14:43:16 -0700 Subject: [PATCH 27/30] CR --- interface/src/Application.cpp | 16 ++++++++-------- interface/src/Application.h | 8 ++++++-- libraries/entities/src/EntityPriorityQueue.h | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d3c75219c5..0d8ab13a9f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -967,7 +967,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo _entitySimulation(new PhysicalEntitySimulation()), _physicsEngine(new PhysicsEngine(Vectors::ZERO)), _entityClipboard(new EntityTree()), - _lastQueriedTime(usecTimestampNow()), _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION), _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES), _hmdTabletScale("hmdTabletScale", DEFAULT_HMD_TABLET_SCALE_PERCENT), @@ -5084,7 +5083,7 @@ void Application::reloadResourceCaches() { resetPhysicsReadyInformation(); // Query the octree to refresh everything in view - _lastQueriedTime = 0; + _queryExpiry = SteadyClock::now(); _octreeQuery.incrementConnectionID(); queryOctree(NodeType::EntityServer, PacketType::EntityQuery); @@ -5660,9 +5659,6 @@ void Application::update(float deltaTime) { PROFILE_RANGE_EX(app, "QueryOctree", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount()); PerformanceTimer perfTimer("queryOctree"); QMutexLocker viewLocker(&_viewMutex); - quint64 sinceLastQuery = now - _lastQueriedTime; - const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND; - bool queryIsDue = sinceLastQuery > TOO_LONG_SINCE_LAST_QUERY; bool viewIsDifferentEnough = false; if (_conicalViews.size() == _lastQueriedViews.size()) { @@ -5678,14 +5674,16 @@ void Application::update(float deltaTime) { // if it's been a while since our last query or the view has significantly changed then send a query, otherwise suppress it - if (queryIsDue || viewIsDifferentEnough) { + static const std::chrono::seconds MIN_PERIOD_BETWEEN_QUERIES { 3 }; + auto now = SteadyClock::now(); + if (now > _queryExpiry || viewIsDifferentEnough) { if (DependencyManager::get()->shouldRenderEntities()) { queryOctree(NodeType::EntityServer, PacketType::EntityQuery); } queryAvatars(); _lastQueriedViews = _conicalViews; - _lastQueriedTime = now; + _queryExpiry = now + MIN_PERIOD_BETWEEN_QUERIES; } } @@ -6142,7 +6140,7 @@ void Application::nodeActivated(SharedNodePointer node) { // If we get a new EntityServer activated, reset lastQueried time // so we will do a proper query during update if (node->getType() == NodeType::EntityServer) { - _lastQueriedTime = 0; + _queryExpiry = SteadyClock::now(); _octreeQuery.incrementConnectionID(); } @@ -6151,6 +6149,8 @@ void Application::nodeActivated(SharedNodePointer node) { } if (node->getType() == NodeType::AvatarMixer) { + _queryExpiry = SteadyClock::now(); + // new avatar mixer, send off our identity packet on next update loop // Reset skeletonModelUrl if the last server modified our choice. // Override the avatar url (but not model name) here too. diff --git a/interface/src/Application.h b/interface/src/Application.h index 4a9c293237..654b5c797b 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -111,7 +111,8 @@ class Application : public QApplication, public AbstractViewStateInterface, public AbstractScriptingServicesInterface, public AbstractUriHandler, - public PluginContainer { + public PluginContainer +{ Q_OBJECT // TODO? Get rid of those @@ -579,7 +580,10 @@ private: ConicalViewFrustums _conicalViews; ConicalViewFrustums _lastQueriedViews; // last views used to query servers - quint64 _lastQueriedTime; + + using SteadyClock = std::chrono::steady_clock; + using TimePoint = SteadyClock::time_point; + TimePoint _queryExpiry; OctreeQuery _octreeQuery { true }; // NodeData derived class for querying octee cells from octree servers diff --git a/libraries/entities/src/EntityPriorityQueue.h b/libraries/entities/src/EntityPriorityQueue.h index 354cd70af3..339676d237 100644 --- a/libraries/entities/src/EntityPriorityQueue.h +++ b/libraries/entities/src/EntityPriorityQueue.h @@ -20,8 +20,8 @@ // PrioritizedEntity is a placeholder in a sorted queue. class PrioritizedEntity { public: - static constexpr float DO_NOT_SEND { -1.0e-6f }; - static constexpr float FORCE_REMOVE { -1.0e-5f }; + static constexpr float DO_NOT_SEND { -1.0e6f }; + static constexpr float FORCE_REMOVE { -1.0e5f }; static constexpr float WHEN_IN_DOUBT_PRIORITY { 1.0f }; PrioritizedEntity(EntityItemPointer entity, float priority, bool forceRemove = false) : _weakEntity(entity), _rawEntityPointer(entity.get()), _priority(priority), _forceRemove(forceRemove) {} From ad60a791803c41ddfac08aef31d7f0ed3c144d46 Mon Sep 17 00:00:00 2001 From: Clement Date: Fri, 4 May 2018 14:43:28 -0700 Subject: [PATCH 28/30] Fix for android builds --- interface/src/Application.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 0d8ab13a9f..0a76c8f475 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5226,9 +5226,8 @@ void Application::updateSecondaryCameraViewFrustum() { auto renderConfig = _renderEngine->getConfiguration(); assert(renderConfig); auto camera = dynamic_cast(renderConfig->getConfig("SecondaryCamera")); - assert(camera); - if (!camera->isEnabled()) { + if (!camera || !camera->isEnabled()) { return; } From da9fb9c751a20b8d915ed657c5056cb4fe030d37 Mon Sep 17 00:00:00 2001 From: Clement Date: Thu, 26 Apr 2018 14:27:45 -0700 Subject: [PATCH 29/30] Fix non self-sufficient headers --- assignment-client/src/AssignmentClient.cpp | 14 ++++---- .../src/AssignmentClientMonitor.cpp | 3 +- assignment-client/src/AssignmentDynamic.cpp | 4 +-- assignment-client/src/AssignmentFactory.cpp | 3 +- .../src/audio/AudioMixerSlavePool.cpp | 4 +-- .../src/audio/AvatarAudioStream.cpp | 3 +- assignment-client/src/avatars/AvatarMixer.cpp | 4 +-- .../src/avatars/AvatarMixerClientData.cpp | 4 +-- .../src/avatars/AvatarMixerSlave.cpp | 4 +-- .../src/avatars/AvatarMixerSlave.h | 2 ++ .../src/avatars/AvatarMixerSlavePool.cpp | 4 +-- .../src/avatars/ScriptableAvatar.cpp | 3 +- .../src/entities/EntityServer.cpp | 8 +++-- .../src/messages/MessagesMixer.cpp | 3 +- .../octree/OctreeInboundPacketProcessor.cpp | 3 +- .../src/octree/OctreeSendThread.cpp | 3 +- domain-server/src/DomainServerNodeData.cpp | 4 +-- domain-server/src/DomainServerNodeData.h | 1 + .../src/DomainServerWebSessionData.cpp | 4 +-- gvr-interface/src/Client.cpp | 6 ++-- gvr-interface/src/GVRInterface.cpp | 4 +-- gvr-interface/src/GVRMainWindow.cpp | 4 +-- gvr-interface/src/LoginDialog.cpp | 6 ++-- gvr-interface/src/RenderingClient.cpp | 4 +-- interface/src/AvatarBookmarks.cpp | 3 +- interface/src/Bookmarks.cpp | 4 +-- interface/src/DiscoverabilityManager.cpp | 6 ++-- interface/src/DiscoverabilityManager.h | 4 +++ interface/src/GLCanvas.cpp | 4 +-- interface/src/InterfaceDynamicFactory.cpp | 5 +-- interface/src/InterfaceParentFinder.cpp | 8 ++--- interface/src/LODManager.cpp | 4 +-- interface/src/LocationBookmarks.cpp | 6 ++-- interface/src/Menu.cpp | 4 +-- interface/src/ModelPackager.cpp | 4 +-- interface/src/ModelPackager.h | 2 ++ interface/src/ModelPropertiesDialog.cpp | 4 +-- interface/src/ModelSelector.cpp | 6 ++-- interface/src/SecondaryCamera.cpp | 13 +++++--- interface/src/SecondaryCamera.h | 2 ++ interface/src/SpeechRecognizer.cpp | 3 +- interface/src/SpeechRecognizer.mm | 4 +-- interface/src/UIUtil.cpp | 4 +-- interface/src/audio/AudioScope.cpp | 4 +-- interface/src/avatar/AvatarManager.cpp | 3 +- interface/src/commerce/Ledger.cpp | 9 ++++-- interface/src/commerce/Wallet.cpp | 32 +++++++++---------- interface/src/networking/CloseEventSender.cpp | 4 +-- .../src/octree/OctreePacketProcessor.cpp | 3 +- .../AccountServicesScriptingInterface.cpp | 4 +-- .../AccountServicesScriptingInterface.h | 2 ++ interface/src/scripting/AudioDevices.cpp | 5 ++- .../GooglePolyScriptingInterface.cpp | 4 +-- ...lessVoiceRecognitionScriptingInterface.cpp | 7 ++-- interface/src/ui/DomainConnectionDialog.cpp | 4 +-- interface/src/ui/HMDToolsDialog.cpp | 5 +-- interface/src/ui/LodToolsDialog.cpp | 3 +- interface/src/ui/ModelsBrowser.cpp | 4 +-- interface/src/ui/OctreeStatsDialog.cpp | 5 ++- interface/src/ui/OctreeStatsDialog.h | 3 +- interface/src/ui/OctreeStatsProvider.cpp | 6 ++-- interface/src/ui/OverlayConductor.cpp | 3 +- interface/src/ui/OverlayConductor.h | 6 ++-- interface/src/ui/Snapshot.cpp | 3 +- interface/src/ui/Snapshot.h | 1 + interface/src/ui/SnapshotAnimated.cpp | 3 +- interface/src/ui/SnapshotUploader.cpp | 5 ++- interface/src/ui/StandAloneJSConsole.cpp | 4 +-- interface/src/ui/TestingDialog.cpp | 4 +-- interface/src/ui/overlays/ModelOverlay.cpp | 3 +- libraries/animation/src/AnimClip.cpp | 3 +- libraries/animation/src/AnimExpression.cpp | 6 ++-- libraries/animation/src/AnimNode.cpp | 3 +- libraries/animation/src/AnimNodeLoader.cpp | 3 +- libraries/animation/src/AnimVariant.cpp | 5 +-- libraries/animation/src/AnimationObject.cpp | 3 +- libraries/audio-client/src/AudioClient.cpp | 4 +-- libraries/audio-client/src/AudioIOStats.cpp | 4 +-- libraries/audio/src/AudioFOA.cpp | 3 +- libraries/audio/src/AudioGate.cpp | 3 +- libraries/audio/src/AudioHRTF.cpp | 3 +- libraries/audio/src/AudioLimiter.cpp | 3 +- libraries/audio/src/AudioReverb.cpp | 4 +-- libraries/audio/src/AudioRingBuffer.cpp | 4 +-- libraries/audio/src/AudioSRC.cpp | 3 +- libraries/audio/src/InboundAudioStream.cpp | 3 +- libraries/audio/src/InjectedAudioStream.cpp | 3 +- libraries/audio/src/Sound.cpp | 4 +-- libraries/avatars/src/AvatarHashMap.cpp | 3 +- libraries/baking/src/Baker.cpp | 4 +-- libraries/baking/src/FBXBaker.cpp | 4 +-- libraries/baking/src/JSBaker.cpp | 3 +- libraries/baking/src/JSBaker.h | 2 ++ libraries/baking/src/OBJBaker.cpp | 3 +- libraries/baking/src/TextureBaker.cpp | 4 +-- libraries/baking/src/TextureBaker.h | 1 + .../src/controllers/DeviceProxy.cpp | 17 ---------- .../controllers/src/controllers/Pose.cpp | 4 +-- .../src/controllers/impl/Mapping.cpp | 15 --------- .../src/controllers/impl/Route.cpp | 15 --------- .../impl/conditionals/EndpointConditional.cpp | 15 --------- .../impl/endpoints/ArrayEndpoint.cpp | 15 --------- .../impl/endpoints/StandardEndpoint.cpp | 15 --------- .../impl/filters/ConstrainToIntegerFilter.cpp | 15 --------- .../ConstrainToPositiveIntegerFilter.cpp | 15 --------- .../controllers/impl/filters/InvertFilter.cpp | 15 --------- .../embedded-webserver/src/HTTPConnection.cpp | 4 +-- .../embedded-webserver/src/HTTPManager.cpp | 3 +- .../src/HTTPSConnection.cpp | 3 +- .../embedded-webserver/src/HTTPSManager.cpp | 4 +-- .../entities/src/DeleteEntityOperator.cpp | 4 +-- libraries/entities/src/DeleteEntityOperator.h | 6 ++++ .../entities/src/EntityDynamicInterface.cpp | 3 +- .../entities/src/EntityDynamicInterface.h | 5 ++- libraries/entities/src/EntityEditFilters.cpp | 2 +- .../entities/src/EntityEditPacketSender.cpp | 8 +++-- .../entities/src/EntityItemProperties.cpp | 16 ++++++---- libraries/entities/src/EntityItemProperties.h | 1 + libraries/entities/src/EntityTree.h | 6 ++-- libraries/entities/src/EntityTypes.cpp | 3 +- libraries/entities/src/HazePropertyGroup.cpp | 3 +- libraries/entities/src/LightEntityItem.cpp | 2 +- libraries/entities/src/ModelEntityItem.cpp | 6 ++-- .../entities/src/MovingEntitiesOperator.cpp | 4 +-- .../entities/src/MovingEntitiesOperator.h | 3 +- .../entities/src/ParticleEffectEntityItem.cpp | 3 +- libraries/entities/src/PolyLineEntityItem.cpp | 2 +- libraries/entities/src/ShapeEntityItem.cpp | 2 +- .../entities/src/SkyboxPropertyGroup.cpp | 3 +- libraries/entities/src/SkyboxPropertyGroup.h | 2 ++ libraries/entities/src/TextEntityItem.cpp | 2 +- libraries/entities/src/ZoneEntityItem.cpp | 2 +- libraries/fbx/src/FBXReader.cpp | 3 +- libraries/fbx/src/FSTReader.cpp | 4 +-- libraries/fbx/src/GLTFReader.cpp | 5 +-- .../src/graphics-scripting/ScriptableMesh.cpp | 16 ++++++---- .../graphics-scripting/ScriptableMeshPart.cpp | 15 +++++---- .../graphics-scripting/ScriptableModel.cpp | 5 ++- libraries/graphics/src/graphics/Haze.cpp | 3 +- libraries/networking/src/AddressManager.cpp | 3 +- libraries/networking/src/Assignment.cpp | 9 +++--- libraries/networking/src/AtpReply.cpp | 3 +- .../networking/src/BandwidthRecorder.cpp | 2 +- .../networking/src/DataServerAccountInfo.cpp | 3 +- libraries/networking/src/HifiSockAddr.cpp | 3 +- .../src/LocationScriptingInterface.cpp | 4 +-- .../networking/src/NetworkAccessManager.cpp | 3 +- libraries/networking/src/Node.cpp | 4 +-- libraries/networking/src/OAuthAccessToken.cpp | 4 +-- .../src/OAuthNetworkAccessManager.cpp | 4 +-- libraries/networking/src/PacketSender.cpp | 3 +- .../networking/src/RSAKeypairGenerator.cpp | 4 +-- .../src/ReceivedPacketProcessor.cpp | 3 +- .../networking/src/ReceivedPacketProcessor.h | 4 +++ .../networking/src/ThreadedAssignment.cpp | 4 +-- .../networking/src/UserActivityLogger.cpp | 7 ++-- .../networking/src/WalletTransaction.cpp | 5 ++- .../networking/src/udt/ConnectionStats.cpp | 3 +- libraries/octree/src/Octree.cpp | 3 +- .../octree/src/OctreeEditPacketSender.cpp | 3 +- libraries/octree/src/OctreeElement.cpp | 5 +-- libraries/octree/src/OctreePacketData.cpp | 3 +- libraries/octree/src/OctreePersistThread.cpp | 3 +- libraries/octree/src/OctreeProcessor.cpp | 5 +-- libraries/octree/src/OctreeSceneStats.cpp | 4 +-- .../octree/src/OctreeScriptingInterface.cpp | 4 +-- libraries/physics/src/EntityMotionState.cpp | 3 +- libraries/physics/src/MeshMassProperties.cpp | 4 +-- libraries/physics/src/ObjectAction.cpp | 4 +-- libraries/physics/src/ObjectActionOffset.cpp | 4 +-- libraries/physics/src/ObjectActionTractor.cpp | 4 +-- .../src/ObjectActionTravelOriented.cpp | 3 +- libraries/physics/src/ObjectConstraint.cpp | 4 +-- .../src/ObjectConstraintBallSocket.cpp | 3 +- .../physics/src/ObjectConstraintConeTwist.cpp | 3 +- .../physics/src/ObjectConstraintHinge.cpp | 3 +- .../physics/src/ObjectConstraintSlider.cpp | 3 +- libraries/physics/src/ObjectDynamic.cpp | 4 +-- libraries/physics/src/ObjectMotionState.cpp | 3 +- libraries/physics/src/PhysicsEngine.cpp | 4 +-- libraries/physics/src/ShapeFactory.cpp | 3 +- libraries/physics/src/ShapeManager.cpp | 5 +-- .../physics/src/ThreadSafeDynamicsWorld.cpp | 3 +- .../recording/src/recording/ClipCache.cpp | 3 +- .../src/AmbientOcclusionEffect.cpp | 7 ++-- .../render-utils/src/AntialiasingEffect.cpp | 2 +- libraries/render-utils/src/LightStage.cpp | 4 +-- .../render-utils/src/RenderPipelines.cpp | 6 ++-- libraries/render/src/render/DrawTask.cpp | 6 ++-- libraries/render/src/render/ShapePipeline.cpp | 7 ++-- .../script-engine/src/ArrayBufferClass.cpp | 4 +-- .../src/ArrayBufferPrototype.cpp | 3 +- libraries/script-engine/src/BatchLoader.cpp | 8 +++-- .../src/ConsoleScriptingInterface.cpp | 4 ++- libraries/script-engine/src/DataViewClass.cpp | 6 ++-- .../script-engine/src/DataViewPrototype.cpp | 5 +-- libraries/script-engine/src/EventTypes.cpp | 4 +-- libraries/script-engine/src/KeyEvent.cpp | 4 +-- libraries/script-engine/src/Mat4.cpp | 9 ++++-- .../script-engine/src/MenuItemProperties.cpp | 4 +-- libraries/script-engine/src/MouseEvent.cpp | 6 ++-- libraries/script-engine/src/MouseEvent.h | 5 ++- libraries/script-engine/src/Quat.cpp | 7 ++-- libraries/script-engine/src/Quat.h | 2 ++ .../script-engine/src/ScriptAudioInjector.cpp | 3 +- libraries/script-engine/src/ScriptEngine.cpp | 3 +- libraries/script-engine/src/ScriptUUID.cpp | 3 +- libraries/script-engine/src/ScriptUUID.h | 1 + libraries/script-engine/src/SpatialEvent.cpp | 6 ++-- libraries/script-engine/src/TouchEvent.cpp | 5 ++- libraries/script-engine/src/TouchEvent.h | 7 +++- .../script-engine/src/TypedArrayPrototype.cpp | 4 +-- libraries/script-engine/src/TypedArrays.cpp | 4 +-- .../src/UndoStackScriptingInterface.cpp | 4 +-- libraries/script-engine/src/Vec3.cpp | 7 ++-- .../script-engine/src/WebSocketClass.cpp | 3 +- .../src/WebSocketServerClass.cpp | 3 +- libraries/script-engine/src/WheelEvent.cpp | 8 ++--- libraries/script-engine/src/WheelEvent.h | 6 +++- .../script-engine/src/XMLHttpRequestClass.cpp | 3 +- libraries/shared/src/AACube.cpp | 3 +- libraries/shared/src/CubeProjectedPolygon.cpp | 4 +-- libraries/shared/src/GPUIdent.cpp | 6 ++-- libraries/shared/src/GPUIdent.h | 2 ++ libraries/shared/src/GenericThread.cpp | 5 ++- libraries/shared/src/Gzip.cpp | 3 +- libraries/shared/src/LogUtils.cpp | 4 +-- libraries/shared/src/OctalCode.cpp | 3 +- libraries/shared/src/PIDController.cpp | 9 ++++-- libraries/shared/src/PerfStat.cpp | 4 +-- libraries/shared/src/SimpleMovingAverage.cpp | 3 +- libraries/shared/src/StDev.cpp | 4 +-- libraries/shared/src/StreamUtils.cpp | 4 +-- libraries/shared/src/TriangleSet.cpp | 2 +- .../shared/src/VariantMapToScriptValue.cpp | 5 +-- libraries/shared/src/ViewFrustum.cpp | 6 ++-- libraries/shared/src/shared/StringHelpers.cpp | 4 +-- plugins/pcmCodec/src/PCMCodecManager.cpp | 4 +-- tests/jitter/src/JitterTests.cpp | 4 +-- tests/networking/src/ResourceTests.cpp | 4 +-- .../src/SequenceNumberStatsTests.cpp | 4 +-- tests/octree/src/AABoxCubeTests.cpp | 4 +-- tests/octree/src/ModelTests.cpp | 6 ++-- tests/octree/src/OctreeTests.cpp | 4 +-- tests/physics/src/ShapeInfoTests.cpp | 4 +-- tests/physics/src/ShapeManagerTests.cpp | 5 +-- tests/shared/src/AABoxTests.cpp | 4 +-- tests/shared/src/AACubeTests.cpp | 4 +-- tests/shared/src/DualQuaternionTests.cpp | 4 +-- tests/shared/src/GeometryUtilTests.cpp | 4 +-- tools/ac-client/src/ACClientApp.cpp | 5 +-- tools/atp-client/src/ATPClientApp.cpp | 4 +-- tools/ice-client/src/ICEClientApp.cpp | 5 +-- tools/oven/src/BakerCLI.cpp | 3 +- tools/oven/src/OvenCLIApplication.cpp | 4 +-- tools/oven/src/ui/BakeWidget.cpp | 4 +-- tools/oven/src/ui/DomainBakeWidget.cpp | 4 +-- tools/oven/src/ui/ModelBakeWidget.cpp | 3 +- tools/oven/src/ui/ModesWidget.cpp | 4 +-- tools/oven/src/ui/OvenMainWindow.cpp | 4 +-- tools/oven/src/ui/ResultsWindow.cpp | 4 +-- tools/oven/src/ui/SkyboxBakeWidget.cpp | 6 ++-- tools/vhacd-util/src/VHACDUtilApp.cpp | 5 ++- 263 files changed, 632 insertions(+), 603 deletions(-) delete mode 100644 libraries/controllers/src/controllers/DeviceProxy.cpp delete mode 100644 libraries/controllers/src/controllers/impl/Mapping.cpp delete mode 100644 libraries/controllers/src/controllers/impl/Route.cpp delete mode 100644 libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.cpp delete mode 100644 libraries/controllers/src/controllers/impl/endpoints/ArrayEndpoint.cpp delete mode 100644 libraries/controllers/src/controllers/impl/endpoints/StandardEndpoint.cpp delete mode 100644 libraries/controllers/src/controllers/impl/filters/ConstrainToIntegerFilter.cpp delete mode 100644 libraries/controllers/src/controllers/impl/filters/ConstrainToPositiveIntegerFilter.cpp delete mode 100644 libraries/controllers/src/controllers/impl/filters/InvertFilter.cpp diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index efced972a0..41e42aa0a1 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AssignmentClient.h" + #include #include @@ -32,16 +34,14 @@ #include #include #include - -#include "AssignmentFactory.h" -#include "AssignmentDynamicFactory.h" - -#include "AssignmentClient.h" -#include "AssignmentClientLogging.h" -#include "avatars/ScriptableAvatar.h" #include #include +#include "AssignmentClientLogging.h" +#include "AssignmentDynamicFactory.h" +#include "AssignmentFactory.h" +#include "avatars/ScriptableAvatar.h" + const QString ASSIGNMENT_CLIENT_TARGET_NAME = "assignment-client"; const long long ASSIGNMENT_REQUEST_INTERVAL_MSECS = 1 * 1000; diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp index 1868ccfafe..2847d4ebf1 100644 --- a/assignment-client/src/AssignmentClientMonitor.cpp +++ b/assignment-client/src/AssignmentClientMonitor.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AssignmentClientMonitor.h" + #include #include @@ -19,7 +21,6 @@ #include #include -#include "AssignmentClientMonitor.h" #include "AssignmentClientApp.h" #include "AssignmentClientChildData.h" #include "SharedUtil.h" diff --git a/assignment-client/src/AssignmentDynamic.cpp b/assignment-client/src/AssignmentDynamic.cpp index 7adbd55c39..447097ac74 100644 --- a/assignment-client/src/AssignmentDynamic.cpp +++ b/assignment-client/src/AssignmentDynamic.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "EntitySimulation.h" - #include "AssignmentDynamic.h" +#include "EntitySimulation.h" + AssignmentDynamic::AssignmentDynamic(EntityDynamicType type, const QUuid& id, EntityItemPointer ownerEntity) : EntityDynamicInterface(type, id), _data(QByteArray()), diff --git a/assignment-client/src/AssignmentFactory.cpp b/assignment-client/src/AssignmentFactory.cpp index 38eb72649f..405039d833 100644 --- a/assignment-client/src/AssignmentFactory.cpp +++ b/assignment-client/src/AssignmentFactory.cpp @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AssignmentFactory.h" + #include #include "Agent.h" #include "assets/AssetServer.h" -#include "AssignmentFactory.h" #include "audio/AudioMixer.h" #include "avatars/AvatarMixer.h" #include "entities/EntityServer.h" diff --git a/assignment-client/src/audio/AudioMixerSlavePool.cpp b/assignment-client/src/audio/AudioMixerSlavePool.cpp index e28c96e259..dfe7ef56aa 100644 --- a/assignment-client/src/audio/AudioMixerSlavePool.cpp +++ b/assignment-client/src/audio/AudioMixerSlavePool.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AudioMixerSlavePool.h" + #include #include -#include "AudioMixerSlavePool.h" - void AudioMixerSlaveThread::run() { while (true) { wait(); diff --git a/assignment-client/src/audio/AvatarAudioStream.cpp b/assignment-client/src/audio/AvatarAudioStream.cpp index 42495b4dd0..22ea8c0617 100644 --- a/assignment-client/src/audio/AvatarAudioStream.cpp +++ b/assignment-client/src/audio/AvatarAudioStream.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AvatarAudioStream.h" + #include #include "AudioLogging.h" -#include "AvatarAudioStream.h" AvatarAudioStream::AvatarAudioStream(bool isStereo, int numStaticJitterFrames) : PositionalAudioStream(PositionalAudioStream::Microphone, isStereo, numStaticJitterFrames) {} diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp index d74c76032d..9b5c4d4f30 100644 --- a/assignment-client/src/avatars/AvatarMixer.cpp +++ b/assignment-client/src/avatars/AvatarMixer.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AvatarMixer.h" + #include #include #include @@ -31,8 +33,6 @@ #include #include -#include "AvatarMixer.h" - const QString AVATAR_MIXER_LOGGING_NAME = "avatar-mixer"; // FIXME - what we'd actually like to do is send to users at ~50% of their present rate down to 30hz. Assume 90 for now. diff --git a/assignment-client/src/avatars/AvatarMixerClientData.cpp b/assignment-client/src/avatars/AvatarMixerClientData.cpp index d5a8b37742..e185fe9167 100644 --- a/assignment-client/src/avatars/AvatarMixerClientData.cpp +++ b/assignment-client/src/avatars/AvatarMixerClientData.cpp @@ -9,13 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AvatarMixerClientData.h" + #include #include #include -#include "AvatarMixerClientData.h" - AvatarMixerClientData::AvatarMixerClientData(const QUuid& nodeID) : NodeData(nodeID) { diff --git a/assignment-client/src/avatars/AvatarMixerSlave.cpp b/assignment-client/src/avatars/AvatarMixerSlave.cpp index 30d94ed772..984884adb2 100644 --- a/assignment-client/src/avatars/AvatarMixerSlave.cpp +++ b/assignment-client/src/avatars/AvatarMixerSlave.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AvatarMixerSlave.h" + #include #include @@ -28,10 +30,8 @@ #include #include - #include "AvatarMixer.h" #include "AvatarMixerClientData.h" -#include "AvatarMixerSlave.h" void AvatarMixerSlave::configure(ConstIter begin, ConstIter end) { _begin = begin; diff --git a/assignment-client/src/avatars/AvatarMixerSlave.h b/assignment-client/src/avatars/AvatarMixerSlave.h index bdddd5ceab..7be119c4b2 100644 --- a/assignment-client/src/avatars/AvatarMixerSlave.h +++ b/assignment-client/src/avatars/AvatarMixerSlave.h @@ -12,6 +12,8 @@ #ifndef hifi_AvatarMixerSlave_h #define hifi_AvatarMixerSlave_h +#include + class AvatarMixerClientData; class AvatarMixerSlaveStats { diff --git a/assignment-client/src/avatars/AvatarMixerSlavePool.cpp b/assignment-client/src/avatars/AvatarMixerSlavePool.cpp index 25b88686b7..962bba21d2 100644 --- a/assignment-client/src/avatars/AvatarMixerSlavePool.cpp +++ b/assignment-client/src/avatars/AvatarMixerSlavePool.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AvatarMixerSlavePool.h" + #include #include -#include "AvatarMixerSlavePool.h" - void AvatarMixerSlaveThread::run() { while (true) { wait(); diff --git a/assignment-client/src/avatars/ScriptableAvatar.cpp b/assignment-client/src/avatars/ScriptableAvatar.cpp index 1f3f770867..e7210db83a 100644 --- a/assignment-client/src/avatars/ScriptableAvatar.cpp +++ b/assignment-client/src/avatars/ScriptableAvatar.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ScriptableAvatar.h" + #include #include #include @@ -16,7 +18,6 @@ #include #include #include -#include "ScriptableAvatar.h" QByteArray ScriptableAvatar::toByteArrayStateful(AvatarDataDetail dataDetail, bool dropFaceTracking) { diff --git a/assignment-client/src/entities/EntityServer.cpp b/assignment-client/src/entities/EntityServer.cpp index 70fad03d67..c108dad6cf 100644 --- a/assignment-client/src/entities/EntityServer.cpp +++ b/assignment-client/src/entities/EntityServer.cpp @@ -9,21 +9,23 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "EntityServer.h" + #include #include +#include +#include + #include #include #include #include #include #include -#include -#include #include #include "AssignmentParentFinder.h" #include "EntityNodeData.h" -#include "EntityServer.h" #include "EntityServerConsts.h" #include "EntityTreeSendThread.h" diff --git a/assignment-client/src/messages/MessagesMixer.cpp b/assignment-client/src/messages/MessagesMixer.cpp index 4bf708cf34..c11c8f40a0 100644 --- a/assignment-client/src/messages/MessagesMixer.cpp +++ b/assignment-client/src/messages/MessagesMixer.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "MessagesMixer.h" + #include #include #include @@ -16,7 +18,6 @@ #include #include #include -#include "MessagesMixer.h" const QString MESSAGES_MIXER_LOGGING_NAME = "messages-mixer"; diff --git a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp index bce6e7fe44..ef532bb33f 100644 --- a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp +++ b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreeInboundPacketProcessor.h" + #include #include @@ -17,7 +19,6 @@ #include "OctreeServer.h" #include "OctreeServerConsts.h" -#include "OctreeInboundPacketProcessor.h" static QUuid DEFAULT_NODE_ID_REF; const quint64 TOO_LONG_SINCE_LAST_NACK = 1 * USECS_PER_SECOND; diff --git a/assignment-client/src/octree/OctreeSendThread.cpp b/assignment-client/src/octree/OctreeSendThread.cpp index 482b20272a..e9aa44b970 100644 --- a/assignment-client/src/octree/OctreeSendThread.cpp +++ b/assignment-client/src/octree/OctreeSendThread.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreeSendThread.h" + #include #include @@ -17,7 +19,6 @@ #include #include -#include "OctreeSendThread.h" #include "OctreeServer.h" #include "OctreeServerConsts.h" #include "OctreeLogging.h" diff --git a/domain-server/src/DomainServerNodeData.cpp b/domain-server/src/DomainServerNodeData.cpp index 974d4a59c3..486b51f9eb 100644 --- a/domain-server/src/DomainServerNodeData.cpp +++ b/domain-server/src/DomainServerNodeData.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "DomainServerNodeData.h" + #include #include #include @@ -17,8 +19,6 @@ #include -#include "DomainServerNodeData.h" - DomainServerNodeData::StringPairHash DomainServerNodeData::_overrideHash; DomainServerNodeData::DomainServerNodeData() { diff --git a/domain-server/src/DomainServerNodeData.h b/domain-server/src/DomainServerNodeData.h index db41c77cf2..6b8e9a1718 100644 --- a/domain-server/src/DomainServerNodeData.h +++ b/domain-server/src/DomainServerNodeData.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include diff --git a/domain-server/src/DomainServerWebSessionData.cpp b/domain-server/src/DomainServerWebSessionData.cpp index 3744af77f3..90eea17bec 100644 --- a/domain-server/src/DomainServerWebSessionData.cpp +++ b/domain-server/src/DomainServerWebSessionData.cpp @@ -9,13 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "DomainServerWebSessionData.h" + #include #include #include #include -#include "DomainServerWebSessionData.h" - DomainServerWebSessionData::DomainServerWebSessionData() : _username(), _roles() diff --git a/gvr-interface/src/Client.cpp b/gvr-interface/src/Client.cpp index 65238ad784..8f064c7fd5 100644 --- a/gvr-interface/src/Client.cpp +++ b/gvr-interface/src/Client.cpp @@ -9,14 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Client.h" + #include #include #include #include #include -#include "Client.h" - Client::Client(QObject* parent) : QObject(parent) { @@ -70,4 +70,4 @@ void Client::processDatagrams() { processVerifiedPacket(senderSockAddr, incomingPacket); } } -} \ No newline at end of file +} diff --git a/gvr-interface/src/GVRInterface.cpp b/gvr-interface/src/GVRInterface.cpp index 3d58396322..f9a29d4ac4 100644 --- a/gvr-interface/src/GVRInterface.cpp +++ b/gvr-interface/src/GVRInterface.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "GVRInterface.h" + #ifdef ANDROID #include @@ -32,8 +34,6 @@ #include "GVRMainWindow.h" #include "RenderingClient.h" -#include "GVRInterface.h" - static QString launchURLString = QString(); #ifdef ANDROID diff --git a/gvr-interface/src/GVRMainWindow.cpp b/gvr-interface/src/GVRMainWindow.cpp index 7a36aba66e..5495354233 100644 --- a/gvr-interface/src/GVRMainWindow.cpp +++ b/gvr-interface/src/GVRMainWindow.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "GVRMainWindow.h" + #include #include #include @@ -37,8 +39,6 @@ const float LIBOVR_LONG_PRESS_DURATION = 0.75f; #include "LoginDialog.h" #include "RenderingClient.h" -#include "GVRMainWindow.h" - GVRMainWindow::GVRMainWindow(QWidget* parent) : diff --git a/gvr-interface/src/LoginDialog.cpp b/gvr-interface/src/LoginDialog.cpp index 95b7451bcb..d4efd425bd 100644 --- a/gvr-interface/src/LoginDialog.cpp +++ b/gvr-interface/src/LoginDialog.cpp @@ -9,14 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "LoginDialog.h" + #include #include #include #include #include -#include "LoginDialog.h" - LoginDialog::LoginDialog(QWidget* parent) : QDialog(parent) { @@ -66,4 +66,4 @@ void LoginDialog::setupGUI() { void LoginDialog::loginButtonClicked() { emit credentialsEntered(_usernameLineEdit->text(), _passwordLineEdit->text()); close(); -} \ No newline at end of file +} diff --git a/gvr-interface/src/RenderingClient.cpp b/gvr-interface/src/RenderingClient.cpp index f04be5cb7f..4c691a48e6 100644 --- a/gvr-interface/src/RenderingClient.cpp +++ b/gvr-interface/src/RenderingClient.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "RenderingClient.h" + #include #include @@ -17,8 +19,6 @@ #include #include -#include "RenderingClient.h" - RenderingClient* RenderingClient::_instance = NULL; RenderingClient::RenderingClient(QObject *parent, const QString& launchURLString) : diff --git a/interface/src/AvatarBookmarks.cpp b/interface/src/AvatarBookmarks.cpp index 7845158a80..8e15de673f 100644 --- a/interface/src/AvatarBookmarks.cpp +++ b/interface/src/AvatarBookmarks.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AvatarBookmarks.h" + #include #include #include @@ -27,7 +29,6 @@ #include "MainWindow.h" #include "Menu.h" -#include "AvatarBookmarks.h" #include "InterfaceLogging.h" #include "QVariantGLM.h" diff --git a/interface/src/Bookmarks.cpp b/interface/src/Bookmarks.cpp index f48b5e1f5b..6e99b81e50 100644 --- a/interface/src/Bookmarks.cpp +++ b/interface/src/Bookmarks.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Bookmarks.h" + #include #include #include @@ -22,8 +24,6 @@ #include "Menu.h" #include "InterfaceLogging.h" -#include "Bookmarks.h" - Bookmarks::Bookmarks() : _isMenuSorted(false) { diff --git a/interface/src/DiscoverabilityManager.cpp b/interface/src/DiscoverabilityManager.cpp index b3c059de7f..684539145e 100644 --- a/interface/src/DiscoverabilityManager.cpp +++ b/interface/src/DiscoverabilityManager.cpp @@ -9,7 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "DiscoverabilityManager.h" + #include +#include #include #include @@ -21,11 +24,8 @@ #include #include "Crashpad.h" -#include "DiscoverabilityManager.h" #include "Menu.h" -#include - const Discoverability::Mode DEFAULT_DISCOVERABILITY_MODE = Discoverability::Connections; DiscoverabilityManager::DiscoverabilityManager() : diff --git a/interface/src/DiscoverabilityManager.h b/interface/src/DiscoverabilityManager.h index 96190b25d9..0c62ad5663 100644 --- a/interface/src/DiscoverabilityManager.h +++ b/interface/src/DiscoverabilityManager.h @@ -12,9 +12,13 @@ #ifndef hifi_DiscoverabilityManager_h #define hifi_DiscoverabilityManager_h +#include + #include #include +class QNetworkReply; + namespace Discoverability { enum Mode { None, diff --git a/interface/src/GLCanvas.cpp b/interface/src/GLCanvas.cpp index ec96f7c5d4..0d087c9b48 100644 --- a/interface/src/GLCanvas.cpp +++ b/interface/src/GLCanvas.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -// FIXME ordering of headers -#include "Application.h" #include "GLCanvas.h" +#include "Application.h" + bool GLCanvas::event(QEvent* event) { if (QEvent::Paint == event->type() && qApp->isAboutToQuit()) { return true; diff --git a/interface/src/InterfaceDynamicFactory.cpp b/interface/src/InterfaceDynamicFactory.cpp index b7861b56c8..e0d912b252 100644 --- a/interface/src/InterfaceDynamicFactory.cpp +++ b/interface/src/InterfaceDynamicFactory.cpp @@ -9,7 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - +#include "InterfaceDynamicFactory.h" #include #include @@ -22,9 +22,6 @@ #include #include -#include "InterfaceDynamicFactory.h" - - EntityDynamicPointer interfaceDynamicFactory(EntityDynamicType type, const QUuid& id, EntityItemPointer ownerEntity) { switch (type) { case DYNAMIC_TYPE_NONE: diff --git a/interface/src/InterfaceParentFinder.cpp b/interface/src/InterfaceParentFinder.cpp index 14088bc716..b9be58f04b 100644 --- a/interface/src/InterfaceParentFinder.cpp +++ b/interface/src/InterfaceParentFinder.cpp @@ -9,13 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "InterfaceParentFinder.h" + #include +#include +#include #include #include -#include -#include - -#include "InterfaceParentFinder.h" SpatiallyNestableWeakPointer InterfaceParentFinder::find(QUuid parentID, bool& success, SpatialParentTree* entityTree) const { SpatiallyNestableWeakPointer parent; diff --git a/interface/src/LODManager.cpp b/interface/src/LODManager.cpp index d7d73e962a..d06ba14bcf 100644 --- a/interface/src/LODManager.cpp +++ b/interface/src/LODManager.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "LODManager.h" + #include #include #include @@ -17,8 +19,6 @@ #include "ui/DialogsManager.h" #include "InterfaceLogging.h" -#include "LODManager.h" - Setting::Handle desktopLODDecreaseFPS("desktopLODDecreaseFPS", DEFAULT_DESKTOP_LOD_DOWN_FPS); Setting::Handle hmdLODDecreaseFPS("hmdLODDecreaseFPS", DEFAULT_HMD_LOD_DOWN_FPS); diff --git a/interface/src/LocationBookmarks.cpp b/interface/src/LocationBookmarks.cpp index 285f533a7f..f29a8f18f9 100644 --- a/interface/src/LocationBookmarks.cpp +++ b/interface/src/LocationBookmarks.cpp @@ -9,10 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "LocationBookmarks.h" + #include #include #include #include +#include #include #include @@ -21,9 +24,6 @@ #include "MainWindow.h" #include "Menu.h" -#include "LocationBookmarks.h" -#include - const QString LocationBookmarks::HOME_BOOKMARK = "Home"; LocationBookmarks::LocationBookmarks() { diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 60d5abf260..bf0fc05350 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Menu.h" + #include #include #include @@ -52,8 +54,6 @@ #include "SpeechRecognizer.h" #endif -#include "Menu.h" - extern bool DEV_DECIMATE_TEXTURES; Menu* Menu::getInstance() { diff --git a/interface/src/ModelPackager.cpp b/interface/src/ModelPackager.cpp index 0e34eebc80..3a5d92eb8c 100644 --- a/interface/src/ModelPackager.cpp +++ b/interface/src/ModelPackager.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ModelPackager.h" + #include #include #include @@ -21,8 +23,6 @@ #include "ModelPropertiesDialog.h" #include "InterfaceLogging.h" -#include "ModelPackager.h" - static const int MAX_TEXTURE_SIZE = 1024; void copyDirectoryContent(QDir& from, QDir& to) { diff --git a/interface/src/ModelPackager.h b/interface/src/ModelPackager.h index 60b3825c4d..acd4d85f68 100644 --- a/interface/src/ModelPackager.h +++ b/interface/src/ModelPackager.h @@ -17,6 +17,8 @@ #include "ui/ModelsBrowser.h" +class FBXGeometry; + class ModelPackager : public QObject { public: static bool package(); diff --git a/interface/src/ModelPropertiesDialog.cpp b/interface/src/ModelPropertiesDialog.cpp index 35b07aa2b2..8984f89d07 100644 --- a/interface/src/ModelPropertiesDialog.cpp +++ b/interface/src/ModelPropertiesDialog.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ModelPropertiesDialog.h" + #include #include #include @@ -23,8 +25,6 @@ #include #include -#include "ModelPropertiesDialog.h" - ModelPropertiesDialog::ModelPropertiesDialog(FSTReader::ModelType modelType, const QVariantHash& originalMapping, const QString& basePath, const FBXGeometry& geometry) : diff --git a/interface/src/ModelSelector.cpp b/interface/src/ModelSelector.cpp index 2f85849fbe..7d91359a11 100644 --- a/interface/src/ModelSelector.cpp +++ b/interface/src/ModelSelector.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ModelSelector.h" + #include #include #include @@ -16,8 +18,6 @@ #include #include -#include "ModelSelector.h" - static const QString AVATAR_HEAD_AND_BODY_STRING = "Avatar Body with Head"; static const QString AVATAR_ATTACHEMENT_STRING = "Avatar Attachment"; static const QString ENTITY_MODEL_STRING = "Entity Model"; @@ -82,4 +82,4 @@ void ModelSelector::browse() { _browseButton->setText(fileInfo.fileName()); lastModelBrowseLocation.set(fileInfo.path()); } -} \ No newline at end of file +} diff --git a/interface/src/SecondaryCamera.cpp b/interface/src/SecondaryCamera.cpp index a4bf0bcefe..acde535d2b 100644 --- a/interface/src/SecondaryCamera.cpp +++ b/interface/src/SecondaryCamera.cpp @@ -9,13 +9,16 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "Application.h" #include "SecondaryCamera.h" -#include -#include -#include + #include +#include +#include +#include + +#include "Application.h" + using RenderArgsPointer = std::shared_ptr; void MainRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred) { @@ -213,4 +216,4 @@ void SecondaryCameraRenderTask::build(JobModel& task, const render::Varying& inp task.addJob("RenderDeferredTask", items); } task.addJob("EndSecondaryCamera", cachedArg); -} \ No newline at end of file +} diff --git a/interface/src/SecondaryCamera.h b/interface/src/SecondaryCamera.h index 026b72d865..3d9e52617c 100644 --- a/interface/src/SecondaryCamera.h +++ b/interface/src/SecondaryCamera.h @@ -17,6 +17,8 @@ #include #include #include +#include +#include class MainRenderTask { public: diff --git a/interface/src/SpeechRecognizer.cpp b/interface/src/SpeechRecognizer.cpp index f5d0cb9e24..4815d20a83 100644 --- a/interface/src/SpeechRecognizer.cpp +++ b/interface/src/SpeechRecognizer.cpp @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "SpeechRecognizer.h" + #include #include #include "InterfaceLogging.h" -#include "SpeechRecognizer.h" #if defined(Q_OS_WIN) diff --git a/interface/src/SpeechRecognizer.mm b/interface/src/SpeechRecognizer.mm index 038bcce3e4..6b9da6f3e8 100644 --- a/interface/src/SpeechRecognizer.mm +++ b/interface/src/SpeechRecognizer.mm @@ -16,10 +16,10 @@ #import #import -#include - #include "SpeechRecognizer.h" +#include + @interface SpeechRecognizerDelegate : NSObject { SpeechRecognizer* _listener; } diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index 7b50975c92..a27bd6c5db 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "UIUtil.h" + #include #include -#include "UIUtil.h" - int UIUtil::getWindowTitleBarHeight(const QWidget* window) { QStyleOptionTitleBar options; options.titleBarState = 1; diff --git a/interface/src/audio/AudioScope.cpp b/interface/src/audio/AudioScope.cpp index 1a2e867d51..1750c00d37 100644 --- a/interface/src/audio/AudioScope.cpp +++ b/interface/src/audio/AudioScope.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AudioScope.h" + #include #include @@ -19,8 +21,6 @@ #include #include -#include "AudioScope.h" - static const unsigned int DEFAULT_FRAMES_PER_SCOPE = 5; static const unsigned int MULTIPLIER_SCOPE_HEIGHT = 20; static const unsigned int SCOPE_HEIGHT = 2 * 15 * MULTIPLIER_SCOPE_HEIGHT; diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index d24618fada..094b3bb67b 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AvatarManager.h" + #include #include @@ -38,7 +40,6 @@ #include #include "Application.h" -#include "AvatarManager.h" #include "InterfaceLogging.h" #include "Menu.h" #include "MyAvatar.h" diff --git a/interface/src/commerce/Ledger.cpp b/interface/src/commerce/Ledger.cpp index fde8c49933..f791ea25bc 100644 --- a/interface/src/commerce/Ledger.cpp +++ b/interface/src/commerce/Ledger.cpp @@ -9,16 +9,19 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Ledger.h" + #include #include #include #include -#include "Wallet.h" -#include "Ledger.h" -#include "CommerceLogging.h" + #include #include +#include "Wallet.h" +#include "CommerceLogging.h" + // inventory answers {status: 'success', data: {assets: [{id: "guid", title: "name", preview: "url"}....]}} // balance answers {status: 'success', data: {balance: integer}} // buy and receive_at answer {status: 'success'} diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index 35e6ca1c92..982adb4b5e 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -9,22 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "CommerceLogging.h" -#include "Ledger.h" #include "Wallet.h" -#include "Application.h" -#include "ui/SecurityImageProvider.h" -#include "scripting/HMDScriptingInterface.h" -#include - -#include -#include -#include - -#include -#include -#include -#include #include #include @@ -33,7 +18,6 @@ #include #include #include - // I know, right? But per https://www.openssl.org/docs/faq.html // this avoids OPENSSL_Uplink(00007FF847238000,08): no OPENSSL_Applink // at runtime. @@ -41,6 +25,22 @@ #include #endif +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "Application.h" +#include "CommerceLogging.h" +#include "Ledger.h" +#include "ui/SecurityImageProvider.h" +#include "scripting/HMDScriptingInterface.h" + static const char* KEY_FILE = "hifikey"; static const char* INSTRUCTIONS_FILE = "backup_instructions.html"; static const char* IMAGE_HEADER = "-----BEGIN SECURITY IMAGE-----\n"; diff --git a/interface/src/networking/CloseEventSender.cpp b/interface/src/networking/CloseEventSender.cpp index fe939afe05..16549d5510 100644 --- a/interface/src/networking/CloseEventSender.cpp +++ b/interface/src/networking/CloseEventSender.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "CloseEventSender.h" + #include #include #include @@ -22,8 +24,6 @@ #include #include -#include "CloseEventSender.h" - QNetworkRequest createNetworkRequest() { QNetworkRequest request; diff --git a/interface/src/octree/OctreePacketProcessor.cpp b/interface/src/octree/OctreePacketProcessor.cpp index 0c2883a9a4..7d38e29710 100644 --- a/interface/src/octree/OctreePacketProcessor.cpp +++ b/interface/src/octree/OctreePacketProcessor.cpp @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreePacketProcessor.h" + #include #include "Application.h" #include "Menu.h" -#include "OctreePacketProcessor.h" #include "SceneScriptingInterface.h" OctreePacketProcessor::OctreePacketProcessor() { diff --git a/interface/src/scripting/AccountServicesScriptingInterface.cpp b/interface/src/scripting/AccountServicesScriptingInterface.cpp index fc293098bb..3939fce91d 100644 --- a/interface/src/scripting/AccountServicesScriptingInterface.cpp +++ b/interface/src/scripting/AccountServicesScriptingInterface.cpp @@ -9,13 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AccountServicesScriptingInterface.h" + #include "AccountManager.h" #include "Application.h" #include "DiscoverabilityManager.h" #include "ResourceCache.h" -#include "AccountServicesScriptingInterface.h" - AccountServicesScriptingInterface::AccountServicesScriptingInterface() { auto accountManager = DependencyManager::get(); connect(accountManager.data(), &AccountManager::usernameChanged, this, &AccountServicesScriptingInterface::onUsernameChanged); diff --git a/interface/src/scripting/AccountServicesScriptingInterface.h b/interface/src/scripting/AccountServicesScriptingInterface.h index 5774ee1da5..fb3c329def 100644 --- a/interface/src/scripting/AccountServicesScriptingInterface.h +++ b/interface/src/scripting/AccountServicesScriptingInterface.h @@ -18,6 +18,8 @@ #include #include #include + +#include #include class DownloadInfoResult { diff --git a/interface/src/scripting/AudioDevices.cpp b/interface/src/scripting/AudioDevices.cpp index a3c80bf1b6..f08a0bf382 100644 --- a/interface/src/scripting/AudioDevices.cpp +++ b/interface/src/scripting/AudioDevices.cpp @@ -9,18 +9,17 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AudioDevices.h" + #include #include #include #include -#include "AudioDevices.h" - #include "Application.h" #include "AudioClient.h" #include "Audio.h" - #include "UserActivityLogger.h" using namespace scripting; diff --git a/interface/src/scripting/GooglePolyScriptingInterface.cpp b/interface/src/scripting/GooglePolyScriptingInterface.cpp index 8ed5d59d07..fde2676986 100644 --- a/interface/src/scripting/GooglePolyScriptingInterface.cpp +++ b/interface/src/scripting/GooglePolyScriptingInterface.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "GooglePolyScriptingInterface.h" + #include #include #include @@ -20,9 +22,7 @@ #include #include #include -#include -#include "GooglePolyScriptingInterface.h" #include "ScriptEngineLogging.h" const QString LIST_POLY_URL = "https://poly.googleapis.com/v1/assets?"; diff --git a/interface/src/scripting/LimitlessVoiceRecognitionScriptingInterface.cpp b/interface/src/scripting/LimitlessVoiceRecognitionScriptingInterface.cpp index ebb5ca9280..2692608106 100644 --- a/interface/src/scripting/LimitlessVoiceRecognitionScriptingInterface.cpp +++ b/interface/src/scripting/LimitlessVoiceRecognitionScriptingInterface.cpp @@ -9,13 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "LimitlessVoiceRecognitionScriptingInterface.h" + #include #include -#include -#include -#include "LimitlessVoiceRecognitionScriptingInterface.h" +#include "InterfaceLogging.h" +#include "ui/AvatarInputs.h" const float LimitlessVoiceRecognitionScriptingInterface::_audioLevelThreshold = 0.33f; const int LimitlessVoiceRecognitionScriptingInterface::_voiceTimeoutDuration = 2000; diff --git a/interface/src/ui/DomainConnectionDialog.cpp b/interface/src/ui/DomainConnectionDialog.cpp index c0471dc5e1..57a8d41257 100644 --- a/interface/src/ui/DomainConnectionDialog.cpp +++ b/interface/src/ui/DomainConnectionDialog.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "DomainConnectionDialog.h" + #include #include #include @@ -17,8 +19,6 @@ #include #include -#include "DomainConnectionDialog.h" - DomainConnectionDialog::DomainConnectionDialog(QWidget* parent) : QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint) { diff --git a/interface/src/ui/HMDToolsDialog.cpp b/interface/src/ui/HMDToolsDialog.cpp index 55c321723e..63794da60f 100644 --- a/interface/src/ui/HMDToolsDialog.cpp +++ b/interface/src/ui/HMDToolsDialog.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "HMDToolsDialog.h" + #include #include #include @@ -25,8 +27,7 @@ #include "Application.h" #include "MainWindow.h" #include "Menu.h" -#include "ui/DialogsManager.h" -#include "ui/HMDToolsDialog.h" +#include "DialogsManager.h" static const int WIDTH = 350; static const int HEIGHT = 100; diff --git a/interface/src/ui/LodToolsDialog.cpp b/interface/src/ui/LodToolsDialog.cpp index 34b68a123e..71e5293f30 100644 --- a/interface/src/ui/LodToolsDialog.cpp +++ b/interface/src/ui/LodToolsDialog.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "LodToolsDialog.h" + #include #include #include @@ -23,7 +25,6 @@ #include #include "Menu.h" -#include "ui/LodToolsDialog.h" LodToolsDialog::LodToolsDialog(QWidget* parent) : diff --git a/interface/src/ui/ModelsBrowser.cpp b/interface/src/ui/ModelsBrowser.cpp index 44089119c6..4709cc0a9c 100644 --- a/interface/src/ui/ModelsBrowser.cpp +++ b/interface/src/ui/ModelsBrowser.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ModelsBrowser.h" + #include #include #include @@ -27,8 +29,6 @@ #include #include -#include "ModelsBrowser.h" - const char* MODEL_TYPE_NAMES[] = { "entities", "heads", "skeletons", "skeletons", "attachments" }; static const QString S3_URL = "http://s3.amazonaws.com/hifi-public"; diff --git a/interface/src/ui/OctreeStatsDialog.cpp b/interface/src/ui/OctreeStatsDialog.cpp index ec5d800042..ea0f05f47f 100644 --- a/interface/src/ui/OctreeStatsDialog.cpp +++ b/interface/src/ui/OctreeStatsDialog.cpp @@ -9,20 +9,19 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreeStatsDialog.h" + #include #include #include - #include #include #include #include "Application.h" - #include "../octree/OctreePacketProcessor.h" -#include "ui/OctreeStatsDialog.h" OctreeStatsDialog::OctreeStatsDialog(QWidget* parent, NodeToOctreeSceneStats* model) : QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint), diff --git a/interface/src/ui/OctreeStatsDialog.h b/interface/src/ui/OctreeStatsDialog.h index 81bf5f251f..c05c8eadba 100644 --- a/interface/src/ui/OctreeStatsDialog.h +++ b/interface/src/ui/OctreeStatsDialog.h @@ -19,7 +19,6 @@ #include #define MAX_STATS 100 -#define DEFAULT_COLOR 0 class OctreeStatsDialog : public QDialog { Q_OBJECT @@ -42,7 +41,7 @@ protected: // Emits a 'closed' signal when this dialog is closed. void closeEvent(QCloseEvent*) override; - int AddStatItem(const char* caption, unsigned colorRGBA = DEFAULT_COLOR); + int AddStatItem(const char* caption, unsigned colorRGBA = 0); void RemoveStatItem(int item); void showAllOctreeServers(); diff --git a/interface/src/ui/OctreeStatsProvider.cpp b/interface/src/ui/OctreeStatsProvider.cpp index a393660c17..8917056be4 100644 --- a/interface/src/ui/OctreeStatsProvider.cpp +++ b/interface/src/ui/OctreeStatsProvider.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "Application.h" +#include "OctreeStatsProvider.h" -#include "../octree/OctreePacketProcessor.h" -#include "ui/OctreeStatsProvider.h" +#include "Application.h" +#include "octree/OctreePacketProcessor.h" OctreeStatsProvider::OctreeStatsProvider(QObject* parent, NodeToOctreeSceneStats* model) : QObject(parent), diff --git a/interface/src/ui/OverlayConductor.cpp b/interface/src/ui/OverlayConductor.cpp index ed8fa53fe2..e7e3c91d13 100644 --- a/interface/src/ui/OverlayConductor.cpp +++ b/interface/src/ui/OverlayConductor.cpp @@ -8,13 +8,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OverlayConductor.h" + #include #include #include "Application.h" #include "avatar/AvatarManager.h" #include "InterfaceLogging.h" -#include "OverlayConductor.h" OverlayConductor::OverlayConductor() { diff --git a/interface/src/ui/OverlayConductor.h b/interface/src/ui/OverlayConductor.h index 1bdfe2ed79..cdd596a7bc 100644 --- a/interface/src/ui/OverlayConductor.h +++ b/interface/src/ui/OverlayConductor.h @@ -11,6 +11,8 @@ #ifndef hifi_OverlayConductor_h #define hifi_OverlayConductor_h +#include + class OverlayConductor { public: OverlayConductor(); @@ -34,12 +36,12 @@ private: bool _hmdMode { false }; // used by updateAvatarHasDriveInput - quint64 _desiredDrivingTimer { 0 }; + uint64_t _desiredDrivingTimer { 0 }; bool _desiredDriving { false }; bool _currentDriving { false }; // used by updateAvatarIsAtRest - quint64 _desiredAtRestTimer { 0 }; + uint64_t _desiredAtRestTimer { 0 }; bool _desiredAtRest { true }; bool _currentAtRest { true }; }; diff --git a/interface/src/ui/Snapshot.cpp b/interface/src/ui/Snapshot.cpp index 69103a40b5..c6750ad424 100644 --- a/interface/src/ui/Snapshot.cpp +++ b/interface/src/ui/Snapshot.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Snapshot.h" + #include #include #include @@ -31,7 +33,6 @@ #include #include "Application.h" -#include "Snapshot.h" #include "SnapshotUploader.h" // filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg diff --git a/interface/src/ui/Snapshot.h b/interface/src/ui/Snapshot.h index 62d3ed3db8..93aaed8aa4 100644 --- a/interface/src/ui/Snapshot.h +++ b/interface/src/ui/Snapshot.h @@ -16,6 +16,7 @@ #include #include +#include #include #include diff --git a/interface/src/ui/SnapshotAnimated.cpp b/interface/src/ui/SnapshotAnimated.cpp index 3c00be8358..7866e742d9 100644 --- a/interface/src/ui/SnapshotAnimated.cpp +++ b/interface/src/ui/SnapshotAnimated.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "SnapshotAnimated.h" + #include #include #include @@ -16,7 +18,6 @@ #include #include -#include "SnapshotAnimated.h" QTimer* SnapshotAnimated::snapshotAnimatedTimer = NULL; qint64 SnapshotAnimated::snapshotAnimatedTimestamp = 0; diff --git a/interface/src/ui/SnapshotUploader.cpp b/interface/src/ui/SnapshotUploader.cpp index 37505db629..67902c1a35 100644 --- a/interface/src/ui/SnapshotUploader.cpp +++ b/interface/src/ui/SnapshotUploader.cpp @@ -9,11 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "SnapshotUploader.h" + #include #include + #include + #include "scripting/WindowScriptingInterface.h" -#include "SnapshotUploader.h" SnapshotUploader::SnapshotUploader(QUrl inWorldLocation, QString pathname) : _inWorldLocation(inWorldLocation), diff --git a/interface/src/ui/StandAloneJSConsole.cpp b/interface/src/ui/StandAloneJSConsole.cpp index 72b6ecc547..49cf22a9eb 100644 --- a/interface/src/ui/StandAloneJSConsole.cpp +++ b/interface/src/ui/StandAloneJSConsole.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "StandAloneJSConsole.h" + #include #include #include @@ -16,8 +18,6 @@ #include #include -#include "StandAloneJSConsole.h" - void StandAloneJSConsole::toggleConsole() { QMainWindow* mainWindow = qApp->getWindow(); if (!_jsConsole) { diff --git a/interface/src/ui/TestingDialog.cpp b/interface/src/ui/TestingDialog.cpp index 6f499f2a8d..6143f20ee6 100644 --- a/interface/src/ui/TestingDialog.cpp +++ b/interface/src/ui/TestingDialog.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "ScriptEngines.h" +#include "TestingDialog.h" -#include "ui/TestingDialog.h" #include "Application.h" +#include "ScriptEngines.h" TestingDialog::TestingDialog(QWidget* parent) : QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint), diff --git a/interface/src/ui/overlays/ModelOverlay.cpp b/interface/src/ui/overlays/ModelOverlay.cpp index 7edc03490c..27e3bd0e2d 100644 --- a/interface/src/ui/overlays/ModelOverlay.cpp +++ b/interface/src/ui/overlays/ModelOverlay.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ModelOverlay.h" + #include #include -#include "ModelOverlay.h" #include #include "Application.h" diff --git a/libraries/animation/src/AnimClip.cpp b/libraries/animation/src/AnimClip.cpp index 2ead4558fe..7d358e85cc 100644 --- a/libraries/animation/src/AnimClip.cpp +++ b/libraries/animation/src/AnimClip.cpp @@ -8,8 +8,9 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GLMHelpers.h" #include "AnimClip.h" + +#include "GLMHelpers.h" #include "AnimationLogging.h" #include "AnimUtil.h" diff --git a/libraries/animation/src/AnimExpression.cpp b/libraries/animation/src/AnimExpression.cpp index 9777e9c6af..ddcbd01220 100644 --- a/libraries/animation/src/AnimExpression.cpp +++ b/libraries/animation/src/AnimExpression.cpp @@ -8,10 +8,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include +#include "AnimExpression.h" + #include -#include "AnimExpression.h" +#include + #include "AnimationLogging.h" AnimExpression::AnimExpression(const QString& str) : diff --git a/libraries/animation/src/AnimNode.cpp b/libraries/animation/src/AnimNode.cpp index 80093e43db..ba8e095109 100644 --- a/libraries/animation/src/AnimNode.cpp +++ b/libraries/animation/src/AnimNode.cpp @@ -8,9 +8,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include #include "AnimNode.h" +#include + AnimNode::Pointer AnimNode::getParent() { return _parent.lock(); } diff --git a/libraries/animation/src/AnimNodeLoader.cpp b/libraries/animation/src/AnimNodeLoader.cpp index 8173845205..4169ff61a7 100644 --- a/libraries/animation/src/AnimNodeLoader.cpp +++ b/libraries/animation/src/AnimNodeLoader.cpp @@ -8,6 +8,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AnimNodeLoader.h" + #include #include #include @@ -19,7 +21,6 @@ #include "AnimBlendLinearMove.h" #include "AnimationLogging.h" #include "AnimOverlay.h" -#include "AnimNodeLoader.h" #include "AnimStateMachine.h" #include "AnimManipulator.h" #include "AnimInverseKinematics.h" diff --git a/libraries/animation/src/AnimVariant.cpp b/libraries/animation/src/AnimVariant.cpp index 832ab8678c..483a7999c9 100644 --- a/libraries/animation/src/AnimVariant.cpp +++ b/libraries/animation/src/AnimVariant.cpp @@ -1,5 +1,5 @@ // -// AnimVariantMap.cpp +// AnimVariant.cpp // library/animation // // Created by Howard Stearns on 10/15/15. @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AnimVariant.h" // which has AnimVariant/AnimVariantMap + #include #include #include #include -#include "AnimVariant.h" // which has AnimVariant/AnimVariantMap const AnimVariant AnimVariant::False = AnimVariant(); diff --git a/libraries/animation/src/AnimationObject.cpp b/libraries/animation/src/AnimationObject.cpp index 25a5743121..7f0f35b104 100644 --- a/libraries/animation/src/AnimationObject.cpp +++ b/libraries/animation/src/AnimationObject.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AnimationObject.h" + #include #include "AnimationCache.h" -#include "AnimationObject.h" QStringList AnimationObject::getJointNames() const { return qscriptvalue_cast(thisObject())->getJointNames(); diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index f643719a2e..a5f79290cd 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AudioClient.h" + #include #include #include @@ -50,8 +52,6 @@ #include "AudioLogging.h" #include "AudioHelpers.h" -#include "AudioClient.h" - const int AudioClient::MIN_BUFFER_FRAMES = 1; const int AudioClient::MAX_BUFFER_FRAMES = 20; diff --git a/libraries/audio-client/src/AudioIOStats.cpp b/libraries/audio-client/src/AudioIOStats.cpp index 3bd3f4a47d..1717ad1f9c 100644 --- a/libraries/audio-client/src/AudioIOStats.cpp +++ b/libraries/audio-client/src/AudioIOStats.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AudioIOStats.h" + #include #include #include @@ -16,8 +18,6 @@ #include "AudioClient.h" -#include "AudioIOStats.h" - // This is called 1x/sec (see AudioClient) and we want it to log the last 5s static const int INPUT_READS_WINDOW = 5; static const int INPUT_UNPLAYED_WINDOW = 5; diff --git a/libraries/audio/src/AudioFOA.cpp b/libraries/audio/src/AudioFOA.cpp index 718b29d1b2..16c0721047 100644 --- a/libraries/audio/src/AudioFOA.cpp +++ b/libraries/audio/src/AudioFOA.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AudioFOA.h" + #include #include -#include "AudioFOA.h" #include "AudioFOAData.h" #if defined(_MSC_VER) diff --git a/libraries/audio/src/AudioGate.cpp b/libraries/audio/src/AudioGate.cpp index 5ef5ee25b5..e9cdf832d2 100644 --- a/libraries/audio/src/AudioGate.cpp +++ b/libraries/audio/src/AudioGate.cpp @@ -6,12 +6,13 @@ // Copyright 2017 High Fidelity, Inc. // +#include "AudioGate.h" + #include #include #include #include "AudioDynamics.h" -#include "AudioGate.h" // log2 domain headroom bits above 0dB (int32_t) static const int LOG2_HEADROOM_Q30 = 1; diff --git a/libraries/audio/src/AudioHRTF.cpp b/libraries/audio/src/AudioHRTF.cpp index aa951210a6..c0751c6a20 100644 --- a/libraries/audio/src/AudioHRTF.cpp +++ b/libraries/audio/src/AudioHRTF.cpp @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AudioHRTF.h" + #include #include #include -#include "AudioHRTF.h" #include "AudioHRTFData.h" #if defined(_MSC_VER) diff --git a/libraries/audio/src/AudioLimiter.cpp b/libraries/audio/src/AudioLimiter.cpp index e20a070bd6..79bb84f7b1 100644 --- a/libraries/audio/src/AudioLimiter.cpp +++ b/libraries/audio/src/AudioLimiter.cpp @@ -6,10 +6,11 @@ // Copyright 2016 High Fidelity, Inc. // +#include "AudioLimiter.h" + #include #include "AudioDynamics.h" -#include "AudioLimiter.h" // // Limiter (common) diff --git a/libraries/audio/src/AudioReverb.cpp b/libraries/audio/src/AudioReverb.cpp index d457ce7a96..a7c6fefd39 100644 --- a/libraries/audio/src/AudioReverb.cpp +++ b/libraries/audio/src/AudioReverb.cpp @@ -6,12 +6,12 @@ // Copyright 2015 High Fidelity, Inc. // +#include "AudioReverb.h" + #include #include #include -#include "AudioReverb.h" - #ifdef _MSC_VER #include #define MULHI(a,b) ((int32_t)(__emul(a, b) >> 32)) diff --git a/libraries/audio/src/AudioRingBuffer.cpp b/libraries/audio/src/AudioRingBuffer.cpp index 518fdd3c17..d8531ec216 100644 --- a/libraries/audio/src/AudioRingBuffer.cpp +++ b/libraries/audio/src/AudioRingBuffer.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AudioRingBuffer.h" + #include #include #include @@ -21,8 +23,6 @@ #include "AudioLogging.h" -#include "AudioRingBuffer.h" - static const QString RING_BUFFER_OVERFLOW_DEBUG { "AudioRingBuffer::writeData has overflown the buffer. Overwriting old data." }; static const QString DROPPED_SILENT_DEBUG { "AudioRingBuffer::addSilentSamples dropping silent samples to prevent overflow." }; diff --git a/libraries/audio/src/AudioSRC.cpp b/libraries/audio/src/AudioSRC.cpp index fbdf890246..d488eccb6a 100644 --- a/libraries/audio/src/AudioSRC.cpp +++ b/libraries/audio/src/AudioSRC.cpp @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AudioSRC.h" + #include #include #include -#include "AudioSRC.h" #include "AudioSRCData.h" #ifndef MAX diff --git a/libraries/audio/src/InboundAudioStream.cpp b/libraries/audio/src/InboundAudioStream.cpp index d60c5ba4ab..7645a674e4 100644 --- a/libraries/audio/src/InboundAudioStream.cpp +++ b/libraries/audio/src/InboundAudioStream.cpp @@ -9,13 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "InboundAudioStream.h" + #include #include #include #include -#include "InboundAudioStream.h" #include "AudioLogging.h" const bool InboundAudioStream::DEFAULT_DYNAMIC_JITTER_BUFFER_ENABLED = true; diff --git a/libraries/audio/src/InjectedAudioStream.cpp b/libraries/audio/src/InjectedAudioStream.cpp index a06dba5389..2f357416f2 100644 --- a/libraries/audio/src/InjectedAudioStream.cpp +++ b/libraries/audio/src/InjectedAudioStream.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "InjectedAudioStream.h" + #include #include @@ -17,7 +19,6 @@ #include #include -#include "InjectedAudioStream.h" #include "AudioHelpers.h" InjectedAudioStream::InjectedAudioStream(const QUuid& streamIdentifier, bool isStereo, int numStaticJitterFrames) : diff --git a/libraries/audio/src/Sound.cpp b/libraries/audio/src/Sound.cpp index 672c0b69b3..cd93f7b52e 100644 --- a/libraries/audio/src/Sound.cpp +++ b/libraries/audio/src/Sound.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Sound.h" + #include #include @@ -29,8 +31,6 @@ #include "AudioLogging.h" #include "AudioSRC.h" -#include "Sound.h" - QScriptValue soundSharedPointerToScriptValue(QScriptEngine* engine, const SharedSoundPointer& in) { return engine->newQObject(new SoundScriptingInterface(in), QScriptEngine::ScriptOwnership); } diff --git a/libraries/avatars/src/AvatarHashMap.cpp b/libraries/avatars/src/AvatarHashMap.cpp index b564ad6a3b..829c98a418 100644 --- a/libraries/avatars/src/AvatarHashMap.cpp +++ b/libraries/avatars/src/AvatarHashMap.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AvatarHashMap.h" + #include #include @@ -17,7 +19,6 @@ #include #include "AvatarLogging.h" -#include "AvatarHashMap.h" AvatarHashMap::AvatarHashMap() { auto nodeList = DependencyManager::get(); diff --git a/libraries/baking/src/Baker.cpp b/libraries/baking/src/Baker.cpp index 2adedf08a1..78a34ac5e8 100644 --- a/libraries/baking/src/Baker.cpp +++ b/libraries/baking/src/Baker.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "ModelBakingLoggingCategory.h" - #include "Baker.h" +#include "ModelBakingLoggingCategory.h" + bool Baker::shouldStop() { if (_shouldAbort) { setWasAborted(true); diff --git a/libraries/baking/src/FBXBaker.cpp b/libraries/baking/src/FBXBaker.cpp index c8ba98f0b1..e3839bb95a 100644 --- a/libraries/baking/src/FBXBaker.cpp +++ b/libraries/baking/src/FBXBaker.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "FBXBaker.h" + #include // need this include so we don't get an error looking for std::isnan #include @@ -31,8 +33,6 @@ #include "ModelBakingLoggingCategory.h" #include "TextureBaker.h" -#include "FBXBaker.h" - void FBXBaker::bake() { qDebug() << "FBXBaker" << _modelURL << "bake starting"; diff --git a/libraries/baking/src/JSBaker.cpp b/libraries/baking/src/JSBaker.cpp index 9932ad633e..b19336f4ca 100644 --- a/libraries/baking/src/JSBaker.cpp +++ b/libraries/baking/src/JSBaker.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "JSBaker.h" + #include -#include "JSBaker.h" #include "Baker.h" const int ASCII_CHARACTERS_UPPER_LIMIT = 126; diff --git a/libraries/baking/src/JSBaker.h b/libraries/baking/src/JSBaker.h index b5889440cb..a7c3e62174 100644 --- a/libraries/baking/src/JSBaker.h +++ b/libraries/baking/src/JSBaker.h @@ -12,6 +12,8 @@ #ifndef hifi_JSBaker_h #define hifi_JSBaker_h +#include + #include "Baker.h" #include "JSBakingLoggingCategory.h" diff --git a/libraries/baking/src/OBJBaker.cpp b/libraries/baking/src/OBJBaker.cpp index 1fe53f26eb..cf62bc4fa8 100644 --- a/libraries/baking/src/OBJBaker.cpp +++ b/libraries/baking/src/OBJBaker.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OBJBaker.h" + #include #include -#include "OBJBaker.h" #include "OBJReader.h" #include "FBXWriter.h" diff --git a/libraries/baking/src/TextureBaker.cpp b/libraries/baking/src/TextureBaker.cpp index 45895494a0..b6957a2712 100644 --- a/libraries/baking/src/TextureBaker.cpp +++ b/libraries/baking/src/TextureBaker.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "TextureBaker.h" + #include #include #include @@ -22,8 +24,6 @@ #include "ModelBakingLoggingCategory.h" -#include "TextureBaker.h" - const QString BAKED_TEXTURE_KTX_EXT = ".ktx"; const QString BAKED_TEXTURE_BCN_SUFFIX = "_bcn.ktx"; const QString BAKED_META_TEXTURE_SUFFIX = ".texmeta.json"; diff --git a/libraries/baking/src/TextureBaker.h b/libraries/baking/src/TextureBaker.h index 93b01080cd..54839c001a 100644 --- a/libraries/baking/src/TextureBaker.h +++ b/libraries/baking/src/TextureBaker.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include diff --git a/libraries/controllers/src/controllers/DeviceProxy.cpp b/libraries/controllers/src/controllers/DeviceProxy.cpp deleted file mode 100644 index f03354c52d..0000000000 --- a/libraries/controllers/src/controllers/DeviceProxy.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// -// Created by Bradley Austin Davis on 2015/10/18 -// (based on UserInputMapper inner class created by Sam Gateau on 4/27/15) -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "DeviceProxy.h" - diff --git a/libraries/controllers/src/controllers/Pose.cpp b/libraries/controllers/src/controllers/Pose.cpp index 6f0296c09d..967838ef84 100644 --- a/libraries/controllers/src/controllers/Pose.cpp +++ b/libraries/controllers/src/controllers/Pose.cpp @@ -6,13 +6,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Pose.h" + #include #include #include -#include "Pose.h" - namespace controller { Pose::Pose(const vec3& translation, const quat& rotation, diff --git a/libraries/controllers/src/controllers/impl/Mapping.cpp b/libraries/controllers/src/controllers/impl/Mapping.cpp deleted file mode 100644 index dd8e1c1d48..0000000000 --- a/libraries/controllers/src/controllers/impl/Mapping.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Bradley Austin Davis 2015/10/09 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "Mapping.h" diff --git a/libraries/controllers/src/controllers/impl/Route.cpp b/libraries/controllers/src/controllers/impl/Route.cpp deleted file mode 100644 index c74f809195..0000000000 --- a/libraries/controllers/src/controllers/impl/Route.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Bradley Austin Davis 2015/10/09 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "Route.h" diff --git a/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.cpp b/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.cpp deleted file mode 100644 index f833eedb60..0000000000 --- a/libraries/controllers/src/controllers/impl/conditionals/EndpointConditional.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Bradley Austin Davis 2015/10/23 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "EndpointConditional.h" \ No newline at end of file diff --git a/libraries/controllers/src/controllers/impl/endpoints/ArrayEndpoint.cpp b/libraries/controllers/src/controllers/impl/endpoints/ArrayEndpoint.cpp deleted file mode 100644 index 5dea1de34e..0000000000 --- a/libraries/controllers/src/controllers/impl/endpoints/ArrayEndpoint.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Bradley Austin Davis 2015/10/23 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "ArrayEndpoint.h" \ No newline at end of file diff --git a/libraries/controllers/src/controllers/impl/endpoints/StandardEndpoint.cpp b/libraries/controllers/src/controllers/impl/endpoints/StandardEndpoint.cpp deleted file mode 100644 index 89bbe5d777..0000000000 --- a/libraries/controllers/src/controllers/impl/endpoints/StandardEndpoint.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Bradley Austin Davis 2015/10/23 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "StandardEndpoint.h" \ No newline at end of file diff --git a/libraries/controllers/src/controllers/impl/filters/ConstrainToIntegerFilter.cpp b/libraries/controllers/src/controllers/impl/filters/ConstrainToIntegerFilter.cpp deleted file mode 100644 index 8bd3d2db89..0000000000 --- a/libraries/controllers/src/controllers/impl/filters/ConstrainToIntegerFilter.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Bradley Austin Davis 2015/10/25 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "ConstrainToIntegerFilter.h" diff --git a/libraries/controllers/src/controllers/impl/filters/ConstrainToPositiveIntegerFilter.cpp b/libraries/controllers/src/controllers/impl/filters/ConstrainToPositiveIntegerFilter.cpp deleted file mode 100644 index f1abc8cecd..0000000000 --- a/libraries/controllers/src/controllers/impl/filters/ConstrainToPositiveIntegerFilter.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Bradley Austin Davis 2015/10/25 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "ConstrainToPositiveIntegerFilter.h" diff --git a/libraries/controllers/src/controllers/impl/filters/InvertFilter.cpp b/libraries/controllers/src/controllers/impl/filters/InvertFilter.cpp deleted file mode 100644 index 5407c6dd1d..0000000000 --- a/libraries/controllers/src/controllers/impl/filters/InvertFilter.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created by Bradley Austin Davis 2015/10/25 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// NOTE: we don't need to include this header unless/until we add additional symbols. -// By removing this header we prevent these warnings on windows: -// -// warning LNK4221: This object file does not define any previously undefined public symbols, -// so it will not be used by any link operation that consumes this library -// -//#include "InvertFilter.h" diff --git a/libraries/embedded-webserver/src/HTTPConnection.cpp b/libraries/embedded-webserver/src/HTTPConnection.cpp index 280b44cec0..12da599575 100644 --- a/libraries/embedded-webserver/src/HTTPConnection.cpp +++ b/libraries/embedded-webserver/src/HTTPConnection.cpp @@ -9,15 +9,15 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "HTTPConnection.h" #include #include #include +#include -#include "HTTPConnection.h" #include "EmbeddedWebserverLogging.h" #include "HTTPManager.h" -#include const char* HTTPConnection::StatusCode200 = "200 OK"; const char* HTTPConnection::StatusCode301 = "301 Moved Permanently"; diff --git a/libraries/embedded-webserver/src/HTTPManager.cpp b/libraries/embedded-webserver/src/HTTPManager.cpp index bd1b545412..db6fc8e084 100644 --- a/libraries/embedded-webserver/src/HTTPManager.cpp +++ b/libraries/embedded-webserver/src/HTTPManager.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "HTTPManager.h" + #include #include #include @@ -18,7 +20,6 @@ #include "HTTPConnection.h" #include "EmbeddedWebserverLogging.h" -#include "HTTPManager.h" const int SOCKET_ERROR_EXIT_CODE = 2; const int SOCKET_CHECK_INTERVAL_IN_MS = 30000; diff --git a/libraries/embedded-webserver/src/HTTPSConnection.cpp b/libraries/embedded-webserver/src/HTTPSConnection.cpp index 7af14ce0a7..f5473d577f 100644 --- a/libraries/embedded-webserver/src/HTTPSConnection.cpp +++ b/libraries/embedded-webserver/src/HTTPSConnection.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "EmbeddedWebserverLogging.h" #include "HTTPSConnection.h" +#include "EmbeddedWebserverLogging.h" + HTTPSConnection::HTTPSConnection(QSslSocket* sslSocket, HTTPSManager* parentManager) : HTTPConnection(sslSocket, parentManager) { diff --git a/libraries/embedded-webserver/src/HTTPSManager.cpp b/libraries/embedded-webserver/src/HTTPSManager.cpp index ee61f15457..8ba44f98ac 100644 --- a/libraries/embedded-webserver/src/HTTPSManager.cpp +++ b/libraries/embedded-webserver/src/HTTPSManager.cpp @@ -9,12 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "HTTPSManager.h" + #include #include "HTTPSConnection.h" -#include "HTTPSManager.h" - HTTPSManager::HTTPSManager(QHostAddress listenAddress, quint16 port, const QSslCertificate& certificate, const QSslKey& privateKey, const QString& documentRoot, HTTPSRequestHandler* requestHandler, QObject* parent) : HTTPManager(listenAddress, port, documentRoot, requestHandler, parent), diff --git a/libraries/entities/src/DeleteEntityOperator.cpp b/libraries/entities/src/DeleteEntityOperator.cpp index 347d40ea49..d369e08ecf 100644 --- a/libraries/entities/src/DeleteEntityOperator.cpp +++ b/libraries/entities/src/DeleteEntityOperator.cpp @@ -9,12 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "DeleteEntityOperator.h" + #include "EntityItem.h" #include "EntityTree.h" #include "EntityTreeElement.h" - #include "EntitiesLogging.h" -#include "DeleteEntityOperator.h" DeleteEntityOperator::DeleteEntityOperator(EntityTreePointer tree, const EntityItemID& searchEntityID) : _tree(tree), diff --git a/libraries/entities/src/DeleteEntityOperator.h b/libraries/entities/src/DeleteEntityOperator.h index 135949a53d..3b3ee2a868 100644 --- a/libraries/entities/src/DeleteEntityOperator.h +++ b/libraries/entities/src/DeleteEntityOperator.h @@ -12,6 +12,12 @@ #ifndef hifi_DeleteEntityOperator_h #define hifi_DeleteEntityOperator_h +#include + +#include + +#include "EntityItem.h" + class EntityToDeleteDetails { public: EntityItemPointer entity; diff --git a/libraries/entities/src/EntityDynamicInterface.cpp b/libraries/entities/src/EntityDynamicInterface.cpp index d43bdd7b51..1115559342 100644 --- a/libraries/entities/src/EntityDynamicInterface.cpp +++ b/libraries/entities/src/EntityDynamicInterface.cpp @@ -89,10 +89,9 @@ variables. These argument variables are used by the code which is run when bull */ -#include "EntityItem.h" - #include "EntityDynamicInterface.h" +#include "EntityItem.h" /**jsdoc *

An entity action may be one of the following types:

diff --git a/libraries/entities/src/EntityDynamicInterface.h b/libraries/entities/src/EntityDynamicInterface.h index 40e39eecf1..6b82e7df73 100644 --- a/libraries/entities/src/EntityDynamicInterface.h +++ b/libraries/entities/src/EntityDynamicInterface.h @@ -13,9 +13,12 @@ #define hifi_EntityDynamicInterface_h #include -#include + #include +#include +#include + class EntityItem; class EntityItemID; class EntitySimulation; diff --git a/libraries/entities/src/EntityEditFilters.cpp b/libraries/entities/src/EntityEditFilters.cpp index 676b1ce518..94df7eb465 100644 --- a/libraries/entities/src/EntityEditFilters.cpp +++ b/libraries/entities/src/EntityEditFilters.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "EntityEditFilters.h" #include #include -#include "EntityEditFilters.h" QList EntityEditFilters::getZonesByPosition(glm::vec3& position) { QList zones; diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index 5d7bd61854..d89dd4f9d0 100644 --- a/libraries/entities/src/EntityEditPacketSender.cpp +++ b/libraries/entities/src/EntityEditPacketSender.cpp @@ -9,16 +9,20 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "EntityEditPacketSender.h" + #include + #include + +#include #include #include #include -#include "EntityEditPacketSender.h" + #include "EntitiesLogging.h" #include "EntityItem.h" #include "EntityItemProperties.h" -#include EntityEditPacketSender::EntityEditPacketSender() { auto& packetReceiver = DependencyManager::get()->getPacketReceiver(); diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 4638b46437..4d7c114176 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -9,24 +9,28 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include -#include -#include -#include +#include "EntityItemProperties.h" + #include #include #include #include -#include + +#include +#include +#include +#include #include #include + +#include #include #include #include #include + #include "EntitiesLogging.h" #include "EntityItem.h" -#include "EntityItemProperties.h" #include "ModelEntityItem.h" #include "PolyLineEntityItem.h" diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 38e4f0c8c0..39ea2e0bdd 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "AnimationPropertyGroup.h" #include "EntityItemID.h" diff --git a/libraries/entities/src/EntityTree.h b/libraries/entities/src/EntityTree.h index d95dbf2990..ee9fb10554 100644 --- a/libraries/entities/src/EntityTree.h +++ b/libraries/entities/src/EntityTree.h @@ -18,15 +18,13 @@ #include #include -class EntityTree; -using EntityTreePointer = std::shared_ptr; - #include "AddEntityOperator.h" #include "EntityTreeElement.h" #include "DeleteEntityOperator.h" #include "MovingEntitiesOperator.h" -class EntityEditFilters; +class EntityTree; +using EntityTreePointer = std::shared_ptr; class EntitySimulation; diff --git a/libraries/entities/src/EntityTypes.cpp b/libraries/entities/src/EntityTypes.cpp index 694542b04e..9611063f8b 100644 --- a/libraries/entities/src/EntityTypes.cpp +++ b/libraries/entities/src/EntityTypes.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "EntityTypes.h" + #include #include @@ -16,7 +18,6 @@ #include "EntityItem.h" #include "EntityItemProperties.h" -#include "EntityTypes.h" #include "EntitiesLogging.h" #include "LightEntityItem.h" diff --git a/libraries/entities/src/HazePropertyGroup.cpp b/libraries/entities/src/HazePropertyGroup.cpp index f137fca5ce..c15b28707c 100644 --- a/libraries/entities/src/HazePropertyGroup.cpp +++ b/libraries/entities/src/HazePropertyGroup.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "HazePropertyGroup.h" + #include -#include "HazePropertyGroup.h" #include "EntityItemProperties.h" #include "EntityItemPropertiesMacros.h" diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp index f0fbb20f98..e95af7ebf9 100644 --- a/libraries/entities/src/LightEntityItem.cpp +++ b/libraries/entities/src/LightEntityItem.cpp @@ -9,6 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "LightEntityItem.h" #include @@ -19,7 +20,6 @@ #include "EntityItemProperties.h" #include "EntityTree.h" #include "EntityTreeElement.h" -#include "LightEntityItem.h" const bool LightEntityItem::DEFAULT_IS_SPOTLIGHT = false; const float LightEntityItem::DEFAULT_INTENSITY = 1.0f; diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 0f59bc673d..cf89a73214 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -9,18 +9,20 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ModelEntityItem.h" + #include +#include + #include #include -#include #include "EntitiesLogging.h" #include "EntityItemProperties.h" #include "EntityTree.h" #include "EntityTreeElement.h" #include "ResourceCache.h" -#include "ModelEntityItem.h" const QString ModelEntityItem::DEFAULT_MODEL_URL = QString(""); const QString ModelEntityItem::DEFAULT_COMPOUND_SHAPE_URL = QString(""); diff --git a/libraries/entities/src/MovingEntitiesOperator.cpp b/libraries/entities/src/MovingEntitiesOperator.cpp index cf043dd93e..4b908745e0 100644 --- a/libraries/entities/src/MovingEntitiesOperator.cpp +++ b/libraries/entities/src/MovingEntitiesOperator.cpp @@ -9,13 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "MovingEntitiesOperator.h" + #include "EntityItem.h" #include "EntityTree.h" #include "EntityTreeElement.h" #include "EntitiesLogging.h" -#include "MovingEntitiesOperator.h" - MovingEntitiesOperator::MovingEntitiesOperator() { } MovingEntitiesOperator::~MovingEntitiesOperator() { diff --git a/libraries/entities/src/MovingEntitiesOperator.h b/libraries/entities/src/MovingEntitiesOperator.h index d93efa60f2..9e98374fc3 100644 --- a/libraries/entities/src/MovingEntitiesOperator.h +++ b/libraries/entities/src/MovingEntitiesOperator.h @@ -14,8 +14,7 @@ #include -#include "EntityTypes.h" -#include "EntityTreeElement.h" +#include "EntityItem.h" class EntityToMoveDetails { public: diff --git a/libraries/entities/src/ParticleEffectEntityItem.cpp b/libraries/entities/src/ParticleEffectEntityItem.cpp index d9ef5e2178..d1fc3d2775 100644 --- a/libraries/entities/src/ParticleEffectEntityItem.cpp +++ b/libraries/entities/src/ParticleEffectEntityItem.cpp @@ -26,6 +26,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ParticleEffectEntityItem.h" #include #include @@ -38,8 +39,6 @@ #include "EntityTreeElement.h" #include "EntitiesLogging.h" #include "EntityScriptingInterface.h" -#include "ParticleEffectEntityItem.h" - using namespace particle; diff --git a/libraries/entities/src/PolyLineEntityItem.cpp b/libraries/entities/src/PolyLineEntityItem.cpp index 420c570e8d..5b3167b9ba 100644 --- a/libraries/entities/src/PolyLineEntityItem.cpp +++ b/libraries/entities/src/PolyLineEntityItem.cpp @@ -9,6 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "PolyLineEntityItem.h" #include @@ -19,7 +20,6 @@ #include "EntityTree.h" #include "EntityTreeElement.h" #include "OctreeConstants.h" -#include "PolyLineEntityItem.h" const float PolyLineEntityItem::DEFAULT_LINE_WIDTH = 0.1f; const int PolyLineEntityItem::MAX_POINTS_PER_LINE = 60; diff --git a/libraries/entities/src/ShapeEntityItem.cpp b/libraries/entities/src/ShapeEntityItem.cpp index 520d892682..943ae2e462 100644 --- a/libraries/entities/src/ShapeEntityItem.cpp +++ b/libraries/entities/src/ShapeEntityItem.cpp @@ -6,6 +6,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ShapeEntityItem.h" #include @@ -17,7 +18,6 @@ #include "EntityItemProperties.h" #include "EntityTree.h" #include "EntityTreeElement.h" -#include "ShapeEntityItem.h" namespace entity { diff --git a/libraries/entities/src/SkyboxPropertyGroup.cpp b/libraries/entities/src/SkyboxPropertyGroup.cpp index f8baf57856..ba40c3fa6f 100644 --- a/libraries/entities/src/SkyboxPropertyGroup.cpp +++ b/libraries/entities/src/SkyboxPropertyGroup.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "SkyboxPropertyGroup.h" + #include -#include "SkyboxPropertyGroup.h" #include "EntityItemProperties.h" #include "EntityItemPropertiesMacros.h" diff --git a/libraries/entities/src/SkyboxPropertyGroup.h b/libraries/entities/src/SkyboxPropertyGroup.h index d7b422bf11..a94365d24d 100644 --- a/libraries/entities/src/SkyboxPropertyGroup.h +++ b/libraries/entities/src/SkyboxPropertyGroup.h @@ -18,6 +18,8 @@ #include +#include + #include "PropertyGroup.h" #include "EntityItemPropertiesMacros.h" diff --git a/libraries/entities/src/TextEntityItem.cpp b/libraries/entities/src/TextEntityItem.cpp index 97080d3ca2..56e12e66d9 100644 --- a/libraries/entities/src/TextEntityItem.cpp +++ b/libraries/entities/src/TextEntityItem.cpp @@ -9,6 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "TextEntityItem.h" #include @@ -21,7 +22,6 @@ #include "EntitiesLogging.h" #include "EntityTree.h" #include "EntityTreeElement.h" -#include "TextEntityItem.h" const QString TextEntityItem::DEFAULT_TEXT(""); const float TextEntityItem::DEFAULT_LINE_HEIGHT = 0.1f; diff --git a/libraries/entities/src/ZoneEntityItem.cpp b/libraries/entities/src/ZoneEntityItem.cpp index b07d0597bc..3a6095b89f 100644 --- a/libraries/entities/src/ZoneEntityItem.cpp +++ b/libraries/entities/src/ZoneEntityItem.cpp @@ -9,6 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ZoneEntityItem.h" #include @@ -18,7 +19,6 @@ #include "EntityItemProperties.h" #include "EntityTree.h" #include "EntityTreeElement.h" -#include "ZoneEntityItem.h" #include "EntityEditFilters.h" bool ZoneEntityItem::_zonesArePickable = false; diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 86422ef70c..81637e82a8 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "FBXReader.h" + #include #include #include @@ -31,7 +33,6 @@ #include #include -#include "FBXReader.h" #include "ModelFormatLogging.h" // TOOL: Uncomment the following line to enable the filtering of all the unkwnon fields of a node so we can break point easily while loading a model with problems... diff --git a/libraries/fbx/src/FSTReader.cpp b/libraries/fbx/src/FSTReader.cpp index d63a5b3cc4..75596862d2 100644 --- a/libraries/fbx/src/FSTReader.cpp +++ b/libraries/fbx/src/FSTReader.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "FSTReader.h" + #include #include #include @@ -17,8 +19,6 @@ #include #include -#include "FSTReader.h" - QVariantHash FSTReader::parseMapping(QIODevice* device) { QVariantHash properties; diff --git a/libraries/fbx/src/GLTFReader.cpp b/libraries/fbx/src/GLTFReader.cpp index 0c04b3d733..f322c2319e 100644 --- a/libraries/fbx/src/GLTFReader.cpp +++ b/libraries/fbx/src/GLTFReader.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "GLTFReader.h" + #include #include #include @@ -28,7 +30,6 @@ #include #include -#include "GLTFReader.h" #include "FBXReader.h" @@ -1377,4 +1378,4 @@ void GLTFReader::fbxDebugDump(const FBXGeometry& fbxgeo) { } qCDebug(modelformat) << "\n"; -} \ No newline at end of file +} diff --git a/libraries/graphics-scripting/src/graphics-scripting/ScriptableMesh.cpp b/libraries/graphics-scripting/src/graphics-scripting/ScriptableMesh.cpp index 8e6d4bec9b..585a719638 100644 --- a/libraries/graphics-scripting/src/graphics-scripting/ScriptableMesh.cpp +++ b/libraries/graphics-scripting/src/graphics-scripting/ScriptableMesh.cpp @@ -5,22 +5,24 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "Forward.h" - #include "ScriptableMesh.h" -#include "ScriptableMeshPart.h" -#include "GraphicsScriptingUtil.h" -#include "OBJWriter.h" -#include #include -#include + #include #include #include + +#include #include #include #include +#include + +#include "Forward.h" +#include "ScriptableMeshPart.h" +#include "GraphicsScriptingUtil.h" +#include "OBJWriter.h" // #define SCRIPTABLE_MESH_DEBUG 1 diff --git a/libraries/graphics-scripting/src/graphics-scripting/ScriptableMeshPart.cpp b/libraries/graphics-scripting/src/graphics-scripting/ScriptableMeshPart.cpp index 4414b0ad7e..192071d3af 100644 --- a/libraries/graphics-scripting/src/graphics-scripting/ScriptableMeshPart.cpp +++ b/libraries/graphics-scripting/src/graphics-scripting/ScriptableMeshPart.cpp @@ -5,22 +5,23 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "Forward.h" - #include "ScriptableMeshPart.h" -#include "GraphicsScriptingUtil.h" -#include "OBJWriter.h" -#include -#include -#include #include #include #include + +#include +#include +#include #include #include #include +#include "Forward.h" +#include "GraphicsScriptingUtil.h" +#include "OBJWriter.h" + QString scriptable::ScriptableMeshPart::toOBJ() { if (!getMeshPointer()) { diff --git a/libraries/graphics-scripting/src/graphics-scripting/ScriptableModel.cpp b/libraries/graphics-scripting/src/graphics-scripting/ScriptableModel.cpp index c65764a225..7aaa182163 100644 --- a/libraries/graphics-scripting/src/graphics-scripting/ScriptableModel.cpp +++ b/libraries/graphics-scripting/src/graphics-scripting/ScriptableModel.cpp @@ -8,14 +8,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GraphicsScriptingUtil.h" #include "ScriptableModel.h" -#include "ScriptableMesh.h" #include +#include "GraphicsScriptingUtil.h" +#include "ScriptableMesh.h" #include "graphics/Material.h" - #include "image/Image.h" // #define SCRIPTABLE_MESH_DEBUG 1 diff --git a/libraries/graphics/src/graphics/Haze.cpp b/libraries/graphics/src/graphics/Haze.cpp index dfe70175f4..d5a060b90b 100644 --- a/libraries/graphics/src/graphics/Haze.cpp +++ b/libraries/graphics/src/graphics/Haze.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include #include "Haze.h" +#include + using namespace graphics; const float Haze::INITIAL_HAZE_RANGE{ 1000.0f }; diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index edb2992128..dd6a7fffe9 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AddressManager.h" + #include #include #include @@ -23,7 +25,6 @@ #include #include -#include "AddressManager.h" #include "NodeList.h" #include "NetworkLogging.h" #include "UserActivityLogger.h" diff --git a/libraries/networking/src/Assignment.cpp b/libraries/networking/src/Assignment.cpp index 58a4446aa6..71a3cfb269 100644 --- a/libraries/networking/src/Assignment.cpp +++ b/libraries/networking/src/Assignment.cpp @@ -9,17 +9,18 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "udt/PacketHeaders.h" -#include "SharedUtil.h" -#include "UUID.h" +#include "Assignment.h" #include #include -#include "Assignment.h" #include #include +#include "udt/PacketHeaders.h" +#include "SharedUtil.h" +#include "UUID.h" + Assignment::Type Assignment::typeForNodeType(NodeType_t nodeType) { switch (nodeType) { case NodeType::AudioMixer: diff --git a/libraries/networking/src/AtpReply.cpp b/libraries/networking/src/AtpReply.cpp index 6417478005..b2b7e8bee7 100644 --- a/libraries/networking/src/AtpReply.cpp +++ b/libraries/networking/src/AtpReply.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "ResourceManager.h" #include "AtpReply.h" +#include "ResourceManager.h" + AtpReply::AtpReply(const QUrl& url, QObject* parent) : _resourceRequest(DependencyManager::get()->createResourceRequest(parent, url)) { setOperation(QNetworkAccessManager::GetOperation); diff --git a/libraries/networking/src/BandwidthRecorder.cpp b/libraries/networking/src/BandwidthRecorder.cpp index d43d4cf21f..5ad3494017 100644 --- a/libraries/networking/src/BandwidthRecorder.cpp +++ b/libraries/networking/src/BandwidthRecorder.cpp @@ -11,9 +11,9 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include #include "BandwidthRecorder.h" +#include BandwidthRecorder::Channel::Channel() { } diff --git a/libraries/networking/src/DataServerAccountInfo.cpp b/libraries/networking/src/DataServerAccountInfo.cpp index 51f93d13b0..8756a0cc4b 100644 --- a/libraries/networking/src/DataServerAccountInfo.cpp +++ b/libraries/networking/src/DataServerAccountInfo.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "DataServerAccountInfo.h" + #include #include @@ -20,7 +22,6 @@ #include #include "NetworkLogging.h" -#include "DataServerAccountInfo.h" #ifdef __clang__ #pragma clang diagnostic ignored "-Wdeprecated-declarations" diff --git a/libraries/networking/src/HifiSockAddr.cpp b/libraries/networking/src/HifiSockAddr.cpp index e2a3e79c79..a1bfcdd275 100644 --- a/libraries/networking/src/HifiSockAddr.cpp +++ b/libraries/networking/src/HifiSockAddr.cpp @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "HifiSockAddr.h" + #include #include #include -#include "HifiSockAddr.h" #include "NetworkLogging.h" int hifiSockAddrMetaTypeId = qRegisterMetaType(); diff --git a/libraries/networking/src/LocationScriptingInterface.cpp b/libraries/networking/src/LocationScriptingInterface.cpp index aae1da73ba..39845558a8 100644 --- a/libraries/networking/src/LocationScriptingInterface.cpp +++ b/libraries/networking/src/LocationScriptingInterface.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "AddressManager.h" - #include "LocationScriptingInterface.h" +#include "AddressManager.h" + LocationScriptingInterface* LocationScriptingInterface::getInstance() { static LocationScriptingInterface sharedInstance; return &sharedInstance; diff --git a/libraries/networking/src/NetworkAccessManager.cpp b/libraries/networking/src/NetworkAccessManager.cpp index fd356c3e94..f73243e675 100644 --- a/libraries/networking/src/NetworkAccessManager.cpp +++ b/libraries/networking/src/NetworkAccessManager.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "NetworkAccessManager.h" + #include #include "AtpReply.h" -#include "NetworkAccessManager.h" #include QThreadStorage networkAccessManagers; diff --git a/libraries/networking/src/Node.cpp b/libraries/networking/src/Node.cpp index 73b7c44e7e..626503d8ae 100644 --- a/libraries/networking/src/Node.cpp +++ b/libraries/networking/src/Node.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Node.h" + #include #include @@ -21,8 +23,6 @@ #include "NodePermissions.h" #include "SharedUtil.h" -#include "Node.h" - const QString UNKNOWN_NodeType_t_NAME = "Unknown"; int NodePtrMetaTypeId = qRegisterMetaType("Node*"); diff --git a/libraries/networking/src/OAuthAccessToken.cpp b/libraries/networking/src/OAuthAccessToken.cpp index 0c14e5e074..44db2a799e 100644 --- a/libraries/networking/src/OAuthAccessToken.cpp +++ b/libraries/networking/src/OAuthAccessToken.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "OAuthAccessToken.h" +#include + OAuthAccessToken::OAuthAccessToken() : token(), refreshToken(), diff --git a/libraries/networking/src/OAuthNetworkAccessManager.cpp b/libraries/networking/src/OAuthNetworkAccessManager.cpp index a30786efa4..272ff47a49 100644 --- a/libraries/networking/src/OAuthNetworkAccessManager.cpp +++ b/libraries/networking/src/OAuthNetworkAccessManager.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OAuthNetworkAccessManager.h" + #include #include #include @@ -18,8 +20,6 @@ #include "NetworkingConstants.h" #include "SharedUtil.h" -#include "OAuthNetworkAccessManager.h" - QThreadStorage oauthNetworkAccessManagers; OAuthNetworkAccessManager* OAuthNetworkAccessManager::getInstance() { diff --git a/libraries/networking/src/PacketSender.cpp b/libraries/networking/src/PacketSender.cpp index 02c4815f1f..6288743c46 100644 --- a/libraries/networking/src/PacketSender.cpp +++ b/libraries/networking/src/PacketSender.cpp @@ -9,12 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "PacketSender.h" + #include #include #include #include "NodeList.h" -#include "PacketSender.h" #include "SharedUtil.h" const quint64 PacketSender::USECS_PER_SECOND = 1000 * 1000; diff --git a/libraries/networking/src/RSAKeypairGenerator.cpp b/libraries/networking/src/RSAKeypairGenerator.cpp index a98cf74564..8ca8b81ea3 100644 --- a/libraries/networking/src/RSAKeypairGenerator.cpp +++ b/libraries/networking/src/RSAKeypairGenerator.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "RSAKeypairGenerator.h" + #include #include #include @@ -16,8 +18,6 @@ #include #include "NetworkLogging.h" - -#include "RSAKeypairGenerator.h" #ifdef __clang__ #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif diff --git a/libraries/networking/src/ReceivedPacketProcessor.cpp b/libraries/networking/src/ReceivedPacketProcessor.cpp index c18d4ed1e8..7145744206 100644 --- a/libraries/networking/src/ReceivedPacketProcessor.cpp +++ b/libraries/networking/src/ReceivedPacketProcessor.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ReceivedPacketProcessor.h" + #include #include "NodeList.h" -#include "ReceivedPacketProcessor.h" #include "SharedUtil.h" ReceivedPacketProcessor::ReceivedPacketProcessor() { diff --git a/libraries/networking/src/ReceivedPacketProcessor.h b/libraries/networking/src/ReceivedPacketProcessor.h index f71abce1f1..6c590ec54d 100644 --- a/libraries/networking/src/ReceivedPacketProcessor.h +++ b/libraries/networking/src/ReceivedPacketProcessor.h @@ -14,8 +14,12 @@ #include +#include "NodeList.h" + #include "GenericThread.h" +class ReceivedMessage; + /// Generalized threaded processor for handling received inbound packets. class ReceivedPacketProcessor : public GenericThread { Q_OBJECT diff --git a/libraries/networking/src/ThreadedAssignment.cpp b/libraries/networking/src/ThreadedAssignment.cpp index 8b6de7da11..9a69d9b3d8 100644 --- a/libraries/networking/src/ThreadedAssignment.cpp +++ b/libraries/networking/src/ThreadedAssignment.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ThreadedAssignment.h" + #include #include #include @@ -17,8 +19,6 @@ #include -#include "ThreadedAssignment.h" - #include "NetworkLogging.h" ThreadedAssignment::ThreadedAssignment(ReceivedMessage& message) : diff --git a/libraries/networking/src/UserActivityLogger.cpp b/libraries/networking/src/UserActivityLogger.cpp index 0cfd1e09e7..7a92d4bad9 100644 --- a/libraries/networking/src/UserActivityLogger.cpp +++ b/libraries/networking/src/UserActivityLogger.cpp @@ -9,16 +9,17 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "UserActivityLogger.h" + #include #include #include #include -#include "NetworkLogging.h" - -#include "UserActivityLogger.h" #include + #include "AddressManager.h" +#include "NetworkLogging.h" UserActivityLogger::UserActivityLogger() { _timer.start(); diff --git a/libraries/networking/src/WalletTransaction.cpp b/libraries/networking/src/WalletTransaction.cpp index 0c823555fd..2bb66c67d0 100644 --- a/libraries/networking/src/WalletTransaction.cpp +++ b/libraries/networking/src/WalletTransaction.cpp @@ -9,13 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "WalletTransaction.h" + #include #include -#include "WalletTransaction.h" - - WalletTransaction::WalletTransaction() : _uuid(), _destinationUUID(), diff --git a/libraries/networking/src/udt/ConnectionStats.cpp b/libraries/networking/src/udt/ConnectionStats.cpp index 46d88e680f..986da062f2 100644 --- a/libraries/networking/src/udt/ConnectionStats.cpp +++ b/libraries/networking/src/udt/ConnectionStats.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include #include "ConnectionStats.h" +#include + using namespace udt; using namespace std::chrono; diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index 2efd32f2e8..5f943fabf2 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Octree.h" + #include #include #include @@ -43,7 +45,6 @@ #include #include -#include "Octree.h" #include "OctreeConstants.h" #include "OctreeLogging.h" #include "OctreeQueryNode.h" diff --git a/libraries/octree/src/OctreeEditPacketSender.cpp b/libraries/octree/src/OctreeEditPacketSender.cpp index 4f10c9bf79..0156013821 100644 --- a/libraries/octree/src/OctreeEditPacketSender.cpp +++ b/libraries/octree/src/OctreeEditPacketSender.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreeEditPacketSender.h" + #include #include @@ -16,7 +18,6 @@ #include #include #include "OctreeLogging.h" -#include "OctreeEditPacketSender.h" const int OctreeEditPacketSender::DEFAULT_MAX_PENDING_MESSAGES = PacketSender::DEFAULT_PACKETS_PER_SECOND; diff --git a/libraries/octree/src/OctreeElement.cpp b/libraries/octree/src/OctreeElement.cpp index a666ba0426..b94d0d57e1 100644 --- a/libraries/octree/src/OctreeElement.cpp +++ b/libraries/octree/src/OctreeElement.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreeElement.h" + #include #include #include @@ -21,17 +23,16 @@ #include #include #include +#include #include "AACube.h" #include "Logging.h" #include "OctalCode.h" #include "Octree.h" #include "OctreeConstants.h" -#include "OctreeElement.h" #include "OctreeLogging.h" #include "OctreeUtils.h" #include "SharedUtil.h" -#include AtomicUIntStat OctreeElement::_octreeMemoryUsage { 0 }; AtomicUIntStat OctreeElement::_octcodeMemoryUsage { 0 }; diff --git a/libraries/octree/src/OctreePacketData.cpp b/libraries/octree/src/OctreePacketData.cpp index 7108f9a4e4..b938850684 100644 --- a/libraries/octree/src/OctreePacketData.cpp +++ b/libraries/octree/src/OctreePacketData.cpp @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreePacketData.h" + #include #include #include "OctreeLogging.h" -#include "OctreePacketData.h" #include "NumericalConstants.h" bool OctreePacketData::_debug = false; diff --git a/libraries/octree/src/OctreePersistThread.cpp b/libraries/octree/src/OctreePersistThread.cpp index e6c28f75e8..e6afccab47 100644 --- a/libraries/octree/src/OctreePersistThread.cpp +++ b/libraries/octree/src/OctreePersistThread.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreePersistThread.h" + #include #include @@ -30,7 +32,6 @@ #include #include "OctreeLogging.h" -#include "OctreePersistThread.h" #include "OctreeUtils.h" #include "OctreeDataUtils.h" diff --git a/libraries/octree/src/OctreeProcessor.cpp b/libraries/octree/src/OctreeProcessor.cpp index 43019c7acc..db78e985e6 100644 --- a/libraries/octree/src/OctreeProcessor.cpp +++ b/libraries/octree/src/OctreeProcessor.cpp @@ -8,16 +8,17 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreeProcessor.h" + +#include #include -#include #include #include #include #include "OctreeLogging.h" -#include "OctreeProcessor.h" OctreeProcessor::OctreeProcessor() : _tree(NULL), diff --git a/libraries/octree/src/OctreeSceneStats.cpp b/libraries/octree/src/OctreeSceneStats.cpp index b2efdfd595..d8ff6ba0ec 100644 --- a/libraries/octree/src/OctreeSceneStats.cpp +++ b/libraries/octree/src/OctreeSceneStats.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctreeSceneStats.h" + #include #include #include @@ -20,8 +22,6 @@ #include "OctreePacketData.h" #include "OctreeElement.h" #include "OctreeLogging.h" -#include "OctreeSceneStats.h" - const int samples = 100; OctreeSceneStats::OctreeSceneStats() : diff --git a/libraries/octree/src/OctreeScriptingInterface.cpp b/libraries/octree/src/OctreeScriptingInterface.cpp index 618e8ac469..b1729c649e 100644 --- a/libraries/octree/src/OctreeScriptingInterface.cpp +++ b/libraries/octree/src/OctreeScriptingInterface.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "OctreeScriptingInterface.h" +#include + OctreeScriptingInterface::OctreeScriptingInterface(OctreeEditPacketSender* packetSender) : _packetSender(packetSender), _managedPacketSender(false), diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 68f21eea87..a801392b66 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "EntityMotionState.h" + #include #include @@ -19,7 +21,6 @@ #include #include "BulletUtil.h" -#include "EntityMotionState.h" #include "PhysicsEngine.h" #include "PhysicsHelpers.h" #include "PhysicsLogging.h" diff --git a/libraries/physics/src/MeshMassProperties.cpp b/libraries/physics/src/MeshMassProperties.cpp index a6a33932aa..ad4208e6a1 100644 --- a/libraries/physics/src/MeshMassProperties.cpp +++ b/libraries/physics/src/MeshMassProperties.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "MeshMassProperties.h" + #include #include -#include "MeshMassProperties.h" - // this method is included for unit test verification void computeBoxInertia(btScalar mass, const btVector3& diagonal, btMatrix3x3& inertia) { // formula for box inertia tensor: diff --git a/libraries/physics/src/ObjectAction.cpp b/libraries/physics/src/ObjectAction.cpp index 87732ded03..dfcf1aba33 100644 --- a/libraries/physics/src/ObjectAction.cpp +++ b/libraries/physics/src/ObjectAction.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "EntitySimulation.h" - #include "ObjectAction.h" +#include "EntitySimulation.h" + #include "PhysicsLogging.h" diff --git a/libraries/physics/src/ObjectActionOffset.cpp b/libraries/physics/src/ObjectActionOffset.cpp index e90862266b..4c2ed35f8e 100644 --- a/libraries/physics/src/ObjectActionOffset.cpp +++ b/libraries/physics/src/ObjectActionOffset.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "QVariantGLM.h" - #include "ObjectActionOffset.h" +#include "QVariantGLM.h" + #include "PhysicsLogging.h" diff --git a/libraries/physics/src/ObjectActionTractor.cpp b/libraries/physics/src/ObjectActionTractor.cpp index 9b2da22665..a48989be33 100644 --- a/libraries/physics/src/ObjectActionTractor.cpp +++ b/libraries/physics/src/ObjectActionTractor.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "QVariantGLM.h" - #include "ObjectActionTractor.h" +#include "QVariantGLM.h" + #include "PhysicsLogging.h" const float TRACTOR_MAX_SPEED = 10.0f; diff --git a/libraries/physics/src/ObjectActionTravelOriented.cpp b/libraries/physics/src/ObjectActionTravelOriented.cpp index accade8695..c93cce2482 100644 --- a/libraries/physics/src/ObjectActionTravelOriented.cpp +++ b/libraries/physics/src/ObjectActionTravelOriented.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ObjectActionTravelOriented.h" + #include #include "QVariantGLM.h" -#include "ObjectActionTravelOriented.h" #include "PhysicsLogging.h" const uint16_t ObjectActionTravelOriented::actionVersion = 1; diff --git a/libraries/physics/src/ObjectConstraint.cpp b/libraries/physics/src/ObjectConstraint.cpp index 54fd4777e0..38467b1d83 100644 --- a/libraries/physics/src/ObjectConstraint.cpp +++ b/libraries/physics/src/ObjectConstraint.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "EntitySimulation.h" - #include "ObjectConstraint.h" +#include "EntitySimulation.h" + #include "PhysicsLogging.h" ObjectConstraint::ObjectConstraint(EntityDynamicType type, const QUuid& id, EntityItemPointer ownerEntity) : diff --git a/libraries/physics/src/ObjectConstraintBallSocket.cpp b/libraries/physics/src/ObjectConstraintBallSocket.cpp index 4736f2c9e2..b7a186e187 100644 --- a/libraries/physics/src/ObjectConstraintBallSocket.cpp +++ b/libraries/physics/src/ObjectConstraintBallSocket.cpp @@ -9,12 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ObjectConstraintBallSocket.h" + #include #include "QVariantGLM.h" #include "EntityTree.h" -#include "ObjectConstraintBallSocket.h" #include "PhysicsLogging.h" diff --git a/libraries/physics/src/ObjectConstraintConeTwist.cpp b/libraries/physics/src/ObjectConstraintConeTwist.cpp index 47228c1c16..e2b86a9e0f 100644 --- a/libraries/physics/src/ObjectConstraintConeTwist.cpp +++ b/libraries/physics/src/ObjectConstraintConeTwist.cpp @@ -9,12 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ObjectConstraintConeTwist.h" + #include #include "QVariantGLM.h" #include "EntityTree.h" -#include "ObjectConstraintConeTwist.h" #include "PhysicsLogging.h" const uint16_t CONE_TWIST_VERSION_WITH_UNUSED_PAREMETERS = 1; diff --git a/libraries/physics/src/ObjectConstraintHinge.cpp b/libraries/physics/src/ObjectConstraintHinge.cpp index 4793741391..0a01f413dc 100644 --- a/libraries/physics/src/ObjectConstraintHinge.cpp +++ b/libraries/physics/src/ObjectConstraintHinge.cpp @@ -9,12 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ObjectConstraintHinge.h" + #include #include "QVariantGLM.h" #include "EntityTree.h" -#include "ObjectConstraintHinge.h" #include "PhysicsLogging.h" diff --git a/libraries/physics/src/ObjectConstraintSlider.cpp b/libraries/physics/src/ObjectConstraintSlider.cpp index da5bba7f4d..4776e0e4a6 100644 --- a/libraries/physics/src/ObjectConstraintSlider.cpp +++ b/libraries/physics/src/ObjectConstraintSlider.cpp @@ -9,12 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ObjectConstraintSlider.h" + #include #include "QVariantGLM.h" #include "EntityTree.h" -#include "ObjectConstraintSlider.h" #include "PhysicsLogging.h" diff --git a/libraries/physics/src/ObjectDynamic.cpp b/libraries/physics/src/ObjectDynamic.cpp index 5bbb5981d1..3341025a8f 100644 --- a/libraries/physics/src/ObjectDynamic.cpp +++ b/libraries/physics/src/ObjectDynamic.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "EntitySimulation.h" - #include "ObjectDynamic.h" +#include "EntitySimulation.h" + #include "PhysicsLogging.h" diff --git a/libraries/physics/src/ObjectMotionState.cpp b/libraries/physics/src/ObjectMotionState.cpp index b11e21366e..64d2368207 100644 --- a/libraries/physics/src/ObjectMotionState.cpp +++ b/libraries/physics/src/ObjectMotionState.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ObjectMotionState.h" + #include #include "BulletUtil.h" -#include "ObjectMotionState.h" #include "PhysicsEngine.h" #include "PhysicsHelpers.h" #include "PhysicsLogging.h" diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 50d516c256..83ffa21a55 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -9,18 +9,18 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include +#include "PhysicsEngine.h" #include #include #include +#include #include #include "CharacterController.h" #include "ObjectMotionState.h" -#include "PhysicsEngine.h" #include "PhysicsHelpers.h" #include "PhysicsDebugDraw.h" #include "ThreadSafeDynamicsWorld.h" diff --git a/libraries/physics/src/ShapeFactory.cpp b/libraries/physics/src/ShapeFactory.cpp index 5abeb022aa..8057eb0e0c 100644 --- a/libraries/physics/src/ShapeFactory.cpp +++ b/libraries/physics/src/ShapeFactory.cpp @@ -9,11 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ShapeFactory.h" + #include #include // for MILLIMETERS_PER_METER -#include "ShapeFactory.h" #include "BulletUtil.h" diff --git a/libraries/physics/src/ShapeManager.cpp b/libraries/physics/src/ShapeManager.cpp index 97b9e5dab1..ef7a4a1749 100644 --- a/libraries/physics/src/ShapeManager.cpp +++ b/libraries/physics/src/ShapeManager.cpp @@ -9,12 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include +#include "ShapeManager.h" #include +#include + #include "ShapeFactory.h" -#include "ShapeManager.h" ShapeManager::ShapeManager() { } diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp index 5b8c0d5843..3f24851dce 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp @@ -15,9 +15,10 @@ * Copied and modified from btDiscreteDynamicsWorld.cpp by AndrewMeadows on 2014.11.12. * */ +#include "ThreadSafeDynamicsWorld.h" + #include -#include "ThreadSafeDynamicsWorld.h" #include "Profile.h" ThreadSafeDynamicsWorld::ThreadSafeDynamicsWorld( diff --git a/libraries/recording/src/recording/ClipCache.cpp b/libraries/recording/src/recording/ClipCache.cpp index 0fbbf1bc8e..c63350de7f 100644 --- a/libraries/recording/src/recording/ClipCache.cpp +++ b/libraries/recording/src/recording/ClipCache.cpp @@ -6,11 +6,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ClipCache.h" + #include #include -#include "ClipCache.h" #include "impl/PointerClip.h" #include "Logging.h" diff --git a/libraries/render-utils/src/AmbientOcclusionEffect.cpp b/libraries/render-utils/src/AmbientOcclusionEffect.cpp index c526f16b75..2ac8e77898 100644 --- a/libraries/render-utils/src/AmbientOcclusionEffect.cpp +++ b/libraries/render-utils/src/AmbientOcclusionEffect.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // - -#include +#include "AmbientOcclusionEffect.h" #include //min max and more +#include #include #include @@ -22,7 +22,6 @@ #include "RenderUtilsLogging.h" #include "DeferredLightingEffect.h" -#include "AmbientOcclusionEffect.h" #include "TextureCache.h" #include "FramebufferCache.h" #include "DependencyManager.h" @@ -543,4 +542,4 @@ void DebugAmbientOcclusion::run(const render::RenderContextPointer& renderContex }); } - \ No newline at end of file + diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index c9aa1b8f71..2173aef76a 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -9,6 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AntialiasingEffect.h" #include @@ -17,7 +18,6 @@ #include #include -#include "AntialiasingEffect.h" #include "StencilMaskPass.h" #include "TextureCache.h" #include "DependencyManager.h" diff --git a/libraries/render-utils/src/LightStage.cpp b/libraries/render-utils/src/LightStage.cpp index 854ff71e20..ceac4ae3c8 100644 --- a/libraries/render-utils/src/LightStage.cpp +++ b/libraries/render-utils/src/LightStage.cpp @@ -9,12 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "ViewFrustum.h" - #include "LightStage.h" #include +#include "ViewFrustum.h" + std::string LightStage::_stageName { "LIGHT_STAGE"}; const glm::mat4 LightStage::Shadow::_biasMatrix{ 0.5, 0.0, 0.0, 0.0, diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index a3abb24afe..b02266e67b 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -10,10 +10,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "RenderPipelines.h" + #include #include #include +#include #include "StencilMaskPass.h" #include "DeferredLightingEffect.h" @@ -615,9 +618,6 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { skinModelShadowFadeDualQuatProgram, state); } -#include "RenderPipelines.h" -#include - // FIXME find a better way to setup the default textures void RenderPipelines::bindMaterial(const graphics::MaterialPointer& material, gpu::Batch& batch, bool enableTextures) { if (!material) { diff --git a/libraries/render/src/render/DrawTask.cpp b/libraries/render/src/render/DrawTask.cpp index 8aabffea46..3a7555f790 100755 --- a/libraries/render/src/render/DrawTask.cpp +++ b/libraries/render/src/render/DrawTask.cpp @@ -9,19 +9,19 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "DrawTask.h" -#include "Logging.h" #include #include +#include #include #include #include #include +#include "Logging.h" + #include "drawItemBounds_vert.h" #include "drawItemBounds_frag.h" diff --git a/libraries/render/src/render/ShapePipeline.cpp b/libraries/render/src/render/ShapePipeline.cpp index 35cc66315b..703acc5fa6 100644 --- a/libraries/render/src/render/ShapePipeline.cpp +++ b/libraries/render/src/render/ShapePipeline.cpp @@ -9,12 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "DependencyManager.h" -#include "Logging.h" #include "ShapePipeline.h" #include +#include "DependencyManager.h" +#include "Logging.h" + using namespace render; ShapePipeline::CustomFactoryMap ShapePipeline::_globalCustomFactoryMap; @@ -182,4 +183,4 @@ const ShapePipelinePointer ShapePlumber::pickPipeline(RenderArgs* args, const Ke } return shapePipeline; -} \ No newline at end of file +} diff --git a/libraries/script-engine/src/ArrayBufferClass.cpp b/libraries/script-engine/src/ArrayBufferClass.cpp index 4a06dee391..f64dbeffd6 100644 --- a/libraries/script-engine/src/ArrayBufferClass.cpp +++ b/libraries/script-engine/src/ArrayBufferClass.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ArrayBufferClass.h" + #include #include "ArrayBufferPrototype.h" @@ -16,8 +18,6 @@ #include "ScriptEngine.h" #include "TypedArrays.h" -#include "ArrayBufferClass.h" - static const QString CLASS_NAME = "ArrayBuffer"; diff --git a/libraries/script-engine/src/ArrayBufferPrototype.cpp b/libraries/script-engine/src/ArrayBufferPrototype.cpp index 9739f67381..d75482aa2e 100644 --- a/libraries/script-engine/src/ArrayBufferPrototype.cpp +++ b/libraries/script-engine/src/ArrayBufferPrototype.cpp @@ -9,13 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ArrayBufferPrototype.h" + #include #include #include #include "ArrayBufferClass.h" -#include "ArrayBufferPrototype.h" static const int QCOMPRESS_HEADER_POSITION = 0; static const int QCOMPRESS_HEADER_SIZE = 4; diff --git a/libraries/script-engine/src/BatchLoader.cpp b/libraries/script-engine/src/BatchLoader.cpp index 0c65d5c6f0..4e2943d536 100644 --- a/libraries/script-engine/src/BatchLoader.cpp +++ b/libraries/script-engine/src/BatchLoader.cpp @@ -9,15 +9,17 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "BatchLoader.h" + #include #include - #include #include -#include "ScriptEngineLogging.h" -#include "BatchLoader.h" + #include #include + +#include "ScriptEngineLogging.h" #include "ResourceManager.h" #include "ScriptEngines.h" #include "ScriptCache.h" diff --git a/libraries/script-engine/src/ConsoleScriptingInterface.cpp b/libraries/script-engine/src/ConsoleScriptingInterface.cpp index b4ef98938d..60de04aa9e 100644 --- a/libraries/script-engine/src/ConsoleScriptingInterface.cpp +++ b/libraries/script-engine/src/ConsoleScriptingInterface.cpp @@ -15,8 +15,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include #include "ConsoleScriptingInterface.h" + +#include + #include "ScriptEngine.h" #define INDENTATION 4 // 1 Tab - 4 spaces diff --git a/libraries/script-engine/src/DataViewClass.cpp b/libraries/script-engine/src/DataViewClass.cpp index a65bdff617..3cc5443973 100644 --- a/libraries/script-engine/src/DataViewClass.cpp +++ b/libraries/script-engine/src/DataViewClass.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "DataViewPrototype.h" - #include "DataViewClass.h" +#include "DataViewPrototype.h" + Q_DECLARE_METATYPE(QByteArray*) static const QString DATA_VIEW_NAME = "DataView"; @@ -91,4 +91,4 @@ QString DataViewClass::name() const { QScriptValue DataViewClass::prototype() const { return _proto; -} \ No newline at end of file +} diff --git a/libraries/script-engine/src/DataViewPrototype.cpp b/libraries/script-engine/src/DataViewPrototype.cpp index 8bab574f33..ef757a5cb4 100644 --- a/libraries/script-engine/src/DataViewPrototype.cpp +++ b/libraries/script-engine/src/DataViewPrototype.cpp @@ -8,14 +8,15 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // + +#include "DataViewPrototype.h" + #include #include #include "DataViewClass.h" -#include "DataViewPrototype.h" - Q_DECLARE_METATYPE(QByteArray*) DataViewPrototype::DataViewPrototype(QObject* parent) : QObject(parent) { diff --git a/libraries/script-engine/src/EventTypes.cpp b/libraries/script-engine/src/EventTypes.cpp index abdd934e5a..94c074d44e 100644 --- a/libraries/script-engine/src/EventTypes.cpp +++ b/libraries/script-engine/src/EventTypes.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "EventTypes.h" + #include "KeyEvent.h" #include "MouseEvent.h" #include "SpatialEvent.h" @@ -16,8 +18,6 @@ #include "TouchEvent.h" #include "WheelEvent.h" -#include "EventTypes.h" - void registerEventTypes(QScriptEngine* engine) { qScriptRegisterMetaType(engine, KeyEvent::toScriptValue, KeyEvent::fromScriptValue); qScriptRegisterMetaType(engine, MouseEvent::toScriptValue, MouseEvent::fromScriptValue); diff --git a/libraries/script-engine/src/KeyEvent.cpp b/libraries/script-engine/src/KeyEvent.cpp index 581f9a816b..b0e622a774 100644 --- a/libraries/script-engine/src/KeyEvent.cpp +++ b/libraries/script-engine/src/KeyEvent.cpp @@ -9,13 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "KeyEvent.h" + #include #include #include "ScriptEngineLogging.h" -#include "KeyEvent.h" - KeyEvent::KeyEvent() : key(0), text(""), diff --git a/libraries/script-engine/src/Mat4.cpp b/libraries/script-engine/src/Mat4.cpp index 15015782e2..3e75d815c3 100644 --- a/libraries/script-engine/src/Mat4.cpp +++ b/libraries/script-engine/src/Mat4.cpp @@ -9,14 +9,17 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include -#include +#include "Mat4.h" + #include #include #include + +#include +#include + #include "ScriptEngineLogging.h" #include "ScriptEngine.h" -#include "Mat4.h" glm::mat4 Mat4::multiply(const glm::mat4& m1, const glm::mat4& m2) const { return m1 * m2; diff --git a/libraries/script-engine/src/MenuItemProperties.cpp b/libraries/script-engine/src/MenuItemProperties.cpp index 40254eeccb..2662ba406d 100644 --- a/libraries/script-engine/src/MenuItemProperties.cpp +++ b/libraries/script-engine/src/MenuItemProperties.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include -#include #include "MenuItemProperties.h" +#include +#include MenuItemProperties::MenuItemProperties(const QString& menuName, const QString& menuItemName, diff --git a/libraries/script-engine/src/MouseEvent.cpp b/libraries/script-engine/src/MouseEvent.cpp index 20bac96087..1bace0425f 100644 --- a/libraries/script-engine/src/MouseEvent.cpp +++ b/libraries/script-engine/src/MouseEvent.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "MouseEvent.h" + #include #include -#include "MouseEvent.h" - MouseEvent::MouseEvent() : x(0.0f), y(0.0f), @@ -104,4 +104,4 @@ QScriptValue MouseEvent::toScriptValue(QScriptEngine* engine, const MouseEvent& void MouseEvent::fromScriptValue(const QScriptValue& object, MouseEvent& event) { // nothing for now... -} \ No newline at end of file +} diff --git a/libraries/script-engine/src/MouseEvent.h b/libraries/script-engine/src/MouseEvent.h index 0fbc688e5f..d9b00a8e01 100644 --- a/libraries/script-engine/src/MouseEvent.h +++ b/libraries/script-engine/src/MouseEvent.h @@ -13,6 +13,9 @@ #define hifi_MouseEvent_h #include +#include + +class QScriptEngine; class MouseEvent { public: @@ -38,4 +41,4 @@ public: Q_DECLARE_METATYPE(MouseEvent) -#endif // hifi_MouseEvent_h \ No newline at end of file +#endif // hifi_MouseEvent_h diff --git a/libraries/script-engine/src/Quat.cpp b/libraries/script-engine/src/Quat.cpp index a6f7acffc8..afff0a6b03 100644 --- a/libraries/script-engine/src/Quat.cpp +++ b/libraries/script-engine/src/Quat.cpp @@ -9,16 +9,17 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Quat.h" + #include +#include #include #include -#include -#include + #include "ScriptEngineLogging.h" #include "ScriptEngine.h" -#include "Quat.h" quat Quat::normalize(const glm::quat& q) { return glm::normalize(q); diff --git a/libraries/script-engine/src/Quat.h b/libraries/script-engine/src/Quat.h index 254757dece..1ccdfdbf31 100644 --- a/libraries/script-engine/src/Quat.h +++ b/libraries/script-engine/src/Quat.h @@ -20,6 +20,8 @@ #include #include +#include + /**jsdoc * A quaternion value. See also the {@link Quat(0)|Quat} object. * @typedef {object} Quat diff --git a/libraries/script-engine/src/ScriptAudioInjector.cpp b/libraries/script-engine/src/ScriptAudioInjector.cpp index 516f62401f..8b51377bff 100644 --- a/libraries/script-engine/src/ScriptAudioInjector.cpp +++ b/libraries/script-engine/src/ScriptAudioInjector.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "ScriptEngineLogging.h" #include "ScriptAudioInjector.h" +#include "ScriptEngineLogging.h" + QScriptValue injectorToScriptValue(QScriptEngine* engine, ScriptAudioInjector* const& in) { // The AudioScriptingInterface::playSound method can return null, so we need to account for that. if (!in) { diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 4915a2dc8b..9a383454d4 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ScriptEngine.h" + #include #include @@ -67,7 +69,6 @@ #include "ScriptAvatarData.h" #include "ScriptCache.h" #include "ScriptEngineLogging.h" -#include "ScriptEngine.h" #include "TypedArrays.h" #include "XMLHttpRequestClass.h" #include "WebSocketClass.h" diff --git a/libraries/script-engine/src/ScriptUUID.cpp b/libraries/script-engine/src/ScriptUUID.cpp index ee15f1a760..f88803c87c 100644 --- a/libraries/script-engine/src/ScriptUUID.cpp +++ b/libraries/script-engine/src/ScriptUUID.cpp @@ -11,11 +11,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ScriptUUID.h" + #include #include "ScriptEngineLogging.h" #include "ScriptEngine.h" -#include "ScriptUUID.h" QUuid ScriptUUID::fromString(const QString& s) { return QUuid(s); diff --git a/libraries/script-engine/src/ScriptUUID.h b/libraries/script-engine/src/ScriptUUID.h index 9b61f451c5..0af0c1cf8e 100644 --- a/libraries/script-engine/src/ScriptUUID.h +++ b/libraries/script-engine/src/ScriptUUID.h @@ -15,6 +15,7 @@ #define hifi_ScriptUUID_h #include +#include #include /**jsdoc diff --git a/libraries/script-engine/src/SpatialEvent.cpp b/libraries/script-engine/src/SpatialEvent.cpp index f20a0c2b1e..d06cc556d3 100644 --- a/libraries/script-engine/src/SpatialEvent.cpp +++ b/libraries/script-engine/src/SpatialEvent.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "SpatialEvent.h" +#include + SpatialEvent::SpatialEvent() : locTranslation(0.0f), locRotation(), @@ -43,4 +43,4 @@ QScriptValue SpatialEvent::toScriptValue(QScriptEngine* engine, const SpatialEve void SpatialEvent::fromScriptValue(const QScriptValue& object,SpatialEvent& event) { // nothing for now... -} \ No newline at end of file +} diff --git a/libraries/script-engine/src/TouchEvent.cpp b/libraries/script-engine/src/TouchEvent.cpp index 097639d4e8..6ff591decf 100644 --- a/libraries/script-engine/src/TouchEvent.cpp +++ b/libraries/script-engine/src/TouchEvent.cpp @@ -9,15 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "TouchEvent.h" + #include #include -#include #include #include -#include "TouchEvent.h" - TouchEvent::TouchEvent() : x(0.0f), y(0.0f), diff --git a/libraries/script-engine/src/TouchEvent.h b/libraries/script-engine/src/TouchEvent.h index d9eedf50d0..62cb1b1801 100644 --- a/libraries/script-engine/src/TouchEvent.h +++ b/libraries/script-engine/src/TouchEvent.h @@ -13,8 +13,13 @@ #define hifi_TouchEvent_h #include + +#include #include +class QScriptValue; +class QScriptEngine; + class TouchEvent { public: TouchEvent(); @@ -54,4 +59,4 @@ private: Q_DECLARE_METATYPE(TouchEvent) -#endif // hifi_TouchEvent_h \ No newline at end of file +#endif // hifi_TouchEvent_h diff --git a/libraries/script-engine/src/TypedArrayPrototype.cpp b/libraries/script-engine/src/TypedArrayPrototype.cpp index 4de948e806..a1f3ff87e8 100644 --- a/libraries/script-engine/src/TypedArrayPrototype.cpp +++ b/libraries/script-engine/src/TypedArrayPrototype.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "TypedArrays.h" - #include "TypedArrayPrototype.h" +#include "TypedArrays.h" + Q_DECLARE_METATYPE(QByteArray*) TypedArrayPrototype::TypedArrayPrototype(QObject* parent) : QObject(parent) { diff --git a/libraries/script-engine/src/TypedArrays.cpp b/libraries/script-engine/src/TypedArrays.cpp index 4d5181ff33..f2c3d3fd3d 100644 --- a/libraries/script-engine/src/TypedArrays.cpp +++ b/libraries/script-engine/src/TypedArrays.cpp @@ -9,13 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "TypedArrays.h" + #include #include "ScriptEngine.h" #include "TypedArrayPrototype.h" -#include "TypedArrays.h" - Q_DECLARE_METATYPE(QByteArray*) TypedArray::TypedArray(ScriptEngine* scriptEngine, QString name) : ArrayBufferViewClass(scriptEngine) { diff --git a/libraries/script-engine/src/UndoStackScriptingInterface.cpp b/libraries/script-engine/src/UndoStackScriptingInterface.cpp index 17bf8b1aa6..1171625c04 100644 --- a/libraries/script-engine/src/UndoStackScriptingInterface.cpp +++ b/libraries/script-engine/src/UndoStackScriptingInterface.cpp @@ -9,13 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "UndoStackScriptingInterface.h" + #include #include #include #include -#include "UndoStackScriptingInterface.h" - UndoStackScriptingInterface::UndoStackScriptingInterface(QUndoStack* undoStack) : _undoStack(undoStack) { } diff --git a/libraries/script-engine/src/Vec3.cpp b/libraries/script-engine/src/Vec3.cpp index c21f96cd47..2d3d4454c3 100644 --- a/libraries/script-engine/src/Vec3.cpp +++ b/libraries/script-engine/src/Vec3.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "Vec3.h" + #include #include @@ -16,11 +18,10 @@ #include #include -#include "ScriptEngineLogging.h" #include "NumericalConstants.h" -#include "Vec3.h" - #include "ScriptEngine.h" +#include "ScriptEngineLogging.h" + float Vec3::orientedAngle(const glm::vec3& v1, const glm::vec3& v2, const glm::vec3& v3) { float radians = glm::orientedAngle(glm::normalize(v1), glm::normalize(v2), glm::normalize(v3)); diff --git a/libraries/script-engine/src/WebSocketClass.cpp b/libraries/script-engine/src/WebSocketClass.cpp index 76faaab415..56753f07d1 100644 --- a/libraries/script-engine/src/WebSocketClass.cpp +++ b/libraries/script-engine/src/WebSocketClass.cpp @@ -12,9 +12,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "ScriptEngine.h" #include "WebSocketClass.h" +#include "ScriptEngine.h" + WebSocketClass::WebSocketClass(QScriptEngine* engine, QString url) : _webSocket(new QWebSocket()), _engine(engine) diff --git a/libraries/script-engine/src/WebSocketServerClass.cpp b/libraries/script-engine/src/WebSocketServerClass.cpp index 3b723d5b3f..860170a3f9 100644 --- a/libraries/script-engine/src/WebSocketServerClass.cpp +++ b/libraries/script-engine/src/WebSocketServerClass.cpp @@ -11,9 +11,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "ScriptEngine.h" #include "WebSocketServerClass.h" +#include "ScriptEngine.h" + WebSocketServerClass::WebSocketServerClass(QScriptEngine* engine, const QString& serverName, const quint16 port) : _webSocketServer(serverName, QWebSocketServer::SslMode::NonSecureMode), _engine(engine) diff --git a/libraries/script-engine/src/WheelEvent.cpp b/libraries/script-engine/src/WheelEvent.cpp index 70004d0d3f..a0a897c991 100644 --- a/libraries/script-engine/src/WheelEvent.cpp +++ b/libraries/script-engine/src/WheelEvent.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include -#include - #include "WheelEvent.h" +#include +#include + WheelEvent::WheelEvent() : x(0.0f), y(0.0f), @@ -99,4 +99,4 @@ QScriptValue WheelEvent::toScriptValue(QScriptEngine* engine, const WheelEvent& void WheelEvent::fromScriptValue(const QScriptValue& object, WheelEvent& event) { // nothing for now... -} \ No newline at end of file +} diff --git a/libraries/script-engine/src/WheelEvent.h b/libraries/script-engine/src/WheelEvent.h index edac4bc3c3..88ac828578 100644 --- a/libraries/script-engine/src/WheelEvent.h +++ b/libraries/script-engine/src/WheelEvent.h @@ -12,8 +12,12 @@ #ifndef hifi_WheelEvent_h #define hifi_WheelEvent_h +#include #include +class QScriptValue; +class QScriptEngine; + class WheelEvent { public: WheelEvent(); @@ -37,4 +41,4 @@ public: Q_DECLARE_METATYPE(WheelEvent) -#endif // hifi_WheelEvent_h \ No newline at end of file +#endif // hifi_WheelEvent_h diff --git a/libraries/script-engine/src/XMLHttpRequestClass.cpp b/libraries/script-engine/src/XMLHttpRequestClass.cpp index 62384f9d97..ebc459b2d1 100644 --- a/libraries/script-engine/src/XMLHttpRequestClass.cpp +++ b/libraries/script-engine/src/XMLHttpRequestClass.cpp @@ -12,6 +12,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "XMLHttpRequestClass.h" + #include #include @@ -20,7 +22,6 @@ #include #include "ScriptEngine.h" -#include "XMLHttpRequestClass.h" const QString METAVERSE_API_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/api/"; diff --git a/libraries/shared/src/AACube.cpp b/libraries/shared/src/AACube.cpp index 8cff3255b3..7dd2f8cb5b 100644 --- a/libraries/shared/src/AACube.cpp +++ b/libraries/shared/src/AACube.cpp @@ -9,8 +9,9 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "AABox.h" #include "AACube.h" + +#include "AABox.h" #include "Extents.h" #include "GeometryUtil.h" #include "NumericalConstants.h" diff --git a/libraries/shared/src/CubeProjectedPolygon.cpp b/libraries/shared/src/CubeProjectedPolygon.cpp index 04d6e8bb4e..acd2fc11d6 100644 --- a/libraries/shared/src/CubeProjectedPolygon.cpp +++ b/libraries/shared/src/CubeProjectedPolygon.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "CubeProjectedPolygon.h" + #include #include @@ -16,8 +18,6 @@ #include "GeometryUtil.h" #include "SharedUtil.h" #include "SharedLogging.h" -#include "CubeProjectedPolygon.h" - glm::vec2 BoundingRectangle::getVertex(int vertexNumber) const { switch (vertexNumber) { diff --git a/libraries/shared/src/GPUIdent.cpp b/libraries/shared/src/GPUIdent.cpp index 309cb30728..3b7a6cee40 100644 --- a/libraries/shared/src/GPUIdent.cpp +++ b/libraries/shared/src/GPUIdent.cpp @@ -8,8 +8,7 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -#include - +#include "GPUIdent.h" #ifdef Q_OS_WIN #include @@ -24,8 +23,9 @@ #include #endif +#include + #include "SharedLogging.h" -#include "GPUIdent.h" GPUIdent GPUIdent::_instance {}; diff --git a/libraries/shared/src/GPUIdent.h b/libraries/shared/src/GPUIdent.h index 8615e61b08..f780a4ddbd 100644 --- a/libraries/shared/src/GPUIdent.h +++ b/libraries/shared/src/GPUIdent.h @@ -16,6 +16,8 @@ #include +#include + class GPUIdent { public: diff --git a/libraries/shared/src/GenericThread.cpp b/libraries/shared/src/GenericThread.cpp index 230b9590f1..e35c74e68a 100644 --- a/libraries/shared/src/GenericThread.cpp +++ b/libraries/shared/src/GenericThread.cpp @@ -9,11 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include -#include - #include "GenericThread.h" +#include +#include GenericThread::GenericThread() : _stopThread(false), diff --git a/libraries/shared/src/Gzip.cpp b/libraries/shared/src/Gzip.cpp index 25e214fffb..06b499b88a 100644 --- a/libraries/shared/src/Gzip.cpp +++ b/libraries/shared/src/Gzip.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include #include "Gzip.h" +#include + const int GZIP_WINDOWS_BIT = 31; const int GZIP_CHUNK_SIZE = 4096; const int DEFAULT_MEM_LEVEL = 8; diff --git a/libraries/shared/src/LogUtils.cpp b/libraries/shared/src/LogUtils.cpp index 73667116a0..11a4665ab1 100644 --- a/libraries/shared/src/LogUtils.cpp +++ b/libraries/shared/src/LogUtils.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "LogUtils.h" +#include + void LogUtils::init() { #ifdef Q_OS_WIN // Windows applications buffer stdout/err hard when not run from a terminal, diff --git a/libraries/shared/src/OctalCode.cpp b/libraries/shared/src/OctalCode.cpp index c7ad4a790d..7f7d03c335 100644 --- a/libraries/shared/src/OctalCode.cpp +++ b/libraries/shared/src/OctalCode.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OctalCode.h" + #include // std:min #include #include @@ -17,7 +19,6 @@ #include #include "NumericalConstants.h" -#include "OctalCode.h" #include "SharedUtil.h" int numberOfThreeBitSectionsInCode(const unsigned char* octalCode, int maxBytes) { diff --git a/libraries/shared/src/PIDController.cpp b/libraries/shared/src/PIDController.cpp index 790c26ac25..5850e345cb 100644 --- a/libraries/shared/src/PIDController.cpp +++ b/libraries/shared/src/PIDController.cpp @@ -9,11 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include -#include -#include "SharedLogging.h" #include "PIDController.h" +#include + +#include + +#include "SharedLogging.h" + float PIDController::update(float measuredValue, float dt, bool resetAccumulator) { const float error = getMeasuredValueSetpoint() - measuredValue; // Sign is the direction we want measuredValue to go. Positive means go higher. diff --git a/libraries/shared/src/PerfStat.cpp b/libraries/shared/src/PerfStat.cpp index 13b3d44eda..c3bc44b7d3 100644 --- a/libraries/shared/src/PerfStat.cpp +++ b/libraries/shared/src/PerfStat.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "PerfStat.h" + #include #include #include @@ -16,8 +18,6 @@ #include #include -#include "PerfStat.h" - #include "NumericalConstants.h" #include "SharedLogging.h" diff --git a/libraries/shared/src/SimpleMovingAverage.cpp b/libraries/shared/src/SimpleMovingAverage.cpp index f75180afb5..9bcc6b732f 100644 --- a/libraries/shared/src/SimpleMovingAverage.cpp +++ b/libraries/shared/src/SimpleMovingAverage.cpp @@ -9,9 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "SharedUtil.h" #include "SimpleMovingAverage.h" +#include "SharedUtil.h" + SimpleMovingAverage::SimpleMovingAverage(int numSamplesToAverage) : _numSamples(0), _lastEventTimestamp(0), diff --git a/libraries/shared/src/StDev.cpp b/libraries/shared/src/StDev.cpp index 23afd12b98..99280ba42e 100644 --- a/libraries/shared/src/StDev.cpp +++ b/libraries/shared/src/StDev.cpp @@ -9,12 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "StDev.h" + #include #include #include -#include "StDev.h" - StDev::StDev() : _sampleCount(0) { diff --git a/libraries/shared/src/StreamUtils.cpp b/libraries/shared/src/StreamUtils.cpp index 876de2e698..9ed0e24593 100644 --- a/libraries/shared/src/StreamUtils.cpp +++ b/libraries/shared/src/StreamUtils.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include +#include "StreamUtils.h" #include -#include "StreamUtils.h" +#include void StreamUtil::dump(std::ostream& s, const QByteArray& buffer) { diff --git a/libraries/shared/src/TriangleSet.cpp b/libraries/shared/src/TriangleSet.cpp index 3f8f748720..d7f685f8d3 100644 --- a/libraries/shared/src/TriangleSet.cpp +++ b/libraries/shared/src/TriangleSet.cpp @@ -9,9 +9,9 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "GLMHelpers.h" #include "TriangleSet.h" +#include "GLMHelpers.h" void TriangleSet::insert(const Triangle& t) { _isBalanced = false; diff --git a/libraries/shared/src/VariantMapToScriptValue.cpp b/libraries/shared/src/VariantMapToScriptValue.cpp index 00fc2cd682..008c3a5d9b 100644 --- a/libraries/shared/src/VariantMapToScriptValue.cpp +++ b/libraries/shared/src/VariantMapToScriptValue.cpp @@ -9,10 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include -#include "SharedLogging.h" #include "VariantMapToScriptValue.h" +#include + +#include "SharedLogging.h" QScriptValue variantToScriptValue(QVariant& qValue, QScriptEngine& scriptEngine) { switch(qValue.type()) { diff --git a/libraries/shared/src/ViewFrustum.cpp b/libraries/shared/src/ViewFrustum.cpp index 3aa70b0897..3e03c13fa4 100644 --- a/libraries/shared/src/ViewFrustum.cpp +++ b/libraries/shared/src/ViewFrustum.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ViewFrustum.h" + #include #include @@ -16,15 +18,13 @@ #include #include #include -#include +#include #include "GeometryUtil.h" #include "GLMHelpers.h" #include "NumericalConstants.h" #include "SharedLogging.h" -//#include "OctreeConstants.h" -#include "ViewFrustum.h" using namespace std; diff --git a/libraries/shared/src/shared/StringHelpers.cpp b/libraries/shared/src/shared/StringHelpers.cpp index 1c1730bd5a..39ac23e510 100644 --- a/libraries/shared/src/shared/StringHelpers.cpp +++ b/libraries/shared/src/shared/StringHelpers.cpp @@ -6,10 +6,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "StringHelpers.h" +#include + /// Note: this will not preserve line breaks in the original input. QString simpleWordWrap(const QString& input, int maxCharactersPerLine) { QStringList words = input.split(QRegExp("\\s+")); diff --git a/plugins/pcmCodec/src/PCMCodecManager.cpp b/plugins/pcmCodec/src/PCMCodecManager.cpp index 051f3973a8..04adb367af 100644 --- a/plugins/pcmCodec/src/PCMCodecManager.cpp +++ b/plugins/pcmCodec/src/PCMCodecManager.cpp @@ -9,12 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "PCMCodecManager.h" + #include #include -#include "PCMCodecManager.h" - const char* PCMCodec::NAME { "pcm" }; void PCMCodec::init() { diff --git a/tests/jitter/src/JitterTests.cpp b/tests/jitter/src/JitterTests.cpp index b09cb40d3e..5c81177b88 100644 --- a/tests/jitter/src/JitterTests.cpp +++ b/tests/jitter/src/JitterTests.cpp @@ -6,6 +6,8 @@ // Copyright (c) 2014 High Fidelity, Inc. All rights reserved. // +#include "JitterTests.h" + #include #ifdef _WINDOWS #include @@ -23,8 +25,6 @@ #include #include -#include "JitterTests.h" - // Uncomment this to run manually //#define RUN_MANUALLY diff --git a/tests/networking/src/ResourceTests.cpp b/tests/networking/src/ResourceTests.cpp index e83eeb66a0..864d7c9939 100644 --- a/tests/networking/src/ResourceTests.cpp +++ b/tests/networking/src/ResourceTests.cpp @@ -7,14 +7,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ResourceTests.h" + #include #include "ResourceCache.h" #include "NetworkAccessManager.h" #include "DependencyManager.h" -#include "ResourceTests.h" - QTEST_MAIN(ResourceTests) void ResourceTests::initTestCase() { diff --git a/tests/networking/src/SequenceNumberStatsTests.cpp b/tests/networking/src/SequenceNumberStatsTests.cpp index aaaeea53fc..0f01fb5b66 100644 --- a/tests/networking/src/SequenceNumberStatsTests.cpp +++ b/tests/networking/src/SequenceNumberStatsTests.cpp @@ -9,12 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "SequenceNumberStatsTests.h" + #include #include -#include "SequenceNumberStatsTests.h" - QTEST_MAIN(SequenceNumberStatsTests) const quint32 UINT16_RANGE = std::numeric_limits::max() + 1; diff --git a/tests/octree/src/AABoxCubeTests.cpp b/tests/octree/src/AABoxCubeTests.cpp index 8180e6f674..4e0a75e3b9 100644 --- a/tests/octree/src/AABoxCubeTests.cpp +++ b/tests/octree/src/AABoxCubeTests.cpp @@ -9,11 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "AABoxCubeTests.h" + #include #include -#include "AABoxCubeTests.h" - QTEST_MAIN(AABoxCubeTests) void AABoxCubeTests::raycastOutHitsXMinFace() { diff --git a/tests/octree/src/ModelTests.cpp b/tests/octree/src/ModelTests.cpp index c2d170da9a..f3e17a56a5 100644 --- a/tests/octree/src/ModelTests.cpp +++ b/tests/octree/src/ModelTests.cpp @@ -12,6 +12,9 @@ // * need to add expected results and accumulation of test success/failure // +#include "ModelTests.h" // needs to be EntityTests.h soon +//#include "EntityTests.h" + #include #include @@ -22,9 +25,6 @@ #include #include -//#include "EntityTests.h" -#include "ModelTests.h" // needs to be EntityTests.h soon - QTEST_MAIN(EntityTests) /* diff --git a/tests/octree/src/OctreeTests.cpp b/tests/octree/src/OctreeTests.cpp index 81300a1293..ae04313a6a 100644 --- a/tests/octree/src/OctreeTests.cpp +++ b/tests/octree/src/OctreeTests.cpp @@ -12,6 +12,8 @@ // * need to add expected results and accumulation of test success/failure // +#include "OctreeTests.h" + #include #include @@ -23,8 +25,6 @@ #include #include -#include "OctreeTests.h" - enum ExamplePropertyList { EXAMPLE_PROP_PAGED_PROPERTY, EXAMPLE_PROP_CUSTOM_PROPERTIES_INCLUDED, diff --git a/tests/physics/src/ShapeInfoTests.cpp b/tests/physics/src/ShapeInfoTests.cpp index 79d0092dc3..efc88a4032 100644 --- a/tests/physics/src/ShapeInfoTests.cpp +++ b/tests/physics/src/ShapeInfoTests.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ShapeInfoTests.h" + #include #include @@ -19,8 +21,6 @@ #include #include -#include "ShapeInfoTests.h" - QTEST_MAIN(ShapeInfoTests) // Enable this to manually run testHashCollisions diff --git a/tests/physics/src/ShapeManagerTests.cpp b/tests/physics/src/ShapeManagerTests.cpp index f214601a42..393bfdcd07 100644 --- a/tests/physics/src/ShapeManagerTests.cpp +++ b/tests/physics/src/ShapeManagerTests.cpp @@ -9,13 +9,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ShapeManagerTests.h" + #include + #include #include #include -#include "ShapeManagerTests.h" - QTEST_MAIN(ShapeManagerTests) void ShapeManagerTests::testShapeAccounting() { diff --git a/tests/shared/src/AABoxTests.cpp b/tests/shared/src/AABoxTests.cpp index 2e9dfab497..865a82e86c 100644 --- a/tests/shared/src/AABoxTests.cpp +++ b/tests/shared/src/AABoxTests.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "AABoxTests.h" +#include + #include #include #include diff --git a/tests/shared/src/AACubeTests.cpp b/tests/shared/src/AACubeTests.cpp index 177daf89f1..4d684b4677 100644 --- a/tests/shared/src/AACubeTests.cpp +++ b/tests/shared/src/AACubeTests.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "AACubeTests.h" +#include + #include #include #include diff --git a/tests/shared/src/DualQuaternionTests.cpp b/tests/shared/src/DualQuaternionTests.cpp index fe14d9d166..276eb44f64 100644 --- a/tests/shared/src/DualQuaternionTests.cpp +++ b/tests/shared/src/DualQuaternionTests.cpp @@ -8,10 +8,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "DualQuaternionTests.h" +#include + #include #include #include diff --git a/tests/shared/src/GeometryUtilTests.cpp b/tests/shared/src/GeometryUtilTests.cpp index eb9be4987f..9b4f0f250f 100644 --- a/tests/shared/src/GeometryUtilTests.cpp +++ b/tests/shared/src/GeometryUtilTests.cpp @@ -9,10 +9,10 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include - #include "GeometryUtilTests.h" +#include + #include #include #include diff --git a/tools/ac-client/src/ACClientApp.cpp b/tools/ac-client/src/ACClientApp.cpp index 4711dc4102..cfede87c53 100644 --- a/tools/ac-client/src/ACClientApp.cpp +++ b/tools/ac-client/src/ACClientApp.cpp @@ -9,10 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ACClientApp.h" + #include #include #include #include + #include #include #include @@ -20,8 +23,6 @@ #include #include -#include "ACClientApp.h" - ACClientApp::ACClientApp(int argc, char* argv[]) : QCoreApplication(argc, argv) { diff --git a/tools/atp-client/src/ATPClientApp.cpp b/tools/atp-client/src/ATPClientApp.cpp index 526065b2f7..c688ba9c82 100644 --- a/tools/atp-client/src/ATPClientApp.cpp +++ b/tools/atp-client/src/ATPClientApp.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ATPClientApp.h" + #include #include #include @@ -25,8 +27,6 @@ #include #include -#include "ATPClientApp.h" - #define HIGH_FIDELITY_ATP_CLIENT_USER_AGENT "Mozilla/5.0 (HighFidelityATPClient)" #define TIMEOUT_MILLISECONDS 8000 diff --git a/tools/ice-client/src/ICEClientApp.cpp b/tools/ice-client/src/ICEClientApp.cpp index f9e7a76142..0301fad6f4 100644 --- a/tools/ice-client/src/ICEClientApp.cpp +++ b/tools/ice-client/src/ICEClientApp.cpp @@ -9,15 +9,16 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ICEClientApp.h" + #include #include #include + #include #include #include -#include "ICEClientApp.h" - ICEClientApp::ICEClientApp(int argc, char* argv[]) : QCoreApplication(argc, argv) { diff --git a/tools/oven/src/BakerCLI.cpp b/tools/oven/src/BakerCLI.cpp index 35550cdca8..a7b8401269 100644 --- a/tools/oven/src/BakerCLI.cpp +++ b/tools/oven/src/BakerCLI.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "BakerCLI.h" + #include #include #include @@ -16,7 +18,6 @@ #include "OvenCLIApplication.h" #include "ModelBakingLoggingCategory.h" -#include "BakerCLI.h" #include "FBXBaker.h" #include "JSBaker.h" #include "TextureBaker.h" diff --git a/tools/oven/src/OvenCLIApplication.cpp b/tools/oven/src/OvenCLIApplication.cpp index 2fb8ea03f2..ab3178db01 100644 --- a/tools/oven/src/OvenCLIApplication.cpp +++ b/tools/oven/src/OvenCLIApplication.cpp @@ -9,13 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OvenCLIApplication.h" + #include #include #include "BakerCLI.h" -#include "OvenCLIApplication.h" - static const QString CLI_INPUT_PARAMETER = "i"; static const QString CLI_OUTPUT_PARAMETER = "o"; static const QString CLI_TYPE_PARAMETER = "t"; diff --git a/tools/oven/src/ui/BakeWidget.cpp b/tools/oven/src/ui/BakeWidget.cpp index 43f4c50328..931ef1de43 100644 --- a/tools/oven/src/ui/BakeWidget.cpp +++ b/tools/oven/src/ui/BakeWidget.cpp @@ -9,12 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "BakeWidget.h" + #include #include "../OvenGUIApplication.h" -#include "BakeWidget.h" - BakeWidget::BakeWidget(QWidget* parent, Qt::WindowFlags flags) : QWidget(parent, flags) { diff --git a/tools/oven/src/ui/DomainBakeWidget.cpp b/tools/oven/src/ui/DomainBakeWidget.cpp index bf79319458..1121041e39 100644 --- a/tools/oven/src/ui/DomainBakeWidget.cpp +++ b/tools/oven/src/ui/DomainBakeWidget.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "DomainBakeWidget.h" + #include #include @@ -23,8 +25,6 @@ #include "../OvenGUIApplication.h" -#include "DomainBakeWidget.h" - static const QString DOMAIN_NAME_SETTING_KEY = "domain_name"; static const QString EXPORT_DIR_SETTING_KEY = "domain_export_directory"; static const QString BROWSE_START_DIR_SETTING_KEY = "domain_search_directory"; diff --git a/tools/oven/src/ui/ModelBakeWidget.cpp b/tools/oven/src/ui/ModelBakeWidget.cpp index f80185df0f..9fa586871e 100644 --- a/tools/oven/src/ui/ModelBakeWidget.cpp +++ b/tools/oven/src/ui/ModelBakeWidget.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ModelBakeWidget.h" + #include #include #include @@ -26,7 +28,6 @@ #include "OvenMainWindow.h" #include "FBXBaker.h" #include "OBJBaker.h" -#include "ModelBakeWidget.h" static const auto EXPORT_DIR_SETTING_KEY = "model_export_directory"; diff --git a/tools/oven/src/ui/ModesWidget.cpp b/tools/oven/src/ui/ModesWidget.cpp index 624aa949cc..1fdfce2c97 100644 --- a/tools/oven/src/ui/ModesWidget.cpp +++ b/tools/oven/src/ui/ModesWidget.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ModesWidget.h" + #include #include #include @@ -17,8 +19,6 @@ #include "ModelBakeWidget.h" #include "SkyboxBakeWidget.h" -#include "ModesWidget.h" - ModesWidget::ModesWidget(QWidget* parent, Qt::WindowFlags flags) : QWidget(parent, flags) { diff --git a/tools/oven/src/ui/OvenMainWindow.cpp b/tools/oven/src/ui/OvenMainWindow.cpp index bebc2fa7dc..59cad3aac5 100644 --- a/tools/oven/src/ui/OvenMainWindow.cpp +++ b/tools/oven/src/ui/OvenMainWindow.cpp @@ -9,12 +9,12 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "OvenMainWindow.h" + #include #include "ModesWidget.h" -#include "OvenMainWindow.h" - OvenMainWindow::OvenMainWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) { diff --git a/tools/oven/src/ui/ResultsWindow.cpp b/tools/oven/src/ui/ResultsWindow.cpp index 3a37a328de..feb7fbc4f1 100644 --- a/tools/oven/src/ui/ResultsWindow.cpp +++ b/tools/oven/src/ui/ResultsWindow.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "ResultsWindow.h" + #include #include #include @@ -17,8 +19,6 @@ #include "OvenMainWindow.h" -#include "ResultsWindow.h" - ResultsWindow::ResultsWindow(QWidget* parent) : QWidget(parent) { diff --git a/tools/oven/src/ui/SkyboxBakeWidget.cpp b/tools/oven/src/ui/SkyboxBakeWidget.cpp index 369b06c39f..71ae0cbab0 100644 --- a/tools/oven/src/ui/SkyboxBakeWidget.cpp +++ b/tools/oven/src/ui/SkyboxBakeWidget.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "SkyboxBakeWidget.h" + #include #include #include @@ -21,9 +23,9 @@ #include #include -#include "../OvenGUIApplication.h" +#include -#include "SkyboxBakeWidget.h" +#include "../OvenGUIApplication.h" static const auto EXPORT_DIR_SETTING_KEY = "skybox_export_directory"; static const auto SELECTION_START_DIR_SETTING_KEY = "skybox_search_directory"; diff --git a/tools/vhacd-util/src/VHACDUtilApp.cpp b/tools/vhacd-util/src/VHACDUtilApp.cpp index 4d48bdf2bf..c263dce609 100644 --- a/tools/vhacd-util/src/VHACDUtilApp.cpp +++ b/tools/vhacd-util/src/VHACDUtilApp.cpp @@ -9,10 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "VHACDUtilApp.h" + #include + #include #include -#include "VHACDUtilApp.h" + #include "VHACDUtil.h" #include "PathUtils.h" From 5a3773ba72811d8dfbe04ad0c2703adc87147764 Mon Sep 17 00:00:00 2001 From: Clement Date: Fri, 4 May 2018 17:08:42 -0700 Subject: [PATCH 30/30] Fix compile error on linux/windows --- interface/src/LocationBookmarks.cpp | 5 ----- interface/src/LocationBookmarks.h | 1 + interface/src/ModelPackager.h | 2 ++ libraries/entities/src/EntityTypes.h | 1 + 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/interface/src/LocationBookmarks.cpp b/interface/src/LocationBookmarks.cpp index f29a8f18f9..8415c84282 100644 --- a/interface/src/LocationBookmarks.cpp +++ b/interface/src/LocationBookmarks.cpp @@ -12,16 +12,11 @@ #include "LocationBookmarks.h" #include -#include -#include #include -#include #include -#include #include -#include "MainWindow.h" #include "Menu.h" const QString LocationBookmarks::HOME_BOOKMARK = "Home"; diff --git a/interface/src/LocationBookmarks.h b/interface/src/LocationBookmarks.h index 9a800ba35e..39abea9ba4 100644 --- a/interface/src/LocationBookmarks.h +++ b/interface/src/LocationBookmarks.h @@ -13,6 +13,7 @@ #define hifi_LocationBookmarks_h #include + #include "Bookmarks.h" class LocationBookmarks : public Bookmarks, public Dependency { diff --git a/interface/src/ModelPackager.h b/interface/src/ModelPackager.h index acd4d85f68..76295e5a85 100644 --- a/interface/src/ModelPackager.h +++ b/interface/src/ModelPackager.h @@ -12,6 +12,8 @@ #ifndef hifi_ModelPackager_h #define hifi_ModelPackager_h +#include + #include #include diff --git a/libraries/entities/src/EntityTypes.h b/libraries/entities/src/EntityTypes.h index 0e2fca8180..1f3434d254 100644 --- a/libraries/entities/src/EntityTypes.h +++ b/libraries/entities/src/EntityTypes.h @@ -12,6 +12,7 @@ #ifndef hifi_EntityTypes_h #define hifi_EntityTypes_h +#include #include #include