From 91b0f6931238ae9b9c061ff9fc97a9828f6fccca Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Tue, 26 Jan 2016 21:02:16 -0800 Subject: [PATCH 1/8] When the avatar marketplace is chosen from avatar preferences, let it be moveable so that the user can move it aside to see their avatar. --- .../resources/qml/dialogs/preferences/AvatarBrowser.qml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml b/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml index 7af5dc851e..cdeddb5886 100644 --- a/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml +++ b/interface/resources/qml/dialogs/preferences/AvatarBrowser.qml @@ -1,5 +1,5 @@ -import QtQuick 2.3 -import QtQuick.Controls 1.2 +import QtQuick 2.5 +import QtQuick.Controls 1.4 import QtWebEngine 1.1 import "../../windows" as Windows @@ -11,9 +11,7 @@ Windows.Window { HifiConstants { id: hifi } width: 900; height: 700 resizable: true - anchors.centerIn: parent modality: Qt.ApplicationModal - frame: Windows.ModalFrame {} Item { anchors.fill: parent From 98453c085b5d966ecf752b388178b1f1475064f5 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 28 Jan 2016 12:08:21 -0800 Subject: [PATCH 2/8] Moved source URL up to top of entity properties panel --- examples/html/entityProperties.html | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index 898f2bea6d..d8a157d5ca 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -976,6 +976,17 @@ +
+ +
+ +
+
Source URL
+
+ +
+
+
@@ -1311,18 +1322,6 @@
-
- -
- -
-
Source URL
-
- -
-
- -
From bf3a09cd00596c6134393365ed76ea8d9f826e8c Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 28 Jan 2016 12:14:20 -0800 Subject: [PATCH 3/8] Fixing the default value for the TOneMapping curve and cleaning the code into the ToneMappingEffect file --- .../render-utils/src/RenderDeferredTask.cpp | 15 +--------- .../render-utils/src/RenderDeferredTask.h | 28 ------------------ .../render-utils/src/ToneMappingEffect.cpp | 17 ++++++++++- .../render-utils/src/ToneMappingEffect.h | 29 ++++++++++++++++++- 4 files changed, 45 insertions(+), 44 deletions(-) diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index eb46129777..d76d0a77de 100755 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -27,6 +27,7 @@ #include "render/DrawStatus.h" #include "AmbientOcclusionEffect.h" #include "AntialiasingEffect.h" +#include "ToneMappingEffect.h" #include "RenderDeferredTask.h" @@ -67,20 +68,6 @@ void RenderDeferred::run(const SceneContextPointer& sceneContext, const RenderCo DependencyManager::get()->render(renderContext); } -void ToneMappingDeferred::configure(const Config& config) { - if (config.exposure >= 0.0f) { - _toneMappingEffect.setExposure(config.exposure); - } - - if (config.curve >= 0) { - _toneMappingEffect.setToneCurve((ToneMappingEffect::ToneCurve)config.curve); - } -} - -void ToneMappingDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) { - _toneMappingEffect.render(renderContext->args); -} - RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) { cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; }; diff --git a/libraries/render-utils/src/RenderDeferredTask.h b/libraries/render-utils/src/RenderDeferredTask.h index 414b019b31..8d773a9b21 100755 --- a/libraries/render-utils/src/RenderDeferredTask.h +++ b/libraries/render-utils/src/RenderDeferredTask.h @@ -16,8 +16,6 @@ #include "render/DrawTask.h" -#include "ToneMappingEffect.h" - class SetupDeferred { public: void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext); @@ -40,32 +38,6 @@ public: using JobModel = render::Job::Model; }; - -class ToneMappingConfig : public render::Job::Config { - Q_OBJECT - Q_PROPERTY(bool enabled MEMBER enabled) - Q_PROPERTY(float exposure MEMBER exposure NOTIFY dirty); - Q_PROPERTY(int curve MEMBER curve NOTIFY dirty); -public: - ToneMappingConfig() : render::Job::Config(true) {} - - float exposure{ 0.0f }; - int curve{ 3 }; -signals: - void dirty(); -}; - -class ToneMappingDeferred { -public: - using Config = ToneMappingConfig; - using JobModel = render::Job::Model; - - void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext); - - ToneMappingEffect _toneMappingEffect; -}; - class DrawConfig : public render::Job::Config { Q_OBJECT Q_PROPERTY(int numDrawn READ getNumDrawn) diff --git a/libraries/render-utils/src/ToneMappingEffect.cpp b/libraries/render-utils/src/ToneMappingEffect.cpp index 55b7d41ab3..da11507965 100644 --- a/libraries/render-utils/src/ToneMappingEffect.cpp +++ b/libraries/render-utils/src/ToneMappingEffect.cpp @@ -145,4 +145,19 @@ void ToneMappingEffect::render(RenderArgs* args) { batch.setResourceTexture(ToneMappingEffect_LightingMapSlot, lightingBuffer); batch.draw(gpu::TRIANGLE_STRIP, 4); }); -} \ No newline at end of file +} + + +void ToneMappingDeferred::configure(const Config& config) { + if (config.exposure >= 0.0f) { + _toneMappingEffect.setExposure(config.exposure); + } + + if (config.curve >= 0) { + _toneMappingEffect.setToneCurve((ToneMappingEffect::ToneCurve)config.curve); + } +} + +void ToneMappingDeferred::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext) { + _toneMappingEffect.render(renderContext->args); +} diff --git a/libraries/render-utils/src/ToneMappingEffect.h b/libraries/render-utils/src/ToneMappingEffect.h index 20ee9024cf..f6747180a2 100644 --- a/libraries/render-utils/src/ToneMappingEffect.h +++ b/libraries/render-utils/src/ToneMappingEffect.h @@ -17,6 +17,8 @@ #include #include +#include + class RenderArgs; @@ -50,7 +52,7 @@ private: float _exposure = 0.0f; float _twoPowExposure = 1.0f; glm::vec2 spareA; - int _toneCurve = Filmic; + int _toneCurve = Gamma22; glm::vec3 spareB; Parameters() {} @@ -61,4 +63,29 @@ private: void init(); }; +class ToneMappingConfig : public render::Job::Config { + Q_OBJECT + Q_PROPERTY(bool enabled MEMBER enabled) + Q_PROPERTY(float exposure MEMBER exposure NOTIFY dirty); + Q_PROPERTY(int curve MEMBER curve NOTIFY dirty); +public: + ToneMappingConfig() : render::Job::Config(true) {} + + float exposure{ 0.0f }; + int curve{ 1 }; +signals: + void dirty(); +}; + +class ToneMappingDeferred { +public: + using Config = ToneMappingConfig; + using JobModel = render::Job::Model; + + void configure(const Config& config); + void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext); + + ToneMappingEffect _toneMappingEffect; +}; + #endif // hifi_ToneMappingEffect_h From 62d5a45829222c981d804e910d8a78f577566abf Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 28 Jan 2016 12:20:09 -0800 Subject: [PATCH 4/8] Cleaner init --- libraries/render-utils/src/ToneMappingEffect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/render-utils/src/ToneMappingEffect.h b/libraries/render-utils/src/ToneMappingEffect.h index f6747180a2..e9a4479dc9 100644 --- a/libraries/render-utils/src/ToneMappingEffect.h +++ b/libraries/render-utils/src/ToneMappingEffect.h @@ -72,7 +72,7 @@ public: ToneMappingConfig() : render::Job::Config(true) {} float exposure{ 0.0f }; - int curve{ 1 }; + int curve{ ToneMappingEffect::Gamma22 }; signals: void dirty(); }; From ef451d40df3d2516cbda67d927c5825eda05c6b3 Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 28 Jan 2016 12:39:52 -0800 Subject: [PATCH 5/8] Cleaner... --- libraries/render-utils/src/ToneMappingEffect.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/render-utils/src/ToneMappingEffect.h b/libraries/render-utils/src/ToneMappingEffect.h index e9a4479dc9..aa48494ca0 100644 --- a/libraries/render-utils/src/ToneMappingEffect.h +++ b/libraries/render-utils/src/ToneMappingEffect.h @@ -66,11 +66,15 @@ private: class ToneMappingConfig : public render::Job::Config { Q_OBJECT Q_PROPERTY(bool enabled MEMBER enabled) - Q_PROPERTY(float exposure MEMBER exposure NOTIFY dirty); - Q_PROPERTY(int curve MEMBER curve NOTIFY dirty); + Q_PROPERTY(float exposure MEMBER exposure WRITE setExposure); + Q_PROPERTY(int curve MEMBER curve WRITE setCurve); public: ToneMappingConfig() : render::Job::Config(true) {} + void setExposure(float newExposure) { exposure = std::max(0.0f, newExposure); emit dirty(); } + void setCurve(int newCurve) { curve = std::max((int)ToneMappingEffect::None, std::min((int)ToneMappingEffect::Filmic, newCurve)); emit dirty(); } + + float exposure{ 0.0f }; int curve{ ToneMappingEffect::Gamma22 }; signals: From 5863e340af253586217bf4ef18eae36205b3fa1e Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 28 Jan 2016 12:46:18 -0800 Subject: [PATCH 6/8] Cleaner... --- libraries/render-utils/src/ToneMappingEffect.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/render-utils/src/ToneMappingEffect.h b/libraries/render-utils/src/ToneMappingEffect.h index aa48494ca0..3dd212c2dc 100644 --- a/libraries/render-utils/src/ToneMappingEffect.h +++ b/libraries/render-utils/src/ToneMappingEffect.h @@ -65,8 +65,8 @@ private: class ToneMappingConfig : public render::Job::Config { Q_OBJECT - Q_PROPERTY(bool enabled MEMBER enabled) - Q_PROPERTY(float exposure MEMBER exposure WRITE setExposure); + Q_PROPERTY(bool enabled MEMBER enabled) + Q_PROPERTY(float exposure MEMBER exposure WRITE setExposure); Q_PROPERTY(int curve MEMBER curve WRITE setCurve); public: ToneMappingConfig() : render::Job::Config(true) {} From 311f1ac0e376409a9a7e6eda5262b6f976354bd0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 28 Jan 2016 15:37:45 -0800 Subject: [PATCH 7/8] fix for overflow on time of next frame --- libraries/audio/src/AudioConstants.h | 3 +++ libraries/audio/src/AudioInjector.cpp | 4 +++- libraries/audio/src/AudioInjector.h | 2 +- libraries/audio/src/AudioInjectorManager.cpp | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libraries/audio/src/AudioConstants.h b/libraries/audio/src/AudioConstants.h index 6c12c6aa15..d5fd3f15e7 100644 --- a/libraries/audio/src/AudioConstants.h +++ b/libraries/audio/src/AudioConstants.h @@ -29,7 +29,10 @@ namespace AudioConstants { const int NETWORK_FRAME_SAMPLES_PER_CHANNEL = NETWORK_FRAME_BYTES_PER_CHANNEL / sizeof(AudioSample); const float NETWORK_FRAME_MSECS = (AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL / (float)AudioConstants::SAMPLE_RATE) * 1000.0f; + + // be careful with overflows when using this constant const int NETWORK_FRAME_USECS = static_cast(NETWORK_FRAME_MSECS * 1000.0f); + const int MIN_SAMPLE_VALUE = std::numeric_limits::min(); const int MAX_SAMPLE_VALUE = std::numeric_limits::max(); } diff --git a/libraries/audio/src/AudioInjector.cpp b/libraries/audio/src/AudioInjector.cpp index 8eb032f8a8..5fd35bc37a 100644 --- a/libraries/audio/src/AudioInjector.cpp +++ b/libraries/audio/src/AudioInjector.cpp @@ -321,14 +321,16 @@ int64_t AudioInjector::injectNextFrame() { const int MAX_ALLOWED_FRAMES_TO_FALL_BEHIND = 7; int64_t currentTime = _frameTimer->nsecsElapsed() / 1000; auto currentFrameBasedOnElapsedTime = currentTime / AudioConstants::NETWORK_FRAME_USECS; + if (currentFrameBasedOnElapsedTime - _nextFrame > MAX_ALLOWED_FRAMES_TO_FALL_BEHIND) { // If we are falling behind by more frames than our threshold, let's skip the frames ahead - qDebug() << "AudioInjector::injectNextFrame() skipping ahead, fell behind by " << (currentFrameBasedOnElapsedTime - _nextFrame) << " frames"; + qDebug() << this << "injectNextFrame() skipping ahead, fell behind by " << (currentFrameBasedOnElapsedTime - _nextFrame) << " frames"; _nextFrame = currentFrameBasedOnElapsedTime; _currentSendOffset = _nextFrame * AudioConstants::NETWORK_FRAME_BYTES_PER_CHANNEL * (_options.stereo ? 2 : 1) % _audioData.size(); } int64_t playNextFrameAt = ++_nextFrame * AudioConstants::NETWORK_FRAME_USECS; + return std::max(INT64_C(0), playNextFrameAt - currentTime); } diff --git a/libraries/audio/src/AudioInjector.h b/libraries/audio/src/AudioInjector.h index acfbc2b04a..79e2e645dd 100644 --- a/libraries/audio/src/AudioInjector.h +++ b/libraries/audio/src/AudioInjector.h @@ -99,7 +99,7 @@ private: AbstractAudioInterface* _localAudioInterface { nullptr }; AudioInjectorLocalBuffer* _localBuffer { nullptr }; - int _nextFrame { 0 }; + int64_t _nextFrame { 0 }; std::unique_ptr _frameTimer { nullptr }; quint16 _outgoingSequenceNumber { 0 }; diff --git a/libraries/audio/src/AudioInjectorManager.cpp b/libraries/audio/src/AudioInjectorManager.cpp index b91bddc553..2327bda0e7 100644 --- a/libraries/audio/src/AudioInjectorManager.cpp +++ b/libraries/audio/src/AudioInjectorManager.cpp @@ -87,7 +87,7 @@ void AudioInjectorManager::run() { if (!injector.isNull()) { // this is an injector that's ready to go, have it send a frame now auto nextCallDelta = injector->injectNextFrame(); - + if (nextCallDelta >= 0 && !injector->isFinished()) { // re-enqueue the injector with the correct timing _injectors.emplace(usecTimestampNow() + nextCallDelta, injector); From 0c2805db7ed8b9f5be7e6ddf1d9071a35cc89de7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 28 Jan 2016 15:50:04 -0800 Subject: [PATCH 8/8] remove debug added to catch injector DOS --- libraries/audio/src/AudioInjector.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/libraries/audio/src/AudioInjector.cpp b/libraries/audio/src/AudioInjector.cpp index 5fd35bc37a..ea63df7f17 100644 --- a/libraries/audio/src/AudioInjector.cpp +++ b/libraries/audio/src/AudioInjector.cpp @@ -295,14 +295,7 @@ int64_t AudioInjector::injectNextFrame() { if (audioMixer) { // send off this audio packet - auto bytesWritten = nodeList->sendUnreliablePacket(*_currentPacket, *audioMixer); - if (bytesWritten < 0) { - auto currentTime = _frameTimer->nsecsElapsed() / 1000; - qDebug() << this << "error sending audio injector packet. NF:" - << _nextFrame << "CT:" << currentTime - << "CF:" << currentTime / AudioConstants::NETWORK_FRAME_USECS; - } - + nodeList->sendUnreliablePacket(*_currentPacket, *audioMixer); _outgoingSequenceNumber++; }