From 00f3682bbee19058d6f39caa2d1390d36694362f Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 27 Feb 2018 14:09:31 -0800 Subject: [PATCH 01/21] NOT WORKING YET. --- .../render-utils/src/RenderPipelines.cpp | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 3fedae1778..6e3d3c85e7 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -490,7 +490,7 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip // Same thing but with Fade on addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent().withFade(), - skinModelFadeVertex, modelTranslucentFadePixel, batchSetter, itemSetter); + skinModelFadeDualQuatVertex, modelTranslucentFadePixel, batchSetter, itemSetter); addPipeline( Key::Builder().withMaterial().withSkinned().withDualQuatSkinned().withTranslucent().withTangents().withFade(), skinModelNormalMapFadeDualQuatVertex, modelTranslucentNormalMapFadePixel, batchSetter, itemSetter); @@ -521,10 +521,15 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba // Vertex shaders auto modelVertex = model_vert::getShader(); auto modelNormalMapVertex = model_normal_map_vert::getShader(); + auto skinModelVertex = skin_model_vert::getShader(); auto skinModelNormalMapVertex = skin_model_normal_map_vert::getShader(); auto skinModelNormalMapFadeVertex = skin_model_normal_map_fade_vert::getShader(); + auto skinModelDualQuatVertex = skin_model_dq_vert::getShader(); + auto skinModelNormalMapDualQuatVertex = skin_model_normal_map_dq_vert::getShader(); + auto skinModelNormalMapFadeDualQuatVertex = skin_model_normal_map_fade_dq_vert::getShader(); + // Pixel shaders auto modelPixel = forward_model_frag::getShader(); auto modelUnlitPixel = forward_model_unlit_frag::getShader(); @@ -568,6 +573,22 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba Key::Builder().withMaterial().withSkinned().withTangents().withFade(), skinModelNormalMapFadeVertex, modelNormalMapFadePixel, batchSetter, itemSetter, nullptr, nullptr); + // Dual Quaternion + addPipeline( + Key::Builder().withMaterial().withSkinned(), + skinModelDualQuatVertex, modelPixel, nullptr, nullptr); + addPipeline( + Key::Builder().withMaterial().withSkinned().withTangents(), + skinModelNormalMapDualQuatVertex, modelNormalMapPixel, nullptr, nullptr); + addPipeline( + Key::Builder().withMaterial().withSkinned(), + skinModelDualQuatVertex, modelSpecularMapPixel, nullptr, nullptr); + addPipeline( + Key::Builder().withMaterial().withSkinned().withTangents().withSpecular(), + skinModelNormalMapDualQuatVertex, modelNormalSpecularMapPixel, nullptr, nullptr); + addPipeline( + Key::Builder().withMaterial().withSkinned().withTangents().withFade(), + skinModelNormalMapFadeDualQuatVertex, modelNormalMapFadePixel, batchSetter, itemSetter, nullptr, nullptr); } void addPlumberPipeline(ShapePlumber& plumber, From f52f146db5f70832d4ce6fb8c16beff7bcfc4012 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 27 Feb 2018 16:28:46 -0800 Subject: [PATCH 02/21] WIP. --- .../render-utils/src/RenderPipelines.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 6e3d3c85e7..6264d82187 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -515,13 +515,22 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip addPipeline( Key::Builder().withSkinned().withDepthOnly().withFade(), skinModelShadowFadeVertex, modelShadowFadePixel, batchSetter, itemSetter); + + // Now repeat for dual quaternion + // Depth-only + addPipeline( + Key::Builder().withSkinned().withDepthOnly().withDualQuatSkinned(), + skinModelShadowDualQuatVertex, modelShadowPixel, nullptr, nullptr); + // Same thing but with Fade on + addPipeline( + Key::Builder().withSkinned().withDepthOnly().withFade().withDualQuatSkinned(), + skinModelShadowDualQuatVertex, modelShadowFadePixel, batchSetter, itemSetter); } void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter) { // Vertex shaders auto modelVertex = model_vert::getShader(); auto modelNormalMapVertex = model_normal_map_vert::getShader(); - auto skinModelVertex = skin_model_vert::getShader(); auto skinModelNormalMapVertex = skin_model_normal_map_vert::getShader(); auto skinModelNormalMapFadeVertex = skin_model_normal_map_fade_vert::getShader(); @@ -575,19 +584,19 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba // Dual Quaternion addPipeline( - Key::Builder().withMaterial().withSkinned(), + Key::Builder().withMaterial().withSkinned().withDualQuatSkinned(), skinModelDualQuatVertex, modelPixel, nullptr, nullptr); addPipeline( - Key::Builder().withMaterial().withSkinned().withTangents(), + Key::Builder().withMaterial().withSkinned().withTangents().withDualQuatSkinned(), skinModelNormalMapDualQuatVertex, modelNormalMapPixel, nullptr, nullptr); addPipeline( Key::Builder().withMaterial().withSkinned(), skinModelDualQuatVertex, modelSpecularMapPixel, nullptr, nullptr); addPipeline( - Key::Builder().withMaterial().withSkinned().withTangents().withSpecular(), + Key::Builder().withMaterial().withSkinned().withTangents().withSpecular().withDualQuatSkinned(), skinModelNormalMapDualQuatVertex, modelNormalSpecularMapPixel, nullptr, nullptr); addPipeline( - Key::Builder().withMaterial().withSkinned().withTangents().withFade(), + Key::Builder().withMaterial().withSkinned().withTangents().withFade().withDualQuatSkinned(), skinModelNormalMapFadeDualQuatVertex, modelNormalMapFadePixel, batchSetter, itemSetter, nullptr, nullptr); } From 7cae04883e85a747e6472049515a07b0093cc473 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 27 Feb 2018 17:19:02 -0800 Subject: [PATCH 03/21] WIP. --- libraries/render-utils/src/RenderPipelines.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 6264d82187..6ad86dfd37 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -718,6 +718,17 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { shapePlumber.addPipeline( ShapeKey::Filter::Builder().withSkinned().withFade(), skinFadeProgram, state); + + //Added for dual quaternions + auto skinDualQuatVertex = skin_model_shadow_dq_vert::getShader(); + gpu::ShaderPointer skinFadeDualQuatProgram = gpu::Shader::createProgram(skinFadeVertex, skinFadePixel); + shapePlumber.addPipeline( + ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withFade(), + skinDualQuatVertex, state); + + shapePlumber.addPipeline( + ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withoutFade(), + skinDualQuatVertex, state); } #include "RenderPipelines.h" From 5764a21c4a7da429db29e510501cb528deb0ea03 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Wed, 28 Feb 2018 08:12:48 -0800 Subject: [PATCH 04/21] WIP. --- libraries/render-utils/src/RenderPipelines.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 6ad86dfd37..14e1993239 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -720,15 +720,11 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { skinFadeProgram, state); //Added for dual quaternions - auto skinDualQuatVertex = skin_model_shadow_dq_vert::getShader(); - gpu::ShaderPointer skinFadeDualQuatProgram = gpu::Shader::createProgram(skinFadeVertex, skinFadePixel); + auto skinModelDualQuatVertex = skin_model_shadow_dq_vert::getShader(); + gpu::ShaderPointer skinModelDualQuatProgram = gpu::Shader::createProgram(skinModelDualQuatVertex, skinPixel); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withFade(), - skinDualQuatVertex, state); - - shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withoutFade(), - skinDualQuatVertex, state); + ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned(), + skinModelDualQuatProgram, state); } #include "RenderPipelines.h" From faad930e352ecb28b5223457cb421a5487b778b8 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Wed, 28 Feb 2018 08:44:01 -0800 Subject: [PATCH 05/21] WIP. --- .../render-utils/src/RenderPipelines.cpp | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 14e1993239..1d3bd00940 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -100,6 +100,7 @@ #include "model_shadow_vert.h" #include "skin_model_shadow_vert.h" #include "skin_model_shadow_dq_vert.h" +#include "skin_model_shadow_fade_dq_vert.h" #include "model_shadow_frag.h" #include "skin_model_shadow_frag.h" @@ -217,6 +218,7 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip auto skinModelDualQuatVertex = skin_model_dq_vert::getShader(); auto skinModelNormalMapDualQuatVertex = skin_model_normal_map_dq_vert::getShader(); auto skinModelShadowDualQuatVertex = skin_model_shadow_dq_vert::getShader(); + auto skinModelShadowFadeDualQuatVertex = skin_model_shadow_fade_dq_vert::getShader(); auto skinModelFadeDualQuatVertex = skin_model_fade_dq_vert::getShader(); auto skinModelNormalMapFadeDualQuatVertex = skin_model_normal_map_fade_dq_vert::getShader(); auto skinModelTranslucentDualQuatVertex = skinModelFadeDualQuatVertex; // We use the same because it ouputs world position per vertex @@ -519,12 +521,12 @@ void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePip // Now repeat for dual quaternion // Depth-only addPipeline( - Key::Builder().withSkinned().withDepthOnly().withDualQuatSkinned(), + Key::Builder().withSkinned().withDualQuatSkinned().withDepthOnly(), skinModelShadowDualQuatVertex, modelShadowPixel, nullptr, nullptr); // Same thing but with Fade on addPipeline( - Key::Builder().withSkinned().withDepthOnly().withFade().withDualQuatSkinned(), - skinModelShadowDualQuatVertex, modelShadowFadePixel, batchSetter, itemSetter); + Key::Builder().withSkinned().withDualQuatSkinned().withDepthOnly().withFade(), + skinModelShadowFadeDualQuatVertex, modelShadowFadePixel, batchSetter, itemSetter); } void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter) { @@ -720,11 +722,17 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { skinFadeProgram, state); //Added for dual quaternions - auto skinModelDualQuatVertex = skin_model_shadow_dq_vert::getShader(); - gpu::ShaderPointer skinModelDualQuatProgram = gpu::Shader::createProgram(skinModelDualQuatVertex, skinPixel); + auto skinModelShadowDualQuatVertex = skin_model_shadow_dq_vert::getShader(); + gpu::ShaderPointer skinModelDualQuatProgram = gpu::Shader::createProgram(skinModelShadowDualQuatVertex, skinPixel); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned(), + ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withoutFade(), skinModelDualQuatProgram, state); + + auto skinModelShadowFadeDualQuatVertex = skin_model_shadow_fade_dq_vert::getShader(); + gpu::ShaderPointer skinModelShadowDualQuatProgram = gpu::Shader::createProgram(skinModelShadowFadeDualQuatVertex, skinPixel); + shapePlumber.addPipeline( + ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withFade(), + skinModelShadowDualQuatProgram, state); } #include "RenderPipelines.h" From 5d7e6651a761b0f96db5b9f81cb8f9cc437a3596 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Wed, 28 Feb 2018 11:05:02 -0800 Subject: [PATCH 06/21] Use correct pixel shader. --- libraries/render-utils/src/RenderPipelines.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 1d3bd00940..2ae59ec59e 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -723,16 +723,16 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { //Added for dual quaternions auto skinModelShadowDualQuatVertex = skin_model_shadow_dq_vert::getShader(); - gpu::ShaderPointer skinModelDualQuatProgram = gpu::Shader::createProgram(skinModelShadowDualQuatVertex, skinPixel); + gpu::ShaderPointer skinModelShadowDualQuatProgram = gpu::Shader::createProgram(skinModelShadowDualQuatVertex, skinPixel); shapePlumber.addPipeline( ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withoutFade(), - skinModelDualQuatProgram, state); + skinModelShadowDualQuatProgram, state); auto skinModelShadowFadeDualQuatVertex = skin_model_shadow_fade_dq_vert::getShader(); - gpu::ShaderPointer skinModelShadowDualQuatProgram = gpu::Shader::createProgram(skinModelShadowFadeDualQuatVertex, skinPixel); + gpu::ShaderPointer skinModelShadowFadeDualQuatProgram = gpu::Shader::createProgram(skinModelShadowFadeDualQuatVertex, skinFadePixel); shapePlumber.addPipeline( ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withFade(), - skinModelShadowDualQuatProgram, state); + skinModelShadowFadeDualQuatProgram, state); } #include "RenderPipelines.h" From a7542d5b9084954d8ee5556e68962ce74fb0173e Mon Sep 17 00:00:00 2001 From: samcake Date: Wed, 28 Feb 2018 17:46:22 -0800 Subject: [PATCH 07/21] fixing the shadow --- libraries/render-utils/src/RenderPipelines.cpp | 17 +++++++++++++++-- libraries/render-utils/src/RenderShadowTask.cpp | 15 ++++++++++++++- .../src/skin_model_normal_map_fade_dq.slv | 2 ++ libraries/render/src/render/ShapePipeline.h | 6 ++++-- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 3fedae1778..1c2535e0aa 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -672,7 +672,7 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { auto skinPixel = skin_model_shadow_frag::getShader(); gpu::ShaderPointer skinProgram = gpu::Shader::createProgram(skinVertex, skinPixel); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withSkinned().withoutFade(), + ShapeKey::Filter::Builder().withSkinned().withoutDualQuatSkinned().withoutFade(), skinProgram, state); auto modelFadeVertex = model_shadow_fade_vert::getShader(); @@ -686,8 +686,21 @@ void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { auto skinFadePixel = skin_model_shadow_fade_frag::getShader(); gpu::ShaderPointer skinFadeProgram = gpu::Shader::createProgram(skinFadeVertex, skinFadePixel); shapePlumber.addPipeline( - ShapeKey::Filter::Builder().withSkinned().withFade(), + ShapeKey::Filter::Builder().withSkinned().withoutDualQuatSkinned().withFade(), skinFadeProgram, state); + + //Added for dual quaternions + auto skinModelShadowDualQuatVertex = skin_model_shadow_dq_vert::getShader(); + gpu::ShaderPointer skinModelShadowDualQuatProgram = gpu::Shader::createProgram(skinModelShadowDualQuatVertex, skinPixel); + shapePlumber.addPipeline( + ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withoutFade(), + skinModelShadowDualQuatProgram, state); +/* + auto skinModelShadowFadeDualQuatVertex = skin_model_shadow_fade_dq_vert::getShader(); + gpu::ShaderPointer skinModelShadowFadeDualQuatProgram = gpu::Shader::createProgram(skinModelShadowFadeDualQuatVertex, skinFadePixel); + shapePlumber.addPipeline( + ShapeKey::Filter::Builder().withSkinned().withDualQuatSkinned().withFade(), + skinModelShadowFadeDualQuatProgram, state);*/ } #include "RenderPipelines.h" diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index e8963c2e4e..b5a329cc91 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -163,8 +163,10 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext, con auto shadowPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder); auto shadowSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned()); + auto shadowSkinnedDQPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned().withDualQuatSkinned()); std::vector skinnedShapeKeys{}; + std::vector skinnedDQShapeKeys{}; std::vector ownPipelineShapeKeys{}; // Iterate through all inShapes and render the unskinned @@ -172,7 +174,11 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext, con batch.setPipeline(shadowPipeline->pipeline); for (auto items : inShapes) { if (items.first.isSkinned()) { - skinnedShapeKeys.push_back(items.first); + if (items.first.isDualQuatSkinned()) { + skinnedDQShapeKeys.push_back(items.first); + } else { + skinnedShapeKeys.push_back(items.first); + } } else if (!items.first.hasOwnPipeline()) { renderItems(renderContext, items.second); } else { @@ -187,6 +193,13 @@ void RenderShadowMap::run(const render::RenderContextPointer& renderContext, con renderItems(renderContext, inShapes.at(key)); } + // Reiterate to render the DQ skinned + args->_shapePipeline = shadowSkinnedDQPipeline; + batch.setPipeline(shadowSkinnedDQPipeline->pipeline); + for (const auto& key : skinnedDQShapeKeys) { + renderItems(renderContext, inShapes.at(key)); + } + // Finally render the items with their own pipeline last to prevent them from breaking the // render state. This is probably a temporary code as there is probably something better // to do in the render call of objects that have their own pipeline. diff --git a/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv b/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv index 02b3742f6f..d6e07575b1 100644 --- a/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv +++ b/libraries/render-utils/src/skin_model_normal_map_fade_dq.slv @@ -30,6 +30,7 @@ out vec3 _normal; out vec3 _tangent; out vec3 _color; out float _alpha; +out vec4 _worldPosition; void main(void) { vec4 position = vec4(0.0, 0.0, 0.0, 0.0); @@ -53,6 +54,7 @@ void main(void) { TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <$transformModelToEyeAndClipPos(cam, obj, position, _position, gl_Position)$> + <$transformModelToWorldPos(obj, position, _worldPosition)$> <$transformModelToWorldDir(cam, obj, interpolatedNormal.xyz, interpolatedNormal.xyz)$> <$transformModelToWorldDir(cam, obj, interpolatedTangent.xyz, interpolatedTangent.xyz)$> diff --git a/libraries/render/src/render/ShapePipeline.h b/libraries/render/src/render/ShapePipeline.h index f175bab99a..e0e675ce83 100644 --- a/libraries/render/src/render/ShapePipeline.h +++ b/libraries/render/src/render/ShapePipeline.h @@ -135,8 +135,8 @@ public: Builder& withSkinned() { _flags.set(SKINNED); _mask.set(SKINNED); return (*this); } Builder& withoutSkinned() { _flags.reset(SKINNED); _mask.set(SKINNED); return (*this); } - Builder& withDualQuatSkinned() { _flags.set(DUAL_QUAT_SKINNED); _mask.set(SKINNED); return (*this); } - Builder& withoutDualQuatSkinned() { _flags.reset(DUAL_QUAT_SKINNED); _mask.set(SKINNED); return (*this); } + Builder& withDualQuatSkinned() { _flags.set(DUAL_QUAT_SKINNED); _mask.set(DUAL_QUAT_SKINNED); return (*this); } + Builder& withoutDualQuatSkinned() { _flags.reset(DUAL_QUAT_SKINNED); _mask.set(DUAL_QUAT_SKINNED); return (*this); } Builder& withDepthOnly() { _flags.set(DEPTH_ONLY); _mask.set(DEPTH_ONLY); return (*this); } Builder& withoutDepthOnly() { _flags.reset(DEPTH_ONLY); _mask.set(DEPTH_ONLY); return (*this); } @@ -176,6 +176,7 @@ public: bool isUnlit() const { return _flags[UNLIT]; } bool isTranslucent() const { return _flags[TRANSLUCENT]; } bool isSkinned() const { return _flags[SKINNED]; } + bool isDualQuatSkinned() const { return _flags[DUAL_QUAT_SKINNED]; } bool isDepthOnly() const { return _flags[DEPTH_ONLY]; } bool isDepthBiased() const { return _flags[DEPTH_BIAS]; } bool isWireframe() const { return _flags[WIREFRAME]; } @@ -216,6 +217,7 @@ inline QDebug operator<<(QDebug debug, const ShapeKey& key) { << "isUnlit:" << key.isUnlit() << "isTranslucent:" << key.isTranslucent() << "isSkinned:" << key.isSkinned() + << "isDualQuatSkinned:" << key.isDualQuatSkinned() << "isDepthOnly:" << key.isDepthOnly() << "isDepthBiased:" << key.isDepthBiased() << "isWireframe:" << key.isWireframe() From 67034274faeb109c6754fcba8018394f1dcb3096 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 28 Feb 2018 17:59:37 -0800 Subject: [PATCH 08/21] Improve font loading by using QRC instead of relative paths --- interface/resources/qml/CurrentAPI.qml | 2 +- .../qml/controls-uit/CheckBoxQQC2.qml | 2 +- .../resources/qml/controls-uit/Keyboard.qml | 4 +-- .../resources/qml/controls-uit/SpinBox.qml | 2 +- .../resources/qml/controls-uit/TextEdit.qml | 2 +- .../resources/qml/controls-uit/TextField.qml | 4 +-- interface/resources/qml/controls-uit/qmldir | 33 +++++++++++++++++++ .../resources/qml/controls/FontAwesome.qml | 2 +- .../resources/qml/dialogs/FileDialog.qml | 4 +-- .../qml/dialogs/TabletFileDialog.qml | 4 +-- .../assetDialog/AssetDialogContent.qml | 4 +-- interface/resources/qml/hifi/AssetServer.qml | 2 +- interface/resources/qml/hifi/ComboDialog.qml | 4 +-- .../qml/hifi/DesktopLetterboxMessage.qml | 4 +-- .../resources/qml/hifi/LetterboxMessage.qml | 4 +-- interface/resources/qml/hifi/NameCard.qml | 2 +- interface/resources/qml/hifi/Pal.qml | 2 +- .../common/EmulatedMarketplaceHeader.qml | 2 +- .../commerce/wallet/sendMoney/SendMoney.qml | 2 +- .../qml/hifi/dialogs/TabletAssetServer.qml | 2 +- .../tablet/tabletWindows/TabletFileDialog.qml | 4 +-- .../qml/styles-uit/AnonymousProRegular.qml | 2 +- .../qml/styles-uit/FiraSansRegular.qml | 2 +- .../qml/styles-uit/FiraSansSemiBold.qml | 2 +- .../resources/qml/styles-uit/HiFiGlyphs.qml | 2 +- .../resources/qml/styles-uit/RalewayBold.qml | 2 +- .../resources/qml/styles-uit/RalewayLight.qml | 2 +- .../qml/styles-uit/RalewayRegular.qml | 2 +- .../qml/styles-uit/RalewaySemiBold.qml | 2 +- interface/resources/qml/styles-uit/qmldir | 22 +++++++++++++ interface/src/ui/overlays/Web3DOverlay.cpp | 2 -- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 1 - 32 files changed, 92 insertions(+), 40 deletions(-) create mode 100644 interface/resources/qml/controls-uit/qmldir create mode 100644 interface/resources/qml/styles-uit/qmldir diff --git a/interface/resources/qml/CurrentAPI.qml b/interface/resources/qml/CurrentAPI.qml index 37984965d9..d9255e51eb 100644 --- a/interface/resources/qml/CurrentAPI.qml +++ b/interface/resources/qml/CurrentAPI.qml @@ -34,7 +34,7 @@ Item { height: parent.height } - FontLoader { id: ralewayRegular; source: pathToFonts + "fonts/Raleway-Regular.ttf"; } + FontLoader { id: ralewayRegular; source: "qrc:/fonts/Raleway-Regular.ttf"; } Timer { id: updateList diff --git a/interface/resources/qml/controls-uit/CheckBoxQQC2.qml b/interface/resources/qml/controls-uit/CheckBoxQQC2.qml index 12b8c80003..040cd8e505 100644 --- a/interface/resources/qml/controls-uit/CheckBoxQQC2.qml +++ b/interface/resources/qml/controls-uit/CheckBoxQQC2.qml @@ -109,7 +109,7 @@ CheckBox { contentItem: Text { id: root - FontLoader { id: ralewaySemiBold; source: pathToFonts + "fonts/Raleway-SemiBold.ttf"; } + FontLoader { id: ralewaySemiBold; source: "qrc:/fonts/Raleway-SemiBold.ttf"; } font.pixelSize: hifi.fontSizes.inputLabel font.family: ralewaySemiBold.name text: checkBox.text diff --git a/interface/resources/qml/controls-uit/Keyboard.qml b/interface/resources/qml/controls-uit/Keyboard.qml index 76b66178d4..0c86754734 100644 --- a/interface/resources/qml/controls-uit/Keyboard.qml +++ b/interface/resources/qml/controls-uit/Keyboard.qml @@ -125,7 +125,7 @@ Rectangle { TextInput { id: mirrorText visible: showMirrorText - FontLoader { id: font; source: "../../fonts/FiraSans-Regular.ttf"; } + FontLoader { id: font; source: "qrc:/fonts/FiraSans-Regular.ttf"; } font.family: font.name font.pixelSize: 20 verticalAlignment: Text.AlignVCenter @@ -165,7 +165,7 @@ Rectangle { anchors.bottom: parent.bottom anchors.bottomMargin: 0 - FontLoader { id: hiFiGlyphs; source: pathToFonts + "fonts/hifi-glyphs.ttf"; } + FontLoader { id: hiFiGlyphs; source: "qrc:/fonts/hifi-glyphs.ttf"; } Column { id: columnAlpha diff --git a/interface/resources/qml/controls-uit/SpinBox.qml b/interface/resources/qml/controls-uit/SpinBox.qml index a1237d4bc7..f2a7e0efe8 100644 --- a/interface/resources/qml/controls-uit/SpinBox.qml +++ b/interface/resources/qml/controls-uit/SpinBox.qml @@ -25,7 +25,7 @@ SpinBox { property color colorLabelInside: hifi.colors.white property real controlHeight: height + (spinBoxLabel.visible ? spinBoxLabel.height + spinBoxLabel.anchors.bottomMargin : 0) - FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; } + FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } font.family: firaSansSemiBold.name font.pixelSize: hifi.fontSizes.textFieldInput height: hifi.fontSizes.textFieldInput + 13 // Match height of TextField control. diff --git a/interface/resources/qml/controls-uit/TextEdit.qml b/interface/resources/qml/controls-uit/TextEdit.qml index 5ee9ce94ba..34eff7586a 100644 --- a/interface/resources/qml/controls-uit/TextEdit.qml +++ b/interface/resources/qml/controls-uit/TextEdit.qml @@ -17,7 +17,7 @@ TextEdit { property real size: 32 - FontLoader { id: ralewaySemiBold; source: "../../fonts/Raleway-SemiBold.ttf"; } + FontLoader { id: ralewaySemiBold; source: "qrc:/fonts/Raleway-SemiBold.ttf"; } font.family: ralewaySemiBold.name font.pointSize: size verticalAlignment: Text.AlignVCenter diff --git a/interface/resources/qml/controls-uit/TextField.qml b/interface/resources/qml/controls-uit/TextField.qml index 3fc5d83129..ee646b2575 100644 --- a/interface/resources/qml/controls-uit/TextField.qml +++ b/interface/resources/qml/controls-uit/TextField.qml @@ -34,8 +34,8 @@ TextField { placeholderText: textField.placeholderText - FontLoader { id: firaSansRegular; source: "../../fonts/FiraSans-Regular.ttf"; } - FontLoader { id: hifiGlyphs; source: "../../fonts/hifi-glyphs.ttf"; } + FontLoader { id: firaSansRegular; source: "qrc:/fonts/FiraSans-Regular.ttf"; } + FontLoader { id: hifiGlyphs; source: "qrc:/fonts/hifi-glyphs.ttf"; } font.family: firaSansRegular.name font.pixelSize: hifi.fontSizes.textFieldInput height: implicitHeight + 3 // Make surrounding box higher so that highlight is vertically centered. diff --git a/interface/resources/qml/controls-uit/qmldir b/interface/resources/qml/controls-uit/qmldir new file mode 100644 index 0000000000..989115b8d2 --- /dev/null +++ b/interface/resources/qml/controls-uit/qmldir @@ -0,0 +1,33 @@ +module controlsUit +AttachmentsTable 1.0 AttachmentsTable.qml +BaseWebView 1.0 BaseWebView.qml +Button 1.0 Button.qml +CheckBox 1.0 CheckBox.qml +CheckBoxQQC2 1.0 CheckBoxQQC2.qml +ComboBox 1.0 ComboBox.qml +ContentSection 1.0 ContentSection.qml +GlyphButton 1.0 GlyphButton.qml +HorizontalRule 1.0 HorizontalRule.qml +HorizontalSpacer 1.0 HorizontalSpacer.qml +ImageMessageBox 1.0 ImageMessageBox.qml +Key 1.0 Key.qml +Keyboard 1.0 Keyboard.qml +Label 1.0 Label.qml +QueuedButton 1.0 QueuedButton.qml +RadioButton 1.0 RadioButton.qml +Separator 1.0 Separator.qml +Slider 1.0 Slider.qml +SpinBox 1.0 SpinBox.qml +Switch 1.0 Switch.qml +Table 1.0 Table.qml +TabletContentSection 1.0 TabletContentSection.qml +TabletHeader 1.0 TabletHeader.qml +TextAction 1.0 TextAction.qml +TextEdit 1.0 TextEdit.qml +TextField 1.0 TextField.qml +ToolTip 1.0 ToolTip.qml +Tree 1.0 Tree.qml +VerticalSpacer 1.0 VerticalSpacer.qml +WebGlyphButton 1.0 WebGlyphButton.qml +WebSpinner 1.0 WebSpinner.qml +WebView 1.0 WebView.qml \ No newline at end of file diff --git a/interface/resources/qml/controls/FontAwesome.qml b/interface/resources/qml/controls/FontAwesome.qml index 50d7e96fb5..7eda46e17e 100644 --- a/interface/resources/qml/controls/FontAwesome.qml +++ b/interface/resources/qml/controls/FontAwesome.qml @@ -4,7 +4,7 @@ import QtQuick.Controls.Styles 1.3 Text { id: root - FontLoader { id: iconFont; source: "../../fonts/fontawesome-webfont.ttf"; } + FontLoader { id: iconFont; source: "qrc:/fonts/fontawesome-webfont.ttf"; } property int size: 32 width: size height: size diff --git a/interface/resources/qml/dialogs/FileDialog.qml b/interface/resources/qml/dialogs/FileDialog.qml index 0b5da8a5f5..c078ace264 100644 --- a/interface/resources/qml/dialogs/FileDialog.qml +++ b/interface/resources/qml/dialogs/FileDialog.qml @@ -532,8 +532,8 @@ ModalWindow { itemDelegate: Item { clip: true - FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; } - FontLoader { id: firaSansRegular; source: "../../fonts/FiraSans-Regular.ttf"; } + FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } + FontLoader { id: firaSansRegular; source: "qrc:/fonts/FiraSans-Regular.ttf"; } FiraSansSemiBold { text: getText(); diff --git a/interface/resources/qml/dialogs/TabletFileDialog.qml b/interface/resources/qml/dialogs/TabletFileDialog.qml index d3b738469e..776f47d19d 100644 --- a/interface/resources/qml/dialogs/TabletFileDialog.qml +++ b/interface/resources/qml/dialogs/TabletFileDialog.qml @@ -496,8 +496,8 @@ TabletModalWindow { itemDelegate: Item { clip: true - //FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; } - //FontLoader { id: firaSansRegular; source: "../../fonts/FiraSans-Regular.ttf"; } + //FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } + //FontLoader { id: firaSansRegular; source: "qrc:/fonts/FiraSans-Regular.ttf"; } FiraSansSemiBold { text: getText(); diff --git a/interface/resources/qml/dialogs/assetDialog/AssetDialogContent.qml b/interface/resources/qml/dialogs/assetDialog/AssetDialogContent.qml index 8c0501e3b4..dabc66c502 100644 --- a/interface/resources/qml/dialogs/assetDialog/AssetDialogContent.qml +++ b/interface/resources/qml/dialogs/assetDialog/AssetDialogContent.qml @@ -345,8 +345,8 @@ Item { itemDelegate: Item { clip: true - FontLoader { id: firaSansSemiBold; source: "../../../fonts/FiraSans-SemiBold.ttf"; } - FontLoader { id: firaSansRegular; source: "../../../fonts/FiraSans-Regular.ttf"; } + FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } + FontLoader { id: firaSansRegular; source: "qrc:/fonts/FiraSans-Regular.ttf"; } FiraSansSemiBold { text: styleData.value diff --git a/interface/resources/qml/hifi/AssetServer.qml b/interface/resources/qml/hifi/AssetServer.qml index fea275999e..03d00fe773 100644 --- a/interface/resources/qml/hifi/AssetServer.qml +++ b/interface/resources/qml/hifi/AssetServer.qml @@ -657,7 +657,7 @@ Windows.ScrollingWindow { text: styleData.value - FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; } + FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } font.family: firaSansSemiBold.name font.pixelSize: hifi.fontSizes.textFieldInput height: hifi.dimensions.tableRowHeight diff --git a/interface/resources/qml/hifi/ComboDialog.qml b/interface/resources/qml/hifi/ComboDialog.qml index 83fcad18c7..0b1a3b1a5c 100644 --- a/interface/resources/qml/hifi/ComboDialog.qml +++ b/interface/resources/qml/hifi/ComboDialog.qml @@ -25,8 +25,8 @@ Item { property int dialogHeight; property int comboOptionTextSize: 16; property int comboBodyTextSize: 16; - FontLoader { id: ralewayRegular; source: "../../fonts/Raleway-Regular.ttf"; } - FontLoader { id: ralewaySemiBold; source: "../../fonts/Raleway-SemiBold.ttf"; } + FontLoader { id: ralewayRegular; source: "qrc:/fonts/Raleway-Regular.ttf"; } + FontLoader { id: ralewaySemiBold; source: "qrc:/fonts/Raleway-SemiBold.ttf"; } visible: false; id: combo; anchors.fill: parent; diff --git a/interface/resources/qml/hifi/DesktopLetterboxMessage.qml b/interface/resources/qml/hifi/DesktopLetterboxMessage.qml index bafa518eb9..9230bbe962 100644 --- a/interface/resources/qml/hifi/DesktopLetterboxMessage.qml +++ b/interface/resources/qml/hifi/DesktopLetterboxMessage.qml @@ -24,8 +24,8 @@ Item { property real headerTextMargin: -5 property real headerGlyphMargin: -15 property bool isDesktop: false - FontLoader { id: ralewayRegular; source: "../../fonts/Raleway-Regular.ttf"; } - FontLoader { id: ralewaySemiBold; source: "../../fonts/Raleway-SemiBold.ttf"; } + FontLoader { id: ralewayRegular; source: "qrc:/fonts/Raleway-Regular.ttf"; } + FontLoader { id: ralewaySemiBold; source: "qrc:/fonts/Raleway-SemiBold.ttf"; } visible: false id: letterbox anchors.fill: parent diff --git a/interface/resources/qml/hifi/LetterboxMessage.qml b/interface/resources/qml/hifi/LetterboxMessage.qml index 7ce66adf11..dcd0d906db 100644 --- a/interface/resources/qml/hifi/LetterboxMessage.qml +++ b/interface/resources/qml/hifi/LetterboxMessage.qml @@ -23,8 +23,8 @@ Item { property real popupTextPixelSize: 16 property real headerTextMargin: -5 property real headerGlyphMargin: -15 - FontLoader { id: ralewayRegular; source: "../../fonts/Raleway-Regular.ttf"; } - FontLoader { id: ralewaySemiBold; source: "../../fonts/Raleway-SemiBold.ttf"; } + FontLoader { id: ralewayRegular; source: "qrc:/fonts/Raleway-Regular.ttf"; } + FontLoader { id: ralewaySemiBold; source: "qrc:/fonts/Raleway-SemiBold.ttf"; } visible: false id: letterbox anchors.fill: parent diff --git a/interface/resources/qml/hifi/NameCard.qml b/interface/resources/qml/hifi/NameCard.qml index e08fdc53ff..4c9c746488 100644 --- a/interface/resources/qml/hifi/NameCard.qml +++ b/interface/resources/qml/hifi/NameCard.qml @@ -177,7 +177,7 @@ Item { anchors.right: parent.right anchors.rightMargin: editGlyph.width + editGlyph.anchors.rightMargin // Style - FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; } + FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } font.family: firaSansSemiBold.name font.pixelSize: displayNameTextPixelSize selectionColor: hifi.colors.blueAccent diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 8fb27714ee..699173aaeb 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -908,7 +908,7 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter; } - FontLoader { id: ralewayRegular; source: "../../fonts/Raleway-Regular.ttf"; } + FontLoader { id: ralewayRegular; source: "qrc:/fonts/Raleway-Regular.ttf"; } Text { id: connectionHelpText; // Anchors diff --git a/interface/resources/qml/hifi/commerce/common/EmulatedMarketplaceHeader.qml b/interface/resources/qml/hifi/commerce/common/EmulatedMarketplaceHeader.qml index eb8159a4e7..8eb03c1254 100644 --- a/interface/resources/qml/hifi/commerce/common/EmulatedMarketplaceHeader.qml +++ b/interface/resources/qml/hifi/commerce/common/EmulatedMarketplaceHeader.qml @@ -141,7 +141,7 @@ Item { } } - FontLoader { id: ralewayRegular; source: "../../../../fonts/Raleway-Regular.ttf"; } + FontLoader { id: ralewayRegular; source: "qrc:/fonts/Raleway-Regular.ttf"; } TextMetrics { id: textMetrics; font.family: ralewayRegular.name diff --git a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml index f5b7f42a3f..07c85a7f6a 100644 --- a/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml +++ b/interface/resources/qml/hifi/commerce/wallet/sendMoney/SendMoney.qml @@ -925,7 +925,7 @@ Item { anchors.rightMargin: 20; height: 95; - FontLoader { id: firaSansSemiBold; source: "../../../../../fonts/FiraSans-SemiBold.ttf"; } + FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } TextArea { id: optionalMessage; property int maximumLength: 72; diff --git a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml index 19297a3251..503a3ccc17 100644 --- a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml +++ b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml @@ -656,7 +656,7 @@ Rectangle { text: styleData.value - FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; } + FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } font.family: firaSansSemiBold.name font.pixelSize: hifi.fontSizes.textFieldInput height: hifi.dimensions.tableRowHeight diff --git a/interface/resources/qml/hifi/tablet/tabletWindows/TabletFileDialog.qml b/interface/resources/qml/hifi/tablet/tabletWindows/TabletFileDialog.qml index 7b91cfeba9..ead63537f0 100644 --- a/interface/resources/qml/hifi/tablet/tabletWindows/TabletFileDialog.qml +++ b/interface/resources/qml/hifi/tablet/tabletWindows/TabletFileDialog.qml @@ -478,8 +478,8 @@ Rectangle { itemDelegate: Item { clip: true - //FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; } - //FontLoader { id: firaSansRegular; source: "../../fonts/FiraSans-Regular.ttf"; } + //FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } + //FontLoader { id: firaSansRegular; source: "qrc:/fonts/FiraSans-Regular.ttf"; } FiraSansSemiBold { text: getText(); diff --git a/interface/resources/qml/styles-uit/AnonymousProRegular.qml b/interface/resources/qml/styles-uit/AnonymousProRegular.qml index 789689973b..c832910ec2 100644 --- a/interface/resources/qml/styles-uit/AnonymousProRegular.qml +++ b/interface/resources/qml/styles-uit/AnonymousProRegular.qml @@ -14,7 +14,7 @@ import QtQuick.Controls.Styles 1.4 Text { id: root - FontLoader { id: anonymousProRegular; source: "../../fonts/AnonymousPro-Regular.ttf"; } + FontLoader { id: anonymousProRegular; source: "qrc:/fonts/AnonymousPro-Regular.ttf"; } property real size: 32 font.pixelSize: size verticalAlignment: Text.AlignVCenter diff --git a/interface/resources/qml/styles-uit/FiraSansRegular.qml b/interface/resources/qml/styles-uit/FiraSansRegular.qml index 4ae0826772..6d73210120 100644 --- a/interface/resources/qml/styles-uit/FiraSansRegular.qml +++ b/interface/resources/qml/styles-uit/FiraSansRegular.qml @@ -14,7 +14,7 @@ import QtQuick.Controls.Styles 1.4 Text { id: root - FontLoader { id: firaSansRegular; source: "../../fonts/FiraSans-Regular.ttf"; } + FontLoader { id: firaSansRegular; source: "qrc:/fonts/FiraSans-Regular.ttf"; } property real size: 32 font.pixelSize: size verticalAlignment: Text.AlignVCenter diff --git a/interface/resources/qml/styles-uit/FiraSansSemiBold.qml b/interface/resources/qml/styles-uit/FiraSansSemiBold.qml index b3f3324090..2bfd319d49 100644 --- a/interface/resources/qml/styles-uit/FiraSansSemiBold.qml +++ b/interface/resources/qml/styles-uit/FiraSansSemiBold.qml @@ -14,7 +14,7 @@ import QtQuick.Controls.Styles 1.4 Text { id: root - FontLoader { id: firaSansSemiBold; source: pathToFonts + "fonts/FiraSans-SemiBold.ttf"; } + FontLoader { id: firaSansSemiBold; source: "qrc:/fonts/FiraSans-SemiBold.ttf"; } property real size: 32 font.pixelSize: size verticalAlignment: Text.AlignVCenter diff --git a/interface/resources/qml/styles-uit/HiFiGlyphs.qml b/interface/resources/qml/styles-uit/HiFiGlyphs.qml index f78d6c6f59..baab41e166 100644 --- a/interface/resources/qml/styles-uit/HiFiGlyphs.qml +++ b/interface/resources/qml/styles-uit/HiFiGlyphs.qml @@ -12,7 +12,7 @@ import QtQuick 2.5 Text { id: root - FontLoader { id: hiFiGlyphs; source: pathToFonts + "fonts/hifi-glyphs.ttf"; } + FontLoader { id: hiFiGlyphs; source: "qrc:/fonts/hifi-glyphs.ttf"; } property int size: 32 font.pixelSize: size width: size diff --git a/interface/resources/qml/styles-uit/RalewayBold.qml b/interface/resources/qml/styles-uit/RalewayBold.qml index 433fdb7ae6..963d8d9ba4 100644 --- a/interface/resources/qml/styles-uit/RalewayBold.qml +++ b/interface/resources/qml/styles-uit/RalewayBold.qml @@ -14,7 +14,7 @@ import QtQuick.Controls.Styles 1.4 Text { id: root - FontLoader { id: ralewayBold; source: pathToFonts + "fonts/Raleway-Bold.ttf"; } + FontLoader { id: ralewayBold; source: "qrc:/fonts/Raleway-Bold.ttf"; } property real size: 32 font.pixelSize: size verticalAlignment: Text.AlignVCenter diff --git a/interface/resources/qml/styles-uit/RalewayLight.qml b/interface/resources/qml/styles-uit/RalewayLight.qml index 913918afd7..8957b70c82 100644 --- a/interface/resources/qml/styles-uit/RalewayLight.qml +++ b/interface/resources/qml/styles-uit/RalewayLight.qml @@ -14,7 +14,7 @@ import QtQuick.Controls.Styles 1.4 Text { id: root - FontLoader { id: ralewayLight; source: "../../fonts/Raleway-Light.ttf"; } + FontLoader { id: ralewayLight; source: "qrc:/fonts/Raleway-Light.ttf"; } property real size: 32 font.pixelSize: size verticalAlignment: Text.AlignVCenter diff --git a/interface/resources/qml/styles-uit/RalewayRegular.qml b/interface/resources/qml/styles-uit/RalewayRegular.qml index aab31ecf33..fd2661928c 100644 --- a/interface/resources/qml/styles-uit/RalewayRegular.qml +++ b/interface/resources/qml/styles-uit/RalewayRegular.qml @@ -14,7 +14,7 @@ import QtQuick.Controls.Styles 1.4 Text { id: root - FontLoader { id: ralewayRegular; source: pathToFonts + "fonts/Raleway-Regular.ttf"; } + FontLoader { id: ralewayRegular; source: "qrc:/fonts/Raleway-Regular.ttf"; } property real size: 32 font.pixelSize: size verticalAlignment: Text.AlignVCenter diff --git a/interface/resources/qml/styles-uit/RalewaySemiBold.qml b/interface/resources/qml/styles-uit/RalewaySemiBold.qml index b6c79e02a4..7ec9ea3b34 100644 --- a/interface/resources/qml/styles-uit/RalewaySemiBold.qml +++ b/interface/resources/qml/styles-uit/RalewaySemiBold.qml @@ -14,7 +14,7 @@ import QtQuick.Controls.Styles 1.4 Text { id: root - FontLoader { id: ralewaySemiBold; source: pathToFonts + "fonts/Raleway-SemiBold.ttf"; } + FontLoader { id: ralewaySemiBold; source: "qrc:/fonts/Raleway-SemiBold.ttf"; } property real size: 32 font.pixelSize: size verticalAlignment: Text.AlignVCenter diff --git a/interface/resources/qml/styles-uit/qmldir b/interface/resources/qml/styles-uit/qmldir new file mode 100644 index 0000000000..7257353c6e --- /dev/null +++ b/interface/resources/qml/styles-uit/qmldir @@ -0,0 +1,22 @@ +module stylesUit +AnonymousProRegular 1.0 AnonymousProRegular.qml +ButtonLabel 1.0 ButtonLabel.qml +FiraSansRegular 1.0 FiraSansRegular.qml +FiraSansSemiBold 1.0 FiraSansSemiBold.qml +HifiConstants 1.0 HifiConstants.qml +HiFiGlyphs 1.0 HiFiGlyphs.qml +IconButton 1.0 IconButton.qml +InfoItem 1.0 InfoItem.qml +InputLabel 1.0 InputLabel.qml +ListItem 1.0 ListItem.qml +Logs 1.0 Logs.qml +OverlayTitle 1.0 OverlayTitle.qml +RalewayBold 1.0 RalewayBold.qml +RalewayLight 1.0 RalewayLight.qml +RalewayRegular 1.0 RalewayRegular.qml +RalewaySemiBold 1.0 RalewaySemiBold.qml +SectionName 1.0 SectionName.qml +Separator 1.0 Separator.qml +ShortcutText 1.0 ShortcutText.qml +TabName 1.0 TabName.qml +TextFieldInput 1.0 TextFieldInput.qml \ No newline at end of file diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index b324bf39c4..57d1cc0acf 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -236,8 +236,6 @@ void Web3DOverlay::setupQmlSurface() { _webSurface->getSurfaceContext()->setContextProperty("Web3DOverlay", this); _webSurface->getSurfaceContext()->setContextProperty("Window", DependencyManager::get().data()); - _webSurface->getSurfaceContext()->setContextProperty("pathToFonts", "../../"); - // Override min fps for tablet UI, for silky smooth scrolling setMaxFPS(90); } diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index 749a60a578..f6f05e2406 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -248,7 +248,6 @@ void OffscreenQmlSurface::initializeEngine(QQmlEngine* engine) { rootContext->setContextProperty("GL", ::getGLContextData()); rootContext->setContextProperty("urlHandler", new UrlHandler()); rootContext->setContextProperty("resourceDirectoryUrl", QUrl::fromLocalFile(PathUtils::resourcesPath())); - rootContext->setContextProperty("pathToFonts", "../../"); rootContext->setContextProperty("ApplicationInterface", qApp); auto javaScriptToInject = getEventBridgeJavascript(); if (!javaScriptToInject.isEmpty()) { From 181944d5db6b814c750c6e995054f143935855eb Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 1 Mar 2018 08:41:13 -0800 Subject: [PATCH 09/21] fix bugs in controllerDispatcher.js --- scripts/system/controllers/controllerDispatcher.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/system/controllers/controllerDispatcher.js b/scripts/system/controllers/controllerDispatcher.js index 345ab33c0d..18b194dd3a 100644 --- a/scripts/system/controllers/controllerDispatcher.js +++ b/scripts/system/controllers/controllerDispatcher.js @@ -7,11 +7,11 @@ /* jslint bitwise: true */ -/* global Script, Entities, Overlays, Controller, Vec3, Quat, getControllerWorldLocation, RayPick, +/* global Script, Entities, Overlays, Controller, Vec3, Quat, getControllerWorldLocation, controllerDispatcherPlugins:true, controllerDispatcherPluginsNeedSort:true, LEFT_HAND, RIGHT_HAND, NEAR_GRAB_PICK_RADIUS, DEFAULT_SEARCH_SPHERE_DISTANCE, DISPATCHER_PROPERTIES, - getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities, Pointers, PickType, COLORS_GRAB_SEARCHING_HALF_SQUEEZE - COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, Picks, TRIGGER_ON_VALUE, PointerManager + getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities, Picks, PickType, Pointers, COLORS_GRAB_SEARCHING_HALF_SQUEEZE + COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, TRIGGER_ON_VALUE, PointerManager */ controllerDispatcherPlugins = {}; @@ -378,8 +378,8 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); }; this.setBlacklist = function() { - RayPick.setIgnoreItems(_this.leftControllerRayPick, this.blacklist); - RayPick.setIgnoreItems(_this.rightControllerRayPick, this.blacklist); + Pointers.setIgnoreItems(_this.leftPointer, this.blacklist); + Pointers.setIgnoreItems(_this.rightPointer, this.blacklist); }; var MAPPING_NAME = "com.highfidelity.controllerDispatcher"; @@ -451,7 +451,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); data = JSON.parse(message); var action = data.action; var id = data.id; - var index = _this.blacklis.indexOf(id); + var index = _this.blacklist.indexOf(id); if (action === 'add' && index === -1) { _this.blacklist.push(id); From b4f941af037990fd9bf31860e8aad9d3e7923d43 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 1 Mar 2018 08:42:08 -0800 Subject: [PATCH 10/21] finish purge of RayPick from grab.js --- scripts/system/controllers/grab.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/system/controllers/grab.js b/scripts/system/controllers/grab.js index b62cb3dd90..1171703847 100644 --- a/scripts/system/controllers/grab.js +++ b/scripts/system/controllers/grab.js @@ -15,7 +15,7 @@ // /* global MyAvatar, Entities, Script, Camera, Vec3, Reticle, Overlays, getEntityCustomData, Messages, Quat, Controller, - isInEditMode, HMD entityIsGrabbable, Pointers, PickType RayPick*/ + isInEditMode, HMD entityIsGrabbable, Picks, PickType, Pointers*/ (function() { // BEGIN LOCAL_SCOPE @@ -258,14 +258,14 @@ function Grabber() { this.liftKey = false; // SHIFT this.rotateKey = false; // CONTROL - this.mouseRayOverlays = RayPick.createRayPick({ + this.mouseRayOverlays = Picks.createPick(PickType.Ray, { joint: "Mouse", filter: Picks.PICK_OVERLAYS, enabled: true }); var tabletItems = getMainTabletIDs(); if (tabletItems.length > 0) { - RayPick.setIncludeItems(this.mouseRayOverlays, tabletItems); + Picks.setIncludeItems(this.mouseRayOverlays, tabletItems); } var renderStates = [{name: "grabbed", end: beacon}]; this.mouseRayEntities = Pointers.createPointer(PickType.Ray, { @@ -328,7 +328,7 @@ Grabber.prototype.pressEvent = function(event) { return; } - var overlayResult = RayPick.getPrevRayPickResult(this.mouseRayOverlays); + var overlayResult = Picks.getPrevPickResult(this.mouseRayOverlays); if (overlayResult.type != Picks.INTERSECTED_NONE) { return; } @@ -599,7 +599,7 @@ Grabber.prototype.keyPressEvent = function(event) { Grabber.prototype.cleanup = function() { Pointers.removePointer(this.mouseRayEntities); - RayPick.removeRayPick(this.mouseRayOverlays); + Picks.removePick(this.mouseRayOverlays); }; var grabber = new Grabber(); From 27c6e7915eeb0a54a5a19882a73577cf954db8f3 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 1 Mar 2018 08:43:30 -0800 Subject: [PATCH 11/21] purge LaserPointers refs from scripts that don't use it --- .../system/controllers/controllerModules/farActionGrabEntity.js | 2 +- scripts/system/controllers/controllerModules/farTrigger.js | 2 +- .../system/controllers/controllerModules/hudOverlayPointer.js | 2 +- scripts/system/controllers/controllerModules/inEditMode.js | 2 +- scripts/system/controllers/controllerModules/teleport.js | 2 +- .../controllers/controllerModules/webSurfaceLaserInput.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index b72a38f986..39841607cd 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -7,7 +7,7 @@ /* jslint bitwise: true */ -/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat, +/* global Script, Controller, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat, getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities, enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable, entityIsGrabbable, makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, diff --git a/scripts/system/controllers/controllerModules/farTrigger.js b/scripts/system/controllers/controllerModules/farTrigger.js index 70e9ceff16..25df17ee84 100644 --- a/scripts/system/controllers/controllerModules/farTrigger.js +++ b/scripts/system/controllers/controllerModules/farTrigger.js @@ -6,7 +6,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, MyAvatar, getGrabPointSphereOffset, +/* global Script, Controller, RIGHT_HAND, LEFT_HAND, MyAvatar, getGrabPointSphereOffset, makeRunningValues, Entities, enableDispatcherModule, disableDispatcherModule, makeDispatcherModuleParameters, PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, getGrabbableData, makeLaserParams diff --git a/scripts/system/controllers/controllerModules/hudOverlayPointer.js b/scripts/system/controllers/controllerModules/hudOverlayPointer.js index afc9256875..04a3911e0b 100644 --- a/scripts/system/controllers/controllerModules/hudOverlayPointer.js +++ b/scripts/system/controllers/controllerModules/hudOverlayPointer.js @@ -10,7 +10,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -/* global Script, Controller, LaserPointers, RayPick, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat, +/* global Script, Controller, RIGHT_HAND, LEFT_HAND, Mat4, MyAvatar, Vec3, Camera, Quat, getGrabPointSphereOffset, getEnabledModuleByName, makeRunningValues, Entities, enableDispatcherModule, disableDispatcherModule, entityIsDistanceGrabbable, makeDispatcherModuleParameters, MSECS_PER_SEC, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index 202290f2df..f7e86f9042 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -10,7 +10,7 @@ /* global Script, Controller, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule, makeRunningValues, Messages, makeDispatcherModuleParameters, HMD, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, - getEnabledModuleByName, PICK_MAX_DISTANCE, isInEditMode, LaserPointers, RayPick, Picks, makeLaserParams + getEnabledModuleByName, PICK_MAX_DISTANCE, isInEditMode, Picks, makeLaserParams */ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); diff --git a/scripts/system/controllers/controllerModules/teleport.js b/scripts/system/controllers/controllerModules/teleport.js index fe8ddb394d..560da57b20 100644 --- a/scripts/system/controllers/controllerModules/teleport.js +++ b/scripts/system/controllers/controllerModules/teleport.js @@ -12,7 +12,7 @@ /* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex, enableDispatcherModule, disableDispatcherModule, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3, - RayPick, HMD, Uuid, AvatarList, Picks, Pointers, PickType + HMD, Uuid, AvatarList, Picks, Pointers, PickType */ Script.include("/~/system/libraries/Xform.js"); diff --git a/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js b/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js index 3d9d7979d5..949fdbb072 100644 --- a/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js +++ b/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js @@ -9,7 +9,7 @@ makeRunningValues, Messages, Quat, Vec3, makeDispatcherModuleParameters, Overlays, ZERO_VEC, HMD, INCHES_TO_METERS, DEFAULT_REGISTRATION_POINT, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE, - TRIGGER_OFF_VALUE, getEnabledModuleByName, PICK_MAX_DISTANCE, LaserPointers, RayPick, ContextOverlay, Picks, makeLaserParams + TRIGGER_OFF_VALUE, getEnabledModuleByName, PICK_MAX_DISTANCE, ContextOverlay, Picks, makeLaserParams */ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); From a227cf1edb0051a6a450156a0be229b393d1233f Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 1 Mar 2018 10:49:58 -0800 Subject: [PATCH 12/21] Fixing bad key/pipeline pair --- libraries/render-utils/src/RenderPipelines.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index b3a1d40257..84a144e6db 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -592,8 +592,8 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba Key::Builder().withMaterial().withSkinned().withTangents().withDualQuatSkinned(), skinModelNormalMapDualQuatVertex, modelNormalMapPixel, nullptr, nullptr); addPipeline( - Key::Builder().withMaterial().withSkinned(), - skinModelDualQuatVertex, modelSpecularMapPixel, nullptr, nullptr); + Key::Builder().withMaterial().withSkinned().withSpecular().withDualQuatSkinned(), + skinModelDualQuatVertex, modelSpecularMapPixel, nullptr, nullptr); addPipeline( Key::Builder().withMaterial().withSkinned().withTangents().withSpecular().withDualQuatSkinned(), skinModelNormalMapDualQuatVertex, modelNormalSpecularMapPixel, nullptr, nullptr); From 1f4aed31f19dae5beb2938771f84f748a4675461 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 1 Mar 2018 16:16:47 -0800 Subject: [PATCH 13/21] adding hyperlink --- interface/src/Application.cpp | 1 + .../controllerModules/farActionGrabEntity.js | 7 ++++++- scripts/system/libraries/controllerDispatcherUtils.js | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 34cdf3cda8..1291b4aab0 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6121,6 +6121,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe scriptEngine->registerGlobalObject("Selection", DependencyManager::get().data()); scriptEngine->registerGlobalObject("ContextOverlay", DependencyManager::get().data()); scriptEngine->registerGlobalObject("Wallet", DependencyManager::get().data()); + scriptEngine->registerGlobalObject("AddressManager", DependencyManager::get().data()); qScriptRegisterMetaType(scriptEngine.data(), OverlayIDtoScriptValue, OverlayIDfromScriptValue); diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index b72a38f986..1fcf98a78e 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -449,11 +449,16 @@ Script.include("/~/system/libraries/Xform.js"); if (rayPickInfo.type === Picks.INTERSECTED_ENTITY) { if (controllerData.triggerClicks[this.hand]) { var entityID = rayPickInfo.objectID; + var targetProps = Entities.getEntityProperties(entityID, [ "dynamic", "shapeType", "position", "rotation", "dimensions", "density", - "userData", "locked", "type" + "userData", "locked", "type", "href" ]); + if (targetProps.href !== "") { + AddressManager.handleLookupString(targetProps.href); + return makeRunningValues(false, [], []); + } this.targetObject = new TargetObject(entityID, targetProps); this.targetObject.parentProps = getEntityParents(targetProps); diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index 915cfc05fb..96d9e919da 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -233,6 +233,16 @@ entityIsDistanceGrabbable = function(props) { return true; }; +entityHasHyperlink = function(entityID) { + var hasHyperlink = false; + var desiredProperties = ["href"]; + var entityProperties = Entities.getEntityProperties(entityID, desiredProperties); + print(entityProperties.href); + if (entityProperties.href !== "") { + hasHyperlink = true; + } + return hasHyperlink; +} getControllerJointIndex = function (hand) { if (HMD.isHandControllerAvailable()) { @@ -398,6 +408,7 @@ if (typeof module !== 'undefined') { entityIsGrabbable: entityIsGrabbable, NEAR_GRAB_RADIUS: NEAR_GRAB_RADIUS, projectOntoOverlayXYPlane: projectOntoOverlayXYPlane, + entityHasHyperlink: entityHasHyperlink, projectOntoEntityXYPlane: projectOntoEntityXYPlane, TRIGGER_OFF_VALUE: TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE: TRIGGER_ON_VALUE From c4e90c24eb698e2a7a06ffd3fec568f8a6d04605 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 1 Mar 2018 16:40:24 -0800 Subject: [PATCH 14/21] Fix undefined request from JS --- scripts/modules/request.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/modules/request.js b/scripts/modules/request.js index c7bf98d815..3516554567 100644 --- a/scripts/modules/request.js +++ b/scripts/modules/request.js @@ -71,7 +71,7 @@ module.exports = { } } httpRequest.open(options.method, options.uri, true); - httpRequest.send(options.body); + httpRequest.send(options.body || null); } }; From 9e8368e50e156e7da338946566547b9156716a97 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 2 Mar 2018 11:12:44 -0800 Subject: [PATCH 15/21] Disable virtual trackpad rendering on non-Android builds --- .../display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp | 6 ++++-- .../src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp index 1a1714ad56..b725c91174 100644 --- a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp @@ -23,6 +23,7 @@ const QString Basic2DWindowOpenGLDisplayPlugin::NAME("Desktop"); static const QString FULLSCREEN = "Fullscreen"; void Basic2DWindowOpenGLDisplayPlugin::customizeContext() { +#if defined(Q_OS_ANDROID) auto iconPath = PathUtils::resourcesPath() + "images/analog_stick.png"; auto image = QImage(iconPath); if (image.format() != QImage::Format_ARGB32) { @@ -61,8 +62,7 @@ void Basic2DWindowOpenGLDisplayPlugin::customizeContext() { _virtualPadStickBaseTexture->assignStoredMip(0, image.byteCount(), image.constBits()); _virtualPadStickBaseTexture->setAutoGenerateMips(true); } - - +#endif Parent::customizeContext(); } @@ -88,6 +88,7 @@ bool Basic2DWindowOpenGLDisplayPlugin::internalActivate() { } void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() { +#if defined(Q_OS_ANDROID) auto& virtualPadManager = VirtualPad::Manager::instance(); if(virtualPadManager.getLeftVirtualPad()->isBeingTouched()) { // render stick base @@ -115,6 +116,7 @@ void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() { batch.draw(gpu::TRIANGLE_STRIP, 4); }); } +#endif Parent::compositeExtra(); } diff --git a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h index d9b942bd97..7a69a40f19 100644 --- a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h +++ b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h @@ -42,6 +42,8 @@ private: uint32_t _framerateTarget { 0 }; int _fullscreenTarget{ -1 }; +#if defined(Q_OS_ANDROID) gpu::TexturePointer _virtualPadStickTexture; gpu::TexturePointer _virtualPadStickBaseTexture; +#endif }; From 4f151a4237f4655e94fc356bdd054c81798462ab Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 2 Mar 2018 11:56:38 -0800 Subject: [PATCH 16/21] fix ASCII art for packet headers in NLPacket --- libraries/networking/src/NLPacket.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/libraries/networking/src/NLPacket.h b/libraries/networking/src/NLPacket.h index f9056bbfaa..f49cc47645 100644 --- a/libraries/networking/src/NLPacket.h +++ b/libraries/networking/src/NLPacket.h @@ -21,15 +21,26 @@ class NLPacket : public udt::Packet { Q_OBJECT public: - + // + // | BYTE | BYTE | BYTE | BYTE | + // // 0 1 2 3 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Packet Type | Packet Version | - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // | Node UUID | Hash (only if verified) | Optional (only if sourced) - // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - // + // | Packet Type | Version | | + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + // | | + // | Node UUID - 16 bytes | + // | (ONLY FOR SOURCED PACKETS) | + // | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + // | | | + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | + // | | + // | MD5 Verification - 16 bytes | + // | (ONLY FOR VERIFIED PACKETS) | + // | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + // | | | + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | // NLPacket Header Format // this is used by the Octree classes - must be known at compile time From 05fb3cfd9a09f5b21e3a608c41ded35186acc817 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 2 Mar 2018 14:03:24 -0800 Subject: [PATCH 17/21] fixing hyper link for entities --- .../nearGrabHyperLinkEntity.js | 93 +++++++++++++++++++ .../system/controllers/controllerScripts.js | 3 +- .../libraries/controllerDispatcherUtils.js | 3 +- 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js diff --git a/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js b/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js new file mode 100644 index 0000000000..64a626f978 --- /dev/null +++ b/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js @@ -0,0 +1,93 @@ +"use strict"; + +// nearActionGrabEntity.js +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html + +/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, + getControllerJointIndex, getGrabbableData, enableDispatcherModule, disableDispatcherModule, + propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable, + Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues, + TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity, + HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE +*/ + +(function() { + Script.include("/~/system/libraries/controllerDispatcherUtils.js"); + Script.include("/~/system/libraries/controllers.js"); + + function NearGrabHyperLinkEntity(hand) { + this.hand = hand; + this.targetEntityID = null; + this.hyperlink = ""; + + this.parameters = makeDispatcherModuleParameters( + 485, + this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"], + [], + 100); + + + this.getTargetProps = function(controllerData) { + var nearbyEntitiesProperties = controllerData.nearbyEntityProperties[this.hand]; + var sensorScaleFactor = MyAvatar.sensorToWorldScale; + for (var i = 0; i < nearbyEntitiesProperties.length; i++) { + var props = nearbyEntitiesProperties[i]; + if (props.distance > NEAR_GRAB_RADIUS * sensorScaleFactor) { + continue; + } + if (props.href !== "" && props.href !== undefined) { + return props; + } + } + return null; + }; + + this.isReady = function(controllerData) { + this.targetEntityID = null; + if (controllerData.triggerValues[this.hand] < TRIGGER_OFF_VALUE && + controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) { + return makeRunningValues(false, [], []); + } + + var targetProps = this.getTargetProps(controllerData); + if (targetProps) { + this.hyperlink = targetProps.href; + this.targetEntityID = targetProps.id; + return makeRunningValues(true, [], []); + } + + return makeRunningValues(false, [], []); + }; + + this.run = function(controllerData) { + if ((controllerData.triggerClicks[this.hand] < TRIGGER_OFF_VALUE && + controllerData.secondaryValues[this.hand] < TRIGGER_OFF_VALUE) || this.hyperlink === "") { + return makeRunningValues(false, [], []); + } + + if (controllerData.triggerClicks[this.hand] || + controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE) { + AddressManager.handleLookupString(this.hyperlink); + return makeRunningValues(false, [], []); + } + + return makeRunningValues(true, [], []); + }; + } + + var leftNearGrabHyperLinkEntity = new NearGrabHyperLinkEntity(LEFT_HAND); + var rightNearGrabHyperLinkEntity = new NearGrabHyperLinkEntity(RIGHT_HAND); + + enableDispatcherModule("LeftNearGrabHyperLink", leftNearGrabHyperLinkEntity); + enableDispatcherModule("RightNearGrabHyperLink", rightNearGrabHyperLinkEntity); + + function cleanup() { + disableDispatcherModule("LeftNearGrabHyperLink"); + disableDispactherModule("RightNearGrabHyperLink"); + + } + + Script.scriptEnding.connect(cleanup); +}()); diff --git a/scripts/system/controllers/controllerScripts.js b/scripts/system/controllers/controllerScripts.js index 1eb30bbefd..8db8e29f37 100644 --- a/scripts/system/controllers/controllerScripts.js +++ b/scripts/system/controllers/controllerScripts.js @@ -31,7 +31,8 @@ var CONTOLLER_SCRIPTS = [ "controllerModules/scaleAvatar.js", "controllerModules/hudOverlayPointer.js", "controllerModules/mouseHMD.js", - "controllerModules/scaleEntity.js" + "controllerModules/scaleEntity.js", + "controllerModules/nearGrabHyperLinkEntity.js" ]; var DEBUG_MENU_ITEM = "Debug defaultScripts.js"; diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index 96d9e919da..efae2edb43 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -105,7 +105,8 @@ DISPATCHER_PROPERTIES = [ "density", "dimensions", "userData", - "type" + "type", + "href" ]; // priority -- a lower priority means the module will be asked sooner than one with a higher priority in a given update step From fc8f1c1e65825f1d15047a4c6afe1f0e12635d43 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 2 Mar 2018 14:20:33 -0800 Subject: [PATCH 18/21] Resolving conflicts --- libraries/render-utils/src/RenderPipelines.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 2522f49920..aca8439547 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -432,7 +432,6 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba auto skinModelDualQuatVertex = skin_model_dq_vert::getShader(); auto skinModelNormalMapDualQuatVertex = skin_model_normal_map_dq_vert::getShader(); - auto skinModelNormalMapFadeDualQuatVertex = skin_model_normal_map_fade_dq_vert::getShader(); // Pixel shaders auto modelPixel = forward_model_frag::getShader(); @@ -472,7 +471,7 @@ void initForwardPipelines(ShapePlumber& plumber, const render::ShapePipeline::Ba addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent(), skinModelVertex, modelTranslucentPixel); addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents(), skinModelNormalMapVertex, modelTranslucentPixel); addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withDualQuatSkinned(), skinModelDualQuatVertex, modelTranslucentPixel); - addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withDualQuatSkinned(), skinModelNormalMapFadeDualQuatVertex, modelTranslucentPixel); + addPipeline(Key::Builder().withMaterial().withSkinned().withTranslucent().withTangents().withDualQuatSkinned(), skinModelNormalMapDualQuatVertex, modelTranslucentPixel); forceLightBatchSetter = false; } From 5dc336bfae5f68f3e3da09f49c7941011457ab39 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 2 Mar 2018 14:23:35 -0800 Subject: [PATCH 19/21] remove dead code and eslint files --- .../controllerModules/farActionGrabEntity.js | 7 ++++--- .../controllerModules/nearGrabHyperLinkEntity.js | 4 ++-- .../system/libraries/controllerDispatcherUtils.js | 12 ------------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index 1fcf98a78e..495c8a87a4 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -14,7 +14,7 @@ PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic, getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD, Reticle, Overlays, isPointingAtUI - Picks, makeLaserLockInfo Xform, makeLaserParams + Picks, makeLaserLockInfo Xform, makeLaserParams, AddressManager, getEntityParents */ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); @@ -375,7 +375,7 @@ Script.include("/~/system/libraries/Xform.js"); return true; } return false; - } + }; this.isReady = function (controllerData) { if (HMD.active) { @@ -485,7 +485,8 @@ Script.include("/~/system/libraries/Xform.js"); this.grabbedDistance = rayPickInfo.distance; } - if (otherFarGrabModule.grabbedThingID === this.grabbedThingID && otherFarGrabModule.distanceHolding) { + if (otherFarGrabModule.grabbedThingID === this.grabbedThingID && + otherFarGrabModule.distanceHolding) { this.prepareDistanceRotatingData(controllerData); this.distanceRotate(otherFarGrabModule); } else { diff --git a/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js b/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js index 64a626f978..bbd111489f 100644 --- a/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js +++ b/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js @@ -10,7 +10,7 @@ propsArePhysical, Messages, HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, entityIsGrabbable, Quat, Vec3, MSECS_PER_SEC, getControllerWorldLocation, makeDispatcherModuleParameters, makeRunningValues, TRIGGER_OFF_VALUE, NEAR_GRAB_RADIUS, findGroupParent, entityIsCloneable, propsAreCloneDynamic, cloneEntity, - HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE + HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, AddressManager */ (function() { @@ -85,7 +85,7 @@ function cleanup() { disableDispatcherModule("LeftNearGrabHyperLink"); - disableDispactherModule("RightNearGrabHyperLink"); + disableDispatcherModule("RightNearGrabHyperLink"); } diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index efae2edb43..75e1d6668b 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -234,17 +234,6 @@ entityIsDistanceGrabbable = function(props) { return true; }; -entityHasHyperlink = function(entityID) { - var hasHyperlink = false; - var desiredProperties = ["href"]; - var entityProperties = Entities.getEntityProperties(entityID, desiredProperties); - print(entityProperties.href); - if (entityProperties.href !== "") { - hasHyperlink = true; - } - return hasHyperlink; -} - getControllerJointIndex = function (hand) { if (HMD.isHandControllerAvailable()) { var controllerJointIndex = -1; @@ -409,7 +398,6 @@ if (typeof module !== 'undefined') { entityIsGrabbable: entityIsGrabbable, NEAR_GRAB_RADIUS: NEAR_GRAB_RADIUS, projectOntoOverlayXYPlane: projectOntoOverlayXYPlane, - entityHasHyperlink: entityHasHyperlink, projectOntoEntityXYPlane: projectOntoEntityXYPlane, TRIGGER_OFF_VALUE: TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE: TRIGGER_ON_VALUE From d12a4f0c18e80f45411e71c44d67b777b9a0c875 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 2 Mar 2018 14:30:02 -0800 Subject: [PATCH 20/21] little change --- .../controllers/controllerModules/nearGrabHyperLinkEntity.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js b/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js index bbd111489f..59ce79cfd1 100644 --- a/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js +++ b/scripts/system/controllers/controllerModules/nearGrabHyperLinkEntity.js @@ -1,6 +1,8 @@ "use strict"; -// nearActionGrabEntity.js +// nearGrabHyperLinkEntity.js +// +// Created by Dante Ruiz on 03/02/2018 // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html From 85b4c3b4229ea3cf975790c123d760fe0808c39b Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 2 Mar 2018 17:10:14 -0800 Subject: [PATCH 21/21] Protect session UUID from concurrent read/writes --- domain-server/src/DomainServer.cpp | 2 +- domain-server/src/DomainServer.h | 2 +- libraries/networking/src/LimitedNodeList.cpp | 28 +++++++++----------- libraries/networking/src/LimitedNodeList.h | 17 +++++++----- libraries/networking/src/NodeList.cpp | 12 ++++----- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index d2ef1a4156..c27ac09d15 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -405,7 +405,7 @@ void DomainServer::restart() { exit(DomainServer::EXIT_CODE_REBOOT); } -const QUuid& DomainServer::getID() { +QUuid DomainServer::getID() { return DependencyManager::get()->getSessionUUID(); } diff --git a/domain-server/src/DomainServer.h b/domain-server/src/DomainServer.h index afe2a1cc7c..6e9fe28c0a 100644 --- a/domain-server/src/DomainServer.h +++ b/domain-server/src/DomainServer.h @@ -135,7 +135,7 @@ signals: void userDisconnected(); private: - const QUuid& getID(); + QUuid getID(); void parseCommandLine(); QString getContentBackupDir(); diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index 9dbbc570dd..0803e380f2 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -49,19 +49,8 @@ const std::set SOLO_NODE_TYPES = { }; LimitedNodeList::LimitedNodeList(int socketListenPort, int dtlsListenPort) : - _sessionUUID(), - _nodeHash(), - _nodeMutex(QReadWriteLock::Recursive), _nodeSocket(this), - _dtlsSocket(NULL), - _localSockAddr(), - _publicSockAddr(), - _stunSockAddr(STUN_SERVER_HOSTNAME, STUN_SERVER_PORT), - _packetReceiver(new PacketReceiver(this)), - _numCollectedPackets(0), - _numCollectedBytes(0), - _packetStatTimer(), - _permissions(NodePermissions()) + _packetReceiver(new PacketReceiver(this)) { qRegisterMetaType("ConnectionStep"); auto port = (socketListenPort != INVALID_PORT) ? socketListenPort : LIMITED_NODELIST_LOCAL_PORT.get(); @@ -122,13 +111,22 @@ LimitedNodeList::LimitedNodeList(int socketListenPort, int dtlsListenPort) : } } +QUuid LimitedNodeList::getSessionUUID() const { + QReadLocker lock { &_sessionUUIDLock }; + return _sessionUUID; +} + void LimitedNodeList::setSessionUUID(const QUuid& sessionUUID) { - QUuid oldUUID = _sessionUUID; - _sessionUUID = sessionUUID; + QUuid oldUUID; + { + QWriteLocker lock { &_sessionUUIDLock }; + oldUUID = _sessionUUID; + _sessionUUID = sessionUUID; + } if (sessionUUID != oldUUID) { qCDebug(networking) << "NodeList UUID changed from" << uuidStringWithoutCurlyBraces(oldUUID) - << "to" << uuidStringWithoutCurlyBraces(_sessionUUID); + << "to" << uuidStringWithoutCurlyBraces(sessionUUID); emit uuidChanged(sessionUUID, oldUUID); } } diff --git a/libraries/networking/src/LimitedNodeList.h b/libraries/networking/src/LimitedNodeList.h index 1b1c809279..7165b3dd63 100644 --- a/libraries/networking/src/LimitedNodeList.h +++ b/libraries/networking/src/LimitedNodeList.h @@ -104,7 +104,7 @@ public: }; Q_ENUM(ConnectionStep); - const QUuid& getSessionUUID() const { return _sessionUUID; } + QUuid getSessionUUID() const; void setSessionUUID(const QUuid& sessionUUID); void setPermissions(const NodePermissions& newPermissions); @@ -380,20 +380,19 @@ protected: bool sockAddrBelongsToNode(const HifiSockAddr& sockAddr) { return findNodeWithAddr(sockAddr) != SharedNodePointer(); } - QUuid _sessionUUID; NodeHash _nodeHash; - mutable QReadWriteLock _nodeMutex; + mutable QReadWriteLock _nodeMutex { QReadWriteLock::Recursive }; udt::Socket _nodeSocket; - QUdpSocket* _dtlsSocket; + QUdpSocket* _dtlsSocket { nullptr }; HifiSockAddr _localSockAddr; HifiSockAddr _publicSockAddr; - HifiSockAddr _stunSockAddr; + HifiSockAddr _stunSockAddr { STUN_SERVER_HOSTNAME, STUN_SERVER_PORT }; bool _hasTCPCheckedLocalSocket { false }; PacketReceiver* _packetReceiver; - std::atomic _numCollectedPackets; - std::atomic _numCollectedBytes; + std::atomic _numCollectedPackets { 0 }; + std::atomic _numCollectedBytes { 0 }; QElapsedTimer _packetStatTimer; NodePermissions _permissions; @@ -424,6 +423,10 @@ private slots: void flagTimeForConnectionStep(ConnectionStep connectionStep, quint64 timestamp); void possiblyTimeoutSTUNAddressLookup(); void addSTUNHandlerToUnfiltered(); // called once STUN socket known + +private: + mutable QReadWriteLock _sessionUUIDLock; + QUuid _sessionUUID; }; #endif // hifi_LimitedNodeList_h diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 9ad0cb5e79..71d448ede9 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -798,7 +798,7 @@ void NodeList::sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationN void NodeList::ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled) { // enumerate the nodes to send a reliable ignore packet to each that can leverage it - if (!nodeID.isNull() && _sessionUUID != nodeID) { + if (!nodeID.isNull() && getSessionUUID() != nodeID) { eachMatchingNode([](const SharedNodePointer& node)->bool { if (node->getType() == NodeType::AudioMixer || node->getType() == NodeType::AvatarMixer) { return true; @@ -851,7 +851,7 @@ void NodeList::ignoreNodeBySessionID(const QUuid& nodeID, bool ignoreEnabled) { void NodeList::removeFromIgnoreMuteSets(const QUuid& nodeID) { // don't remove yourself, or nobody - if (!nodeID.isNull() && _sessionUUID != nodeID) { + if (!nodeID.isNull() && getSessionUUID() != nodeID) { { QWriteLocker ignoredSetLocker{ &_ignoredSetLock }; _ignoredNodeIDs.unsafe_erase(nodeID); @@ -870,7 +870,7 @@ bool NodeList::isIgnoringNode(const QUuid& nodeID) const { void NodeList::personalMuteNodeBySessionID(const QUuid& nodeID, bool muteEnabled) { // cannot personal mute yourself, or nobody - if (!nodeID.isNull() && _sessionUUID != nodeID) { + if (!nodeID.isNull() && getSessionUUID() != nodeID) { auto audioMixer = soloNodeOfType(NodeType::AudioMixer); if (audioMixer) { if (isIgnoringNode(nodeID)) { @@ -970,7 +970,7 @@ void NodeList::maybeSendIgnoreSetToNode(SharedNodePointer newNode) { void NodeList::setAvatarGain(const QUuid& nodeID, float gain) { // cannot set gain of yourself - if (_sessionUUID != nodeID) { + if (getSessionUUID() != nodeID) { auto audioMixer = soloNodeOfType(NodeType::AudioMixer); if (audioMixer) { // setup the packet @@ -1013,7 +1013,7 @@ void NodeList::kickNodeBySessionID(const QUuid& nodeID) { // send a request to domain-server to kick the node with the given session ID // the domain-server will handle the persistence of the kick (via username or IP) - if (!nodeID.isNull() && _sessionUUID != nodeID ) { + if (!nodeID.isNull() && getSessionUUID() != nodeID ) { if (getThisNodeCanKick()) { // setup the packet auto kickPacket = NLPacket::create(PacketType::NodeKickRequest, NUM_BYTES_RFC4122_UUID, true); @@ -1036,7 +1036,7 @@ void NodeList::kickNodeBySessionID(const QUuid& nodeID) { void NodeList::muteNodeBySessionID(const QUuid& nodeID) { // cannot mute yourself, or nobody - if (!nodeID.isNull() && _sessionUUID != nodeID ) { + if (!nodeID.isNull() && getSessionUUID() != nodeID ) { if (getThisNodeCanKick()) { auto audioMixer = soloNodeOfType(NodeType::AudioMixer); if (audioMixer) {