From add675e16c7814c95e14a68611b5eb856211b7a7 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Tue, 8 Aug 2017 12:04:44 +0200 Subject: [PATCH 01/48] Create PickItemsJob than can be used to select a render item in front of the camera --- libraries/render-utils/src/PickItemsJob.cpp | 51 ++++++++++++++++++++ libraries/render-utils/src/PickItemsJob.h | 53 +++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 libraries/render-utils/src/PickItemsJob.cpp create mode 100644 libraries/render-utils/src/PickItemsJob.h diff --git a/libraries/render-utils/src/PickItemsJob.cpp b/libraries/render-utils/src/PickItemsJob.cpp new file mode 100644 index 0000000000..4665a45989 --- /dev/null +++ b/libraries/render-utils/src/PickItemsJob.cpp @@ -0,0 +1,51 @@ +// +// PickItemsJob.cpp +// render-utils/src/ +// +// Created by Olivier Prat on 08/08/17. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "PickItemsJob.h" + +void PickItemsJob::configure(const Config& config) { + _isEnabled = config.isEnabled; +} + +void PickItemsJob::run(const render::RenderContextPointer& renderContext, const PickItemsJob::Input& input, PickItemsJob::Output& output) { + output.clear(); + + if (_isEnabled) { + float minIsectDistance = std::numeric_limits::max(); + auto& itemBounds = input; + auto itemID = findNearestItem(renderContext, itemBounds, minIsectDistance); + + if (render::Item::isValidID(itemID)) { + output.emplace_back(itemID); + } + } +} + +render::ItemID PickItemsJob::findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const { + const glm::vec3 rayOrigin = renderContext->args->getViewFrustum().getPosition(); + const glm::vec3 rayDirection = renderContext->args->getViewFrustum().getDirection(); + BoxFace face; + glm::vec3 normal; + float isectDistance; + render::ItemID nearestItem = render::Item::INVALID_ITEM_ID; + const float minDistance = 1.f; + const float maxDistance = 50.f; + + for (const auto& itemBound : inputs) { + if (!itemBound.bound.contains(rayOrigin) && itemBound.bound.findRayIntersection(rayOrigin, rayDirection, isectDistance, face, normal)) { + auto& item = renderContext->_scene->getItem(itemBound.id); + if (item.getKey().isWorldSpace() && isectDistance>minDistance && isectDistance < minIsectDistance && isectDistance + +class PickItemsConfig : public render::Job::Config { + Q_OBJECT + Q_PROPERTY(bool isEnabled MEMBER isEnabled NOTIFY dirty) + +public: + + bool isEnabled{ false }; + +signals: + + void dirty(); +}; + +class PickItemsJob { + +public: + + using Config = PickItemsConfig; + using Input = render::ItemBounds; + using Output = render::ItemBounds; + using JobModel = render::Job::ModelIO; + + PickItemsJob() {} + + void configure(const Config& config); + void run(const render::RenderContextPointer& renderContext, const PickItemsJob::Input& input, PickItemsJob::Output& output); + +private: + + bool _isEnabled{ false }; + + render::ItemID findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const; +}; + +#endif // hifi_render_utils_PickItemsJob_h + + From 7de6079df89feec5020b7273905fa455de7bb541 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Tue, 8 Aug 2017 15:28:36 +0200 Subject: [PATCH 02/48] Added PrepareOutline job to save outlined zbuffer --- libraries/gpu/src/gpu/Format.cpp | 2 + libraries/gpu/src/gpu/Format.h | 2 + .../render-utils/src/RenderDeferredTask.cpp | 12 +++ libraries/render-utils/src/RenderOutline.cpp | 76 +++++++++++++++++++ libraries/render-utils/src/RenderOutline.h | 53 +++++++++++++ .../src/surfaceGeometry_copyDepth.slf | 20 +++++ 6 files changed, 165 insertions(+) create mode 100644 libraries/render-utils/src/RenderOutline.cpp create mode 100644 libraries/render-utils/src/RenderOutline.h create mode 100644 libraries/render-utils/src/surfaceGeometry_copyDepth.slf diff --git a/libraries/gpu/src/gpu/Format.cpp b/libraries/gpu/src/gpu/Format.cpp index b15f8d929f..4079606286 100644 --- a/libraries/gpu/src/gpu/Format.cpp +++ b/libraries/gpu/src/gpu/Format.cpp @@ -30,6 +30,8 @@ const Element Element::VEC2NU8_XY{ VEC2, NUINT8, XY }; const Element Element::COLOR_R11G11B10{ SCALAR, FLOAT, R11G11B10 }; const Element Element::VEC4F_COLOR_RGBA{ VEC4, FLOAT, RGBA }; +const Element Element::COLOR_RED_FLOAT{ SCALAR, FLOAT, RED }; +const Element Element::COLOR_RED_HALF{ SCALAR, HALF, RED }; const Element Element::VEC2F_UV{ VEC2, FLOAT, UV }; const Element Element::VEC2F_XY{ VEC2, FLOAT, XY }; const Element Element::VEC3F_XYZ{ VEC3, FLOAT, XYZ }; diff --git a/libraries/gpu/src/gpu/Format.h b/libraries/gpu/src/gpu/Format.h index c4d88236da..19965077b5 100644 --- a/libraries/gpu/src/gpu/Format.h +++ b/libraries/gpu/src/gpu/Format.h @@ -314,6 +314,8 @@ public: static const Element COLOR_COMPRESSED_SRGBA_HIGH; static const Element VEC2NU8_XY; static const Element VEC4F_COLOR_RGBA; + static const Element COLOR_RED_FLOAT; + static const Element COLOR_RED_HALF; static const Element VEC2F_UV; static const Element VEC2F_XY; static const Element VEC3F_XYZ; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 20c999019b..01c111151f 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -39,6 +39,8 @@ #include "AntialiasingEffect.h" #include "ToneMappingEffect.h" #include "SubsurfaceScattering.h" +#include "PickItemsJob.h" +#include "RenderOutline.h" #include @@ -85,6 +87,16 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren // draw a stencil mask in hidden regions of the framebuffer. task.addJob("PrepareStencil", primaryFramebuffer); + // Select items that need to be outlined + const auto outlinedOpaques = task.addJob("PickOutlined", opaques); + + // Render opaque outline objects first in DeferredBuffer + const auto opaqueOutlineInputs = DrawStateSortDeferred::Inputs(outlinedOpaques, lightingModel).hasVarying(); + task.addJob("DrawOpaqueOutlined", opaqueOutlineInputs, shapePlumber); + + // Retrieve z value of the outlined objects + const auto outlinedZBuffer = task.addJob("PrepareOutline", deferredFramebuffer); + // Render opaque objects in DeferredBuffer const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).hasVarying(); task.addJob("DrawOpaqueDeferred", opaqueInputs, shapePlumber); diff --git a/libraries/render-utils/src/RenderOutline.cpp b/libraries/render-utils/src/RenderOutline.cpp new file mode 100644 index 0000000000..6ecf86143f --- /dev/null +++ b/libraries/render-utils/src/RenderOutline.cpp @@ -0,0 +1,76 @@ +// +// RenderOutline.cpp +// render-utils/src/ +// +// Created by Olivier Prat on 08/08/17. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "RenderOutline.h" + +#include "gpu/Context.h" +#include "gpu/StandardShaderLib.h" + +#include "surfaceGeometry_copyDepth_frag.h" + +void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Input& deferredFramebuffer, PrepareOutline::Output& output) { + glm::uvec2 frameSize(renderContext->args->_viewport.z, renderContext->args->_viewport.w); + auto args = renderContext->args; + + // Resizing framebuffers instead of re-building them seems to cause issues with threaded + // rendering + if (_outlineFramebuffer && _outlineFramebuffer->getSize() != frameSize) { + _outlineFramebuffer.reset(); + } + + if (!_outlineFramebuffer) { + _outlineFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("deferredOutline")); + auto colorFormat = gpu::Element::COLOR_RED_HALF; + + auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT); + auto primaryColorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler); + + _outlineFramebuffer->setRenderBuffer(0, primaryColorTexture); + } + + if (!_copyDepthPipeline) { + auto vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS(); + auto ps = gpu::Shader::createPixel(std::string(surfaceGeometry_copyDepth_frag)); + gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); + + gpu::Shader::BindingSet slotBindings; + slotBindings.insert(gpu::Shader::Binding(std::string("depthMap"), 0)); + gpu::Shader::makeProgram(*program, slotBindings); + + gpu::StatePointer state = gpu::StatePointer(new gpu::State()); + + state->setColorWriteMask(true, false, false, false); + + // Good to go add the brand new pipeline + _copyDepthPipeline = gpu::Pipeline::create(program, state); + } + + gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { + auto depthBuffer = deferredFramebuffer->getPrimaryDepthTexture(); + + // Copy depth to texture as we will overwrite + batch.enableStereo(false); + + batch.setViewportTransform(args->_viewport); + batch.setProjectionTransform(glm::mat4()); + batch.resetViewTransform(); + batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(frameSize, args->_viewport)); + + batch.setFramebuffer(_outlineFramebuffer); + batch.setPipeline(_copyDepthPipeline); + batch.setResourceTexture(0, depthBuffer); + batch.draw(gpu::TRIANGLE_STRIP, 4); + + // Restore previous frame buffer + batch.setFramebuffer(deferredFramebuffer->getDeferredFramebuffer()); + }); + + output = _outlineFramebuffer->getRenderBuffer(0); +} diff --git a/libraries/render-utils/src/RenderOutline.h b/libraries/render-utils/src/RenderOutline.h new file mode 100644 index 0000000000..a97f2033ef --- /dev/null +++ b/libraries/render-utils/src/RenderOutline.h @@ -0,0 +1,53 @@ +// +// RenderOutline.h +// render-utils/src/ +// +// Created by Olivier Prat on 08/08/17. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_render_utils_RenderOutline_h +#define hifi_render_utils_RenderOutline_h + +#include +#include "DeferredFramebuffer.h" + +/* +class PickItemsConfig : public render::Job::Config { + Q_OBJECT + Q_PROPERTY(bool isEnabled MEMBER isEnabled NOTIFY dirty) + +public: + + bool isEnabled{ false }; + +signals: + + void dirty(); +}; +*/ +class PrepareOutline { + +public: + + using Input = DeferredFramebufferPointer; + // Output will contain outlined objects only z-depth texture + using Output = gpu::TexturePointer; + using JobModel = render::Job::ModelIO; + + PrepareOutline() {} + + void run(const render::RenderContextPointer& renderContext, const PrepareOutline::Input& input, PrepareOutline::Output& output); + +private: + + gpu::FramebufferPointer _outlineFramebuffer; + gpu::PipelinePointer _copyDepthPipeline; +}; + +#endif // hifi_render_utils_RenderOutline_h + + diff --git a/libraries/render-utils/src/surfaceGeometry_copyDepth.slf b/libraries/render-utils/src/surfaceGeometry_copyDepth.slf new file mode 100644 index 0000000000..9db8cdbb01 --- /dev/null +++ b/libraries/render-utils/src/surfaceGeometry_copyDepth.slf @@ -0,0 +1,20 @@ +<@include gpu/Config.slh@> +<$VERSION_HEADER$> +// Generated on <$_SCRIBE_DATE$> +// +// Created by Olivier Prat on 08/08/17. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +uniform sampler2D depthMap; + +out vec4 outFragColor; + +void main(void) { + float Zdb = texelFetch(depthMap, ivec2(gl_FragCoord.xy), 0).x; + outFragColor = vec4(Zdb, 0.0, 0.0, 1.0); +} + From 27227d6bd2c493df4f5d2fa6a89633fd13f0e399 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Tue, 8 Aug 2017 17:45:17 +0200 Subject: [PATCH 03/48] Simplified pick item jobs by using inherited enabled flag in render::Job::Config --- libraries/render-utils/src/PickItemsJob.cpp | 18 +++++++++--------- libraries/render-utils/src/PickItemsJob.h | 10 ++-------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/libraries/render-utils/src/PickItemsJob.cpp b/libraries/render-utils/src/PickItemsJob.cpp index 4665a45989..866510a115 100644 --- a/libraries/render-utils/src/PickItemsJob.cpp +++ b/libraries/render-utils/src/PickItemsJob.cpp @@ -10,22 +10,22 @@ // #include "PickItemsJob.h" +PickItemsJob::PickItemsJob() { +} + void PickItemsJob::configure(const Config& config) { - _isEnabled = config.isEnabled; } void PickItemsJob::run(const render::RenderContextPointer& renderContext, const PickItemsJob::Input& input, PickItemsJob::Output& output) { output.clear(); - if (_isEnabled) { - float minIsectDistance = std::numeric_limits::max(); - auto& itemBounds = input; - auto itemID = findNearestItem(renderContext, itemBounds, minIsectDistance); + float minIsectDistance = std::numeric_limits::max(); + auto& itemBounds = input; + auto itemID = findNearestItem(renderContext, itemBounds, minIsectDistance); - if (render::Item::isValidID(itemID)) { - output.emplace_back(itemID); - } - } + if (render::Item::isValidID(itemID)) { + output.emplace_back(itemID); + } } render::ItemID PickItemsJob::findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const { diff --git a/libraries/render-utils/src/PickItemsJob.h b/libraries/render-utils/src/PickItemsJob.h index c6fea52207..b88c881b16 100644 --- a/libraries/render-utils/src/PickItemsJob.h +++ b/libraries/render-utils/src/PickItemsJob.h @@ -15,16 +15,10 @@ #include class PickItemsConfig : public render::Job::Config { - Q_OBJECT - Q_PROPERTY(bool isEnabled MEMBER isEnabled NOTIFY dirty) public: - bool isEnabled{ false }; - -signals: - - void dirty(); + PickItemsConfig() : render::Job::Config(false) {} }; class PickItemsJob { @@ -36,7 +30,7 @@ public: using Output = render::ItemBounds; using JobModel = render::Job::ModelIO; - PickItemsJob() {} + PickItemsJob(); void configure(const Config& config); void run(const render::RenderContextPointer& renderContext, const PickItemsJob::Input& input, PickItemsJob::Output& output); From 44ee7c4bf14e7380f163eb2f33f32b6bd2a66ab5 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Tue, 8 Aug 2017 18:41:57 +0200 Subject: [PATCH 04/48] Renamed to OutlineEffect and working on debugging tool. Problems with outline framebuffer not complete --- libraries/render-utils/src/OutlineEffect.cpp | 207 ++++++++++++++++++ libraries/render-utils/src/OutlineEffect.h | 112 ++++++++++ .../render-utils/src/RenderDeferredTask.cpp | 8 +- libraries/render-utils/src/RenderOutline.cpp | 76 ------- libraries/render-utils/src/RenderOutline.h | 53 ----- .../utilities/render/debugOutline.js | 20 ++ .../developer/utilities/render/outline.qml | 37 ++++ 7 files changed, 382 insertions(+), 131 deletions(-) create mode 100644 libraries/render-utils/src/OutlineEffect.cpp create mode 100644 libraries/render-utils/src/OutlineEffect.h delete mode 100644 libraries/render-utils/src/RenderOutline.cpp delete mode 100644 libraries/render-utils/src/RenderOutline.h create mode 100644 scripts/developer/utilities/render/debugOutline.js create mode 100644 scripts/developer/utilities/render/outline.qml diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp new file mode 100644 index 0000000000..45bf9c7d81 --- /dev/null +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -0,0 +1,207 @@ +// +// OutlineEffect.cpp +// render-utils/src/ +// +// Created by Olivier Prat on 08/08/17. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +#include "OutlineEffect.h" + +#include "GeometryCache.h" + +#include "gpu/Context.h" +#include "gpu/StandardShaderLib.h" + +#include "surfaceGeometry_copyDepth_frag.h" +#include "debug_deferred_buffer_vert.h" +#include "debug_deferred_buffer_frag.h" + +OutlineFramebuffer::OutlineFramebuffer() { +} + +void OutlineFramebuffer::update(const gpu::TexturePointer& linearDepthBuffer) { + //If the depth buffer or size changed, we need to delete our FBOs + bool reset = false; + + if (_depthTexture) { + auto newFrameSize = glm::ivec2(linearDepthBuffer->getDimensions()); + if (_frameSize != newFrameSize) { + _frameSize = newFrameSize; + reset = true; + } + } + + if (reset) { + clear(); + } +} + +void OutlineFramebuffer::clear() { + _depthFramebuffer.reset(); + _depthTexture.reset(); +} + +void OutlineFramebuffer::allocate() { + + auto width = _frameSize.x; + auto height = _frameSize.y; + auto colorFormat = gpu::Element::VEC4F_COLOR_RGBA; // TODO : find a more compact format + + _depthFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("outlineDepth", colorFormat, width, height)); + _depthTexture = _depthFramebuffer->getRenderBuffer(0); +} + +gpu::FramebufferPointer OutlineFramebuffer::getDepthFramebuffer() { + if (!_depthFramebuffer) { + allocate(); + } + return _depthFramebuffer; +} + +gpu::TexturePointer OutlineFramebuffer::getDepthTexture() { + if (!_depthTexture) { + allocate(); + } + return _depthTexture; +} + +void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Input& input, PrepareOutline::Output& output) { + auto outlinedItems = input.get1(); + + if (!outlinedItems.empty()) { + glm::uvec2 frameSize(renderContext->args->_viewport.z, renderContext->args->_viewport.w); + auto args = renderContext->args; + auto deferredFrameBuffer = input.get0(); + + if (!_outlineFramebuffer) { + _outlineFramebuffer = std::make_shared(); + } + _outlineFramebuffer->update(deferredFrameBuffer->getPrimaryDepthTexture()); + + if (!_copyDepthPipeline) { + auto vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS(); + auto ps = gpu::Shader::createPixel(std::string(surfaceGeometry_copyDepth_frag)); + gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); + + gpu::Shader::BindingSet slotBindings; + slotBindings.insert(gpu::Shader::Binding(std::string("depthMap"), 0)); + gpu::Shader::makeProgram(*program, slotBindings); + + gpu::StatePointer state = gpu::StatePointer(new gpu::State()); + + state->setColorWriteMask(true, false, false, false); + + // Good to go add the brand new pipeline + _copyDepthPipeline = gpu::Pipeline::create(program, state); + } + + gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { + auto depthBuffer = deferredFrameBuffer->getPrimaryDepthTexture(); + + // Copy depth to texture as we will overwrite + batch.enableStereo(false); + + batch.setViewportTransform(args->_viewport); + batch.setProjectionTransform(glm::mat4()); + batch.resetViewTransform(); + batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(frameSize, args->_viewport)); + + batch.setFramebuffer(_outlineFramebuffer->getDepthFramebuffer()); + batch.setPipeline(_copyDepthPipeline); + batch.setResourceTexture(0, depthBuffer); + batch.draw(gpu::TRIANGLE_STRIP, 4); + + // Restore previous frame buffer + batch.setFramebuffer(deferredFrameBuffer->getDeferredFramebuffer()); + }); + + output = _outlineFramebuffer; + } else { + output = nullptr; + } +} + +DebugOutline::DebugOutline() { + _geometryId = DependencyManager::get()->allocateID(); +} + +DebugOutline::~DebugOutline() { + auto geometryCache = DependencyManager::get(); + if (geometryCache) { + geometryCache->releaseID(_geometryId); + } +} + +void DebugOutline::configure(const Config& config) { + _isDisplayDepthEnabled = config.viewOutlinedDepth; +} + +void DebugOutline::run(const render::RenderContextPointer& renderContext, const Input& input) { + if (_isDisplayDepthEnabled && input) { + assert(renderContext->args); + assert(renderContext->args->hasViewFrustum()); + RenderArgs* args = renderContext->args; + + gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { + batch.enableStereo(false); + batch.setViewportTransform(args->_viewport); + + const auto geometryBuffer = DependencyManager::get(); + + glm::mat4 projMat; + Transform viewMat; + args->getViewFrustum().evalProjectionMatrix(projMat); + args->getViewFrustum().evalViewTransform(viewMat); + batch.setProjectionTransform(projMat); + batch.setViewTransform(viewMat, true); + batch.setModelTransform(Transform()); + + batch.setPipeline(getDebugPipeline()); + batch.setResourceTexture(0, input->getDepthTexture()); + const glm::vec4 color(1.0f, 0.5f, 0.2f, 1.0f); + const glm::vec2 bottomLeft(-1.0f, -1.0f); + const glm::vec2 topRight(1.0f, 1.0f); + geometryBuffer->renderQuad(batch, bottomLeft, topRight, color, _geometryId); + + batch.setResourceTexture(0, nullptr); + }); + } +} + +const gpu::PipelinePointer& DebugOutline::getDebugPipeline() { + if (!_debugPipeline) { + static const std::string VERTEX_SHADER{ debug_deferred_buffer_vert }; + static const std::string FRAGMENT_SHADER{ debug_deferred_buffer_frag }; + static const std::string SOURCE_PLACEHOLDER{ "//SOURCE_PLACEHOLDER" }; + static const auto SOURCE_PLACEHOLDER_INDEX = FRAGMENT_SHADER.find(SOURCE_PLACEHOLDER); + Q_ASSERT_X(SOURCE_PLACEHOLDER_INDEX != std::string::npos, Q_FUNC_INFO, + "Could not find source placeholder"); + static const std::string DEFAULT_DEPTH_SHADER{ + "vec4 getFragmentColor() {" + " float depth = texture(depthMap, uv).x;" + " return vec4(vec3(depth), 1.0);" + " }" + }; + + auto bakedFragmentShader = FRAGMENT_SHADER; + bakedFragmentShader.replace(SOURCE_PLACEHOLDER_INDEX, SOURCE_PLACEHOLDER.size(), DEFAULT_DEPTH_SHADER); + + static const auto vs = gpu::Shader::createVertex(VERTEX_SHADER); + const auto ps = gpu::Shader::createPixel(bakedFragmentShader); + const auto program = gpu::Shader::createProgram(vs, ps); + + gpu::Shader::BindingSet slotBindings; + slotBindings.insert(gpu::Shader::Binding("depthMap", 0)); + gpu::Shader::makeProgram(*program, slotBindings); + + auto state = std::make_shared(); + state->setDepthTest(gpu::State::DepthTest(false)); + state->setColorWriteMask(true, false, false, false); + _debugPipeline = gpu::Pipeline::create(program, state); + } + + return _debugPipeline; +} diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h new file mode 100644 index 0000000000..bb4343b06a --- /dev/null +++ b/libraries/render-utils/src/OutlineEffect.h @@ -0,0 +1,112 @@ +// +// OutlineEffect.h +// render-utils/src/ +// +// Created by Olivier Prat on 08/08/17. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_render_utils_OutlineEffect_h +#define hifi_render_utils_OutlineEffect_h + +#include +#include "DeferredFramebuffer.h" + +/* +class PickItemsConfig : public render::Job::Config { + Q_OBJECT + Q_PROPERTY(bool isEnabled MEMBER isEnabled NOTIFY dirty) + +public: + + bool isEnabled{ false }; + +signals: + + void dirty(); +}; +*/ + +class OutlineFramebuffer { +public: + OutlineFramebuffer(); + + gpu::FramebufferPointer getDepthFramebuffer(); + gpu::TexturePointer getDepthTexture(); + + // Update the source framebuffer size which will drive the allocation of all the other resources. + void update(const gpu::TexturePointer& linearDepthBuffer); + const glm::ivec2& getSourceFrameSize() const { return _frameSize; } + +protected: + + void clear(); + void allocate(); + + gpu::FramebufferPointer _depthFramebuffer; + gpu::TexturePointer _depthTexture; + + glm::ivec2 _frameSize; +}; + +using OutlineFramebufferPointer = std::shared_ptr; + +class PrepareOutline { + +public: + + using Input = render::VaryingSet2; + // Output will contain outlined objects only z-depth texture + using Output = OutlineFramebufferPointer; + using JobModel = render::Job::ModelIO; + + PrepareOutline() {} + + void run(const render::RenderContextPointer& renderContext, const PrepareOutline::Input& input, PrepareOutline::Output& output); + +private: + + OutlineFramebufferPointer _outlineFramebuffer; + gpu::PipelinePointer _copyDepthPipeline; +}; + +class DebugOutlineConfig : public render::Job::Config { + Q_OBJECT + Q_PROPERTY(bool viewOutlinedDepth MEMBER viewOutlinedDepth NOTIFY dirty) + +public: + + bool viewOutlinedDepth{ false }; + +signals: + void dirty(); +}; + + +class DebugOutline { +public: + using Input = OutlineFramebufferPointer; + using Config = DebugOutlineConfig; + using JobModel = render::Job::ModelI; + + DebugOutline(); + ~DebugOutline(); + + void configure(const Config& config); + void run(const render::RenderContextPointer& renderContext, const Input& inputs); + +private: + + const gpu::PipelinePointer& getDebugPipeline(); + + gpu::PipelinePointer _debugPipeline; + int _geometryId{ 0 }; + bool _isDisplayDepthEnabled{ false }; +}; + +#endif // hifi_render_utils_OutlineEffect_h + + diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 01c111151f..8740b767f6 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -40,7 +40,7 @@ #include "ToneMappingEffect.h" #include "SubsurfaceScattering.h" #include "PickItemsJob.h" -#include "RenderOutline.h" +#include "OutlineEffect.h" #include @@ -95,7 +95,8 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("DrawOpaqueOutlined", opaqueOutlineInputs, shapePlumber); // Retrieve z value of the outlined objects - const auto outlinedZBuffer = task.addJob("PrepareOutline", deferredFramebuffer); + const auto outlinePrepareInputs = PrepareOutline::Input(deferredFramebuffer, outlinedOpaques).hasVarying(); + const auto outlinedFrameBuffer = task.addJob("PrepareOutline", outlinePrepareInputs); // Render opaque objects in DeferredBuffer const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).hasVarying(); @@ -199,6 +200,9 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto debugAmbientOcclusionInputs = DebugAmbientOcclusion::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget, ambientOcclusionUniforms).hasVarying(); task.addJob("DebugAmbientOcclusion", debugAmbientOcclusionInputs); + // Debug outline + task.addJob("DebugOutline", outlinedFrameBuffer); + // Scene Octree Debugging job { task.addJob("DrawSceneOctree", spatialSelection); diff --git a/libraries/render-utils/src/RenderOutline.cpp b/libraries/render-utils/src/RenderOutline.cpp deleted file mode 100644 index 6ecf86143f..0000000000 --- a/libraries/render-utils/src/RenderOutline.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// -// RenderOutline.cpp -// render-utils/src/ -// -// Created by Olivier Prat on 08/08/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// -#include "RenderOutline.h" - -#include "gpu/Context.h" -#include "gpu/StandardShaderLib.h" - -#include "surfaceGeometry_copyDepth_frag.h" - -void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Input& deferredFramebuffer, PrepareOutline::Output& output) { - glm::uvec2 frameSize(renderContext->args->_viewport.z, renderContext->args->_viewport.w); - auto args = renderContext->args; - - // Resizing framebuffers instead of re-building them seems to cause issues with threaded - // rendering - if (_outlineFramebuffer && _outlineFramebuffer->getSize() != frameSize) { - _outlineFramebuffer.reset(); - } - - if (!_outlineFramebuffer) { - _outlineFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("deferredOutline")); - auto colorFormat = gpu::Element::COLOR_RED_HALF; - - auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_POINT); - auto primaryColorTexture = gpu::Texture::createRenderBuffer(colorFormat, frameSize.x, frameSize.y, gpu::Texture::SINGLE_MIP, defaultSampler); - - _outlineFramebuffer->setRenderBuffer(0, primaryColorTexture); - } - - if (!_copyDepthPipeline) { - auto vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS(); - auto ps = gpu::Shader::createPixel(std::string(surfaceGeometry_copyDepth_frag)); - gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); - - gpu::Shader::BindingSet slotBindings; - slotBindings.insert(gpu::Shader::Binding(std::string("depthMap"), 0)); - gpu::Shader::makeProgram(*program, slotBindings); - - gpu::StatePointer state = gpu::StatePointer(new gpu::State()); - - state->setColorWriteMask(true, false, false, false); - - // Good to go add the brand new pipeline - _copyDepthPipeline = gpu::Pipeline::create(program, state); - } - - gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { - auto depthBuffer = deferredFramebuffer->getPrimaryDepthTexture(); - - // Copy depth to texture as we will overwrite - batch.enableStereo(false); - - batch.setViewportTransform(args->_viewport); - batch.setProjectionTransform(glm::mat4()); - batch.resetViewTransform(); - batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(frameSize, args->_viewport)); - - batch.setFramebuffer(_outlineFramebuffer); - batch.setPipeline(_copyDepthPipeline); - batch.setResourceTexture(0, depthBuffer); - batch.draw(gpu::TRIANGLE_STRIP, 4); - - // Restore previous frame buffer - batch.setFramebuffer(deferredFramebuffer->getDeferredFramebuffer()); - }); - - output = _outlineFramebuffer->getRenderBuffer(0); -} diff --git a/libraries/render-utils/src/RenderOutline.h b/libraries/render-utils/src/RenderOutline.h deleted file mode 100644 index a97f2033ef..0000000000 --- a/libraries/render-utils/src/RenderOutline.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// RenderOutline.h -// render-utils/src/ -// -// Created by Olivier Prat on 08/08/17. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_render_utils_RenderOutline_h -#define hifi_render_utils_RenderOutline_h - -#include -#include "DeferredFramebuffer.h" - -/* -class PickItemsConfig : public render::Job::Config { - Q_OBJECT - Q_PROPERTY(bool isEnabled MEMBER isEnabled NOTIFY dirty) - -public: - - bool isEnabled{ false }; - -signals: - - void dirty(); -}; -*/ -class PrepareOutline { - -public: - - using Input = DeferredFramebufferPointer; - // Output will contain outlined objects only z-depth texture - using Output = gpu::TexturePointer; - using JobModel = render::Job::ModelIO; - - PrepareOutline() {} - - void run(const render::RenderContextPointer& renderContext, const PrepareOutline::Input& input, PrepareOutline::Output& output); - -private: - - gpu::FramebufferPointer _outlineFramebuffer; - gpu::PipelinePointer _copyDepthPipeline; -}; - -#endif // hifi_render_utils_RenderOutline_h - - diff --git a/scripts/developer/utilities/render/debugOutline.js b/scripts/developer/utilities/render/debugOutline.js new file mode 100644 index 0000000000..6a456054e1 --- /dev/null +++ b/scripts/developer/utilities/render/debugOutline.js @@ -0,0 +1,20 @@ +// +// debugOutline.js +// developer/utilities/render +// +// Olivier Prat, created on 08/08/2017. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +// Set up the qml ui +var qml = Script.resolvePath('outline.qml'); +var window = new OverlayWindow({ + title: 'Outline', + source: qml, + width: 250, + height: 80, +}); +window.closed.connect(function() { Script.stop(); }); \ No newline at end of file diff --git a/scripts/developer/utilities/render/outline.qml b/scripts/developer/utilities/render/outline.qml new file mode 100644 index 0000000000..11a9ecf432 --- /dev/null +++ b/scripts/developer/utilities/render/outline.qml @@ -0,0 +1,37 @@ +// +// outline.qml +// developer/utilities/render +// +// Olivier Prat, created on 08/08/2017. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.5 +import QtQuick.Controls 1.4 + +Item { + id: root + property var pickConfig: Render.getConfig("RenderMainView.PickOutlined") + property var debugConfig: Render.getConfig("RenderMainView.DebugOutline") + + Column { + spacing: 8 + + CheckBox { + text: "Edit Outline" + checked: root.pickConfig["enabled"] + onCheckedChanged: { + root.pickConfig["enabled"] = checked; + } + } + CheckBox { + text: "View Outlined Depth" + checked: root.debugConfig["viewOutlinedDepth"] + onCheckedChanged: { + root.debugConfig["viewOutlinedDepth"] = checked; + } + } + } +} From 0fb4e42e1fc9c64ff58a762e3d5d0ff8a90071cf Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 9 Aug 2017 11:52:31 +0200 Subject: [PATCH 05/48] Improved PickItemJob with item key filter --- libraries/render-utils/src/PickItemsJob.cpp | 19 +++++++++++-------- libraries/render-utils/src/PickItemsJob.h | 8 +++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/libraries/render-utils/src/PickItemsJob.cpp b/libraries/render-utils/src/PickItemsJob.cpp index 866510a115..3cfbd0f956 100644 --- a/libraries/render-utils/src/PickItemsJob.cpp +++ b/libraries/render-utils/src/PickItemsJob.cpp @@ -10,7 +10,7 @@ // #include "PickItemsJob.h" -PickItemsJob::PickItemsJob() { +PickItemsJob::PickItemsJob(render::ItemKey::Flags validKeys, render::ItemKey::Flags excludeKeys) : _validKeys{ validKeys }, _excludeKeys{ excludeKeys } { } void PickItemsJob::configure(const Config& config) { @@ -21,28 +21,31 @@ void PickItemsJob::run(const render::RenderContextPointer& renderContext, const float minIsectDistance = std::numeric_limits::max(); auto& itemBounds = input; - auto itemID = findNearestItem(renderContext, itemBounds, minIsectDistance); + auto item = findNearestItem(renderContext, itemBounds, minIsectDistance); - if (render::Item::isValidID(itemID)) { - output.emplace_back(itemID); + if (render::Item::isValidID(item.id)) { + output.push_back(item); } } -render::ItemID PickItemsJob::findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const { +render::ItemBound PickItemsJob::findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const { const glm::vec3 rayOrigin = renderContext->args->getViewFrustum().getPosition(); const glm::vec3 rayDirection = renderContext->args->getViewFrustum().getDirection(); BoxFace face; glm::vec3 normal; float isectDistance; - render::ItemID nearestItem = render::Item::INVALID_ITEM_ID; + render::ItemBound nearestItem( render::Item::INVALID_ITEM_ID ); const float minDistance = 1.f; const float maxDistance = 50.f; + render::ItemKey itemKey; for (const auto& itemBound : inputs) { if (!itemBound.bound.contains(rayOrigin) && itemBound.bound.findRayIntersection(rayOrigin, rayDirection, isectDistance, face, normal)) { auto& item = renderContext->_scene->getItem(itemBound.id); - if (item.getKey().isWorldSpace() && isectDistance>minDistance && isectDistance < minIsectDistance && isectDistanceminDistance && isectDistance < minIsectDistance && isectDistance +#include class PickItemsConfig : public render::Job::Config { @@ -30,16 +31,17 @@ public: using Output = render::ItemBounds; using JobModel = render::Job::ModelIO; - PickItemsJob(); + PickItemsJob(render::ItemKey::Flags validKeys = render::ItemKey::Builder().withTypeMeta().withTypeShape().build()._flags, render::ItemKey::Flags excludeKeys = 0); void configure(const Config& config); void run(const render::RenderContextPointer& renderContext, const PickItemsJob::Input& input, PickItemsJob::Output& output); private: - bool _isEnabled{ false }; + render::ItemKey::Flags _validKeys; + render::ItemKey::Flags _excludeKeys; - render::ItemID findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const; + render::ItemBound findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const; }; #endif // hifi_render_utils_PickItemsJob_h From cfa23b1758b5e40db34e90f3af6960776a4b008b Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 9 Aug 2017 12:32:32 +0200 Subject: [PATCH 06/48] Writing out depth buffer of outlined objects to texture working --- libraries/render-utils/src/OutlineEffect.cpp | 15 ++++++--------- libraries/render-utils/src/RenderDeferredTask.cpp | 4 +++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index 45bf9c7d81..758783760d 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -48,10 +48,11 @@ void OutlineFramebuffer::allocate() { auto width = _frameSize.x; auto height = _frameSize.y; - auto colorFormat = gpu::Element::VEC4F_COLOR_RGBA; // TODO : find a more compact format + auto format = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RED); - _depthFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("outlineDepth", colorFormat, width, height)); - _depthTexture = _depthFramebuffer->getRenderBuffer(0); + _depthTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(format, width, height)); + _depthFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("outlineDepth")); + _depthFramebuffer->setRenderBuffer(0, _depthTexture); } gpu::FramebufferPointer OutlineFramebuffer::getDepthFramebuffer() { @@ -72,9 +73,9 @@ void PrepareOutline::run(const render::RenderContextPointer& renderContext, cons auto outlinedItems = input.get1(); if (!outlinedItems.empty()) { - glm::uvec2 frameSize(renderContext->args->_viewport.z, renderContext->args->_viewport.w); auto args = renderContext->args; auto deferredFrameBuffer = input.get0(); + auto frameSize = deferredFrameBuffer->getFrameSize(); if (!_outlineFramebuffer) { _outlineFramebuffer = std::make_shared(); @@ -99,9 +100,6 @@ void PrepareOutline::run(const render::RenderContextPointer& renderContext, cons } gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { - auto depthBuffer = deferredFrameBuffer->getPrimaryDepthTexture(); - - // Copy depth to texture as we will overwrite batch.enableStereo(false); batch.setViewportTransform(args->_viewport); @@ -111,7 +109,7 @@ void PrepareOutline::run(const render::RenderContextPointer& renderContext, cons batch.setFramebuffer(_outlineFramebuffer->getDepthFramebuffer()); batch.setPipeline(_copyDepthPipeline); - batch.setResourceTexture(0, depthBuffer); + batch.setResourceTexture(0, deferredFrameBuffer->getPrimaryDepthTexture()); batch.draw(gpu::TRIANGLE_STRIP, 4); // Restore previous frame buffer @@ -199,7 +197,6 @@ const gpu::PipelinePointer& DebugOutline::getDebugPipeline() { auto state = std::make_shared(); state->setDepthTest(gpu::State::DepthTest(false)); - state->setColorWriteMask(true, false, false, false); _debugPipeline = gpu::Pipeline::create(program, state); } diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 8740b767f6..ba045dfff9 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -88,7 +88,9 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("PrepareStencil", primaryFramebuffer); // Select items that need to be outlined - const auto outlinedOpaques = task.addJob("PickOutlined", opaques); + const auto outlinedOpaques = task.addJob("PickOutlined", opaques, + // Pick only shapes so exclude meta + render::ItemKey::Builder().withTypeShape().build()._flags, render::ItemKey::Builder().withTypeMeta().build()._flags); // Render opaque outline objects first in DeferredBuffer const auto opaqueOutlineInputs = DrawStateSortDeferred::Inputs(outlinedOpaques, lightingModel).hasVarying(); From f36500a74c281a864b55c506349b0fab659c382c Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 9 Aug 2017 14:52:52 +0200 Subject: [PATCH 07/48] Working outline debugging view --- libraries/render-utils/src/OutlineEffect.cpp | 16 ++++++++++------ libraries/render-utils/src/OutlineEffect.h | 12 ++++++------ .../render-utils/src/RenderDeferredTask.cpp | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index 758783760d..84315c6004 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -69,7 +69,7 @@ gpu::TexturePointer OutlineFramebuffer::getDepthTexture() { return _depthTexture; } -void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Input& input, PrepareOutline::Output& output) { +void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Inputs& input, PrepareOutline::Output& output) { auto outlinedItems = input.get1(); if (!outlinedItems.empty()) { @@ -137,8 +137,10 @@ void DebugOutline::configure(const Config& config) { _isDisplayDepthEnabled = config.viewOutlinedDepth; } -void DebugOutline::run(const render::RenderContextPointer& renderContext, const Input& input) { - if (_isDisplayDepthEnabled && input) { +void DebugOutline::run(const render::RenderContextPointer& renderContext, const Inputs& input) { + const auto outlineFramebuffer = input; + + if (_isDisplayDepthEnabled && outlineFramebuffer) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); RenderArgs* args = renderContext->args; @@ -158,7 +160,8 @@ void DebugOutline::run(const render::RenderContextPointer& renderContext, const batch.setModelTransform(Transform()); batch.setPipeline(getDebugPipeline()); - batch.setResourceTexture(0, input->getDepthTexture()); + batch.setResourceTexture(0, outlineFramebuffer->getDepthTexture()); + const glm::vec4 color(1.0f, 0.5f, 0.2f, 1.0f); const glm::vec2 bottomLeft(-1.0f, -1.0f); const glm::vec2 topRight(1.0f, 1.0f); @@ -179,8 +182,9 @@ const gpu::PipelinePointer& DebugOutline::getDebugPipeline() { "Could not find source placeholder"); static const std::string DEFAULT_DEPTH_SHADER{ "vec4 getFragmentColor() {" - " float depth = texture(depthMap, uv).x;" - " return vec4(vec3(depth), 1.0);" + " float Zdb = texelFetch(depthMap, ivec2(gl_FragCoord.xy), 0).x;" + " Zdb = 1.0-(1.0-Zdb)*100;" + " return vec4(Zdb, Zdb, Zdb, 1.0);" " }" }; diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index bb4343b06a..2b5faf4378 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -58,14 +58,14 @@ class PrepareOutline { public: - using Input = render::VaryingSet2; + using Inputs = render::VaryingSet2; // Output will contain outlined objects only z-depth texture using Output = OutlineFramebufferPointer; - using JobModel = render::Job::ModelIO; + using JobModel = render::Job::ModelIO; PrepareOutline() {} - void run(const render::RenderContextPointer& renderContext, const PrepareOutline::Input& input, PrepareOutline::Output& output); + void run(const render::RenderContextPointer& renderContext, const PrepareOutline::Inputs& input, PrepareOutline::Output& output); private: @@ -88,15 +88,15 @@ signals: class DebugOutline { public: - using Input = OutlineFramebufferPointer; + using Inputs = OutlineFramebufferPointer; using Config = DebugOutlineConfig; - using JobModel = render::Job::ModelI; + using JobModel = render::Job::ModelI; DebugOutline(); ~DebugOutline(); void configure(const Config& config); - void run(const render::RenderContextPointer& renderContext, const Input& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); private: diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index ba045dfff9..b48934f664 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -97,7 +97,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("DrawOpaqueOutlined", opaqueOutlineInputs, shapePlumber); // Retrieve z value of the outlined objects - const auto outlinePrepareInputs = PrepareOutline::Input(deferredFramebuffer, outlinedOpaques).hasVarying(); + const auto outlinePrepareInputs = PrepareOutline::Inputs(deferredFramebuffer, outlinedOpaques).hasVarying(); const auto outlinedFrameBuffer = task.addJob("PrepareOutline", outlinePrepareInputs); // Render opaque objects in DeferredBuffer From 01a028cbb63081a7a2fee960773b1868e47095cb Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 9 Aug 2017 18:03:52 +0200 Subject: [PATCH 08/48] First alpha working version of outline --- libraries/render-utils/src/Outline.slf | 63 ++++++++++++++++++ libraries/render-utils/src/OutlineEffect.cpp | 66 +++++++++++++++++++ libraries/render-utils/src/OutlineEffect.h | 55 +++++++++++++++- libraries/render-utils/src/Outline_shared.slh | 17 +++++ libraries/render-utils/src/PickItemsJob.cpp | 14 ++-- libraries/render-utils/src/PickItemsJob.h | 8 ++- .../render-utils/src/RenderDeferredTask.cpp | 4 ++ .../utilities/render/debugOutline.js | 2 +- .../developer/utilities/render/outline.qml | 42 +++++++++++- 9 files changed, 260 insertions(+), 11 deletions(-) create mode 100644 libraries/render-utils/src/Outline.slf create mode 100644 libraries/render-utils/src/Outline_shared.slh diff --git a/libraries/render-utils/src/Outline.slf b/libraries/render-utils/src/Outline.slf new file mode 100644 index 0000000000..f3f01ff72b --- /dev/null +++ b/libraries/render-utils/src/Outline.slf @@ -0,0 +1,63 @@ +<@include gpu/Config.slh@> +<$VERSION_HEADER$> +// +// Add outline effect based on two zbuffers : one containing the total scene z and another +// with the z of only the objects to be outlined +// +// Created by Olivier Prat on 08/09/2017 +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +<@include Outline_shared.slh@> + +uniform outlineParamsBuffer { + OutlineParameters params; +}; + +uniform sampler2D sceneDepthMap; +uniform sampler2D outlinedDepthMap; + +in vec2 varTexCoord0; +out vec4 outFragColor; + +const int BLUR_KERNEL_SIZE = 9; +const float FAR_DISTANCE = 1.0; + +void main(void) { + float outlinedDepth = texture(outlinedDepthMap, varTexCoord0).x; + if (outlinedDepth < FAR_DISTANCE) { + // We're not on the far plane so we are on the outlined object, thus no outline to do! + discard; + } + + //float sceneDepth = texture(sceneDepthMap, varTexCoord0).x; + float outlineIntensity = 0.0; + { + const float deltaUv = params._size / BLUR_KERNEL_SIZE; + vec2 uv; + vec2 startUv = varTexCoord0 - vec2(params._size, params._size) / 2.0; + int x; + int y; + + for (y=0 ; y_context, [&](gpu::Batch& batch) { batch.enableStereo(false); @@ -122,6 +125,69 @@ void PrepareOutline::run(const render::RenderContextPointer& renderContext, cons } } +DrawOutline::DrawOutline() { +} + +void DrawOutline::configure(const Config& config) { + _color = config.color; + _size = config.width; +} + +void DrawOutline::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { + auto mainFrameBuffer = inputs.get0(); + + if (mainFrameBuffer) { + auto sceneDepthBuffer = mainFrameBuffer->getPrimaryDepthTexture(); + auto outlinedDepthBuffer = inputs.get1(); + auto pipeline = getPipeline(); + + if (outlinedDepthBuffer) { + auto framebufferSize = glm::ivec2(sceneDepthBuffer->getDimensions()); + auto args = renderContext->args; + { + auto& configuration = _configuration.edit(); + configuration._color = _color; + configuration._size = _size / 1024.f; + } + + gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { + batch.enableStereo(false); + + batch.setViewportTransform(args->_viewport); + batch.setProjectionTransform(glm::mat4()); + batch.resetViewTransform(); + batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(framebufferSize, args->_viewport)); + batch.setPipeline(pipeline); + + batch.setUniformBuffer(0, _configuration); + batch.setResourceTexture(SCENE_DEPTH_SLOT, sceneDepthBuffer); + batch.setResourceTexture(OUTLINED_DEPTH_SLOT, outlinedDepthBuffer->getDepthTexture()); + batch.draw(gpu::TRIANGLE_STRIP, 4); + }); + } + } +} + +const gpu::PipelinePointer& DrawOutline::getPipeline() { + if (!_pipeline) { + auto vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS(); + auto ps = gpu::Shader::createPixel(std::string(Outline_frag)); + gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); + + gpu::Shader::BindingSet slotBindings; + slotBindings.insert(gpu::Shader::Binding("outlineParamsBuffer", 0)); + slotBindings.insert(gpu::Shader::Binding("sceneDepthMap", SCENE_DEPTH_SLOT)); + slotBindings.insert(gpu::Shader::Binding("outlinedDepthMap", OUTLINED_DEPTH_SLOT)); + gpu::Shader::makeProgram(*program, slotBindings); + + gpu::StatePointer state = gpu::StatePointer(new gpu::State()); + state->setDepthTest(false); + state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); + _pipeline = gpu::Pipeline::create(program, state); + } + return _pipeline; +} + DebugOutline::DebugOutline() { _geometryId = DependencyManager::get()->allocateID(); } diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index 2b5faf4378..0561510d2b 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -73,6 +73,60 @@ private: gpu::PipelinePointer _copyDepthPipeline; }; +class DrawOutlineConfig : public render::Job::Config { + Q_OBJECT + Q_PROPERTY(float width MEMBER width NOTIFY dirty) + Q_PROPERTY(float colorR READ getColorR WRITE setColorR NOTIFY dirty) + Q_PROPERTY(float colorG READ getColorG WRITE setColorG NOTIFY dirty) + Q_PROPERTY(float colorB READ getColorB WRITE setColorB NOTIFY dirty) +public: + + void setColorR(float value) { color.r = value; } + float getColorR() const { return color.r; } + + void setColorG(float value) { color.g = value; } + float getColorG() const { return color.g; } + + void setColorB(float value) { color.b = value; } + float getColorB() const { return color.b; } + + float width{ 5.f }; + glm::vec3 color{ 1.f, 0.7f, 0.2f }; + +signals: + void dirty(); +}; + +class DrawOutline { +public: + using Inputs = render::VaryingSet2; + using Config = DrawOutlineConfig; + using JobModel = render::Job::ModelI; + + DrawOutline(); + + void configure(const Config& config); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); + +private: + + enum { + SCENE_DEPTH_SLOT = 0, + OUTLINED_DEPTH_SLOT + }; + +#include "Outline_shared.slh" + + using OutlineConfigurationBuffer = gpu::StructBuffer; + + const gpu::PipelinePointer& getPipeline(); + + gpu::PipelinePointer _pipeline; + OutlineConfigurationBuffer _configuration; + glm::vec3 _color; + float _size; +}; + class DebugOutlineConfig : public render::Job::Config { Q_OBJECT Q_PROPERTY(bool viewOutlinedDepth MEMBER viewOutlinedDepth NOTIFY dirty) @@ -85,7 +139,6 @@ signals: void dirty(); }; - class DebugOutline { public: using Inputs = OutlineFramebufferPointer; diff --git a/libraries/render-utils/src/Outline_shared.slh b/libraries/render-utils/src/Outline_shared.slh new file mode 100644 index 0000000000..fd1d9aac49 --- /dev/null +++ b/libraries/render-utils/src/Outline_shared.slh @@ -0,0 +1,17 @@ +// glsl / C++ compatible source as interface for Outline +#ifdef __cplusplus +# define VEC3 glm::vec3 +#else +# define VEC3 vec3 +#endif + +struct OutlineParameters +{ + VEC3 _color; + float _size; +}; + +// <@if 1@> +// Trigger Scribe include +// <@endif@> +// diff --git a/libraries/render-utils/src/PickItemsJob.cpp b/libraries/render-utils/src/PickItemsJob.cpp index 3cfbd0f956..5d67f26157 100644 --- a/libraries/render-utils/src/PickItemsJob.cpp +++ b/libraries/render-utils/src/PickItemsJob.cpp @@ -14,17 +14,19 @@ PickItemsJob::PickItemsJob(render::ItemKey::Flags validKeys, render::ItemKey::Fl } void PickItemsJob::configure(const Config& config) { + _isEnabled = config.pick; } void PickItemsJob::run(const render::RenderContextPointer& renderContext, const PickItemsJob::Input& input, PickItemsJob::Output& output) { output.clear(); + if (_isEnabled) { + float minIsectDistance = std::numeric_limits::max(); + auto& itemBounds = input; + auto item = findNearestItem(renderContext, itemBounds, minIsectDistance); - float minIsectDistance = std::numeric_limits::max(); - auto& itemBounds = input; - auto item = findNearestItem(renderContext, itemBounds, minIsectDistance); - - if (render::Item::isValidID(item.id)) { - output.push_back(item); + if (render::Item::isValidID(item.id)) { + output.push_back(item); + } } } diff --git a/libraries/render-utils/src/PickItemsJob.h b/libraries/render-utils/src/PickItemsJob.h index 3e220a4e7f..221ef13b13 100644 --- a/libraries/render-utils/src/PickItemsJob.h +++ b/libraries/render-utils/src/PickItemsJob.h @@ -16,10 +16,15 @@ #include class PickItemsConfig : public render::Job::Config { + Q_OBJECT + Q_PROPERTY(bool pick MEMBER pick NOTIFY dirty) public: - PickItemsConfig() : render::Job::Config(false) {} + bool pick{ false }; + +signals: + void dirty(); }; class PickItemsJob { @@ -40,6 +45,7 @@ private: render::ItemKey::Flags _validKeys; render::ItemKey::Flags _excludeKeys; + bool _isEnabled{ false }; render::ItemBound findNearestItem(const render::RenderContextPointer& renderContext, const render::ItemBounds& inputs, float& minIsectDistance) const; }; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index b48934f664..945e1c0fe3 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -169,6 +169,10 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto toneMappingInputs = render::Varying(ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer)); task.addJob("ToneMapping", toneMappingInputs); + // Draw outline + const auto outlineInputs = DrawOutline::Inputs(deferredFramebuffer, outlinedFrameBuffer).hasVarying(); + task.addJob("DrawOutline", outlineInputs); + { // DEbug the bounds of the rendered items, still look at the zbuffer task.addJob("DrawMetaBounds", metas); task.addJob("DrawOpaqueBounds", opaques); diff --git a/scripts/developer/utilities/render/debugOutline.js b/scripts/developer/utilities/render/debugOutline.js index 6a456054e1..05b7ffbbc9 100644 --- a/scripts/developer/utilities/render/debugOutline.js +++ b/scripts/developer/utilities/render/debugOutline.js @@ -15,6 +15,6 @@ var window = new OverlayWindow({ title: 'Outline', source: qml, width: 250, - height: 80, + height: 250, }); window.closed.connect(function() { Script.stop(); }); \ No newline at end of file diff --git a/scripts/developer/utilities/render/outline.qml b/scripts/developer/utilities/render/outline.qml index 11a9ecf432..4ba7dad157 100644 --- a/scripts/developer/utilities/render/outline.qml +++ b/scripts/developer/utilities/render/outline.qml @@ -10,20 +10,22 @@ // import QtQuick 2.5 import QtQuick.Controls 1.4 +import "configSlider" Item { id: root property var pickConfig: Render.getConfig("RenderMainView.PickOutlined") property var debugConfig: Render.getConfig("RenderMainView.DebugOutline") + property var drawConfig: Render.getConfig("RenderMainView.DrawOutline") Column { spacing: 8 CheckBox { text: "Edit Outline" - checked: root.pickConfig["enabled"] + checked: root.pickConfig["pick"] onCheckedChanged: { - root.pickConfig["enabled"] = checked; + root.pickConfig["pick"] = checked; } } CheckBox { @@ -33,5 +35,41 @@ Item { root.debugConfig["viewOutlinedDepth"] = checked; } } + ConfigSlider { + label: "Width" + integral: false + config: root.drawConfig + property: "width" + max: 15.0 + min: 0.0 + width: 230 + } + ConfigSlider { + label: "Color R" + integral: false + config: root.drawConfig + property: "colorR" + max: 1.0 + min: 0.0 + width: 230 + } + ConfigSlider { + label: "Color G" + integral: false + config: root.drawConfig + property: "colorG" + max: 1.0 + min: 0.0 + width: 230 + } + ConfigSlider { + label: "Color B" + integral: false + config: root.drawConfig + property: "colorB" + max: 1.0 + min: 0.0 + width: 230 + } } } From 57dfe10baf6d4be910de76806c9e4a4559bf849f Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 9 Aug 2017 18:15:05 +0200 Subject: [PATCH 09/48] Fixed blur problems on screen edges --- libraries/render-utils/src/Outline.slf | 17 ++++++++++++----- libraries/render-utils/src/OutlineEffect.h | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/libraries/render-utils/src/Outline.slf b/libraries/render-utils/src/Outline.slf index f3f01ff72b..d55938e9d7 100644 --- a/libraries/render-utils/src/Outline.slf +++ b/libraries/render-utils/src/Outline.slf @@ -35,6 +35,7 @@ void main(void) { //float sceneDepth = texture(sceneDepthMap, varTexCoord0).x; float outlineIntensity = 0.0; + float weight = 0.0; { const float deltaUv = params._size / BLUR_KERNEL_SIZE; vec2 uv; @@ -46,14 +47,20 @@ void main(void) { uv = startUv; startUv.y += deltaUv; - for (x=0 ; x=0.0 && uv.y<=1.0) { + for (x=0 ; x=0.0 && uv.x<=1.0) + { + outlinedDepth = texture(outlinedDepthMap, uv).x; + outlineIntensity += (outlinedDepth < FAR_DISTANCE) ? 1.0 : 0.0; + weight += 1.f; + } + uv.x += deltaUv; + } } } - outlineIntensity /= BLUR_KERNEL_SIZE*BLUR_KERNEL_SIZE; + outlineIntensity /= weight; } if (outlineIntensity < 1e-3) { diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index 0561510d2b..3e58d78acc 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -81,13 +81,13 @@ class DrawOutlineConfig : public render::Job::Config { Q_PROPERTY(float colorB READ getColorB WRITE setColorB NOTIFY dirty) public: - void setColorR(float value) { color.r = value; } + void setColorR(float value) { color.r = value; emit dirty(); } float getColorR() const { return color.r; } - void setColorG(float value) { color.g = value; } + void setColorG(float value) { color.g = value; emit dirty(); } float getColorG() const { return color.g; } - void setColorB(float value) { color.b = value; } + void setColorB(float value) { color.b = value; emit dirty(); } float getColorB() const { return color.b; } float width{ 5.f }; From 0f2c41b0095d96e26226b34ba8182020281e79d7 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 9 Aug 2017 18:27:39 +0200 Subject: [PATCH 10/48] Added outline intensity --- libraries/render-utils/src/Outline.slf | 1 + libraries/render-utils/src/OutlineEffect.cpp | 6 ++++-- libraries/render-utils/src/OutlineEffect.h | 5 ++++- libraries/render-utils/src/Outline_shared.slh | 1 + scripts/developer/utilities/render/outline.qml | 9 +++++++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libraries/render-utils/src/Outline.slf b/libraries/render-utils/src/Outline.slf index d55938e9d7..1aec1efd5a 100644 --- a/libraries/render-utils/src/Outline.slf +++ b/libraries/render-utils/src/Outline.slf @@ -66,5 +66,6 @@ void main(void) { if (outlineIntensity < 1e-3) { discard; } + outlineIntensity = min(1.0, outlineIntensity * params._intensity); outFragColor = vec4(params._color.rgb, outlineIntensity); } diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index b63f30f51c..c91f10001d 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -130,7 +130,8 @@ DrawOutline::DrawOutline() { void DrawOutline::configure(const Config& config) { _color = config.color; - _size = config.width; + _size = config.width / 1024.f; + _intensity = config.intensity * 10.f; } void DrawOutline::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { @@ -147,7 +148,8 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I { auto& configuration = _configuration.edit(); configuration._color = _color; - configuration._size = _size / 1024.f; + configuration._size = _size; + configuration._intensity = _intensity; } gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index 3e58d78acc..fc8a715a53 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -76,6 +76,7 @@ private: class DrawOutlineConfig : public render::Job::Config { Q_OBJECT Q_PROPERTY(float width MEMBER width NOTIFY dirty) + Q_PROPERTY(float intensity MEMBER intensity NOTIFY dirty) Q_PROPERTY(float colorR READ getColorR WRITE setColorR NOTIFY dirty) Q_PROPERTY(float colorG READ getColorG WRITE setColorG NOTIFY dirty) Q_PROPERTY(float colorB READ getColorB WRITE setColorB NOTIFY dirty) @@ -90,8 +91,9 @@ public: void setColorB(float value) { color.b = value; emit dirty(); } float getColorB() const { return color.b; } - float width{ 5.f }; glm::vec3 color{ 1.f, 0.7f, 0.2f }; + float width{ 5.f }; + float intensity{ 1.f }; signals: void dirty(); @@ -125,6 +127,7 @@ private: OutlineConfigurationBuffer _configuration; glm::vec3 _color; float _size; + float _intensity; }; class DebugOutlineConfig : public render::Job::Config { diff --git a/libraries/render-utils/src/Outline_shared.slh b/libraries/render-utils/src/Outline_shared.slh index fd1d9aac49..602e15f8e7 100644 --- a/libraries/render-utils/src/Outline_shared.slh +++ b/libraries/render-utils/src/Outline_shared.slh @@ -9,6 +9,7 @@ struct OutlineParameters { VEC3 _color; float _size; + float _intensity; }; // <@if 1@> diff --git a/scripts/developer/utilities/render/outline.qml b/scripts/developer/utilities/render/outline.qml index 4ba7dad157..7ed3b6a2bb 100644 --- a/scripts/developer/utilities/render/outline.qml +++ b/scripts/developer/utilities/render/outline.qml @@ -44,6 +44,15 @@ Item { min: 0.0 width: 230 } + ConfigSlider { + label: "Intensity" + integral: false + config: root.drawConfig + property: "intensity" + max: 1.0 + min: 0.0 + width: 230 + } ConfigSlider { label: "Color R" integral: false From 392a99f038cf7367dba134d086d72d6c92b2201a Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 9 Aug 2017 19:18:16 +0200 Subject: [PATCH 11/48] Added some fill parameters. Still need to fix issues with blur changing with screen aspect ratio --- libraries/render-utils/src/Outline.slf | 38 ++++--- libraries/render-utils/src/OutlineEffect.cpp | 8 +- libraries/render-utils/src/OutlineEffect.h | 10 ++ libraries/render-utils/src/Outline_shared.slh | 3 + .../utilities/render/debugOutline.js | 4 +- .../developer/utilities/render/outline.qml | 101 +++++++++++++----- 6 files changed, 119 insertions(+), 45 deletions(-) diff --git a/libraries/render-utils/src/Outline.slf b/libraries/render-utils/src/Outline.slf index 1aec1efd5a..acb79184fe 100644 --- a/libraries/render-utils/src/Outline.slf +++ b/libraries/render-utils/src/Outline.slf @@ -28,15 +28,25 @@ const float FAR_DISTANCE = 1.0; void main(void) { float outlinedDepth = texture(outlinedDepthMap, varTexCoord0).x; + float intensity = 0.0; + if (outlinedDepth < FAR_DISTANCE) { // We're not on the far plane so we are on the outlined object, thus no outline to do! - discard; - } - //float sceneDepth = texture(sceneDepthMap, varTexCoord0).x; - float outlineIntensity = 0.0; - float weight = 0.0; - { + // But maybe we need to fill the interior + if (params._fillOpacityUnoccluded>1e-3 && params._fillOpacityUnoccluded>1e-3) { + // Are we occluded? + float sceneDepth = texture(sceneDepthMap, varTexCoord0).x; + if (sceneDepth < outlinedDepth) { + intensity = params._fillOpacityOccluded; + } else { + intensity = params._fillOpacityUnoccluded; + } + } else { + discard; + } + } else { + float weight = 0.0; const float deltaUv = params._size / BLUR_KERNEL_SIZE; vec2 uv; vec2 startUv = varTexCoord0 - vec2(params._size, params._size) / 2.0; @@ -52,7 +62,7 @@ void main(void) { if (uv.x>=0.0 && uv.x<=1.0) { outlinedDepth = texture(outlinedDepthMap, uv).x; - outlineIntensity += (outlinedDepth < FAR_DISTANCE) ? 1.0 : 0.0; + intensity += (outlinedDepth < FAR_DISTANCE) ? 1.0 : 0.0; weight += 1.f; } uv.x += deltaUv; @@ -60,12 +70,14 @@ void main(void) { } } - outlineIntensity /= weight; + intensity /= weight; + + if (intensity < 1e-3) { + discard; + } + + intensity = min(1.0, intensity / params._threshold) * params._intensity; } - if (outlineIntensity < 1e-3) { - discard; - } - outlineIntensity = min(1.0, outlineIntensity * params._intensity); - outFragColor = vec4(params._color.rgb, outlineIntensity); + outFragColor = vec4(params._color.rgb, intensity); } diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index c91f10001d..1012067851 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -131,7 +131,10 @@ DrawOutline::DrawOutline() { void DrawOutline::configure(const Config& config) { _color = config.color; _size = config.width / 1024.f; - _intensity = config.intensity * 10.f; + _fillOpacityUnoccluded = config.fillOpacityUnoccluded; + _fillOpacityOccluded = config.fillOpacityOccluded; + _threshold = config.glow ? 1.f : 0.f; + _intensity = config.intensity * (config.glow ? 2.f : 1.f); } void DrawOutline::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { @@ -150,6 +153,9 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I configuration._color = _color; configuration._size = _size; configuration._intensity = _intensity; + configuration._fillOpacityUnoccluded = _fillOpacityUnoccluded; + configuration._fillOpacityOccluded = _fillOpacityOccluded; + configuration._threshold = _threshold; } gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index fc8a715a53..d0c586dafc 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -75,11 +75,15 @@ private: class DrawOutlineConfig : public render::Job::Config { Q_OBJECT + Q_PROPERTY(bool glow MEMBER glow NOTIFY dirty) Q_PROPERTY(float width MEMBER width NOTIFY dirty) Q_PROPERTY(float intensity MEMBER intensity NOTIFY dirty) Q_PROPERTY(float colorR READ getColorR WRITE setColorR NOTIFY dirty) Q_PROPERTY(float colorG READ getColorG WRITE setColorG NOTIFY dirty) Q_PROPERTY(float colorB READ getColorB WRITE setColorB NOTIFY dirty) + Q_PROPERTY(float fillOpacityUnoccluded MEMBER fillOpacityUnoccluded NOTIFY dirty) + Q_PROPERTY(float fillOpacityOccluded MEMBER fillOpacityOccluded NOTIFY dirty) + public: void setColorR(float value) { color.r = value; emit dirty(); } @@ -94,6 +98,9 @@ public: glm::vec3 color{ 1.f, 0.7f, 0.2f }; float width{ 5.f }; float intensity{ 1.f }; + float fillOpacityUnoccluded{ 0.35f }; + float fillOpacityOccluded{ 0.1f }; + bool glow{ false }; signals: void dirty(); @@ -128,6 +135,9 @@ private: glm::vec3 _color; float _size; float _intensity; + float _fillOpacityUnoccluded; + float _fillOpacityOccluded; + float _threshold; }; class DebugOutlineConfig : public render::Job::Config { diff --git a/libraries/render-utils/src/Outline_shared.slh b/libraries/render-utils/src/Outline_shared.slh index 602e15f8e7..27c9882815 100644 --- a/libraries/render-utils/src/Outline_shared.slh +++ b/libraries/render-utils/src/Outline_shared.slh @@ -10,6 +10,9 @@ struct OutlineParameters VEC3 _color; float _size; float _intensity; + float _fillOpacityUnoccluded; + float _fillOpacityOccluded; + float _threshold; }; // <@if 1@> diff --git a/scripts/developer/utilities/render/debugOutline.js b/scripts/developer/utilities/render/debugOutline.js index 05b7ffbbc9..e333ab5869 100644 --- a/scripts/developer/utilities/render/debugOutline.js +++ b/scripts/developer/utilities/render/debugOutline.js @@ -14,7 +14,7 @@ var qml = Script.resolvePath('outline.qml'); var window = new OverlayWindow({ title: 'Outline', source: qml, - width: 250, - height: 250, + width: 285, + height: 370, }); window.closed.connect(function() { Script.stop(); }); \ No newline at end of file diff --git a/scripts/developer/utilities/render/outline.qml b/scripts/developer/utilities/render/outline.qml index 7ed3b6a2bb..321dd9271b 100644 --- a/scripts/developer/utilities/render/outline.qml +++ b/scripts/developer/utilities/render/outline.qml @@ -35,6 +35,13 @@ Item { root.debugConfig["viewOutlinedDepth"] = checked; } } + CheckBox { + text: "Glow" + checked: root.drawConfig["glow"] + onCheckedChanged: { + root.drawConfig["glow"] = checked; + } + } ConfigSlider { label: "Width" integral: false @@ -42,7 +49,7 @@ Item { property: "width" max: 15.0 min: 0.0 - width: 230 + width: 280 } ConfigSlider { label: "Intensity" @@ -51,34 +58,70 @@ Item { property: "intensity" max: 1.0 min: 0.0 - width: 230 - } - ConfigSlider { - label: "Color R" - integral: false - config: root.drawConfig - property: "colorR" - max: 1.0 - min: 0.0 - width: 230 - } - ConfigSlider { - label: "Color G" - integral: false - config: root.drawConfig - property: "colorG" - max: 1.0 - min: 0.0 - width: 230 - } - ConfigSlider { - label: "Color B" - integral: false - config: root.drawConfig - property: "colorB" - max: 1.0 - min: 0.0 - width: 230 + width: 280 } + + GroupBox { + title: "Color" + width: 280 + Column { + spacing: 8 + + ConfigSlider { + label: "Red" + integral: false + config: root.drawConfig + property: "colorR" + max: 1.0 + min: 0.0 + width: 270 + } + ConfigSlider { + label: "Green" + integral: false + config: root.drawConfig + property: "colorG" + max: 1.0 + min: 0.0 + width: 270 + } + ConfigSlider { + label: "Blue" + integral: false + config: root.drawConfig + property: "colorB" + max: 1.0 + min: 0.0 + width: 270 + } + } + } + + GroupBox { + title: "Fill Opacity" + width: 280 + Column { + spacing: 8 + + ConfigSlider { + label: "Unoccluded" + integral: false + config: root.drawConfig + property: "fillOpacityUnoccluded" + max: 1.0 + min: 0.0 + width: 270 + } + ConfigSlider { + label: "Occluded" + integral: false + config: root.drawConfig + property: "fillOpacityOccluded" + max: 1.0 + min: 0.0 + width: 270 + } + } + } } } From 189cc8efd0044045802046201436f9fdc93dea83 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 10 Aug 2017 10:12:10 +0200 Subject: [PATCH 12/48] Outline width is now screen aspect ratio independent --- libraries/render-utils/src/Outline.slf | 15 +++++++-------- libraries/render-utils/src/OutlineEffect.cpp | 3 ++- libraries/render-utils/src/OutlineEffect.h | 15 --------------- libraries/render-utils/src/Outline_shared.slh | 9 ++++++++- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/libraries/render-utils/src/Outline.slf b/libraries/render-utils/src/Outline.slf index acb79184fe..7c3277d2f2 100644 --- a/libraries/render-utils/src/Outline.slf +++ b/libraries/render-utils/src/Outline.slf @@ -23,7 +23,7 @@ uniform sampler2D outlinedDepthMap; in vec2 varTexCoord0; out vec4 outFragColor; -const int BLUR_KERNEL_SIZE = 9; +const int BLUR_KERNEL_SIZE = 7; const float FAR_DISTANCE = 1.0; void main(void) { @@ -47,15 +47,15 @@ void main(void) { } } else { float weight = 0.0; - const float deltaUv = params._size / BLUR_KERNEL_SIZE; + const vec2 deltaUv = params._size / BLUR_KERNEL_SIZE; + vec2 lineStartUv = varTexCoord0 - params._size / 2.0; vec2 uv; - vec2 startUv = varTexCoord0 - vec2(params._size, params._size) / 2.0; int x; int y; for (y=0 ; y=0.0 && uv.y<=1.0) { for (x=0 ; x #include "DeferredFramebuffer.h" -/* -class PickItemsConfig : public render::Job::Config { - Q_OBJECT - Q_PROPERTY(bool isEnabled MEMBER isEnabled NOTIFY dirty) - -public: - - bool isEnabled{ false }; - -signals: - - void dirty(); -}; -*/ - class OutlineFramebuffer { public: OutlineFramebuffer(); diff --git a/libraries/render-utils/src/Outline_shared.slh b/libraries/render-utils/src/Outline_shared.slh index 27c9882815..4eaa995907 100644 --- a/libraries/render-utils/src/Outline_shared.slh +++ b/libraries/render-utils/src/Outline_shared.slh @@ -1,18 +1,25 @@ // glsl / C++ compatible source as interface for Outline #ifdef __cplusplus +# define VEC2 glm::vec2 # define VEC3 glm::vec3 #else +# define VEC2 vec2 # define VEC3 vec3 #endif struct OutlineParameters { VEC3 _color; - float _size; float _intensity; + + VEC2 _size; float _fillOpacityUnoccluded; float _fillOpacityOccluded; + float _threshold; + float padding1; + float padding2; + float padding3; }; // <@if 1@> From b410f97aef84e6a41fe4bf23e97ee68bb6119e63 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 10 Aug 2017 10:54:28 +0200 Subject: [PATCH 13/48] Adjusted kernel size to real pixel blur width --- libraries/render-utils/src/Outline.slf | 19 ++++++++++--------- libraries/render-utils/src/OutlineEffect.cpp | 8 +++++--- libraries/render-utils/src/Outline_shared.slh | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/libraries/render-utils/src/Outline.slf b/libraries/render-utils/src/Outline.slf index 7c3277d2f2..9117d0c340 100644 --- a/libraries/render-utils/src/Outline.slf +++ b/libraries/render-utils/src/Outline.slf @@ -23,21 +23,22 @@ uniform sampler2D outlinedDepthMap; in vec2 varTexCoord0; out vec4 outFragColor; -const int BLUR_KERNEL_SIZE = 7; const float FAR_DISTANCE = 1.0; +const float DEPTH_BIAS = 0.0; +const float OPACITY_EPSILON = 5e-3; void main(void) { float outlinedDepth = texture(outlinedDepthMap, varTexCoord0).x; float intensity = 0.0; - if (outlinedDepth < FAR_DISTANCE) { + if (outlinedDepth < (FAR_DISTANCE-DEPTH_BIAS)) { // We're not on the far plane so we are on the outlined object, thus no outline to do! // But maybe we need to fill the interior - if (params._fillOpacityUnoccluded>1e-3 && params._fillOpacityUnoccluded>1e-3) { + if (params._fillOpacityUnoccluded>OPACITY_EPSILON && params._fillOpacityUnoccluded>OPACITY_EPSILON) { // Are we occluded? float sceneDepth = texture(sceneDepthMap, varTexCoord0).x; - if (sceneDepth < outlinedDepth) { + if (sceneDepth < (outlinedDepth-DEPTH_BIAS)) { intensity = params._fillOpacityOccluded; } else { intensity = params._fillOpacityUnoccluded; @@ -47,22 +48,22 @@ void main(void) { } } else { float weight = 0.0; - const vec2 deltaUv = params._size / BLUR_KERNEL_SIZE; + const vec2 deltaUv = params._size / params._blurKernelSize; vec2 lineStartUv = varTexCoord0 - params._size / 2.0; vec2 uv; int x; int y; - for (y=0 ; y=0.0 && uv.y<=1.0) { - for (x=0 ; x=0.0 && uv.x<=1.0) { outlinedDepth = texture(outlinedDepthMap, uv).x; - intensity += (outlinedDepth < FAR_DISTANCE) ? 1.0 : 0.0; + intensity += (outlinedDepth < (FAR_DISTANCE-DEPTH_BIAS)) ? 1.0 : 0.0; weight += 1.f; } uv.x += deltaUv.x; @@ -71,7 +72,7 @@ void main(void) { } intensity /= weight; - if (intensity < 5e-3) { + if (intensity < OPACITY_EPSILON) { discard; } diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index 1da83f4fe9..78952d353b 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -133,7 +133,7 @@ void DrawOutline::configure(const Config& config) { _size = config.width / 1024.f; _fillOpacityUnoccluded = config.fillOpacityUnoccluded; _fillOpacityOccluded = config.fillOpacityOccluded; - _threshold = config.glow ? 1.f : 0.f; + _threshold = config.glow ? 1.f : 1e-3f; _intensity = config.intensity * (config.glow ? 2.f : 1.f); } @@ -151,12 +151,14 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I { auto& configuration = _configuration.edit(); configuration._color = _color; - configuration._size.x = _size * framebufferSize.y / framebufferSize.x; - configuration._size.y = _size; configuration._intensity = _intensity; configuration._fillOpacityUnoccluded = _fillOpacityUnoccluded; configuration._fillOpacityOccluded = _fillOpacityOccluded; configuration._threshold = _threshold; + // Size is normalized for 1 pixel at 1024 pix resolution so we multiply by the real resolution to have the final pixel size estimate + configuration._blurKernelSize = std::min(10, std::max(2, (int)floorf(_size*framebufferSize.y + 0.5f))); + configuration._size.x = _size * framebufferSize.y / framebufferSize.x; + configuration._size.y = _size; } gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { diff --git a/libraries/render-utils/src/Outline_shared.slh b/libraries/render-utils/src/Outline_shared.slh index 4eaa995907..902bbd20ad 100644 --- a/libraries/render-utils/src/Outline_shared.slh +++ b/libraries/render-utils/src/Outline_shared.slh @@ -17,7 +17,7 @@ struct OutlineParameters float _fillOpacityOccluded; float _threshold; - float padding1; + int _blurKernelSize; float padding2; float padding3; }; From f88141aa31319a2d567276df15d52ecff9b5bd58 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 10 Aug 2017 11:37:07 +0200 Subject: [PATCH 14/48] Removed unused color formats in render::Format --- libraries/gpu/src/gpu/Format.cpp | 2 -- libraries/gpu/src/gpu/Format.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/libraries/gpu/src/gpu/Format.cpp b/libraries/gpu/src/gpu/Format.cpp index 4079606286..b15f8d929f 100644 --- a/libraries/gpu/src/gpu/Format.cpp +++ b/libraries/gpu/src/gpu/Format.cpp @@ -30,8 +30,6 @@ const Element Element::VEC2NU8_XY{ VEC2, NUINT8, XY }; const Element Element::COLOR_R11G11B10{ SCALAR, FLOAT, R11G11B10 }; const Element Element::VEC4F_COLOR_RGBA{ VEC4, FLOAT, RGBA }; -const Element Element::COLOR_RED_FLOAT{ SCALAR, FLOAT, RED }; -const Element Element::COLOR_RED_HALF{ SCALAR, HALF, RED }; const Element Element::VEC2F_UV{ VEC2, FLOAT, UV }; const Element Element::VEC2F_XY{ VEC2, FLOAT, XY }; const Element Element::VEC3F_XYZ{ VEC3, FLOAT, XYZ }; diff --git a/libraries/gpu/src/gpu/Format.h b/libraries/gpu/src/gpu/Format.h index 19965077b5..c4d88236da 100644 --- a/libraries/gpu/src/gpu/Format.h +++ b/libraries/gpu/src/gpu/Format.h @@ -314,8 +314,6 @@ public: static const Element COLOR_COMPRESSED_SRGBA_HIGH; static const Element VEC2NU8_XY; static const Element VEC4F_COLOR_RGBA; - static const Element COLOR_RED_FLOAT; - static const Element COLOR_RED_HALF; static const Element VEC2F_UV; static const Element VEC2F_XY; static const Element VEC3F_XYZ; From d61652f958496157b9721b095b5299dea6608700 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Fri, 11 Aug 2017 10:11:19 +0200 Subject: [PATCH 15/48] Fixed compilation errors due to merge with master --- libraries/render-utils/src/PickItemsJob.cpp | 2 +- libraries/render-utils/src/RenderDeferredTask.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/render-utils/src/PickItemsJob.cpp b/libraries/render-utils/src/PickItemsJob.cpp index 5d67f26157..48ba605d7b 100644 --- a/libraries/render-utils/src/PickItemsJob.cpp +++ b/libraries/render-utils/src/PickItemsJob.cpp @@ -37,7 +37,7 @@ render::ItemBound PickItemsJob::findNearestItem(const render::RenderContextPoint glm::vec3 normal; float isectDistance; render::ItemBound nearestItem( render::Item::INVALID_ITEM_ID ); - const float minDistance = 1.f; + const float minDistance = 0.2f; const float maxDistance = 50.f; render::ItemKey itemKey; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 76572eac76..3ff68b8c64 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -105,11 +105,11 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren render::ItemKey::Builder().withTypeShape().build()._flags, render::ItemKey::Builder().withTypeMeta().build()._flags); // Render opaque outline objects first in DeferredBuffer - const auto opaqueOutlineInputs = DrawStateSortDeferred::Inputs(outlinedOpaques, lightingModel).hasVarying(); + const auto opaqueOutlineInputs = DrawStateSortDeferred::Inputs(outlinedOpaques, lightingModel).asVarying(); task.addJob("DrawOpaqueOutlined", opaqueOutlineInputs, shapePlumber); // Retrieve z value of the outlined objects - const auto outlinePrepareInputs = PrepareOutline::Inputs(deferredFramebuffer, outlinedOpaques).hasVarying(); + const auto outlinePrepareInputs = PrepareOutline::Inputs(deferredFramebuffer, outlinedOpaques).asVarying(); const auto outlinedFrameBuffer = task.addJob("PrepareOutline", outlinePrepareInputs); // Render opaque objects in DeferredBuffer @@ -182,7 +182,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("ToneMapping", toneMappingInputs); // Draw outline - const auto outlineInputs = DrawOutline::Inputs(deferredFramebuffer, outlinedFrameBuffer).hasVarying(); + const auto outlineInputs = DrawOutline::Inputs(deferredFramebuffer, outlinedFrameBuffer).asVarying(); task.addJob("DrawOutline", outlineInputs); { // DEbug the bounds of the rendered items, still look at the zbuffer From d86c3c4f2af1924ac5af29538d7249341747aa06 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Fri, 11 Aug 2017 11:33:46 +0200 Subject: [PATCH 16/48] Outline is now drawn with framebuffer with no depth buffer attached to prevent concurrent depth clear on NVidia GPU cards --- libraries/render-utils/src/Outline.slf | 19 ++++++++---- libraries/render-utils/src/OutlineEffect.cpp | 29 ++++++++++++++----- libraries/render-utils/src/OutlineEffect.h | 15 ++++++---- .../render-utils/src/RenderDeferredTask.cpp | 4 +-- 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/libraries/render-utils/src/Outline.slf b/libraries/render-utils/src/Outline.slf index 9117d0c340..c467e2db9a 100644 --- a/libraries/render-utils/src/Outline.slf +++ b/libraries/render-utils/src/Outline.slf @@ -10,6 +10,8 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +<@include DeferredTransform.slh@> +<$declareDeferredFrameTransform()$> <@include Outline_shared.slh@> @@ -23,22 +25,27 @@ uniform sampler2D outlinedDepthMap; in vec2 varTexCoord0; out vec4 outFragColor; -const float FAR_DISTANCE = 1.0; -const float DEPTH_BIAS = 0.0; +const float FAR_Z = 1.0; +const float LINEAR_DEPTH_BIAS = 5e-3; const float OPACITY_EPSILON = 5e-3; void main(void) { float outlinedDepth = texture(outlinedDepthMap, varTexCoord0).x; float intensity = 0.0; - if (outlinedDepth < (FAR_DISTANCE-DEPTH_BIAS)) { + if (outlinedDepth < FAR_Z) { // We're not on the far plane so we are on the outlined object, thus no outline to do! // But maybe we need to fill the interior + // TODO: this should be done as another shader with switch done on CPU if (params._fillOpacityUnoccluded>OPACITY_EPSILON && params._fillOpacityUnoccluded>OPACITY_EPSILON) { - // Are we occluded? float sceneDepth = texture(sceneDepthMap, varTexCoord0).x; - if (sceneDepth < (outlinedDepth-DEPTH_BIAS)) { + // Transform to linear depth for better precision + outlinedDepth = -evalZeyeFromZdb(outlinedDepth); + sceneDepth = -evalZeyeFromZdb(sceneDepth); + + // Are we occluded? + if (sceneDepth < (outlinedDepth-LINEAR_DEPTH_BIAS)) { intensity = params._fillOpacityOccluded; } else { intensity = params._fillOpacityUnoccluded; @@ -63,7 +70,7 @@ void main(void) { if (uv.x>=0.0 && uv.x<=1.0) { outlinedDepth = texture(outlinedDepthMap, uv).x; - intensity += (outlinedDepth < (FAR_DISTANCE-DEPTH_BIAS)) ? 1.0 : 0.0; + intensity += (outlinedDepth < FAR_Z) ? 1.0 : 0.0; weight += 1.f; } uv.x += deltaUv.x; diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index 78952d353b..b65422222e 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -70,12 +70,12 @@ gpu::TexturePointer OutlineFramebuffer::getDepthTexture() { return _depthTexture; } -void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Inputs& input, PrepareOutline::Output& output) { - auto outlinedItems = input.get1(); +void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Inputs& inputs, PrepareOutline::Output& output) { + auto outlinedItems = inputs.get0(); if (!outlinedItems.empty()) { auto args = renderContext->args; - auto deferredFrameBuffer = input.get0(); + auto deferredFrameBuffer = inputs.get1(); auto frameSize = deferredFrameBuffer->getFrameSize(); if (!_outlineFramebuffer) { @@ -138,13 +138,20 @@ void DrawOutline::configure(const Config& config) { } void DrawOutline::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { - auto mainFrameBuffer = inputs.get0(); + auto mainFrameBuffer = inputs.get1(); if (mainFrameBuffer) { auto sceneDepthBuffer = mainFrameBuffer->getPrimaryDepthTexture(); - auto outlinedDepthBuffer = inputs.get1(); + const auto frameTransform = inputs.get0(); + auto outlinedDepthBuffer = inputs.get2(); + auto destinationFrameBuffer = inputs.get3(); auto pipeline = getPipeline(); + if (!_primaryWithoutDepthBuffer) { + _primaryWithoutDepthBuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("primaryWithoutDepth")); + _primaryWithoutDepthBuffer->setRenderBuffer(0, destinationFrameBuffer->getRenderBuffer(0)); + } + if (outlinedDepthBuffer) { auto framebufferSize = glm::ivec2(sceneDepthBuffer->getDimensions()); auto args = renderContext->args; @@ -163,6 +170,7 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { batch.enableStereo(false); + batch.setFramebuffer(_primaryWithoutDepthBuffer); batch.setViewportTransform(args->_viewport); batch.setProjectionTransform(glm::mat4()); @@ -170,10 +178,14 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(framebufferSize, args->_viewport)); batch.setPipeline(pipeline); - batch.setUniformBuffer(0, _configuration); + batch.setUniformBuffer(OUTLINE_PARAMS_SLOT, _configuration); + batch.setUniformBuffer(FRAME_TRANSFORM_SLOT, frameTransform->getFrameTransformBuffer()); batch.setResourceTexture(SCENE_DEPTH_SLOT, sceneDepthBuffer); batch.setResourceTexture(OUTLINED_DEPTH_SLOT, outlinedDepthBuffer->getDepthTexture()); batch.draw(gpu::TRIANGLE_STRIP, 4); + + // Restore previous frame buffer + batch.setFramebuffer(destinationFrameBuffer); }); } } @@ -186,13 +198,14 @@ const gpu::PipelinePointer& DrawOutline::getPipeline() { gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); gpu::Shader::BindingSet slotBindings; - slotBindings.insert(gpu::Shader::Binding("outlineParamsBuffer", 0)); + slotBindings.insert(gpu::Shader::Binding("outlineParamsBuffer", OUTLINE_PARAMS_SLOT)); + slotBindings.insert(gpu::Shader::Binding("deferredFrameTransformBuffer", FRAME_TRANSFORM_SLOT)); slotBindings.insert(gpu::Shader::Binding("sceneDepthMap", SCENE_DEPTH_SLOT)); slotBindings.insert(gpu::Shader::Binding("outlinedDepthMap", OUTLINED_DEPTH_SLOT)); gpu::Shader::makeProgram(*program, slotBindings); gpu::StatePointer state = gpu::StatePointer(new gpu::State()); - state->setDepthTest(false); + state->setDepthTest(gpu::State::DepthTest(false, false)); state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); _pipeline = gpu::Pipeline::create(program, state); } diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index b5b44bbeb8..09b1c36883 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -14,6 +14,7 @@ #include #include "DeferredFramebuffer.h" +#include "DeferredFrameTransform.h" class OutlineFramebuffer { public: @@ -43,9 +44,9 @@ class PrepareOutline { public: - using Inputs = render::VaryingSet2; - // Output will contain outlined objects only z-depth texture - using Output = OutlineFramebufferPointer; + using Inputs = render::VaryingSet2; + // Output will contain outlined objects only z-depth texture and the input primary buffer but without the primary depth buffer + using Output = OutlineFramebufferPointer; using JobModel = render::Job::ModelIO; PrepareOutline() {} @@ -93,7 +94,7 @@ signals: class DrawOutline { public: - using Inputs = render::VaryingSet2; + using Inputs = render::VaryingSet4; using Config = DrawOutlineConfig; using JobModel = render::Job::ModelI; @@ -106,7 +107,10 @@ private: enum { SCENE_DEPTH_SLOT = 0, - OUTLINED_DEPTH_SLOT + OUTLINED_DEPTH_SLOT, + + OUTLINE_PARAMS_SLOT = 0, + FRAME_TRANSFORM_SLOT }; #include "Outline_shared.slh" @@ -115,6 +119,7 @@ private: const gpu::PipelinePointer& getPipeline(); + gpu::FramebufferPointer _primaryWithoutDepthBuffer; gpu::PipelinePointer _pipeline; OutlineConfigurationBuffer _configuration; glm::vec3 _color; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 3ff68b8c64..5d16a0727d 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -109,7 +109,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("DrawOpaqueOutlined", opaqueOutlineInputs, shapePlumber); // Retrieve z value of the outlined objects - const auto outlinePrepareInputs = PrepareOutline::Inputs(deferredFramebuffer, outlinedOpaques).asVarying(); + const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedOpaques, deferredFramebuffer).asVarying(); const auto outlinedFrameBuffer = task.addJob("PrepareOutline", outlinePrepareInputs); // Render opaque objects in DeferredBuffer @@ -182,7 +182,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("ToneMapping", toneMappingInputs); // Draw outline - const auto outlineInputs = DrawOutline::Inputs(deferredFramebuffer, outlinedFrameBuffer).asVarying(); + const auto outlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying(); task.addJob("DrawOutline", outlineInputs); { // DEbug the bounds of the rendered items, still look at the zbuffer From 68753211dc541ed4b7b9a9ca728bdb9f881da207 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 17 Aug 2017 15:25:41 +0200 Subject: [PATCH 17/48] Fixed bug on Mac where the outline effect would stop working once the window was resized --- libraries/render-utils/src/Outline.slf | 2 +- libraries/render-utils/src/OutlineEffect.cpp | 29 +++++++++----------- libraries/render-utils/src/OutlineEffect.h | 1 + 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/libraries/render-utils/src/Outline.slf b/libraries/render-utils/src/Outline.slf index c467e2db9a..1d3d21a3c7 100644 --- a/libraries/render-utils/src/Outline.slf +++ b/libraries/render-utils/src/Outline.slf @@ -55,7 +55,7 @@ void main(void) { } } else { float weight = 0.0; - const vec2 deltaUv = params._size / params._blurKernelSize; + vec2 deltaUv = params._size / params._blurKernelSize; vec2 lineStartUv = varTexCoord0 - params._size / 2.0; vec2 uv; int x; diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index b65422222e..b0a57a0e03 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -24,20 +24,15 @@ OutlineFramebuffer::OutlineFramebuffer() { } void OutlineFramebuffer::update(const gpu::TexturePointer& linearDepthBuffer) { - //If the depth buffer or size changed, we need to delete our FBOs - bool reset = false; - + // If the depth buffer or size changed, we need to delete our FBOs and recreate them at the + // new correct dimensions. if (_depthTexture) { auto newFrameSize = glm::ivec2(linearDepthBuffer->getDimensions()); if (_frameSize != newFrameSize) { _frameSize = newFrameSize; - reset = true; + clear(); } } - - if (reset) { - clear(); - } } void OutlineFramebuffer::clear() { @@ -46,11 +41,11 @@ void OutlineFramebuffer::clear() { } void OutlineFramebuffer::allocate() { - + auto width = _frameSize.x; auto height = _frameSize.y; - auto format = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RED); - + auto format = gpu::Element(gpu::SCALAR, gpu::HALF, gpu::RED); + _depthTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(format, width, height)); _depthFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("outlineDepth")); _depthFramebuffer->setRenderBuffer(0, _depthTexture); @@ -146,14 +141,16 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I auto outlinedDepthBuffer = inputs.get2(); auto destinationFrameBuffer = inputs.get3(); auto pipeline = getPipeline(); + auto framebufferSize = glm::ivec2(sceneDepthBuffer->getDimensions()); - if (!_primaryWithoutDepthBuffer) { + if (!_primaryWithoutDepthBuffer || framebufferSize!=_frameBufferSize) { + // Failing to recreate this frame buffer when the screen has been resized creates a bug on Mac _primaryWithoutDepthBuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("primaryWithoutDepth")); _primaryWithoutDepthBuffer->setRenderBuffer(0, destinationFrameBuffer->getRenderBuffer(0)); + _frameBufferSize = framebufferSize; } if (outlinedDepthBuffer) { - auto framebufferSize = glm::ivec2(sceneDepthBuffer->getDimensions()); auto args = renderContext->args; { auto& configuration = _configuration.edit(); @@ -163,8 +160,8 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I configuration._fillOpacityOccluded = _fillOpacityOccluded; configuration._threshold = _threshold; // Size is normalized for 1 pixel at 1024 pix resolution so we multiply by the real resolution to have the final pixel size estimate - configuration._blurKernelSize = std::min(10, std::max(2, (int)floorf(_size*framebufferSize.y + 0.5f))); - configuration._size.x = _size * framebufferSize.y / framebufferSize.x; + configuration._blurKernelSize = std::min(10, std::max(2, (int)floorf(_size*_frameBufferSize.y + 0.5f))); + configuration._size.x = _size * _frameBufferSize.y / _frameBufferSize.x; configuration._size.y = _size; } @@ -175,7 +172,7 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I batch.setViewportTransform(args->_viewport); batch.setProjectionTransform(glm::mat4()); batch.resetViewTransform(); - batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(framebufferSize, args->_viewport)); + batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(_frameBufferSize, args->_viewport)); batch.setPipeline(pipeline); batch.setUniformBuffer(OUTLINE_PARAMS_SLOT, _configuration); diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index 09b1c36883..c67964a121 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -120,6 +120,7 @@ private: const gpu::PipelinePointer& getPipeline(); gpu::FramebufferPointer _primaryWithoutDepthBuffer; + glm::ivec2 _frameBufferSize {0, 0}; gpu::PipelinePointer _pipeline; OutlineConfigurationBuffer _configuration; glm::vec3 _color; From 2d598f34280c1bf0f2fe073077210123b192becd Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 17 Aug 2017 15:44:02 +0200 Subject: [PATCH 18/48] Improved outline visual width normalization that makes it independant from resolution. It is now a ratio of the screen height --- libraries/render-utils/src/OutlineEffect.cpp | 7 ++++--- libraries/render-utils/src/OutlineEffect.h | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index b0a57a0e03..c4ede4dcf6 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -125,7 +125,9 @@ DrawOutline::DrawOutline() { void DrawOutline::configure(const Config& config) { _color = config.color; - _size = config.width / 1024.f; + _blurKernelSize = std::min(10, std::max(2, (int)floorf(config.width*2 + 0.5f))); + // Size is in normalized screen height. We decide that for outline width = 1, this is equal to 1/400. + _size = config.width / 400.f; _fillOpacityUnoccluded = config.fillOpacityUnoccluded; _fillOpacityOccluded = config.fillOpacityOccluded; _threshold = config.glow ? 1.f : 1e-3f; @@ -159,8 +161,7 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I configuration._fillOpacityUnoccluded = _fillOpacityUnoccluded; configuration._fillOpacityOccluded = _fillOpacityOccluded; configuration._threshold = _threshold; - // Size is normalized for 1 pixel at 1024 pix resolution so we multiply by the real resolution to have the final pixel size estimate - configuration._blurKernelSize = std::min(10, std::max(2, (int)floorf(_size*_frameBufferSize.y + 0.5f))); + configuration._blurKernelSize = _blurKernelSize; configuration._size.x = _size * _frameBufferSize.y / _frameBufferSize.x; configuration._size.y = _size; } diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index c67964a121..11bb39b954 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -82,7 +82,7 @@ public: float getColorB() const { return color.b; } glm::vec3 color{ 1.f, 0.7f, 0.2f }; - float width{ 5.f }; + float width{ 3.f }; float intensity{ 1.f }; float fillOpacityUnoccluded{ 0.35f }; float fillOpacityOccluded{ 0.1f }; @@ -125,6 +125,7 @@ private: OutlineConfigurationBuffer _configuration; glm::vec3 _color; float _size; + int _blurKernelSize; float _intensity; float _fillOpacityUnoccluded; float _fillOpacityOccluded; From 7910b0d8ffc0293ba462c6c586ab90a5c6a5af5c Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 17 Aug 2017 15:55:59 +0200 Subject: [PATCH 19/48] Switched back to full float for outline depth buffer because of precision issues --- libraries/render-utils/src/OutlineEffect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index c4ede4dcf6..4733120fd3 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -44,7 +44,7 @@ void OutlineFramebuffer::allocate() { auto width = _frameSize.x; auto height = _frameSize.y; - auto format = gpu::Element(gpu::SCALAR, gpu::HALF, gpu::RED); + auto format = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RED); _depthTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(format, width, height)); _depthFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("outlineDepth")); From d0fdf175fd06fed09b92bc2fa248c6b645449ac4 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Thu, 31 Aug 2017 15:21:47 -0700 Subject: [PATCH 20/48] Fix access to menu on background thread --- .../display-plugins/hmd/HmdDisplayPlugin.cpp | 30 +++++++++---------- .../display-plugins/hmd/HmdDisplayPlugin.h | 2 -- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp index aef5c73fa3..caeba37839 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.cpp @@ -62,24 +62,9 @@ QRect HmdDisplayPlugin::getRecommendedOverlayRect() const { return CompositorHelper::VIRTUAL_SCREEN_RECOMMENDED_OVERLAY_RECT; } -bool HmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) { - if (!_vsyncEnabled && !_disablePreviewItemAdded) { - _container->addMenuItem(PluginType::DISPLAY_PLUGIN, MENU_PATH(), DISABLE_PREVIEW, - [this](bool clicked) { - _disablePreview = clicked; - _container->setBoolSetting("disableHmdPreview", _disablePreview); - if (_disablePreview) { - _clearPreviewFlag = true; - } - }, true, _disablePreview); - _disablePreviewItemAdded = true; - } - return Parent::beginFrameRender(frameIndex); -} - +#define DISABLE_PREVIEW_MENU_ITEM_DELAY_MS 500 bool HmdDisplayPlugin::internalActivate() { - _disablePreviewItemAdded = false; _monoPreview = _container->getBoolSetting("monoPreview", DEFAULT_MONO_VIEW); _clearPreviewFlag = true; _container->addMenuItem(PluginType::DISPLAY_PLUGIN, MENU_PATH(), MONO_PREVIEW, @@ -94,6 +79,19 @@ bool HmdDisplayPlugin::internalActivate() { _disablePreview = _container->getBoolSetting("disableHmdPreview", DEFAULT_DISABLE_PREVIEW || _vsyncEnabled); #endif + QTimer::singleShot(DISABLE_PREVIEW_MENU_ITEM_DELAY_MS, [this] { + if (isActive() && !_vsyncEnabled) { + _container->addMenuItem(PluginType::DISPLAY_PLUGIN, MENU_PATH(), DISABLE_PREVIEW, + [this](bool clicked) { + _disablePreview = clicked; + _container->setBoolSetting("disableHmdPreview", _disablePreview); + if (_disablePreview) { + _clearPreviewFlag = true; + } + }, true, _disablePreview); + } + }); + _container->removeMenu(FRAMERATE); for_each_eye([&](Eye eye) { _eyeInverseProjections[eye] = glm::inverse(_eyeProjections[eye]); diff --git a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h index 0827d04922..683c910b7c 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h +++ b/libraries/display-plugins/src/display-plugins/hmd/HmdDisplayPlugin.h @@ -51,7 +51,6 @@ protected: virtual void postPreview() {}; virtual void updatePresentPose(); - bool beginFrameRender(uint32_t frameIndex) override; bool internalActivate() override; void internalDeactivate() override; void compositeOverlay() override; @@ -87,7 +86,6 @@ private: ivec4 getViewportForSourceSize(const uvec2& size) const; float getLeftCenterPixel() const; - bool _disablePreviewItemAdded { false }; bool _monoPreview { true }; bool _clearPreviewFlag { false }; gpu::TexturePointer _previewTexture; From 9c03fa0369c2a4c8369c9b99290904f76501c099 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Sat, 2 Sep 2017 11:25:00 -0700 Subject: [PATCH 21/48] Cleanup CMake --- CMakeLists.txt | 309 ++++-------------- cmake/compiler.cmake | 106 ++++++ cmake/externals/LibOVR/CMakeLists.txt | 1 - cmake/externals/quazip/CMakeLists.txt | 14 +- cmake/init.cmake | 43 +++ .../macros/SetupHifiClientServerPlugin.cmake | 6 +- cmake/macros/SetupHifiPlugin.cmake | 4 +- cmake/macros/SetupQt.cmake | 82 +++++ 8 files changed, 312 insertions(+), 253 deletions(-) create mode 100644 cmake/compiler.cmake create mode 100644 cmake/init.cmake create mode 100644 cmake/macros/SetupQt.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e67002b89d..be513abddb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,254 +4,81 @@ else() cmake_minimum_required(VERSION 3.2) endif() -if (USE_ANDROID_TOOLCHAIN) - set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/android/android.toolchain.cmake") - set(ANDROID_NATIVE_API_LEVEL 19) - set(ANDROID_TOOLCHAIN_NAME arm-linux-androideabi-clang3.5) - set(ANDROID_STL c++_shared) -endif () - -if (WIN32) - cmake_policy(SET CMP0020 NEW) -endif (WIN32) - -if (POLICY CMP0043) - cmake_policy(SET CMP0043 OLD) -endif () - -if (POLICY CMP0042) - cmake_policy(SET CMP0042 OLD) -endif () - -set_property(GLOBAL PROPERTY USE_FOLDERS ON) -set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets") +include("cmake/init.cmake") project(hifi) -add_definitions(-DGLM_FORCE_RADIANS) -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") -find_package( Threads ) +include("cmake/compiler.cmake") -if (WIN32) - if (NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - message( FATAL_ERROR "Only 64 bit builds supported." ) - endif() - - add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS) - - if (NOT WINDOW_SDK_PATH) - set(DEBUG_DISCOVERED_SDK_PATH TRUE) - endif() - - # sets path for Microsoft SDKs - # if you get build error about missing 'glu32' this path is likely wrong - if (MSVC_VERSION GREATER_EQUAL 1910) # VS 2017 - set(WINDOW_SDK_PATH "C:/Program Files (x86)/Windows Kits/10/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64" CACHE PATH "Windows SDK PATH") - elseif (MSVC_VERSION GREATER_EQUAL 1800) # VS 2013 - set(WINDOW_SDK_PATH "C:\\Program Files (x86)\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\${WINDOW_SDK_FOLDER}" CACHE PATH "Windows SDK PATH") - else() - message( FATAL_ERROR "Visual Studio 2013 or higher required." ) - endif() - - if (DEBUG_DISCOVERED_SDK_PATH) - message(STATUS "The discovered Windows SDK path is ${WINDOW_SDK_PATH}") - endif () - - set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${WINDOW_SDK_PATH}) - # /wd4351 disables warning C4351: new behavior: elements of array will be default initialized - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4351") - # /LARGEADDRESSAWARE enables 32-bit apps to use more than 2GB of memory. - # Caveats: http://stackoverflow.com/questions/2288728/drawbacks-of-using-largeaddressaware-for-32-bit-windows-executables - # TODO: Remove when building 64-bit. - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") - # always produce symbols as PDB files - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /OPT:REF /OPT:ICF") -else () - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-strict-aliasing -Wno-unused-parameter") - if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -Woverloaded-virtual -Wdouble-promotion") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.1") # gcc 5.1 and on have suggest-override - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override") - endif () - endif () -endif(WIN32) - -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.3") - # GLM 0.9.8 on Ubuntu 14 (gcc 4.4) has issues with the simd declarations - add_definitions(-DGLM_FORCE_PURE) - endif() +if (NOT DEFINED SERVER_ONLY) + set(SERVER_ONLY 0) endif() -if (NOT ANDROID) - if ((NOT MSVC12) AND (NOT MSVC14)) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) - CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) - - if (COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - else() - message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") - endif() - endif () -else () - # assume that the toolchain selected for android has C++11 support - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -endif () - -if (APPLE) - set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") - set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++") -endif () - -if (NOT ANDROID_LIB_DIR) - set(ANDROID_LIB_DIR $ENV{ANDROID_LIB_DIR}) -endif () - -if (ANDROID) - if (NOT ANDROID_QT_CMAKE_PREFIX_PATH) - set(QT_CMAKE_PREFIX_PATH ${ANDROID_LIB_DIR}/Qt/5.5/android_armv7/lib/cmake) - else () - set(QT_CMAKE_PREFIX_PATH ${ANDROID_QT_CMAKE_PREFIX_PATH}) - endif () - - set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) - - if (ANDROID_LIB_DIR) - list(APPEND CMAKE_FIND_ROOT_PATH ${ANDROID_LIB_DIR}) - endif () -else () - if (NOT QT_CMAKE_PREFIX_PATH) - set(QT_CMAKE_PREFIX_PATH $ENV{QT_CMAKE_PREFIX_PATH}) - endif () - if (NOT QT_CMAKE_PREFIX_PATH) - get_filename_component(QT_CMAKE_PREFIX_PATH "${Qt5_DIR}/.." REALPATH) - endif () -endif () - -set(QT_DIR $ENV{QT_DIR}) - -if (WIN32) - if (NOT EXISTS ${QT_CMAKE_PREFIX_PATH}) - message(FATAL_ERROR "Could not determine QT_CMAKE_PREFIX_PATH.") - endif () +if (ANDROID OR UWP) + set(MOBILE 1) +else() + set(MOBILE 0) endif() -# figure out where the qt dir is -get_filename_component(QT_DIR "${QT_CMAKE_PREFIX_PATH}/../../" ABSOLUTE) +if (ANDROID OR UWP) + option(BUILD_SERVER "Build server components" OFF) + option(BUILD_TOOLS "Build tools" OFF) +else() + option(BUILD_SERVER "Build server components" ON) + option(BUILD_TOOLS "Build tools" ON) +endif() -set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) +if (SERVER_ONLY) + option(BUILD_CLIENT "Build client components" OFF) + option(BUILD_TESTS "Build tests" OFF) +else() + option(BUILD_CLIENT "Build client components" ON) + option(BUILD_TESTS "Build tests" ON) +endif() -if (APPLE) +option(BUILD_INSTALLER "Build installer" ON) - exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE OSX_VERSION) - string(REGEX MATCH "^[0-9]+\\.[0-9]+" OSX_VERSION ${OSX_VERSION}) - message(STATUS "Detected OS X version = ${OSX_VERSION}") +MESSAGE(STATUS "Build server: " ${BUILD_SERVER}) +MESSAGE(STATUS "Build client: " ${BUILD_CLIENT}) +MESSAGE(STATUS "Build tests: " ${BUILD_TESTS}) +MESSAGE(STATUS "Build tools: " ${BUILD_TOOLS}) +MESSAGE(STATUS "Build installer: " ${BUILD_INSTALLER}) - set(OSX_SDK "${OSX_VERSION}" CACHE String "OS X SDK version to look for inside Xcode bundle or at OSX_SDK_PATH") +if (UNIX AND DEFINED ENV{HIFI_MEMORY_DEBUGGING}) + MESSAGE(STATUS "Memory debugging is enabled") +endif() - # set our OS X deployment target - set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) - - # find the SDK path for the desired SDK - find_path( - _OSX_DESIRED_SDK_PATH - NAME MacOSX${OSX_SDK}.sdk - HINTS ${OSX_SDK_PATH} - PATHS /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ - /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ - ) - - if (NOT _OSX_DESIRED_SDK_PATH) - message(STATUS "Could not find OS X ${OSX_SDK} SDK. Will fall back to default. If you want a specific SDK, please pass OSX_SDK and optionally OSX_SDK_PATH to CMake.") - else () - message(STATUS "Found OS X ${OSX_SDK} SDK at ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk") - - # set that as the SDK to use - set(CMAKE_OSX_SYSROOT ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk) - endif () - -endif () - -# Hide automoc folders (for IDEs) -set(AUTOGEN_TARGETS_FOLDER "hidden/generated") - -# Find includes in corresponding build directories -set(CMAKE_INCLUDE_CURRENT_DIR ON) -# Instruct CMake to run moc automatically when needed. -set(CMAKE_AUTOMOC ON) -# Instruct CMake to run rcc automatically when needed -set(CMAKE_AUTORCC ON) - -set(HIFI_LIBRARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries") - -# setup for find modules -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") - -if (CMAKE_BUILD_TYPE) - string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE) -else () - set(UPPER_CMAKE_BUILD_TYPE DEBUG) -endif () - -set(HF_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -set(MACRO_DIR "${HF_CMAKE_DIR}/macros") -set(EXTERNAL_PROJECT_DIR "${HF_CMAKE_DIR}/externals") - -file(GLOB HIFI_CUSTOM_MACROS "cmake/macros/*.cmake") -foreach(CUSTOM_MACRO ${HIFI_CUSTOM_MACROS}) - include(${CUSTOM_MACRO}) -endforeach() +# +# Helper projects +# +file(GLOB_RECURSE CMAKE_SRC cmake/*.cmake cmake/CMakeLists.txt) +add_custom_target(cmake SOURCES ${CMAKE_SRC}) +GroupSources("cmake") file(GLOB_RECURSE JS_SRC scripts/*.js unpublishedScripts/*.js) add_custom_target(js SOURCES ${JS_SRC}) GroupSources("scripts") GroupSources("unpublishedScripts") -if (UNIX) - install( - DIRECTORY "${CMAKE_SOURCE_DIR}/scripts" - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/interface - COMPONENT ${CLIENT_COMPONENT} - ) -endif() +# Locate the required Qt build on the filesystem +setup_qt() +list(APPEND CMAKE_PREFIX_PATH "${QT_CMAKE_PREFIX_PATH}") -if (ANDROID) - file(GLOB ANDROID_CUSTOM_MACROS "cmake/android/*.cmake") - foreach(CUSTOM_MACRO ${ANDROID_CUSTOM_MACROS}) - include(${CUSTOM_MACRO}) - endforeach() -endif () +find_package( Threads ) + +add_definitions(-DGLM_FORCE_RADIANS) +set(HIFI_LIBRARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries") set(EXTERNAL_PROJECT_PREFIX "project") set_property(DIRECTORY PROPERTY EP_PREFIX ${EXTERNAL_PROJECT_PREFIX}) setup_externals_binary_dir() option(USE_NSIGHT "Attempt to find the nSight libraries" 1) -option(GET_QUAZIP "Get QuaZip library automatically as external project" 1) - - -if (WIN32) - add_paths_to_fixup_libs("${QT_DIR}/bin") -endif () - -if (NOT DEFINED SERVER_ONLY) - set(SERVER_ONLY 0) -endif() set_packaging_parameters() -option(BUILD_TESTS "Build tests" ON) -MESSAGE(STATUS "Build tests: " ${BUILD_TESTS}) - # add subdirectories for all targets -if (NOT ANDROID) +if (BUILD_SERVER) add_subdirectory(assignment-client) set_target_properties(assignment-client PROPERTIES FOLDER "Apps") add_subdirectory(domain-server) @@ -259,30 +86,36 @@ if (NOT ANDROID) add_subdirectory(ice-server) set_target_properties(ice-server PROPERTIES FOLDER "Apps") add_subdirectory(server-console) - if (NOT SERVER_ONLY) +endif() + +if (BUILD_CLIENT) add_subdirectory(interface) set_target_properties(interface PROPERTIES FOLDER "Apps") - if (BUILD_TESTS) - add_subdirectory(tests) + if (ANDROID) + add_subdirectory(gvr-interface) + set_target_properties(gvr-interface PROPERTIES FOLDER "Apps") endif() - endif() - add_subdirectory(plugins) +endif() + +if (BUILD_CLIENT OR BUILD_SERVER) + add_subdirectory(plugins) +endif() + +if (BUILD_TOOLS) add_subdirectory(tools) endif() -if (ANDROID OR DESKTOP_GVR) - add_subdirectory(interface) - add_subdirectory(gvr-interface) - add_subdirectory(plugins) -endif () +if (BUILD_TESTS) + add_subdirectory(tests) +endif() -if (DEFINED ENV{HIFI_MEMORY_DEBUGGING}) - SET( HIFI_MEMORY_DEBUGGING true ) -endif () -if (HIFI_MEMORY_DEBUGGING) - if (UNIX) - MESSAGE("-- Memory debugging is enabled") - endif (UNIX) -endif () - -generate_installers() +if (BUILD_INSTALLER) + if (UNIX) + install( + DIRECTORY "${CMAKE_SOURCE_DIR}/scripts" + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/interface + COMPONENT ${CLIENT_COMPONENT} + ) + endif() + generate_installers() +endif() diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake new file mode 100644 index 0000000000..968a65a6dd --- /dev/null +++ b/cmake/compiler.cmake @@ -0,0 +1,106 @@ +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") + +if (WIN32) + if (NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + message( FATAL_ERROR "Only 64 bit builds supported." ) + endif() + + add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS) + + if (NOT WINDOW_SDK_PATH) + set(DEBUG_DISCOVERED_SDK_PATH TRUE) + endif() + + # sets path for Microsoft SDKs + # if you get build error about missing 'glu32' this path is likely wrong + if (MSVC_VERSION GREATER_EQUAL 1910) # VS 2017 + set(WINDOW_SDK_PATH "C:/Program Files (x86)/Windows Kits/10/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64" CACHE PATH "Windows SDK PATH") + elseif (MSVC_VERSION GREATER_EQUAL 1800) # VS 2013 + set(WINDOW_SDK_PATH "C:\\Program Files (x86)\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\${WINDOW_SDK_FOLDER}" CACHE PATH "Windows SDK PATH") + else() + message( FATAL_ERROR "Visual Studio 2013 or higher required." ) + endif() + + if (DEBUG_DISCOVERED_SDK_PATH) + message(STATUS "The discovered Windows SDK path is ${WINDOW_SDK_PATH}") + endif () + + list(APPEND CMAKE_PREFIX_PATH "${WINDOW_SDK_PATH}") + + # /wd4351 disables warning C4351: new behavior: elements of array will be default initialized + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4351") + # /LARGEADDRESSAWARE enables 32-bit apps to use more than 2GB of memory. + # Caveats: http://stackoverflow.com/questions/2288728/drawbacks-of-using-largeaddressaware-for-32-bit-windows-executables + # TODO: Remove when building 64-bit. + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") + # always produce symbols as PDB files + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /OPT:REF /OPT:ICF") +else () + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-strict-aliasing -Wno-unused-parameter") + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -Woverloaded-virtual -Wdouble-promotion") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.1") # gcc 5.1 and on have suggest-override + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override") + endif () + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.3") + # GLM 0.9.8 on Ubuntu 14 (gcc 4.4) has issues with the simd declarations + add_definitions(-DGLM_FORCE_PURE) + endif() + endif () +endif() + +if (ANDROID) + # assume that the toolchain selected for android has C++11 support + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif ((NOT MSVC12) AND (NOT MSVC14)) + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) + CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) + if (COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + elseif(COMPILER_SUPPORTS_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + else() + message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + endif() +endif () + +if (APPLE) + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++") +endif () + +if (NOT ANDROID_LIB_DIR) + set(ANDROID_LIB_DIR $ENV{ANDROID_LIB_DIR}) +endif () + +if (APPLE) + exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE OSX_VERSION) + string(REGEX MATCH "^[0-9]+\\.[0-9]+" OSX_VERSION ${OSX_VERSION}) + message(STATUS "Detected OS X version = ${OSX_VERSION}") + + set(OSX_SDK "${OSX_VERSION}" CACHE String "OS X SDK version to look for inside Xcode bundle or at OSX_SDK_PATH") + + # set our OS X deployment target + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) + + # find the SDK path for the desired SDK + find_path( + _OSX_DESIRED_SDK_PATH + NAME MacOSX${OSX_SDK}.sdk + HINTS ${OSX_SDK_PATH} + PATHS /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ + /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ + ) + + if (NOT _OSX_DESIRED_SDK_PATH) + message(STATUS "Could not find OS X ${OSX_SDK} SDK. Will fall back to default. If you want a specific SDK, please pass OSX_SDK and optionally OSX_SDK_PATH to CMake.") + else () + message(STATUS "Found OS X ${OSX_SDK} SDK at ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk") + + # set that as the SDK to use + set(CMAKE_OSX_SYSROOT ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk) + endif () +endif () \ No newline at end of file diff --git a/cmake/externals/LibOVR/CMakeLists.txt b/cmake/externals/LibOVR/CMakeLists.txt index c98aa8a04a..97508be0c5 100644 --- a/cmake/externals/LibOVR/CMakeLists.txt +++ b/cmake/externals/LibOVR/CMakeLists.txt @@ -33,7 +33,6 @@ if (WIN32) include(SelectLibraryConfigurations) select_library_configurations(LIBOVR) set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${${EXTERNAL_NAME_UPPER}_LIBRARIES} CACHE TYPE INTERNAL) - message("Libs ${EXTERNAL_NAME_UPPER}_LIBRARIES ${${EXTERNAL_NAME_UPPER}_LIBRARIES}") elseif(APPLE) diff --git a/cmake/externals/quazip/CMakeLists.txt b/cmake/externals/quazip/CMakeLists.txt index 01650a432d..0d66b365a2 100644 --- a/cmake/externals/quazip/CMakeLists.txt +++ b/cmake/externals/quazip/CMakeLists.txt @@ -4,14 +4,6 @@ cmake_policy(SET CMP0046 OLD) include(ExternalProject) -if (WIN32) - # windows shell does not like backslashes expanded on the command line, - # so convert all backslashes in the QT path to forward slashes - string(REPLACE \\ / QT_CMAKE_PREFIX_PATH $ENV{QT_CMAKE_PREFIX_PATH}) -elseif ($ENV{QT_CMAKE_PREFIX_PATH}) - set(QT_CMAKE_PREFIX_PATH $ENV{QT_CMAKE_PREFIX_PATH}) -endif () - set(QUAZIP_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_PREFIX_PATH=${QT_CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_NAME_DIR:PATH=/lib -DZLIB_ROOT=${ZLIB_ROOT} -DCMAKE_POSITION_INDEPENDENT_CODE=ON) if (APPLE) @@ -34,9 +26,9 @@ add_dependencies(quazip zlib) # Hide this external target (for ide users) set_target_properties(${EXTERNAL_NAME} PROPERTIES - FOLDER "hidden/externals" - INSTALL_NAME_DIR ${INSTALL_DIR}/lib - BUILD_WITH_INSTALL_RPATH True) + FOLDER "hidden/externals" + INSTALL_NAME_DIR ${INSTALL_DIR}/lib + BUILD_WITH_INSTALL_RPATH True) ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include CACHE PATH "List of QuaZip include directories") diff --git a/cmake/init.cmake b/cmake/init.cmake new file mode 100644 index 0000000000..75fb3a4b52 --- /dev/null +++ b/cmake/init.cmake @@ -0,0 +1,43 @@ +if (WIN32) + cmake_policy(SET CMP0020 NEW) +endif (WIN32) + +if (POLICY CMP0043) + cmake_policy(SET CMP0043 OLD) +endif () + +if (POLICY CMP0042) + cmake_policy(SET CMP0042 OLD) +endif () + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets") +# Hide automoc folders (for IDEs) +set(AUTOGEN_TARGETS_FOLDER "hidden/generated") +# Find includes in corresponding build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +if (CMAKE_BUILD_TYPE) + string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE) +else () + set(UPPER_CMAKE_BUILD_TYPE DEBUG) +endif () + +# CMAKE_CURRENT_SOURCE_DIR is the parent folder here +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") + +set(HF_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +set(MACRO_DIR "${HF_CMAKE_DIR}/macros") +set(EXTERNAL_PROJECT_DIR "${HF_CMAKE_DIR}/externals") + +file(GLOB HIFI_CUSTOM_MACROS "cmake/macros/*.cmake") +foreach(CUSTOM_MACRO ${HIFI_CUSTOM_MACROS}) + include(${CUSTOM_MACRO}) +endforeach() + +if (ANDROID) + file(GLOB ANDROID_CUSTOM_MACROS "cmake/android/*.cmake") + foreach(CUSTOM_MACRO ${ANDROID_CUSTOM_MACROS}) + include(${CUSTOM_MACRO}) + endforeach() +endif () diff --git a/cmake/macros/SetupHifiClientServerPlugin.cmake b/cmake/macros/SetupHifiClientServerPlugin.cmake index 37b000efb5..bc66484c30 100644 --- a/cmake/macros/SetupHifiClientServerPlugin.cmake +++ b/cmake/macros/SetupHifiClientServerPlugin.cmake @@ -9,11 +9,13 @@ macro(SETUP_HIFI_CLIENT_SERVER_PLUGIN) set(${TARGET_NAME}_SHARED 1) setup_hifi_library(${ARGV}) - if (NOT DEFINED SERVER_ONLY) + if (BUILD_CLIENT) add_dependencies(interface ${TARGET_NAME}) endif() - add_dependencies(assignment-client ${TARGET_NAME}) + if (BUILD_SERVER) + add_dependencies(assignment-client ${TARGET_NAME}) + endif() set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Plugins") diff --git a/cmake/macros/SetupHifiPlugin.cmake b/cmake/macros/SetupHifiPlugin.cmake index 7e56ea3db2..023c7603dc 100644 --- a/cmake/macros/SetupHifiPlugin.cmake +++ b/cmake/macros/SetupHifiPlugin.cmake @@ -8,7 +8,9 @@ macro(SETUP_HIFI_PLUGIN) set(${TARGET_NAME}_SHARED 1) setup_hifi_library(${ARGV}) - add_dependencies(interface ${TARGET_NAME}) + if (BUILD_CLIENT) + add_dependencies(interface ${TARGET_NAME}) + endif() target_link_libraries(${TARGET_NAME} ${CMAKE_THREAD_LIBS_INIT}) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Plugins") diff --git a/cmake/macros/SetupQt.cmake b/cmake/macros/SetupQt.cmake new file mode 100644 index 0000000000..e83d85b284 --- /dev/null +++ b/cmake/macros/SetupQt.cmake @@ -0,0 +1,82 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Bradley Austin Davis on 2015/10/10 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +function(set_from_env _RESULT_NAME _ENV_VAR_NAME _DEFAULT_VALUE) + if ("$ENV{${_ENV_VAR_NAME}}" STREQUAL "") + set (${_RESULT_NAME} ${_DEFAULT_VALUE} PARENT_SCOPE) + else() + set (${_RESULT_NAME} $ENV{${_ENV_VAR_NAME}} PARENT_SCOPE) + endif() +endfunction() + +# Construct a default QT location from a root path, a version and an architecture +function(calculate_default_qt_dir _RESULT_NAME) + if (ANDROID) + set(QT_DEFAULT_ARCH "android_armv7") + elseif(UWP) + set(QT_DEFAULT_ARCH "winrt_x64_msvc2017") + elseif(APPLE) + set(QT_DEFAULT_ARCH "clang_64") + elseif(WIN32) + set(QT_DEFAULT_ARCH "msvc2017_64") + else() + set(QT_DEFAULT_ARCH "gcc_64") + endif() + + if (WIN32) + set(QT_DEFAULT_ROOT "c:/Qt") + else() + set(QT_DEFAULT_ROOT "$ENV{HOME}/Qt") + endif() + + set_from_env(QT_ROOT QT_ROOT ${QT_DEFAULT_ROOT}) + set_from_env(QT_VERSION QT_VERSION "5.9.1") + set_from_env(QT_ARCH QT_ARCH ${QT_DEFAULT_ARCH}) + + set(${_RESULT_NAME} "${QT_ROOT}/${QT_VERSION}/${QT_ARCH}" PARENT_SCOPE) +endfunction() + +# Sets the QT_CMAKE_PREFIX_PATH and QT_DIR variables +# Also enables CMAKE_AUTOMOC and CMAKE_AUTORCC +macro(setup_qt) + set(QT_CMAKE_PREFIX_PATH "$ENV{QT_CMAKE_PREFIX_PATH}") + if (("QT_CMAKE_PREFIX_PATH" STREQUAL "") OR (NOT EXISTS "${QT_CMAKE_PREFIX_PATH}")) + calculate_default_qt_dir(QT_DIR) + set(QT_CMAKE_PREFIX_PATH "${QT_DIR}/lib/cmake") + else() + # figure out where the qt dir is + get_filename_component(QT_DIR "${QT_CMAKE_PREFIX_PATH}/../../" ABSOLUTE) + endif() + + if (WIN32) + # windows shell does not like backslashes expanded on the command line, + # so convert all backslashes in the QT path to forward slashes + string(REPLACE \\ / QT_CMAKE_PREFIX_PATH ${QT_CMAKE_PREFIX_PATH}) + string(REPLACE \\ / QT_DIR ${QT_DIR}) + endif() + + + if (NOT EXISTS "${QT_DIR}/include/QtCore/QtGlobal") + message(FATAL_ERROR "Unable to locate Qt includes in ${QT_DIR}") + endif() + if (NOT EXISTS "${QT_CMAKE_PREFIX_PATH}/Qt5Core/Qt5CoreConfig.cmake") + message(FATAL_ERROR "Unable to locate Qt cmake config in ${QT_CMAKE_PREFIX_PATH}") + endif() + message(STATUS "The Qt build in use is: \"${QT_DIR}\"") + + # Instruct CMake to run moc automatically when needed. + set(CMAKE_AUTOMOC ON) + + # Instruct CMake to run rcc automatically when needed + set(CMAKE_AUTORCC ON) + + if (WIN32) + add_paths_to_fixup_libs("${QT_DIR}/bin") + endif () + +endmacro() \ No newline at end of file From e64227bccdf2b83d171f7297b587e86a7ee0d483 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Sun, 3 Sep 2017 09:50:25 -0700 Subject: [PATCH 22/48] Fix mac build --- cmake/macros/SetupQt.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/macros/SetupQt.cmake b/cmake/macros/SetupQt.cmake index e83d85b284..b2a89f81e5 100644 --- a/cmake/macros/SetupQt.cmake +++ b/cmake/macros/SetupQt.cmake @@ -60,13 +60,15 @@ macro(setup_qt) string(REPLACE \\ / QT_DIR ${QT_DIR}) endif() - - if (NOT EXISTS "${QT_DIR}/include/QtCore/QtGlobal") - message(FATAL_ERROR "Unable to locate Qt includes in ${QT_DIR}") - endif() + # This check doesn't work on Mac + #if (NOT EXISTS "${QT_DIR}/include/QtCore/QtGlobal") + # message(FATAL_ERROR "Unable to locate Qt includes in ${QT_DIR}") + #endif() + if (NOT EXISTS "${QT_CMAKE_PREFIX_PATH}/Qt5Core/Qt5CoreConfig.cmake") message(FATAL_ERROR "Unable to locate Qt cmake config in ${QT_CMAKE_PREFIX_PATH}") endif() + message(STATUS "The Qt build in use is: \"${QT_DIR}\"") # Instruct CMake to run moc automatically when needed. From 700d4a4b43ef79e31c1bea0ed5893f9162a1f2fe Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 6 Sep 2017 15:47:10 +0200 Subject: [PATCH 23/48] First working version of outline working with selection interface. --- libraries/render-utils/src/OutlineEffect.cpp | 7 ++++--- libraries/render-utils/src/OutlineEffect.h | 2 +- .../render-utils/src/RenderDeferredTask.cpp | 17 ++++++++++------- libraries/render/src/render/FilterTask.cpp | 12 ++++++++++-- libraries/render/src/render/FilterTask.h | 4 ++-- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index 4733120fd3..158cb3871a 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -66,11 +66,12 @@ gpu::TexturePointer OutlineFramebuffer::getDepthTexture() { } void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Inputs& inputs, PrepareOutline::Output& output) { - auto outlinedItems = inputs.get0(); + auto outlinedOpaqueItems = inputs.get0(); + auto outlinedTransparentItems = inputs.get1(); - if (!outlinedItems.empty()) { + if (!outlinedOpaqueItems.empty() || !outlinedTransparentItems.empty()) { auto args = renderContext->args; - auto deferredFrameBuffer = inputs.get1(); + auto deferredFrameBuffer = inputs.get2(); auto frameSize = deferredFrameBuffer->getFrameSize(); if (!_outlineFramebuffer) { diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index 11bb39b954..fb625fbabc 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -44,7 +44,7 @@ class PrepareOutline { public: - using Inputs = render::VaryingSet2; + using Inputs = render::VaryingSet3; // Output will contain outlined objects only z-depth texture and the input primary buffer but without the primary depth buffer using Output = OutlineFramebufferPointer; using JobModel = render::Job::ModelIO; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index f53cfa443b..f240f0728e 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -40,7 +40,6 @@ #include "AntialiasingEffect.h" #include "ToneMappingEffect.h" #include "SubsurfaceScattering.h" -#include "PickItemsJob.h" #include "OutlineEffect.h" #include @@ -96,16 +95,20 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("PrepareStencil", primaryFramebuffer); // Select items that need to be outlined - const auto outlinedOpaques = task.addJob("PickOutlined", opaques, - // Pick only shapes so exclude meta - render::ItemKey::Builder().withTypeShape().build()._flags, render::ItemKey::Builder().withTypeMeta().build()._flags); + const auto outlineSelectionName = "contextOverlayHighlightList"; + const auto outlinedOpaquesSelection = task.addJob("SelectOutlinedOpaques", opaques, outlineSelectionName); + const auto outlinedTransparentSelection = task.addJob("SelectOutlinedTransparents", transparents, outlineSelectionName); + const auto outlinedOpaqueItems = task.addJob("OutlinedOpaqueMetaToSubItems", outlinedOpaquesSelection); + const auto outlinedTransparentItems = task.addJob("OutlinedTransparentMetaToSubItems", outlinedTransparentSelection); // Render opaque outline objects first in DeferredBuffer - const auto opaqueOutlineInputs = DrawStateSortDeferred::Inputs(outlinedOpaques, lightingModel).asVarying(); - task.addJob("DrawOpaqueOutlined", opaqueOutlineInputs, shapePlumber); + const auto outlineOpaqueInputs = DrawStateSortDeferred::Inputs(outlinedOpaqueItems, lightingModel).asVarying(); + const auto outlineTransparentInputs = DrawStateSortDeferred::Inputs(outlinedTransparentItems, lightingModel).asVarying(); + task.addJob("DrawOpaqueOutlined", outlineOpaqueInputs, shapePlumber); + task.addJob("DrawTransparentOutlined", outlineTransparentInputs, shapePlumber); // Retrieve z value of the outlined objects - const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedOpaques, deferredFramebuffer).asVarying(); + const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedOpaqueItems, outlinedTransparentItems, deferredFramebuffer).asVarying(); const auto outlinedFrameBuffer = task.addJob("PrepareOutline", outlinePrepareInputs); // Render opaque objects in DeferredBuffer diff --git a/libraries/render/src/render/FilterTask.cpp b/libraries/render/src/render/FilterTask.cpp index 19953f3399..b4da280697 100644 --- a/libraries/render/src/render/FilterTask.cpp +++ b/libraries/render/src/render/FilterTask.cpp @@ -98,8 +98,9 @@ void SelectSortItems::run(const RenderContextPointer& renderContext, const ItemB } } -void MetaToSubItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems) { +void MetaToSubItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { auto& scene = renderContext->_scene; + ItemIDs outItemIds; // Now we have a selection of items to render outItems.clear(); @@ -107,7 +108,14 @@ void MetaToSubItems::run(const RenderContextPointer& renderContext, const ItemBo for (auto idBound : inItems) { auto& item = scene->getItem(idBound.id); - item.fetchMetaSubItems(outItems); + item.fetchMetaSubItems(outItemIds); + } + + // Transform Item IDs to ItemBounds + for (auto id : outItemIds) { + auto& item = scene->getItem(id); + + outItems.emplace_back(ItemBound{ id, item.getBound() }); } } diff --git a/libraries/render/src/render/FilterTask.h b/libraries/render/src/render/FilterTask.h index 1c4611ee9f..b9b02017da 100644 --- a/libraries/render/src/render/FilterTask.h +++ b/libraries/render/src/render/FilterTask.h @@ -135,11 +135,11 @@ namespace render { // From meta-Items, generate the sub-items class MetaToSubItems { public: - using JobModel = Job::ModelIO; + using JobModel = Job::ModelIO; MetaToSubItems() {} - void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); }; } From 75e06b691fba8bd399c6b810241570c57ecd957b Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 6 Sep 2017 15:59:04 +0200 Subject: [PATCH 24/48] Simplified version that works directly with metas --- libraries/render-utils/src/OutlineEffect.cpp | 7 +++---- libraries/render-utils/src/OutlineEffect.h | 2 +- .../render-utils/src/RenderDeferredTask.cpp | 19 +++++++------------ 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index 158cb3871a..4733120fd3 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -66,12 +66,11 @@ gpu::TexturePointer OutlineFramebuffer::getDepthTexture() { } void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Inputs& inputs, PrepareOutline::Output& output) { - auto outlinedOpaqueItems = inputs.get0(); - auto outlinedTransparentItems = inputs.get1(); + auto outlinedItems = inputs.get0(); - if (!outlinedOpaqueItems.empty() || !outlinedTransparentItems.empty()) { + if (!outlinedItems.empty()) { auto args = renderContext->args; - auto deferredFrameBuffer = inputs.get2(); + auto deferredFrameBuffer = inputs.get1(); auto frameSize = deferredFrameBuffer->getFrameSize(); if (!_outlineFramebuffer) { diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index fb625fbabc..11bb39b954 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -44,7 +44,7 @@ class PrepareOutline { public: - using Inputs = render::VaryingSet3; + using Inputs = render::VaryingSet2; // Output will contain outlined objects only z-depth texture and the input primary buffer but without the primary depth buffer using Output = OutlineFramebufferPointer; using JobModel = render::Job::ModelIO; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index f240f0728e..3d39e2ff5e 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -96,19 +96,15 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren // Select items that need to be outlined const auto outlineSelectionName = "contextOverlayHighlightList"; - const auto outlinedOpaquesSelection = task.addJob("SelectOutlinedOpaques", opaques, outlineSelectionName); - const auto outlinedTransparentSelection = task.addJob("SelectOutlinedTransparents", transparents, outlineSelectionName); - const auto outlinedOpaqueItems = task.addJob("OutlinedOpaqueMetaToSubItems", outlinedOpaquesSelection); - const auto outlinedTransparentItems = task.addJob("OutlinedTransparentMetaToSubItems", outlinedTransparentSelection); + const auto selectedMetas = task.addJob("PassTestSelection", metas, "contextOverlayHighlightList"); + const auto outlinedItems = task.addJob("OutlinedMetaToSubItems", selectedMetas); // Render opaque outline objects first in DeferredBuffer - const auto outlineOpaqueInputs = DrawStateSortDeferred::Inputs(outlinedOpaqueItems, lightingModel).asVarying(); - const auto outlineTransparentInputs = DrawStateSortDeferred::Inputs(outlinedTransparentItems, lightingModel).asVarying(); - task.addJob("DrawOpaqueOutlined", outlineOpaqueInputs, shapePlumber); - task.addJob("DrawTransparentOutlined", outlineTransparentInputs, shapePlumber); + const auto outlineInputs = DrawStateSortDeferred::Inputs(outlinedItems, lightingModel).asVarying(); + task.addJob("DrawOutlinedDepth", outlineInputs, shapePlumber); // Retrieve z value of the outlined objects - const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedOpaqueItems, outlinedTransparentItems, deferredFramebuffer).asVarying(); + const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, deferredFramebuffer).asVarying(); const auto outlinedFrameBuffer = task.addJob("PrepareOutline", outlinePrepareInputs); // Render opaque objects in DeferredBuffer @@ -181,8 +177,8 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("ToneMapping", toneMappingInputs); // Draw outline - const auto outlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying(); - task.addJob("DrawOutline", outlineInputs); + const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying(); + task.addJob("DrawOutline", drawOutlineInputs); { // DEbug the bounds of the rendered items, still look at the zbuffer task.addJob("DrawMetaBounds", metas); @@ -237,7 +233,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("DrawZoneStack", deferredFrameTransform); // Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true - const auto selectedMetas = task.addJob("PassTestSelection", metas, "contextOverlayHighlightList"); task.addJob("DrawSelectionBounds", selectedMetas); } From d6ea01c4f3a16ace6ada6de4a9b4d30098d3e964 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 6 Sep 2017 17:34:29 +0200 Subject: [PATCH 25/48] Created outline task but still need to create specific render job with z-pass shaders --- libraries/render-utils/src/OutlineEffect.cpp | 39 +++++++++++++++++++ libraries/render-utils/src/OutlineEffect.h | 15 +++++++ .../render-utils/src/RenderDeferredTask.cpp | 20 ++-------- libraries/render/src/task/Varying.h | 18 +++++++++ 4 files changed, 75 insertions(+), 17 deletions(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index 4733120fd3..a99ced93f0 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -12,6 +12,10 @@ #include "GeometryCache.h" +#include + +#include "RenderDeferredTask.h" + #include "gpu/Context.h" #include "gpu/StandardShaderLib.h" @@ -294,3 +298,38 @@ const gpu::PipelinePointer& DebugOutline::getDebugPipeline() { return _debugPipeline; } + +DrawOutlineTask::DrawOutlineTask() { + +} + +void DrawOutlineTask::configure(const Config& config) { + +} + +void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs) { + const auto input = inputs.get(); + const auto selectedMetas = inputs.getN(0); + const auto shapePlumber = input.get1(); + const auto lightingModel = inputs.getN(2); + const auto deferredFramebuffer = inputs.getN(3); + const auto primaryFramebuffer = inputs.getN(4); + const auto deferredFrameTransform = inputs.getN(5); + + const auto& outlinedItems = task.addJob("OutlinedMetaToSubItems", selectedMetas); + + // Render opaque outline objects first in DeferredBuffer + const auto outlineInputs = DrawStateSortDeferred::Inputs(outlinedItems, lightingModel).asVarying(); + task.addJob("DrawOutlinedDepth", outlineInputs, shapePlumber); + + // Retrieve z value of the outlined objects + const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, deferredFramebuffer).asVarying(); + const auto outlinedFrameBuffer = task.addJob("CopyOutlineDepth", outlinePrepareInputs); + + // Draw outline + const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying(); + task.addJob("DrawOutlineEffect", drawOutlineInputs); + + // Debug outline + task.addJob("DebugOutline", outlinedFrameBuffer); +} diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index 11bb39b954..ccc1e03fdd 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -165,6 +165,21 @@ private: bool _isDisplayDepthEnabled{ false }; }; +#include "LightingModel.h" + +class DrawOutlineTask { +public: + using Inputs = render::VaryingSet6; + using Config = render::Task::Config; + using JobModel = render::Task::ModelI; + + DrawOutlineTask(); + + void configure(const Config& config); + void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs); + +}; + #endif // hifi_render_utils_OutlineEffect_h diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 3d39e2ff5e..5ea506e18f 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -95,17 +95,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("PrepareStencil", primaryFramebuffer); // Select items that need to be outlined - const auto outlineSelectionName = "contextOverlayHighlightList"; const auto selectedMetas = task.addJob("PassTestSelection", metas, "contextOverlayHighlightList"); - const auto outlinedItems = task.addJob("OutlinedMetaToSubItems", selectedMetas); - - // Render opaque outline objects first in DeferredBuffer - const auto outlineInputs = DrawStateSortDeferred::Inputs(outlinedItems, lightingModel).asVarying(); - task.addJob("DrawOutlinedDepth", outlineInputs, shapePlumber); - - // Retrieve z value of the outlined objects - const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, deferredFramebuffer).asVarying(); - const auto outlinedFrameBuffer = task.addJob("PrepareOutline", outlinePrepareInputs); // Render opaque objects in DeferredBuffer const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).asVarying(); @@ -173,12 +163,11 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto toneAndPostRangeTimer = task.addJob("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing"); // Lighting Buffer ready for tone mapping - const auto toneMappingInputs = render::Varying(ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer)); + const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying(); task.addJob("ToneMapping", toneMappingInputs); - // Draw outline - const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying(); - task.addJob("DrawOutline", drawOutlineInputs); + const auto outlineInputs = DrawOutlineTask::Inputs(selectedMetas, shapePlumber, lightingModel, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying(); + task.addJob("DrawOutline", outlineInputs); { // DEbug the bounds of the rendered items, still look at the zbuffer task.addJob("DrawMetaBounds", metas); @@ -213,9 +202,6 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto debugAmbientOcclusionInputs = DebugAmbientOcclusion::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget, ambientOcclusionUniforms).asVarying(); task.addJob("DebugAmbientOcclusion", debugAmbientOcclusionInputs); - // Debug outline - task.addJob("DebugOutline", outlinedFrameBuffer); - // Scene Octree Debugging job { task.addJob("DrawSceneOctree", spatialSelection); diff --git a/libraries/render/src/task/Varying.h b/libraries/render/src/task/Varying.h index 0144801701..9ce234061e 100644 --- a/libraries/render/src/task/Varying.h +++ b/libraries/render/src/task/Varying.h @@ -238,6 +238,24 @@ public: const T5& get5() const { return std::get<5>((*this)).template get(); } T5& edit5() { return std::get<5>((*this)).template edit(); } + virtual Varying operator[] (uint8_t index) const { + switch (index) { + default: + return std::get<0>((*this)); + case 1: + return std::get<1>((*this)); + case 2: + return std::get<2>((*this)); + case 3: + return std::get<3>((*this)); + case 4: + return std::get<4>((*this)); + case 5: + return std::get<5>((*this)); + }; + } + virtual uint8_t length() const { return 6; } + Varying asVarying() const { return Varying((*this)); } }; From 10643feb7859543042773cd420110f34c95dfac1 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 6 Sep 2017 18:40:38 +0200 Subject: [PATCH 26/48] Working with specific zpass rendering for outline. Debug script needs relinking to correct config --- libraries/render-utils/src/OutlineEffect.cpp | 95 ++++++++++++++++--- libraries/render-utils/src/OutlineEffect.h | 14 ++- .../render-utils/src/RenderDeferredTask.cpp | 2 +- .../render-utils/src/RenderPipelines.cpp | 48 ++++++++-- .../render-utils/src/RenderShadowTask.cpp | 42 +------- libraries/render/src/render/FilterTask.cpp | 30 ++++-- libraries/render/src/render/FilterTask.h | 17 +++- 7 files changed, 175 insertions(+), 73 deletions(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index a99ced93f0..3876a87c02 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -13,8 +13,7 @@ #include "GeometryCache.h" #include - -#include "RenderDeferredTask.h" +#include #include "gpu/Context.h" #include "gpu/StandardShaderLib.h" @@ -24,6 +23,10 @@ #include "debug_deferred_buffer_frag.h" #include "Outline_frag.h" +using namespace render; + +extern void initZPassPipelines(ShapePlumber& plumber, gpu::StatePointer state); + OutlineFramebuffer::OutlineFramebuffer() { } @@ -299,6 +302,61 @@ const gpu::PipelinePointer& DebugOutline::getDebugPipeline() { return _debugPipeline; } +void DrawOutlineDepth::run(const render::RenderContextPointer& renderContext, const render::ShapeBounds& inShapes) { + assert(renderContext->args); + assert(renderContext->args->hasViewFrustum()); + + RenderArgs* args = renderContext->args; + ShapeKey::Builder defaultKeyBuilder; + + gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { + args->_batch = &batch; + + // Setup camera, projection and viewport for all items + batch.setViewportTransform(args->_viewport); + batch.setStateScissorRect(args->_viewport); + + glm::mat4 projMat; + Transform viewMat; + args->getViewFrustum().evalProjectionMatrix(projMat); + args->getViewFrustum().evalViewTransform(viewMat); + + batch.setProjectionTransform(projMat); + batch.setViewTransform(viewMat); + + batch.clearFramebuffer( + gpu::Framebuffer::BUFFER_DEPTH, + vec4(vec3(1.0, 1.0, 1.0), 0.0), 1.0, 0, true); + + auto shadowPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder); + auto shadowSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned()); + + std::vector skinnedShapeKeys{}; + + // Iterate through all inShapes and render the unskinned + args->_shapePipeline = shadowPipeline; + batch.setPipeline(shadowPipeline->pipeline); + for (auto items : inShapes) { + if (items.first.isSkinned()) { + skinnedShapeKeys.push_back(items.first); + } + else { + renderItems(renderContext, items.second); + } + } + + // Reiterate to render the skinned + args->_shapePipeline = shadowSkinnedPipeline; + batch.setPipeline(shadowSkinnedPipeline->pipeline); + for (const auto& key : skinnedShapeKeys) { + renderItems(renderContext, inShapes.at(key)); + } + + args->_shapePipeline = nullptr; + args->_batch = nullptr; + }); +} + DrawOutlineTask::DrawOutlineTask() { } @@ -311,25 +369,36 @@ void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, rende const auto input = inputs.get(); const auto selectedMetas = inputs.getN(0); const auto shapePlumber = input.get1(); - const auto lightingModel = inputs.getN(2); - const auto deferredFramebuffer = inputs.getN(3); - const auto primaryFramebuffer = inputs.getN(4); - const auto deferredFrameTransform = inputs.getN(5); + const auto deferredFramebuffer = inputs.getN(2); + const auto primaryFramebuffer = inputs.getN(3); + const auto deferredFrameTransform = inputs.getN(4); - const auto& outlinedItems = task.addJob("OutlinedMetaToSubItems", selectedMetas); + // Prepare the ShapePipeline + ShapePlumberPointer shapePlumberZPass = std::make_shared(); + { + auto state = std::make_shared(); + state->setDepthTest(true, true, gpu::LESS_EQUAL); + state->setColorWriteMask(0); - // Render opaque outline objects first in DeferredBuffer - const auto outlineInputs = DrawStateSortDeferred::Inputs(outlinedItems, lightingModel).asVarying(); - task.addJob("DrawOutlinedDepth", outlineInputs, shapePlumber); + initZPassPipelines(*shapePlumberZPass, state); + } + + const auto& outlinedItemIDs = task.addJob("MetaToSubItemIDs", selectedMetas); + const auto& outlinedItems = task.addJob("MetaToSubItems", outlinedItemIDs, true); + + // Sort + const auto& sortedPipelines = task.addJob("PipelineSort", outlinedItems); + const auto& sortedShapes = task.addJob("DepthSort", sortedPipelines); + task.addJob("Depth", sortedShapes, shapePlumberZPass); // Retrieve z value of the outlined objects const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, deferredFramebuffer).asVarying(); - const auto outlinedFrameBuffer = task.addJob("CopyOutlineDepth", outlinePrepareInputs); + const auto outlinedFrameBuffer = task.addJob("CopyDepth", outlinePrepareInputs); // Draw outline const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying(); - task.addJob("DrawOutlineEffect", drawOutlineInputs); + task.addJob("Effect", drawOutlineInputs); // Debug outline - task.addJob("DebugOutline", outlinedFrameBuffer); + task.addJob("Debug", outlinedFrameBuffer); } diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index ccc1e03fdd..a0e1823a56 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -165,11 +165,21 @@ private: bool _isDisplayDepthEnabled{ false }; }; -#include "LightingModel.h" +class DrawOutlineDepth { +public: + using JobModel = render::Job::ModelI; + + DrawOutlineDepth(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {} + void run(const render::RenderContextPointer& renderContext, + const render::ShapeBounds& inShapes); + +protected: + render::ShapePlumberPointer _shapePlumber; +}; class DrawOutlineTask { public: - using Inputs = render::VaryingSet6; + using Inputs = render::VaryingSet5; using Config = render::Task::Config; using JobModel = render::Task::ModelI; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 5ea506e18f..d396377969 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -166,7 +166,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying(); task.addJob("ToneMapping", toneMappingInputs); - const auto outlineInputs = DrawOutlineTask::Inputs(selectedMetas, shapePlumber, lightingModel, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying(); + const auto outlineInputs = DrawOutlineTask::Inputs(selectedMetas, shapePlumber, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying(); task.addJob("DrawOutline", outlineInputs); { // DEbug the bounds of the rendered items, still look at the zbuffer diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 0353e10407..7f644add72 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -21,19 +21,15 @@ #include "render/DrawTask.h" #include "model_vert.h" -#include "model_shadow_vert.h" #include "model_normal_map_vert.h" #include "model_lightmap_vert.h" #include "model_lightmap_normal_map_vert.h" #include "skin_model_vert.h" -#include "skin_model_shadow_vert.h" #include "skin_model_normal_map_vert.h" -#include "model_shadow_fade_vert.h" #include "model_lightmap_fade_vert.h" #include "model_lightmap_normal_map_fade_vert.h" #include "skin_model_fade_vert.h" -#include "skin_model_shadow_fade_vert.h" #include "skin_model_normal_map_fade_vert.h" #include "simple_vert.h" @@ -50,7 +46,6 @@ #include "model_frag.h" #include "model_unlit_frag.h" -#include "model_shadow_frag.h" #include "model_normal_map_frag.h" #include "model_normal_specular_map_frag.h" #include "model_specular_map_frag.h" @@ -59,7 +54,6 @@ #include "model_normal_map_fade_vert.h" #include "model_fade_frag.h" -#include "model_shadow_fade_frag.h" #include "model_unlit_fade_frag.h" #include "model_normal_map_fade_frag.h" #include "model_normal_specular_map_fade_frag.h" @@ -95,6 +89,17 @@ #include "overlay3D_model_unlit_frag.h" #include "overlay3D_model_translucent_unlit_frag.h" +#include "model_shadow_vert.h" +#include "skin_model_shadow_vert.h" + +#include "model_shadow_frag.h" +#include "skin_model_shadow_frag.h" + +#include "model_shadow_fade_vert.h" +#include "skin_model_shadow_fade_vert.h" + +#include "model_shadow_fade_frag.h" +#include "skin_model_shadow_fade_frag.h" using namespace render; using namespace std::placeholders; @@ -102,6 +107,7 @@ using namespace std::placeholders; void initOverlay3DPipelines(ShapePlumber& plumber, bool depthTest = false); void initDeferredPipelines(ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter); void initForwardPipelines(ShapePlumber& plumber); +void initZPassPipelines(ShapePlumber& plumber, gpu::StatePointer state); void addPlumberPipeline(ShapePlumber& plumber, const ShapeKey& key, const gpu::ShaderPointer& vertex, const gpu::ShaderPointer& pixel, @@ -566,3 +572,33 @@ void lightBatchSetter(const ShapePipeline& pipeline, gpu::Batch& batch, RenderAr pipeline.locations->lightAmbientMapUnit); } } + +void initZPassPipelines(ShapePlumber& shapePlumber, gpu::StatePointer state) { + auto modelVertex = gpu::Shader::createVertex(std::string(model_shadow_vert)); + auto modelPixel = gpu::Shader::createPixel(std::string(model_shadow_frag)); + gpu::ShaderPointer modelProgram = gpu::Shader::createProgram(modelVertex, modelPixel); + shapePlumber.addPipeline( + ShapeKey::Filter::Builder().withoutSkinned().withoutFade(), + modelProgram, state); + + auto skinVertex = gpu::Shader::createVertex(std::string(skin_model_shadow_vert)); + auto skinPixel = gpu::Shader::createPixel(std::string(skin_model_shadow_frag)); + gpu::ShaderPointer skinProgram = gpu::Shader::createProgram(skinVertex, skinPixel); + shapePlumber.addPipeline( + ShapeKey::Filter::Builder().withSkinned().withoutFade(), + skinProgram, state); + + auto modelFadeVertex = gpu::Shader::createVertex(std::string(model_shadow_fade_vert)); + auto modelFadePixel = gpu::Shader::createPixel(std::string(model_shadow_fade_frag)); + gpu::ShaderPointer modelFadeProgram = gpu::Shader::createProgram(modelFadeVertex, modelFadePixel); + shapePlumber.addPipeline( + ShapeKey::Filter::Builder().withoutSkinned().withFade(), + modelFadeProgram, state); + + auto skinFadeVertex = gpu::Shader::createVertex(std::string(skin_model_shadow_fade_vert)); + auto skinFadePixel = gpu::Shader::createPixel(std::string(skin_model_shadow_fade_frag)); + gpu::ShaderPointer skinFadeProgram = gpu::Shader::createProgram(skinFadeVertex, skinFadePixel); + shapePlumber.addPipeline( + ShapeKey::Filter::Builder().withSkinned().withFade(), + skinFadeProgram, state); +} diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index ac80c03873..d32857bc65 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -22,20 +22,10 @@ #include "DeferredLightingEffect.h" #include "FramebufferCache.h" -#include "model_shadow_vert.h" -#include "skin_model_shadow_vert.h" - -#include "model_shadow_frag.h" -#include "skin_model_shadow_frag.h" - -#include "model_shadow_fade_vert.h" -#include "skin_model_shadow_fade_vert.h" - -#include "model_shadow_fade_frag.h" -#include "skin_model_shadow_fade_frag.h" - using namespace render; +extern void initZPassPipelines(ShapePlumber& plumber, gpu::StatePointer state); + void RenderShadowMap::run(const render::RenderContextPointer& renderContext, const render::ShapeBounds& inShapes) { assert(renderContext->args); @@ -108,33 +98,7 @@ void RenderShadowTask::build(JobModel& task, const render::Varying& input, rende state->setCullMode(gpu::State::CULL_BACK); state->setDepthTest(true, true, gpu::LESS_EQUAL); - auto modelVertex = gpu::Shader::createVertex(std::string(model_shadow_vert)); - auto modelPixel = gpu::Shader::createPixel(std::string(model_shadow_frag)); - gpu::ShaderPointer modelProgram = gpu::Shader::createProgram(modelVertex, modelPixel); - shapePlumber->addPipeline( - ShapeKey::Filter::Builder().withoutSkinned().withoutFade(), - modelProgram, state); - - auto skinVertex = gpu::Shader::createVertex(std::string(skin_model_shadow_vert)); - auto skinPixel = gpu::Shader::createPixel(std::string(skin_model_shadow_frag)); - gpu::ShaderPointer skinProgram = gpu::Shader::createProgram(skinVertex, skinPixel); - shapePlumber->addPipeline( - ShapeKey::Filter::Builder().withSkinned().withoutFade(), - skinProgram, state); - - auto modelFadeVertex = gpu::Shader::createVertex(std::string(model_shadow_fade_vert)); - auto modelFadePixel = gpu::Shader::createPixel(std::string(model_shadow_fade_frag)); - gpu::ShaderPointer modelFadeProgram = gpu::Shader::createProgram(modelFadeVertex, modelFadePixel); - shapePlumber->addPipeline( - ShapeKey::Filter::Builder().withoutSkinned().withFade(), - modelFadeProgram, state); - - auto skinFadeVertex = gpu::Shader::createVertex(std::string(skin_model_shadow_fade_vert)); - auto skinFadePixel = gpu::Shader::createPixel(std::string(skin_model_shadow_fade_frag)); - gpu::ShaderPointer skinFadeProgram = gpu::Shader::createProgram(skinFadeVertex, skinFadePixel); - shapePlumber->addPipeline( - ShapeKey::Filter::Builder().withSkinned().withFade(), - skinFadeProgram, state); + initZPassPipelines(*shapePlumber, state); } const auto cachedMode = task.addJob("ShadowSetup"); diff --git a/libraries/render/src/render/FilterTask.cpp b/libraries/render/src/render/FilterTask.cpp index b4da280697..39bc19adc7 100644 --- a/libraries/render/src/render/FilterTask.cpp +++ b/libraries/render/src/render/FilterTask.cpp @@ -98,9 +98,8 @@ void SelectSortItems::run(const RenderContextPointer& renderContext, const ItemB } } -void MetaToSubItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { +void MetaToSubItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems) { auto& scene = renderContext->_scene; - ItemIDs outItemIds; // Now we have a selection of items to render outItems.clear(); @@ -108,14 +107,25 @@ void MetaToSubItems::run(const RenderContextPointer& renderContext, const ItemBo for (auto idBound : inItems) { auto& item = scene->getItem(idBound.id); - item.fetchMetaSubItems(outItemIds); - } - - // Transform Item IDs to ItemBounds - for (auto id : outItemIds) { - auto& item = scene->getItem(id); - - outItems.emplace_back(ItemBound{ id, item.getBound() }); + item.fetchMetaSubItems(outItems); } } +void IDsToBounds::run(const RenderContextPointer& renderContext, const ItemIDs& inItems, ItemBounds& outItems) { + auto& scene = renderContext->_scene; + + // Now we have a selection of items to render + outItems.clear(); + + if (!_disableAABBs) { + for (auto id : inItems) { + auto& item = scene->getItem(id); + + outItems.emplace_back(ItemBound{ id, item.getBound() }); + } + } else { + for (auto id : inItems) { + outItems.emplace_back(ItemBound{ id }); + } + } +} diff --git a/libraries/render/src/render/FilterTask.h b/libraries/render/src/render/FilterTask.h index b9b02017da..2f8b53722f 100644 --- a/libraries/render/src/render/FilterTask.h +++ b/libraries/render/src/render/FilterTask.h @@ -135,11 +135,24 @@ namespace render { // From meta-Items, generate the sub-items class MetaToSubItems { public: - using JobModel = Job::ModelIO; + using JobModel = Job::ModelIO; MetaToSubItems() {} - void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems); + }; + + // From item IDs build item bounds + class IDsToBounds { + public: + using JobModel = Job::ModelIO; + + IDsToBounds(bool disableAABBs = false) : _disableAABBs(disableAABBs) {} + + void run(const RenderContextPointer& renderContext, const ItemIDs& inItems, ItemBounds& outItems); + + private: + bool _disableAABBs{ false }; }; } From 25ff132fc7028d57ef0c8a44cfa54f1207723b3c Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 6 Sep 2017 19:05:15 +0200 Subject: [PATCH 27/48] Debugging scripts working again with correct occlusion management --- libraries/render-utils/src/OutlineEffect.cpp | 40 +++++++++--------- libraries/render-utils/src/OutlineEffect.h | 2 +- .../utilities/lib/plotperf/PlotPerf.qmlc | Bin 0 -> 44724 bytes .../render/configSlider/ConfigSlider.qmlc | Bin 0 -> 11559 bytes scripts/developer/utilities/render/fade.qmlc | Bin 0 -> 41940 bytes .../developer/utilities/render/outline.qml | 12 +----- .../developer/utilities/render/outline.qmlc | Bin 0 -> 13063 bytes 7 files changed, 23 insertions(+), 31 deletions(-) create mode 100644 scripts/developer/utilities/lib/plotperf/PlotPerf.qmlc create mode 100644 scripts/developer/utilities/render/configSlider/ConfigSlider.qmlc create mode 100644 scripts/developer/utilities/render/fade.qmlc create mode 100644 scripts/developer/utilities/render/outline.qmlc diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index 3876a87c02..f7cb72b8ef 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -145,12 +145,12 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I auto mainFrameBuffer = inputs.get1(); if (mainFrameBuffer) { - auto sceneDepthBuffer = mainFrameBuffer->getPrimaryDepthTexture(); + auto sceneDepthBuffer = inputs.get2(); const auto frameTransform = inputs.get0(); - auto outlinedDepthBuffer = inputs.get2(); + auto outlinedDepthBuffer = mainFrameBuffer->getPrimaryDepthTexture(); auto destinationFrameBuffer = inputs.get3(); auto pipeline = getPipeline(); - auto framebufferSize = glm::ivec2(sceneDepthBuffer->getDimensions()); + auto framebufferSize = glm::ivec2(outlinedDepthBuffer->getDimensions()); if (!_primaryWithoutDepthBuffer || framebufferSize!=_frameBufferSize) { // Failing to recreate this frame buffer when the screen has been resized creates a bug on Mac @@ -159,7 +159,7 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I _frameBufferSize = framebufferSize; } - if (outlinedDepthBuffer) { + if (sceneDepthBuffer) { auto args = renderContext->args; { auto& configuration = _configuration.edit(); @@ -185,8 +185,8 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I batch.setUniformBuffer(OUTLINE_PARAMS_SLOT, _configuration); batch.setUniformBuffer(FRAME_TRANSFORM_SLOT, frameTransform->getFrameTransformBuffer()); - batch.setResourceTexture(SCENE_DEPTH_SLOT, sceneDepthBuffer); - batch.setResourceTexture(OUTLINED_DEPTH_SLOT, outlinedDepthBuffer->getDepthTexture()); + batch.setResourceTexture(SCENE_DEPTH_SLOT, sceneDepthBuffer->getDepthTexture()); + batch.setResourceTexture(OUTLINED_DEPTH_SLOT, outlinedDepthBuffer); batch.draw(gpu::TRIANGLE_STRIP, 4); // Restore previous frame buffer @@ -255,7 +255,7 @@ void DebugOutline::run(const render::RenderContextPointer& renderContext, const batch.setModelTransform(Transform()); batch.setPipeline(getDebugPipeline()); - batch.setResourceTexture(0, outlineFramebuffer->getDepthTexture()); + batch.setResourceTexture(0, outlineFramebuffer->getPrimaryDepthTexture()); const glm::vec4 color(1.0f, 0.5f, 0.2f, 1.0f); const glm::vec2 bottomLeft(-1.0f, -1.0f); @@ -369,7 +369,7 @@ void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, rende const auto input = inputs.get(); const auto selectedMetas = inputs.getN(0); const auto shapePlumber = input.get1(); - const auto deferredFramebuffer = inputs.getN(2); + const auto outlinedFrameBuffer = inputs.getN(2); const auto primaryFramebuffer = inputs.getN(3); const auto deferredFrameTransform = inputs.getN(4); @@ -383,22 +383,22 @@ void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, rende initZPassPipelines(*shapePlumberZPass, state); } - const auto& outlinedItemIDs = task.addJob("MetaToSubItemIDs", selectedMetas); - const auto& outlinedItems = task.addJob("MetaToSubItems", outlinedItemIDs, true); + const auto& outlinedItemIDs = task.addJob("OutlineMetaToSubItemIDs", selectedMetas); + const auto& outlinedItems = task.addJob("OutlineMetaToSubItems", outlinedItemIDs, true); + + // Retrieve z value of the scene objects + const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, outlinedFrameBuffer).asVarying(); + const auto sceneFrameBuffer = task.addJob("OutlineCopyDepth", outlinePrepareInputs); // Sort - const auto& sortedPipelines = task.addJob("PipelineSort", outlinedItems); - const auto& sortedShapes = task.addJob("DepthSort", sortedPipelines); - task.addJob("Depth", sortedShapes, shapePlumberZPass); - - // Retrieve z value of the outlined objects - const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, deferredFramebuffer).asVarying(); - const auto outlinedFrameBuffer = task.addJob("CopyDepth", outlinePrepareInputs); + const auto& sortedPipelines = task.addJob("OutlinePipelineSort", outlinedItems); + const auto& sortedShapes = task.addJob("OutlineDepthSort", sortedPipelines); + task.addJob("OutlineDepth", sortedShapes, shapePlumberZPass); // Draw outline - const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, deferredFramebuffer, outlinedFrameBuffer, primaryFramebuffer).asVarying(); - task.addJob("Effect", drawOutlineInputs); + const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, outlinedFrameBuffer, sceneFrameBuffer, primaryFramebuffer).asVarying(); + task.addJob("OutlineEffect", drawOutlineInputs); // Debug outline - task.addJob("Debug", outlinedFrameBuffer); + task.addJob("OutlineDebug", outlinedFrameBuffer); } diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index a0e1823a56..4cbfb5851c 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -146,7 +146,7 @@ signals: class DebugOutline { public: - using Inputs = OutlineFramebufferPointer; + using Inputs = DeferredFramebufferPointer; using Config = DebugOutlineConfig; using JobModel = render::Job::ModelI; diff --git a/scripts/developer/utilities/lib/plotperf/PlotPerf.qmlc b/scripts/developer/utilities/lib/plotperf/PlotPerf.qmlc new file mode 100644 index 0000000000000000000000000000000000000000..e23e6334ff9ae336ad0005b7f1dfbddcae57622d GIT binary patch literal 44724 zcmeHQ4Rl;po&P1JX-biqwrP{JWjE?9gwKXrpn@)$lHkOhXecQZwuOGBAJ8IuoQJMAbJwE3o+nYS!DM7?#Fxg&3kX& zOful&nae3N^WMGxd+-1I|Gyu(;l{=5*01SUGZR43^r^V;Pgho~DgySO0(|n7YerYJ zt$g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lider.qmlc b/scripts/developer/utilities/render/configSlider/ConfigSlider.qmlc new file mode 100644 index 0000000000000000000000000000000000000000..2fdd99273a98086d918b117e8f8112243822071b GIT binary patch literal 11559 zcmd^_U2I%O6@b5MJC2jO*}H4!uLQbHw$L^|j+->|-+j|E*NUnp+U;pFlKl;Vn z-RIuUZhq-sUv0b}*aiIN%1{3j`T5n?-}=kfewAqY{*S)|>;~Rn1M7g(7?_^(%-gYh z?gXlUsgWWLpdA9!%hgL|srL={X{L9`kMt6{tvHq<~*4UE-*zXA@ffb%PW zT6m@w&ep=sT1c#fpR6>rQz9VnUGt#XJ`;hb$aEXNeX}r3T6*uuBA~&d2k8lHWZbh; zw}dkr&Fha!uIL?x-g?W`idiDpUE~oIC+~dF`nmG*RWCws4#q8AC#O|IK^`a9W(K`V zo4=!gXnFaTVwcvt z3|*(k`RuZ_Lc1K?Tug61yKJw}E+@8>-?!+f(l{@}KD4#q_M$ z1v-x2Zgy5gul0+D-WD6zmVAMZqxS$TNYDAtpd{}y`EV)zlecugVdcEnuqnvrtkkZ~j)(A9`Vzp@x*b1yA#ahmLw?nJQ zB7Mj@QmiBA`S#rdzc5Nv~FiP8$!l$}midFq4+Qn|oR3d{X#~ zTPiCHvjTUL(w~8q1w9GeLrQ;c&hRzROiF)l&bBQI50TPeL`QW+yVyvIjkdEADP^7L zBS;&y(yW~XTpR|Uq8&HxRxATM)Q4*4@XZ%`o3-jw0$!0n2snDdr^xBXC#=q*IkQNFtqIKSCa1OBv`@9%9+=xj zPWuKajb=^FlH`^=@Gv>+gU;V}tKJ?Z$D{b3v2(4>6$Vz>pC zu|=a>1iBxow--WiF$C|1;KLBq`>@G}Z9cU4u-}JnA71g{hd!M1;i3;$e37-BBNzLg}euorS{A^Gu50d668D1{X@1v9FN$X0<`?KR>i3LPnk@mQiPkM%amB4_+ z+7NvzvGAEoLFgO&UiulPpQlykVbV&#(CaMpECyf3x5k(F7asi#>Tc7j3+b!Sv7757 zt#Z3sD)~-!Av#Gj#1OrTALS4O93?u>YOzN$pf9;=SeQ;wTc#)I=ELp87r??NODd&`ONMFTYAcJ__y+U)Bhd|c%I~}h4}`tjlEvdNIarD zm3=%J@Oz23A+`M=Ptwb`t$&x7_g1T<=PoB-FiV*I9W7*uO4bLlP5jKhDfR&Y@ej!_ z5_iGa5^dWs><6hky=UhL%SrNWbP)$%|&a%Lh@F%J4_?(QzJR56`iO-E6m#WK?6% z>Ha0MBzMSMAA^b~@%@7Ccov>YWdE8NnNB6M>6^)He?FNVo@)Q4ng4L6J^R~^(L;5K zLbn}%Q;gZ3t%u^VpdD?*+8_UTkbfO zjGdhoH$L`|<#pch+BtWhKLf0Z>kBpwa>80ll93`=Y^3r<`xRTfOwnGT0?(;TC8pXXpVgbE z4kbcI^2I^~3|!(V|8@yVmn^_uK9B?mm9Uqa_eA!ccy@nmEPkmic2R0tT(aKD@zAT% zJ2zkbK#rJi$_+~ZEn1D>Pq;tyL-wIW=)3u3^OWSy%Qxa7zb!U)BOVI3#U@2iDe~iQ zHpziiI;f{xrF|;&K`N^BQZDH}W0UUn^RK7{6e2YFS2z*@XRU&(!@^)*fKK)3E%>oTd zNvCtBQfrm#biOHU=k0W4GjGYU{sZZAn*Wr&*8Y~7CR$B$)wO_G3*AU!^gwAd^82OT zH!W3{EsN6S_bSz;+!Y6mQj$L(4S2r2%xFE>Dn0Dw8=+@^x9DK_xcL9F*So!ovRB3Z en%u=NWUo(5y_2uL#rZt2t&-eOv3{1RU;8h3EWUsM literal 0 HcmV?d00001 diff --git a/scripts/developer/utilities/render/fade.qmlc b/scripts/developer/utilities/render/fade.qmlc new file mode 100644 index 0000000000000000000000000000000000000000..8c69d76eff64d74d6a36bcfd97b16413bfa65dc8 GIT binary patch literal 41940 zcmeI54U}C~dG~+&BxJ&8ZXiH_P%kh*{2&=IKtP3=Fo7AFNlqqT69_Q*f&}t0Bol~y z=-7ZJMD(J*ZKzgLWwlYU?`W}WK&^TEri=8|+M{LF)MAaRXroPaq+h9JExP`DpMCG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O5) zdsdVA)Wg1V^tE66`P6w;z*dv_R1aI`e5$rSjch(OKR%zDxgH{Oyt%CkMHnB?7maQ_ zf9W{BV`)z_^;drtD$D+dM^SD;p2kFz0$y|h9m89>;zGNlzuL)OOVPfpqZLJMOK z%8~1r1Cr9MKib_~f5^A92cCaet6jBJYFXp(aY*$GH)0xbJd&x8_jrBOsx61#ko8@o zUvM&Fd9?wrig@&B9Ng?Ji!o;!S51Yoy906FU2){OS-JK!*Y8rT_35`lF*w|--ww3w zJl60+bG!3O!7rfSxol2kX1jXHoGNWX&M(Vry3Hn>M#n+M)K`# zecv&i-jf-%zGxQ#CTPU?|H`kYdc^Cij^cRz_4QXCuU?Or*8h#;mDxYjPAA(w>#sFe zz)Nd(tjj3#Gr5WGZeMvLVcQnFNL7tQStmCtH5vNb%l2zoO-6O=T)hhzvHfS_qn!<- z!zcgW0iV~~-YeISD#ht*+InPdY*3C;8uav|mBXGGRwzt>Y-;Oq3)ZwLr>nBs6lbVv$3-1f# z4S_@4#p?J)8*bX|X34j+^m|AXI)X0J|CsvJA2}?q&*5yo>iFOL@3>}%`0w=izc=>Z z)}{Pv#s8z-@2NkUSUtX{CO!Xf{VR`erT9O6PpHQ?vwh5pZeRC3p}%(aS$Vu&+EKZG zu0P&Zz5eL2=j4sGV&u6e(mgYwC&@bcp59&G05sxjIwe2 EFUMI0bN~PV literal 0 HcmV?d00001 diff --git a/scripts/developer/utilities/render/outline.qml b/scripts/developer/utilities/render/outline.qml index 321dd9271b..e17f7c1f1c 100644 --- a/scripts/developer/utilities/render/outline.qml +++ b/scripts/developer/utilities/render/outline.qml @@ -14,20 +14,12 @@ import "configSlider" Item { id: root - property var pickConfig: Render.getConfig("RenderMainView.PickOutlined") - property var debugConfig: Render.getConfig("RenderMainView.DebugOutline") - property var drawConfig: Render.getConfig("RenderMainView.DrawOutline") + property var debugConfig: Render.getConfig("RenderMainView.OutlineDebug") + property var drawConfig: Render.getConfig("RenderMainView.OutlineEffect") Column { spacing: 8 - CheckBox { - text: "Edit Outline" - checked: root.pickConfig["pick"] - onCheckedChanged: { - root.pickConfig["pick"] = checked; - } - } CheckBox { text: "View Outlined Depth" checked: root.debugConfig["viewOutlinedDepth"] diff --git a/scripts/developer/utilities/render/outline.qmlc b/scripts/developer/utilities/render/outline.qmlc new file mode 100644 index 0000000000000000000000000000000000000000..e85e72ad3c452e3c85bb7b199b398fba1350cbc5 GIT binary patch literal 13063 zcmeI1U2GiH6~})!AGSjRS(_yGt`oA91;STsAkaWju@k3WgAJ2UB9)IAdu=cHW8)8E zUaGVf5|)MV1FiDFL!|N$Ref-!Rx*f65kw-Ys%qMo`Y}>fiB@T~MLgu8lB@rnncZ1? zY_Ahj1(Xv_#xwWcbI<*s|2g;E+0$?B>+0?t?W_jOrj5LPZQIFL4b1F*+<_t8hgR|@4@;XSahunIYT@O_o;N%9lumP@Zfb>QUDG z-3pkifIXEkUI~{gy>&@`;@kG5e@}<*vS~9h|4n()c$e3&&Up7qe^^+rq?)|nBU+r@ z-upn$CcoQ4JvCfeR!=VJ4P5JW=6$_C_Gb@JT4-OKQ$}5a_e+WMJ+I|=zCQ6#5{wJ( zi4|~*rMz)#z20eG?@H@Umbu>iy`G&bt@rK~);pu1TY<;xR>9-OJ)XW=-w$!`v4DTz zhdnsu`Sk%$!E*jsjeV}KZzcO4Ez`dIgKKMF?xFJVYsM`Lzv+k9*1p&y<=OXKnf5jA zU0eHRe0?kV_h^~+xeaS;pVL?#ewi}u%RRcXeG0{L_o2M6ZzcQ&%d}5(`>DXj=|wZ+cq3~Np7?MOFTgIS73M4T{T1Sev6@?XS3B2pq^~f z<94RmPSST#WuaA4%e1{bsVw+Kau?I~3fknqK<;JQUY=AIu$Sy*+Fn6h7}Nbs+bd}E z?DgbjrtKx!;=d~w5BW2|<3oR464i=OQDS=>*VY`j+qQs-aEIzkT6tl656; z3$?|K+9zx!fqg*@C`sbl8eyS*cLKX{*&VVk%+I@V3$?&Dt4VTwe3E}9_4a?CPiIeC zK0S=f!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9s~1^`?Dl?92A4fqeT^=308-_vYtDj#RX!QIYQ#+c!IM66Yr6;Z?KhYQa_R0S=&;R0reRU~$XzE1l&^v$G z`p)}SNlR+BV`@jo)R8@HQ|r=GXU`g`Zb{8Ff6*S(KNy{6b)+*%Gqpc8&ZSNgR&3Xgs)_VgA1piIIIy>ZJpG-7= ztOH?DMf0rAxgkYW3l-`2kHCy#q?`+wAob$^Oi0Jf!f3mZ5Lh+;Rd7Y;hvo6r23bD7 zo5KKhs>#oqCy%9OmCQb+X}w)$ z$9wImS$Xb)hWpl?i}GACWw%XSJ+-RjrJCuxv%f6QAAO`MpFd^Cr@mc;9K47>(ebJ8 z);3eiqVGn0>W6{y@hv+(1AJE(p8>wN;`9Gr|LGuhJ^5W9xXb5{KHk`E&kk8;{|xx! zZ^Vn@bJ5=CtS*Co>+n;J^%m! literal 0 HcmV?d00001 From fe357671e1b479156550cec306d771f3dac7f6ff Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Wed, 6 Sep 2017 19:06:40 +0200 Subject: [PATCH 28/48] Removed qmlc files --- .../utilities/lib/plotperf/PlotPerf.qmlc | Bin 44724 -> 0 bytes .../render/configSlider/ConfigSlider.qmlc | Bin 11559 -> 0 bytes scripts/developer/utilities/render/fade.qmlc | Bin 41940 -> 0 bytes scripts/developer/utilities/render/outline.qmlc | Bin 13063 -> 0 bytes 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 scripts/developer/utilities/lib/plotperf/PlotPerf.qmlc delete mode 100644 scripts/developer/utilities/render/configSlider/ConfigSlider.qmlc delete mode 100644 scripts/developer/utilities/render/fade.qmlc delete mode 100644 scripts/developer/utilities/render/outline.qmlc diff --git a/scripts/developer/utilities/lib/plotperf/PlotPerf.qmlc b/scripts/developer/utilities/lib/plotperf/PlotPerf.qmlc deleted file mode 100644 index e23e6334ff9ae336ad0005b7f1dfbddcae57622d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 44724 zcmeHQ4Rl;po&P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u%kpvxz5g)lzgNJ&ckI)@=axe5KIE?VJ6+pg?aL-yf9%1TOb)89e9FsG@_|ND6H@^;Rel--NIIm#e MbK$!2Xo6h&fBtFeW&i*H diff --git a/scripts/developer/utilities/render/configSlider/ConfigSlider.qmlc b/scripts/developer/utilities/render/configSlider/ConfigSlider.qmlc deleted file mode 100644 index 2fdd99273a98086d918b117e8f8112243822071b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11559 zcmd^_U2I%O6@b5MJC2jO*}H4!uLQbHw$L^|j+->|-+j|E*NUnp+U;pFlKl;Vn z-RIuUZhq-sUv0b}*aiIN%1{3j`T5n?-}=kfewAqY{*S)|>;~Rn1M7g(7?_^(%-gYh z?gXlUsgWWLpdA9!%hgL|srL={X{L9`kMt6{tvHq<~*4UE-*zXA@ffb%PW zT6m@w&ep=sT1c#fpR6>rQz9VnUGt#XJ`;hb$aEXNeX}r3T6*uuBA~&d2k8lHWZbh; zw}dkr&Fha!uIL?x-g?W`idiDpUE~oIC+~dF`nmG*RWCws4#q8AC#O|IK^`a9W(K`V zo4=!gXnFaTVwcvt z3|*(k`RuZ_Lc1K?Tug61yKJw}E+@8>-?!+f(l{@}KD4#q_M$ z1v-x2Zgy5gul0+D-WD6zmVAMZqxS$TNYDAtpd{}y`EV)zlecugVdcEnuqnvrtkkZ~j)(A9`Vzp@x*b1yA#ahmLw?nJQ zB7Mj@QmiBA`S#rdzc5Nv~FiP8$!l$}midFq4+Qn|oR3d{X#~ zTPiCHvjTUL(w~8q1w9GeLrQ;c&hRzROiF)l&bBQI50TPeL`QW+yVyvIjkdEADP^7L zBS;&y(yW~XTpR|Uq8&HxRxATM)Q4*4@XZ%`o3-jw0$!0n2snDdr^xBXC#=q*IkQNFtqIKSCa1OBv`@9%9+=xj zPWuKajb=^FlH`^=@Gv>+gU;V}tKJ?Z$D{b3v2(4>6$Vz>pC zu|=a>1iBxow--WiF$C|1;KLBq`>@G}Z9cU4u-}JnA71g{hd!M1;i3;$e37-BBNzLg}euorS{A^Gu50d668D1{X@1v9FN$X0<`?KR>i3LPnk@mQiPkM%amB4_+ z+7NvzvGAEoLFgO&UiulPpQlykVbV&#(CaMpECyf3x5k(F7asi#>Tc7j3+b!Sv7757 zt#Z3sD)~-!Av#Gj#1OrTALS4O93?u>YOzN$pf9;=SeQ;wTc#)I=ELp87r??NODd&`ONMFTYAcJ__y+U)Bhd|c%I~}h4}`tjlEvdNIarD zm3=%J@Oz23A+`M=Ptwb`t$&x7_g1T<=PoB-FiV*I9W7*uO4bLlP5jKhDfR&Y@ej!_ z5_iGa5^dWs><6hky=UhL%SrNWbP)$%|&a%Lh@F%J4_?(QzJR56`iO-E6m#WK?6% z>Ha0MBzMSMAA^b~@%@7Ccov>YWdE8NnNB6M>6^)He?FNVo@)Q4ng4L6J^R~^(L;5K zLbn}%Q;gZ3t%u^VpdD?*+8_UTkbfO zjGdhoH$L`|<#pch+BtWhKLf0Z>kBpwa>80ll93`=Y^3r<`xRTfOwnGT0?(;TC8pXXpVgbE z4kbcI^2I^~3|!(V|8@yVmn^_uK9B?mm9Uqa_eA!ccy@nmEPkmic2R0tT(aKD@zAT% zJ2zkbK#rJi$_+~ZEn1D>Pq;tyL-wIW=)3u3^OWSy%Qxa7zb!U)BOVI3#U@2iDe~iQ zHpziiI;f{xrF|;&K`N^BQZDH}W0UUn^RK7{6e2YFS2z*@XRU&(!@^)*fKK)3E%>oTd zNvCtBQfrm#biOHU=k0W4GjGYU{sZZAn*Wr&*8Y~7CR$B$)wO_G3*AU!^gwAd^82OT zH!W3{EsN6S_bSz;+!Y6mQj$L(4S2r2%xFE>Dn0Dw8=+@^x9DK_xcL9F*So!ovRB3Z en%u=NWUo(5y_2uL#rZt2t&-eOv3{1RU;8h3EWUsM diff --git a/scripts/developer/utilities/render/fade.qmlc b/scripts/developer/utilities/render/fade.qmlc deleted file mode 100644 index 8c69d76eff64d74d6a36bcfd97b16413bfa65dc8..0000000000000000000000000000000000000000 GIT binary patch literal 0 H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_=$MHR(_+B%P?^y8F zglWb3i_+v=e>^!?K4o{nPuZ2tNF9pr?k~F=#dr6`^CCAGc%^AduDQPdm8L0Eo9iQY z)#t7byQ}@~>WI7A=dO;bJxES%X?9z4Q<0lF(^j1!b5muLh3l)GFd6ZDN#=a2{`O5) zdsdVA)Wg1V^tE66`P6w;z*dv_R1aI`e5$rSjch(OKR%zDxgH{Oyt%CkMHnB?7maQ_ zf9W{BV`)z_^;drtD$D+dM^SD;p2kFz0$y|h9m89>;zGNlzuL)OOVPfpqZLJMOK z%8~1r1Cr9MKib_~f5^A92cCaet6jBJYFXp(aY*$GH)0xbJd&x8_jrBOsx61#ko8@o zUvM&Fd9?wrig@&B9Ng?Ji!o;!S51Yoy906FU2){OS-JK!*Y8rT_35`lF*w|--ww3w zJl60+bG!3O!7rfSxol2kX1jXHoGNWX&M(Vry3Hn>M#n+M)K`# zecv&i-jf-%zGxQ#CTPU?|H`kYdc^Cij^cRz_4QXCuU?Or*8h#;mDxYjPAA(w>#sFe zz)Nd(tjj3#Gr5WGZeMvLVcQnFNL7tQStmCtH5vNb%l2zoO-6O=T)hhzvHfS_qn!<- z!zcgW0iV~~-YeISD#ht*+InPdY*3C;8uav|mBXGGRwzt>Y-;Oq3)ZwLr>nBs6lbVv$3-1f# z4S_@4#p?J)8*bX|X34j+^m|AXI)X0J|CsvJA2}?q&*5yo>iFOL@3>}%`0w=izc=>Z z)}{Pv#s8z-@2NkUSUtX{CO!Xf{VR`erT9O6PpHQ?vwh5pZeRC3p}%(aS$Vu&+EKZG zu0P&Zz5eL2=j4sGV&u6e(mgYwC&@bcp59&G05sxjIwe2 EFUMI0bN~PV diff --git a/scripts/developer/utilities/render/outline.qmlc b/scripts/developer/utilities/render/outline.qmlc deleted file mode 100644 index e85e72ad3c452e3c85bb7b199b398fba1350cbc5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13063 zcmeI1U2GiH6~})!AGSjRS(_yGt`oA91;STsAkaWju@k3WgAJ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}w)$ z$9wImS$Xb)hWpl?i}GACWw%XSJ+-RjrJCuxv%f6QAAO`MpFd^Cr@mc;9K47>(ebJ8 z);3eiqVGn0>W6{y@hv+(1AJE(p8>wN;`9Gr|LGuhJ^5W9xXb5{KHk`E&kk8;{|xx! zZ^Vn@bJ5=CtS*Co>+n;J^%m! From 31a23acb1a43a274f4889bf47ee8606c815834e2 Mon Sep 17 00:00:00 2001 From: vladest Date: Wed, 6 Sep 2017 23:04:58 +0200 Subject: [PATCH 29/48] Add flickable on mouse wheel to web pages --- interface/resources/qml/controls/FlickableWebViewCore.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interface/resources/qml/controls/FlickableWebViewCore.qml b/interface/resources/qml/controls/FlickableWebViewCore.qml index 0460b5b16a..13a435c4e5 100644 --- a/interface/resources/qml/controls/FlickableWebViewCore.qml +++ b/interface/resources/qml/controls/FlickableWebViewCore.qml @@ -19,6 +19,7 @@ Flickable { signal newViewRequestedCallback(var request) signal loadingChangedCallback(var loadRequest) + pressDelay: 300 boundsBehavior: Flickable.StopAtBounds @@ -167,4 +168,11 @@ Flickable { playing: visible z: 10000 } + + MouseArea { + anchors.fill: parent + onWheel: { + flick.flick(0, wheel.angleDelta.y*10) + } + } } From b9eb317d9b2f0f49e9d9de0a553c63fdf9e4616e Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 7 Sep 2017 10:33:55 +0200 Subject: [PATCH 30/48] Fixed non working outline in stereo with new changes --- libraries/render-utils/src/OutlineEffect.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index f7cb72b8ef..adbfed2775 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -119,6 +119,10 @@ void PrepareOutline::run(const render::RenderContextPointer& renderContext, cons // Restore previous frame buffer batch.setFramebuffer(deferredFrameBuffer->getDeferredFramebuffer()); + // Clear it + batch.clearFramebuffer( + gpu::Framebuffer::BUFFER_DEPTH, + vec4(vec3(1.0, 1.0, 1.0), 0.0), 1.0, 0, false); }); output = _outlineFramebuffer; @@ -324,10 +328,6 @@ void DrawOutlineDepth::run(const render::RenderContextPointer& renderContext, co batch.setProjectionTransform(projMat); batch.setViewTransform(viewMat); - batch.clearFramebuffer( - gpu::Framebuffer::BUFFER_DEPTH, - vec4(vec3(1.0, 1.0, 1.0), 0.0), 1.0, 0, true); - auto shadowPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder); auto shadowSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned()); From b43514fb8bfd2cc90c617f615adaf88fd7066dc2 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 7 Sep 2017 12:14:32 +0200 Subject: [PATCH 31/48] Modified outline shader to do fill branch on CPU. Fixed assymetric outline due to depth sample not offset by a half texel in shader. --- libraries/render-utils/src/Outline.slf | 87 +---------------- libraries/render-utils/src/Outline.slh | 95 +++++++++++++++++++ libraries/render-utils/src/OutlineEffect.cpp | 85 +++++++++-------- libraries/render-utils/src/OutlineEffect.h | 3 +- libraries/render-utils/src/Outline_filled.slf | 13 +++ 5 files changed, 162 insertions(+), 121 deletions(-) create mode 100644 libraries/render-utils/src/Outline.slh create mode 100644 libraries/render-utils/src/Outline_filled.slf diff --git a/libraries/render-utils/src/Outline.slf b/libraries/render-utils/src/Outline.slf index 1d3d21a3c7..68ef870cba 100644 --- a/libraries/render-utils/src/Outline.slf +++ b/libraries/render-utils/src/Outline.slf @@ -1,8 +1,7 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> -// +// Outline.slf // Add outline effect based on two zbuffers : one containing the total scene z and another -// with the z of only the objects to be outlined +// with the z of only the objects to be outlined. +// This is the version without the fill effect inside the silhouette. // // Created by Olivier Prat on 08/09/2017 // Copyright 2017 High Fidelity, Inc. @@ -10,81 +9,5 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -<@include DeferredTransform.slh@> -<$declareDeferredFrameTransform()$> - -<@include Outline_shared.slh@> - -uniform outlineParamsBuffer { - OutlineParameters params; -}; - -uniform sampler2D sceneDepthMap; -uniform sampler2D outlinedDepthMap; - -in vec2 varTexCoord0; -out vec4 outFragColor; - -const float FAR_Z = 1.0; -const float LINEAR_DEPTH_BIAS = 5e-3; -const float OPACITY_EPSILON = 5e-3; - -void main(void) { - float outlinedDepth = texture(outlinedDepthMap, varTexCoord0).x; - float intensity = 0.0; - - if (outlinedDepth < FAR_Z) { - // We're not on the far plane so we are on the outlined object, thus no outline to do! - - // But maybe we need to fill the interior - // TODO: this should be done as another shader with switch done on CPU - if (params._fillOpacityUnoccluded>OPACITY_EPSILON && params._fillOpacityUnoccluded>OPACITY_EPSILON) { - float sceneDepth = texture(sceneDepthMap, varTexCoord0).x; - // Transform to linear depth for better precision - outlinedDepth = -evalZeyeFromZdb(outlinedDepth); - sceneDepth = -evalZeyeFromZdb(sceneDepth); - - // Are we occluded? - if (sceneDepth < (outlinedDepth-LINEAR_DEPTH_BIAS)) { - intensity = params._fillOpacityOccluded; - } else { - intensity = params._fillOpacityUnoccluded; - } - } else { - discard; - } - } else { - float weight = 0.0; - vec2 deltaUv = params._size / params._blurKernelSize; - vec2 lineStartUv = varTexCoord0 - params._size / 2.0; - vec2 uv; - int x; - int y; - - for (y=0 ; y=0.0 && uv.y<=1.0) { - for (x=0 ; x=0.0 && uv.x<=1.0) - { - outlinedDepth = texture(outlinedDepthMap, uv).x; - intensity += (outlinedDepth < FAR_Z) ? 1.0 : 0.0; - weight += 1.f; - } - uv.x += deltaUv.x; - } - } - } - - intensity /= weight; - if (intensity < OPACITY_EPSILON) { - discard; - } - - intensity = min(1.0, intensity / params._threshold) * params._intensity; - } - - outFragColor = vec4(params._color.rgb, intensity); -} +<@include Outline.slh@> +<$main(0)$> diff --git a/libraries/render-utils/src/Outline.slh b/libraries/render-utils/src/Outline.slh new file mode 100644 index 0000000000..6e510581b4 --- /dev/null +++ b/libraries/render-utils/src/Outline.slh @@ -0,0 +1,95 @@ +<@include gpu/Config.slh@> +<$VERSION_HEADER$> + +<@include DeferredTransform.slh@> +<$declareDeferredFrameTransform()$> + +<@include Outline_shared.slh@> + +uniform outlineParamsBuffer { + OutlineParameters params; +}; + +uniform sampler2D sceneDepthMap; +uniform sampler2D outlinedDepthMap; + +in vec2 varTexCoord0; +out vec4 outFragColor; + +const float FAR_Z = 1.0; +const float LINEAR_DEPTH_BIAS = 5e-3; +const float OPACITY_EPSILON = 5e-3; + +<@func main(IS_FILLED)@> + +void main(void) { + float outlinedDepth = texture(outlinedDepthMap, varTexCoord0).x; + float intensity = 0.0; + + if (outlinedDepth < FAR_Z) { + // We're not on the far plane so we are on the outlined object, thus no outline to do! +<@if IS_FILLED@> + // But we need to fill the interior + float sceneDepth = texture(sceneDepthMap, varTexCoord0).x; + // Transform to linear depth for better precision + outlinedDepth = -evalZeyeFromZdb(outlinedDepth); + sceneDepth = -evalZeyeFromZdb(sceneDepth); + + // Are we occluded? + if (sceneDepth < (outlinedDepth-LINEAR_DEPTH_BIAS)) { + intensity = params._fillOpacityOccluded; + } else { + intensity = params._fillOpacityUnoccluded; + } +<@else@> + discard; +<@endif@> + } else { + float weight = 0.0; + vec2 deltaUv = params._size / params._blurKernelSize; + // We offset by half a texel to be centered on the depth sample. If we don't do this + // the blur will have a different width between the left / right sides and top / bottom + // sides of the silhouette + vec2 lineStartUv = varTexCoord0 + (getInvWidthHeight() - params._size) / 2.0; + vec2 uv; + int x; + int y; + + for (y=0 ; y=0.0 && uv.y<=1.0) { + for (x=0 ; x=0.0 && uv.x<=1.0) + { + outlinedDepth = texture(outlinedDepthMap, uv).x; + intensity += (outlinedDepth < FAR_Z) ? 1.0 : 0.0; + weight += 1.f; + } + uv.x += deltaUv.x; + } + } + } + + intensity /= weight; + if (intensity < OPACITY_EPSILON) { + discard; + } + + intensity = min(1.0, intensity / params._threshold) * params._intensity; + } + + outFragColor = vec4(params._color.rgb, intensity); +} + +<@endfunc@> diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index adbfed2775..289405b127 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -22,6 +22,7 @@ #include "debug_deferred_buffer_vert.h" #include "debug_deferred_buffer_frag.h" #include "Outline_frag.h" +#include "Outline_filled_frag.h" using namespace render; @@ -153,7 +154,6 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I const auto frameTransform = inputs.get0(); auto outlinedDepthBuffer = mainFrameBuffer->getPrimaryDepthTexture(); auto destinationFrameBuffer = inputs.get3(); - auto pipeline = getPipeline(); auto framebufferSize = glm::ivec2(outlinedDepthBuffer->getDimensions()); if (!_primaryWithoutDepthBuffer || framebufferSize!=_frameBufferSize) { @@ -164,6 +164,8 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I } if (sceneDepthBuffer) { + const auto OPACITY_EPSILON = 5e-3f; + auto pipeline = getPipeline(_fillOpacityUnoccluded>OPACITY_EPSILON || _fillOpacityOccluded>OPACITY_EPSILON); auto args = renderContext->args; { auto& configuration = _configuration.edit(); @@ -200,7 +202,7 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I } } -const gpu::PipelinePointer& DrawOutline::getPipeline() { +const gpu::PipelinePointer& DrawOutline::getPipeline(bool isFilled) { if (!_pipeline) { auto vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS(); auto ps = gpu::Shader::createPixel(std::string(Outline_frag)); @@ -217,8 +219,13 @@ const gpu::PipelinePointer& DrawOutline::getPipeline() { state->setDepthTest(gpu::State::DepthTest(false, false)); state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA); _pipeline = gpu::Pipeline::create(program, state); + + ps = gpu::Shader::createPixel(std::string(Outline_filled_frag)); + program = gpu::Shader::createProgram(vs, ps); + gpu::Shader::makeProgram(*program, slotBindings); + _pipelineFilled = gpu::Pipeline::create(program, state); } - return _pipeline; + return isFilled ? _pipelineFilled : _pipeline; } DebugOutline::DebugOutline() { @@ -310,51 +317,53 @@ void DrawOutlineDepth::run(const render::RenderContextPointer& renderContext, co assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); - RenderArgs* args = renderContext->args; - ShapeKey::Builder defaultKeyBuilder; + if (!inShapes.empty()) { + RenderArgs* args = renderContext->args; + ShapeKey::Builder defaultKeyBuilder; - gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { - args->_batch = &batch; + gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { + args->_batch = &batch; - // Setup camera, projection and viewport for all items - batch.setViewportTransform(args->_viewport); - batch.setStateScissorRect(args->_viewport); + // Setup camera, projection and viewport for all items + batch.setViewportTransform(args->_viewport); + batch.setStateScissorRect(args->_viewport); - glm::mat4 projMat; - Transform viewMat; - args->getViewFrustum().evalProjectionMatrix(projMat); - args->getViewFrustum().evalViewTransform(viewMat); + glm::mat4 projMat; + Transform viewMat; + args->getViewFrustum().evalProjectionMatrix(projMat); + args->getViewFrustum().evalViewTransform(viewMat); - batch.setProjectionTransform(projMat); - batch.setViewTransform(viewMat); + batch.setProjectionTransform(projMat); + batch.setViewTransform(viewMat); - auto shadowPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder); - auto shadowSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned()); + auto shadowPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder); + auto shadowSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned()); - std::vector skinnedShapeKeys{}; + std::vector skinnedShapeKeys{}; - // Iterate through all inShapes and render the unskinned - args->_shapePipeline = shadowPipeline; - batch.setPipeline(shadowPipeline->pipeline); - for (auto items : inShapes) { - if (items.first.isSkinned()) { - skinnedShapeKeys.push_back(items.first); + // Iterate through all inShapes and render the unskinned + args->_shapePipeline = shadowPipeline; + batch.setPipeline(shadowPipeline->pipeline); + for (auto items : inShapes) { + if (items.first.isSkinned()) { + skinnedShapeKeys.push_back(items.first); + } + else { + renderItems(renderContext, items.second); + } } - else { - renderItems(renderContext, items.second); + + // Reiterate to render the skinned + args->_shapePipeline = shadowSkinnedPipeline; + batch.setPipeline(shadowSkinnedPipeline->pipeline); + for (const auto& key : skinnedShapeKeys) { + renderItems(renderContext, inShapes.at(key)); } - } - // Reiterate to render the skinned - args->_shapePipeline = shadowSkinnedPipeline; - batch.setPipeline(shadowSkinnedPipeline->pipeline); - for (const auto& key : skinnedShapeKeys) { - renderItems(renderContext, inShapes.at(key)); - } - - args->_shapePipeline = nullptr; - args->_batch = nullptr; - }); + args->_shapePipeline = nullptr; + args->_batch = nullptr; + }); + } } DrawOutlineTask::DrawOutlineTask() { diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index 4cbfb5851c..7e7cf83d19 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -117,11 +117,12 @@ private: using OutlineConfigurationBuffer = gpu::StructBuffer; - const gpu::PipelinePointer& getPipeline(); + const gpu::PipelinePointer& getPipeline(bool isFilled); gpu::FramebufferPointer _primaryWithoutDepthBuffer; glm::ivec2 _frameBufferSize {0, 0}; gpu::PipelinePointer _pipeline; + gpu::PipelinePointer _pipelineFilled; OutlineConfigurationBuffer _configuration; glm::vec3 _color; float _size; diff --git a/libraries/render-utils/src/Outline_filled.slf b/libraries/render-utils/src/Outline_filled.slf new file mode 100644 index 0000000000..aaa3396bac --- /dev/null +++ b/libraries/render-utils/src/Outline_filled.slf @@ -0,0 +1,13 @@ +// Outline_filled.slf +// Add outline effect based on two zbuffers : one containing the total scene z and another +// with the z of only the objects to be outlined. +// This is the version with the fill effect inside the silhouette. +// +// Created by Olivier Prat on 09/07/2017 +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +<@include Outline.slh@> +<$main(1)$> From 2003495166c81366c8a60c9e196d42f8e160eba0 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 7 Sep 2017 12:30:20 +0200 Subject: [PATCH 32/48] Adjustments to half texel fix --- libraries/render-utils/src/Outline.slh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libraries/render-utils/src/Outline.slh b/libraries/render-utils/src/Outline.slh index 6e510581b4..ac56e4c95c 100644 --- a/libraries/render-utils/src/Outline.slh +++ b/libraries/render-utils/src/Outline.slh @@ -32,14 +32,19 @@ const float OPACITY_EPSILON = 5e-3; <@func main(IS_FILLED)@> void main(void) { - float outlinedDepth = texture(outlinedDepthMap, varTexCoord0).x; + // We offset by half a texel to be centered on the depth sample. If we don't do this + // the blur will have a different width between the left / right sides and top / bottom + // sides of the silhouette + vec2 halfTexel = getInvWidthHeight() / 2; + vec2 texCoord0 = varTexCoord0+halfTexel; + float outlinedDepth = texture(outlinedDepthMap, texCoord0).x; float intensity = 0.0; if (outlinedDepth < FAR_Z) { // We're not on the far plane so we are on the outlined object, thus no outline to do! <@if IS_FILLED@> // But we need to fill the interior - float sceneDepth = texture(sceneDepthMap, varTexCoord0).x; + float sceneDepth = texture(sceneDepthMap, texCoord0).x; // Transform to linear depth for better precision outlinedDepth = -evalZeyeFromZdb(outlinedDepth); sceneDepth = -evalZeyeFromZdb(sceneDepth); @@ -56,10 +61,7 @@ void main(void) { } else { float weight = 0.0; vec2 deltaUv = params._size / params._blurKernelSize; - // We offset by half a texel to be centered on the depth sample. If we don't do this - // the blur will have a different width between the left / right sides and top / bottom - // sides of the silhouette - vec2 lineStartUv = varTexCoord0 + (getInvWidthHeight() - params._size) / 2.0; + vec2 lineStartUv = texCoord0 - params._size / 2.0; vec2 uv; int x; int y; From 6b5ca0c6cee78567675ae60b0a416590fe8bc6f7 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 7 Sep 2017 18:33:00 +0200 Subject: [PATCH 33/48] Optimized by removing unnecessary Z buffer copy --- libraries/render-utils/src/OutlineEffect.cpp | 185 +++++++----------- libraries/render-utils/src/OutlineEffect.h | 37 ++-- .../render-utils/src/RenderDeferredTask.cpp | 2 + 3 files changed, 86 insertions(+), 138 deletions(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index 289405b127..dda371be80 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -18,6 +18,7 @@ #include "gpu/Context.h" #include "gpu/StandardShaderLib.h" + #include "surfaceGeometry_copyDepth_frag.h" #include "debug_deferred_buffer_vert.h" #include "debug_deferred_buffer_frag.h" @@ -31,11 +32,11 @@ extern void initZPassPipelines(ShapePlumber& plumber, gpu::StatePointer state); OutlineFramebuffer::OutlineFramebuffer() { } -void OutlineFramebuffer::update(const gpu::TexturePointer& linearDepthBuffer) { +void OutlineFramebuffer::update(const gpu::TexturePointer& colorBuffer) { // If the depth buffer or size changed, we need to delete our FBOs and recreate them at the // new correct dimensions. if (_depthTexture) { - auto newFrameSize = glm::ivec2(linearDepthBuffer->getDimensions()); + auto newFrameSize = glm::ivec2(colorBuffer->getDimensions()); if (_frameSize != newFrameSize) { _frameSize = newFrameSize; clear(); @@ -52,11 +53,11 @@ void OutlineFramebuffer::allocate() { auto width = _frameSize.x; auto height = _frameSize.y; - auto format = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::RED); - + auto format = gpu::Element(gpu::SCALAR, gpu::FLOAT, gpu::DEPTH); + _depthTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(format, width, height)); _depthFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("outlineDepth")); - _depthFramebuffer->setRenderBuffer(0, _depthTexture); + _depthFramebuffer->setDepthStencilBuffer(_depthTexture, format); } gpu::FramebufferPointer OutlineFramebuffer::getDepthFramebuffer() { @@ -73,57 +74,69 @@ gpu::TexturePointer OutlineFramebuffer::getDepthTexture() { return _depthTexture; } -void PrepareOutline::run(const render::RenderContextPointer& renderContext, const PrepareOutline::Inputs& inputs, PrepareOutline::Output& output) { - auto outlinedItems = inputs.get0(); +void DrawOutlineDepth::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& output) { + assert(renderContext->args); + assert(renderContext->args->hasViewFrustum()); + auto& inShapes = inputs.get0(); + auto& deferredFrameBuffer = inputs.get1(); - if (!outlinedItems.empty()) { - auto args = renderContext->args; - auto deferredFrameBuffer = inputs.get1(); + if (!inShapes.empty()) { auto frameSize = deferredFrameBuffer->getFrameSize(); + RenderArgs* args = renderContext->args; + ShapeKey::Builder defaultKeyBuilder; if (!_outlineFramebuffer) { _outlineFramebuffer = std::make_shared(); } - _outlineFramebuffer->update(deferredFrameBuffer->getPrimaryDepthTexture()); + _outlineFramebuffer->update(deferredFrameBuffer->getDeferredColorTexture()); - if (!_copyDepthPipeline) { - auto vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS(); - auto ps = gpu::Shader::createPixel(std::string(surfaceGeometry_copyDepth_frag)); - gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); - - gpu::Shader::BindingSet slotBindings; - slotBindings.insert(gpu::Shader::Binding(std::string("depthMap"), 0)); - gpu::Shader::makeProgram(*program, slotBindings); - - gpu::StatePointer state = gpu::StatePointer(new gpu::State()); - - state->setColorWriteMask(true, false, false, false); - - // Good to go add the brand new pipeline - _copyDepthPipeline = gpu::Pipeline::create(program, state); - } - - // TODO : Instead of copying entire buffer, we should only copy the sub rect containing the outlined object - // grown to take into account blur width gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { - batch.enableStereo(false); - - batch.setViewportTransform(args->_viewport); - batch.setProjectionTransform(glm::mat4()); - batch.resetViewTransform(); - batch.setModelTransform(gpu::Framebuffer::evalSubregionTexcoordTransform(frameSize, args->_viewport)); + args->_batch = &batch; batch.setFramebuffer(_outlineFramebuffer->getDepthFramebuffer()); - batch.setPipeline(_copyDepthPipeline); - batch.setResourceTexture(0, deferredFrameBuffer->getPrimaryDepthTexture()); - batch.draw(gpu::TRIANGLE_STRIP, 4); - - // Restore previous frame buffer - batch.setFramebuffer(deferredFrameBuffer->getDeferredFramebuffer()); // Clear it batch.clearFramebuffer( gpu::Framebuffer::BUFFER_DEPTH, vec4(vec3(1.0, 1.0, 1.0), 0.0), 1.0, 0, false); + + // Setup camera, projection and viewport for all items + batch.setViewportTransform(args->_viewport); + batch.setStateScissorRect(args->_viewport); + + glm::mat4 projMat; + Transform viewMat; + args->getViewFrustum().evalProjectionMatrix(projMat); + args->getViewFrustum().evalViewTransform(viewMat); + + batch.setProjectionTransform(projMat); + batch.setViewTransform(viewMat); + + auto shadowPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder); + auto shadowSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned()); + + std::vector skinnedShapeKeys{}; + + // Iterate through all inShapes and render the unskinned + args->_shapePipeline = shadowPipeline; + batch.setPipeline(shadowPipeline->pipeline); + for (auto items : inShapes) { + if (items.first.isSkinned()) { + skinnedShapeKeys.push_back(items.first); + } + else { + renderItems(renderContext, items.second); + } + } + + // Reiterate to render the skinned + args->_shapePipeline = shadowSkinnedPipeline; + batch.setPipeline(shadowSkinnedPipeline->pipeline); + for (const auto& key : skinnedShapeKeys) { + renderItems(renderContext, inShapes.at(key)); + } + + args->_shapePipeline = nullptr; + args->_batch = nullptr; }); output = _outlineFramebuffer; @@ -147,14 +160,14 @@ void DrawOutline::configure(const Config& config) { } void DrawOutline::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { - auto mainFrameBuffer = inputs.get1(); + auto outlineFrameBuffer = inputs.get1(); - if (mainFrameBuffer) { + if (outlineFrameBuffer) { auto sceneDepthBuffer = inputs.get2(); const auto frameTransform = inputs.get0(); - auto outlinedDepthBuffer = mainFrameBuffer->getPrimaryDepthTexture(); + auto outlinedDepthTexture = outlineFrameBuffer->getDepthTexture(); auto destinationFrameBuffer = inputs.get3(); - auto framebufferSize = glm::ivec2(outlinedDepthBuffer->getDimensions()); + auto framebufferSize = glm::ivec2(outlinedDepthTexture->getDimensions()); if (!_primaryWithoutDepthBuffer || framebufferSize!=_frameBufferSize) { // Failing to recreate this frame buffer when the screen has been resized creates a bug on Mac @@ -191,8 +204,8 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I batch.setUniformBuffer(OUTLINE_PARAMS_SLOT, _configuration); batch.setUniformBuffer(FRAME_TRANSFORM_SLOT, frameTransform->getFrameTransformBuffer()); - batch.setResourceTexture(SCENE_DEPTH_SLOT, sceneDepthBuffer->getDepthTexture()); - batch.setResourceTexture(OUTLINED_DEPTH_SLOT, outlinedDepthBuffer); + batch.setResourceTexture(SCENE_DEPTH_SLOT, sceneDepthBuffer->getPrimaryDepthTexture()); + batch.setResourceTexture(OUTLINED_DEPTH_SLOT, outlinedDepthTexture); batch.draw(gpu::TRIANGLE_STRIP, 4); // Restore previous frame buffer @@ -266,7 +279,7 @@ void DebugOutline::run(const render::RenderContextPointer& renderContext, const batch.setModelTransform(Transform()); batch.setPipeline(getDebugPipeline()); - batch.setResourceTexture(0, outlineFramebuffer->getPrimaryDepthTexture()); + batch.setResourceTexture(0, outlineFramebuffer->getDepthTexture()); const glm::vec4 color(1.0f, 0.5f, 0.2f, 1.0f); const glm::vec2 bottomLeft(-1.0f, -1.0f); @@ -313,59 +326,6 @@ const gpu::PipelinePointer& DebugOutline::getDebugPipeline() { return _debugPipeline; } -void DrawOutlineDepth::run(const render::RenderContextPointer& renderContext, const render::ShapeBounds& inShapes) { - assert(renderContext->args); - assert(renderContext->args->hasViewFrustum()); - - if (!inShapes.empty()) { - RenderArgs* args = renderContext->args; - ShapeKey::Builder defaultKeyBuilder; - - gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { - args->_batch = &batch; - - // Setup camera, projection and viewport for all items - batch.setViewportTransform(args->_viewport); - batch.setStateScissorRect(args->_viewport); - - glm::mat4 projMat; - Transform viewMat; - args->getViewFrustum().evalProjectionMatrix(projMat); - args->getViewFrustum().evalViewTransform(viewMat); - - batch.setProjectionTransform(projMat); - batch.setViewTransform(viewMat); - - auto shadowPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder); - auto shadowSkinnedPipeline = _shapePlumber->pickPipeline(args, defaultKeyBuilder.withSkinned()); - - std::vector skinnedShapeKeys{}; - - // Iterate through all inShapes and render the unskinned - args->_shapePipeline = shadowPipeline; - batch.setPipeline(shadowPipeline->pipeline); - for (auto items : inShapes) { - if (items.first.isSkinned()) { - skinnedShapeKeys.push_back(items.first); - } - else { - renderItems(renderContext, items.second); - } - } - - // Reiterate to render the skinned - args->_shapePipeline = shadowSkinnedPipeline; - batch.setPipeline(shadowSkinnedPipeline->pipeline); - for (const auto& key : skinnedShapeKeys) { - renderItems(renderContext, inShapes.at(key)); - } - - args->_shapePipeline = nullptr; - args->_batch = nullptr; - }); - } -} - DrawOutlineTask::DrawOutlineTask() { } @@ -378,7 +338,7 @@ void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, rende const auto input = inputs.get(); const auto selectedMetas = inputs.getN(0); const auto shapePlumber = input.get1(); - const auto outlinedFrameBuffer = inputs.getN(2); + const auto sceneFrameBuffer = inputs.getN(2); const auto primaryFramebuffer = inputs.getN(3); const auto deferredFrameTransform = inputs.getN(4); @@ -387,22 +347,21 @@ void DrawOutlineTask::build(JobModel& task, const render::Varying& inputs, rende { auto state = std::make_shared(); state->setDepthTest(true, true, gpu::LESS_EQUAL); - state->setColorWriteMask(0); + state->setColorWriteMask(false, false, false, false); initZPassPipelines(*shapePlumberZPass, state); } - const auto& outlinedItemIDs = task.addJob("OutlineMetaToSubItemIDs", selectedMetas); - const auto& outlinedItems = task.addJob("OutlineMetaToSubItems", outlinedItemIDs, true); - - // Retrieve z value of the scene objects - const auto outlinePrepareInputs = PrepareOutline::Inputs(outlinedItems, outlinedFrameBuffer).asVarying(); - const auto sceneFrameBuffer = task.addJob("OutlineCopyDepth", outlinePrepareInputs); + const auto outlinedItemIDs = task.addJob("OutlineMetaToSubItemIDs", selectedMetas); + const auto outlinedItems = task.addJob("OutlineMetaToSubItems", outlinedItemIDs, true); // Sort - const auto& sortedPipelines = task.addJob("OutlinePipelineSort", outlinedItems); - const auto& sortedShapes = task.addJob("OutlineDepthSort", sortedPipelines); - task.addJob("OutlineDepth", sortedShapes, shapePlumberZPass); + const auto sortedPipelines = task.addJob("OutlinePipelineSort", outlinedItems); + const auto sortedShapes = task.addJob("OutlineDepthSort", sortedPipelines); + + // Draw depth of outlined objects in separate buffer + const auto drawOutlineDepthInputs = DrawOutlineDepth::Inputs(sortedShapes, sceneFrameBuffer).asVarying(); + const auto outlinedFrameBuffer = task.addJob("OutlineDepth", drawOutlineDepthInputs, shapePlumberZPass); // Draw outline const auto drawOutlineInputs = DrawOutline::Inputs(deferredFrameTransform, outlinedFrameBuffer, sceneFrameBuffer, primaryFramebuffer).asVarying(); diff --git a/libraries/render-utils/src/OutlineEffect.h b/libraries/render-utils/src/OutlineEffect.h index 7e7cf83d19..36dc59f29e 100644 --- a/libraries/render-utils/src/OutlineEffect.h +++ b/libraries/render-utils/src/OutlineEffect.h @@ -24,7 +24,7 @@ public: gpu::TexturePointer getDepthTexture(); // Update the source framebuffer size which will drive the allocation of all the other resources. - void update(const gpu::TexturePointer& linearDepthBuffer); + void update(const gpu::TexturePointer& colorBuffer); const glm::ivec2& getSourceFrameSize() const { return _frameSize; } protected: @@ -40,23 +40,22 @@ protected: using OutlineFramebufferPointer = std::shared_ptr; -class PrepareOutline { - +class DrawOutlineDepth { public: - using Inputs = render::VaryingSet2; - // Output will contain outlined objects only z-depth texture and the input primary buffer but without the primary depth buffer - using Output = OutlineFramebufferPointer; - using JobModel = render::Job::ModelIO; + using Inputs = render::VaryingSet2; + // Output will contain outlined objects only z-depth texture and the input primary buffer but without the primary depth buffer + using Outputs = OutlineFramebufferPointer; + using JobModel = render::Job::ModelIO; - PrepareOutline() {} + DrawOutlineDepth(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {} - void run(const render::RenderContextPointer& renderContext, const PrepareOutline::Inputs& input, PrepareOutline::Output& output); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& output); -private: +protected: + render::ShapePlumberPointer _shapePlumber; OutlineFramebufferPointer _outlineFramebuffer; - gpu::PipelinePointer _copyDepthPipeline; }; class DrawOutlineConfig : public render::Job::Config { @@ -94,7 +93,7 @@ signals: class DrawOutline { public: - using Inputs = render::VaryingSet4; + using Inputs = render::VaryingSet4; using Config = DrawOutlineConfig; using JobModel = render::Job::ModelI; @@ -147,7 +146,7 @@ signals: class DebugOutline { public: - using Inputs = DeferredFramebufferPointer; + using Inputs = OutlineFramebufferPointer; using Config = DebugOutlineConfig; using JobModel = render::Job::ModelI; @@ -166,18 +165,6 @@ private: bool _isDisplayDepthEnabled{ false }; }; -class DrawOutlineDepth { -public: - using JobModel = render::Job::ModelI; - - DrawOutlineDepth(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {} - void run(const render::RenderContextPointer& renderContext, - const render::ShapeBounds& inShapes); - -protected: - render::ShapePlumberPointer _shapePlumber; -}; - class DrawOutlineTask { public: using Inputs = render::VaryingSet5; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index d396377969..b6e17b6fae 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -166,8 +166,10 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren const auto toneMappingInputs = ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer).asVarying(); task.addJob("ToneMapping", toneMappingInputs); + const auto outlineRangeTimer = task.addJob("BeginOutlineRangeTimer", "Outline"); const auto outlineInputs = DrawOutlineTask::Inputs(selectedMetas, shapePlumber, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying(); task.addJob("DrawOutline", outlineInputs); + task.addJob("EndOutlineRangeTimer", outlineRangeTimer); { // DEbug the bounds of the rendered items, still look at the zbuffer task.addJob("DrawMetaBounds", metas); From 7fb7ebca5728eda7e91853bcd2b0a85c4f8542a4 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 7 Sep 2017 19:03:22 +0200 Subject: [PATCH 34/48] Fixed warning on Mac --- libraries/render-utils/src/OutlineEffect.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/render-utils/src/OutlineEffect.cpp b/libraries/render-utils/src/OutlineEffect.cpp index dda371be80..d5b3b1c3bb 100644 --- a/libraries/render-utils/src/OutlineEffect.cpp +++ b/libraries/render-utils/src/OutlineEffect.cpp @@ -81,7 +81,6 @@ void DrawOutlineDepth::run(const render::RenderContextPointer& renderContext, co auto& deferredFrameBuffer = inputs.get1(); if (!inShapes.empty()) { - auto frameSize = deferredFrameBuffer->getFrameSize(); RenderArgs* args = renderContext->args; ShapeKey::Builder defaultKeyBuilder; From 37b184d9829962d5458386ff5b81669f0798bf8a Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Thu, 7 Sep 2017 14:32:50 -0700 Subject: [PATCH 35/48] Fix crashes in entity rendering on OSX --- .../RenderableParticleEffectEntityItem.cpp | 93 ++++++++++--------- .../src/RenderableParticleEffectEntityItem.h | 3 +- .../src/RenderableTextEntityItem.cpp | 5 +- .../src/RenderableTextEntityItem.h | 5 +- .../entities/src/ParticleEffectEntityItem.cpp | 15 ++- .../entities/src/ParticleEffectEntityItem.h | 4 +- 6 files changed, 70 insertions(+), 55 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp index 7349e9147e..3328076911 100644 --- a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.cpp @@ -91,20 +91,27 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi qCWarning(entitiesrenderer) << "Bad particle properties"; } } - if (_particleProperties != newParticleProperties) { + + if (resultWithReadLock([&]{ return _particleProperties != newParticleProperties; })) { _timeUntilNextEmit = 0; - _particleProperties = newParticleProperties; + withWriteLock([&]{ + _particleProperties = newParticleProperties; + }); } _emitting = entity->getIsEmitting(); - if (_particleProperties.textures.isEmpty()) { + bool hasTexture = resultWithReadLock([&]{ return _particleProperties.textures.isEmpty(); }); + if (hasTexture) { if (_networkTexture) { withWriteLock([&] { _networkTexture.reset(); }); } } else { - if (!_networkTexture || _networkTexture->getURL() != QUrl(_particleProperties.textures)) { + bool textureNeedsUpdate = resultWithReadLock([&]{ + return !_networkTexture || _networkTexture->getURL() != QUrl(_particleProperties.textures); + }); + if (textureNeedsUpdate) { withWriteLock([&] { _networkTexture = DependencyManager::get()->getTexture(_particleProperties.textures); }); @@ -115,15 +122,17 @@ void ParticleEffectEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePoi void ParticleEffectEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) { // Fill in Uniforms structure ParticleUniforms particleUniforms; - particleUniforms.radius.start = _particleProperties.radius.range.start; - particleUniforms.radius.middle = _particleProperties.radius.gradient.target; - particleUniforms.radius.finish = _particleProperties.radius.range.finish; - particleUniforms.radius.spread = _particleProperties.radius.gradient.spread; - particleUniforms.color.start = _particleProperties.getColorStart(); - particleUniforms.color.middle = _particleProperties.getColorMiddle(); - particleUniforms.color.finish = _particleProperties.getColorFinish(); - particleUniforms.color.spread = _particleProperties.getColorSpread(); - particleUniforms.lifespan = _particleProperties.lifespan; + withReadLock([&]{ + particleUniforms.radius.start = _particleProperties.radius.range.start; + particleUniforms.radius.middle = _particleProperties.radius.gradient.target; + particleUniforms.radius.finish = _particleProperties.radius.range.finish; + particleUniforms.radius.spread = _particleProperties.radius.gradient.spread; + particleUniforms.color.start = _particleProperties.getColorStart(); + particleUniforms.color.middle = _particleProperties.getColorMiddle(); + particleUniforms.color.finish = _particleProperties.getColorFinish(); + particleUniforms.color.spread = _particleProperties.getColorSpread(); + particleUniforms.lifespan = _particleProperties.lifespan; + }); // Update particle uniforms memcpy(&_uniformBuffer.edit(), &particleUniforms, sizeof(ParticleUniforms)); } @@ -146,35 +155,26 @@ Item::Bound ParticleEffectEntityRenderer::getBound() { static const size_t VERTEX_PER_PARTICLE = 4; -bool ParticleEffectEntityRenderer::emitting() const { - return ( - _emitting && - _particleProperties.emission.rate > 0.0f && - _particleProperties.lifespan > 0.0f && - _particleProperties.polar.start <= _particleProperties.polar.finish - ); -} - -void ParticleEffectEntityRenderer::createParticle(uint64_t now) { +ParticleEffectEntityRenderer::CpuParticle ParticleEffectEntityRenderer::createParticle(uint64_t now, const Transform& baseTransform, const particle::Properties& particleProperties) { CpuParticle particle; - const auto& accelerationSpread = _particleProperties.emission.acceleration.spread; - const auto& azimuthStart = _particleProperties.azimuth.start; - const auto& azimuthFinish = _particleProperties.azimuth.finish; - const auto& emitDimensions = _particleProperties.emission.dimensions; - const auto& emitAcceleration = _particleProperties.emission.acceleration.target; - auto emitOrientation = _particleProperties.emission.orientation; - const auto& emitRadiusStart = glm::max(_particleProperties.radiusStart, EPSILON); // Avoid math complications at center - const auto& emitSpeed = _particleProperties.emission.speed.target; - const auto& speedSpread = _particleProperties.emission.speed.spread; - const auto& polarStart = _particleProperties.polar.start; - const auto& polarFinish = _particleProperties.polar.finish; + const auto& accelerationSpread = particleProperties.emission.acceleration.spread; + const auto& azimuthStart = particleProperties.azimuth.start; + const auto& azimuthFinish = particleProperties.azimuth.finish; + const auto& emitDimensions = particleProperties.emission.dimensions; + const auto& emitAcceleration = particleProperties.emission.acceleration.target; + auto emitOrientation = particleProperties.emission.orientation; + const auto& emitRadiusStart = glm::max(particleProperties.radiusStart, EPSILON); // Avoid math complications at center + const auto& emitSpeed = particleProperties.emission.speed.target; + const auto& speedSpread = particleProperties.emission.speed.spread; + const auto& polarStart = particleProperties.polar.start; + const auto& polarFinish = particleProperties.polar.finish; particle.seed = randFloatInRange(-1.0f, 1.0f); - particle.expiration = now + (uint64_t)(_particleProperties.lifespan * USECS_PER_SECOND); - if (_particleProperties.emission.shouldTrail) { - particle.position = _modelTransform.getTranslation(); - emitOrientation = _modelTransform.getRotation() * emitOrientation; + particle.expiration = now + (uint64_t)(particleProperties.lifespan * USECS_PER_SECOND); + if (particleProperties.emission.shouldTrail) { + particle.position = baseTransform.getTranslation(); + emitOrientation = baseTransform.getRotation() * emitOrientation; } // Position, velocity, and acceleration @@ -232,7 +232,7 @@ void ParticleEffectEntityRenderer::createParticle(uint64_t now) { particle.acceleration = emitAcceleration + randFloatInRange(-1.0f, 1.0f) * accelerationSpread; } - _cpuParticles.push_back(particle); + return particle; } void ParticleEffectEntityRenderer::stepSimulation() { @@ -244,14 +244,19 @@ void ParticleEffectEntityRenderer::stepSimulation() { const auto now = usecTimestampNow(); const auto interval = std::min(USECS_PER_SECOND / 60, now - _lastSimulated); _lastSimulated = now; + + particle::Properties particleProperties; + withReadLock([&]{ + particleProperties = _particleProperties; + }); - if (emitting()) { - uint64_t emitInterval = (uint64_t)(USECS_PER_SECOND / _particleProperties.emission.rate); - if (interval >= _timeUntilNextEmit) { + if (_emitting && particleProperties.emitting()) { + uint64_t emitInterval = particleProperties.emitIntervalUsecs(); + if (emitInterval > 0 && interval >= _timeUntilNextEmit) { auto timeRemaining = interval; while (timeRemaining > _timeUntilNextEmit) { // emit particle - createParticle(now); + _cpuParticles.push_back(createParticle(now, _modelTransform, particleProperties)); _timeUntilNextEmit = emitInterval; if (emitInterval < timeRemaining) { timeRemaining -= emitInterval; @@ -263,7 +268,7 @@ void ParticleEffectEntityRenderer::stepSimulation() { } // Kill any particles that have expired or are over the max size - while (_cpuParticles.size() > _particleProperties.maxParticles || (!_cpuParticles.empty() && _cpuParticles.front().expiration <= now)) { + while (_cpuParticles.size() > particleProperties.maxParticles || (!_cpuParticles.empty() && _cpuParticles.front().expiration <= now)) { _cpuParticles.pop_front(); } diff --git a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h index e4c1d4be13..be2641c0c9 100644 --- a/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h +++ b/libraries/entities-renderer/src/RenderableParticleEffectEntityItem.h @@ -93,9 +93,8 @@ private: }; - void createParticle(uint64_t now); + static CpuParticle createParticle(uint64_t now, const Transform& baseTransform, const particle::Properties& particleProperties); void stepSimulation(); - bool emitting() const; particle::Properties _particleProperties; CpuParticles _cpuParticles; diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp index d39139257b..8757bcbb0f 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp @@ -30,14 +30,11 @@ TextEntityRenderer::TextEntityRenderer(const EntityItemPointer& entity) : } - -void TextEntityRenderer::onRemoveFromSceneTyped(const TypedEntityPointer& entity) { +TextEntityRenderer::~TextEntityRenderer() { auto geometryCache = DependencyManager::get(); if (_geometryID && geometryCache) { geometryCache->releaseID(_geometryID); } - delete _textRenderer; - _textRenderer = nullptr; } bool TextEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const { diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.h b/libraries/entities-renderer/src/RenderableTextEntityItem.h index 1d8227069e..b0a72cf253 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.h +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.h @@ -24,14 +24,13 @@ class TextEntityRenderer : public TypedEntityRenderer { using Pointer = std::shared_ptr; public: TextEntityRenderer(const EntityItemPointer& entity); - + ~TextEntityRenderer(); private: - virtual void onRemoveFromSceneTyped(const TypedEntityPointer& entity) override; virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override; virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override; virtual void doRender(RenderArgs* args) override; int _geometryID{ 0 }; - TextRenderer3D* _textRenderer; + std::shared_ptr _textRenderer; bool _faceCamera; glm::vec3 _dimensions; glm::vec3 _textColor; diff --git a/libraries/entities/src/ParticleEffectEntityItem.cpp b/libraries/entities/src/ParticleEffectEntityItem.cpp index bc6830e1a7..9bbf4323da 100644 --- a/libraries/entities/src/ParticleEffectEntityItem.cpp +++ b/libraries/entities/src/ParticleEffectEntityItem.cpp @@ -104,7 +104,7 @@ bool operator!=(const Properties& a, const Properties& b) { return !(a == b); } -bool particle::Properties::valid() const { +bool Properties::valid() const { if (glm::any(glm::isnan(emission.orientation))) { qCWarning(entities) << "Bad particle data"; return false; @@ -133,6 +133,19 @@ bool particle::Properties::valid() const { (radius.gradient.spread == glm::clamp(radius.gradient.spread, MINIMUM_PARTICLE_RADIUS, MAXIMUM_PARTICLE_RADIUS)); } +bool Properties::emitting() const { + return emission.rate > 0.0f && lifespan > 0.0f && polar.start <= polar.finish; + +} + +uint64_t Properties::emitIntervalUsecs() const { + if (emission.rate > 0.0f) { + return (uint64_t)(USECS_PER_SECOND / emission.rate); + } + return 0; +} + + EntityItemPointer ParticleEffectEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { EntityItemPointer entity { new ParticleEffectEntityItem(entityID) }; entity->setProperties(properties); diff --git a/libraries/entities/src/ParticleEffectEntityItem.h b/libraries/entities/src/ParticleEffectEntityItem.h index 6a3791f77e..9c0fd0ef95 100644 --- a/libraries/entities/src/ParticleEffectEntityItem.h +++ b/libraries/entities/src/ParticleEffectEntityItem.h @@ -160,7 +160,9 @@ namespace particle { Properties() {}; Properties(const Properties& other) { *this = other; } bool valid() const; - + bool emitting() const; + uint64_t emitIntervalUsecs() const; + Properties& operator =(const Properties& other) { color = other.color; alpha = other.alpha; From eb8b892571df62edcdfe44ff4e8c8a31ca9a5ef5 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Thu, 7 Sep 2017 14:45:35 -0700 Subject: [PATCH 36/48] Various Mac fixes --- interface/src/main.cpp | 23 ++++++++++++++----- .../src/EntityTreeRenderer.cpp | 7 +++++- libraries/gl/src/gl/GLHelpers.cpp | 7 ++++-- libraries/gpu-gl/src/gpu/gl/GLTexture.cpp | 12 ++++++---- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 11 +++++---- 5 files changed, 41 insertions(+), 19 deletions(-) diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 503daa177d..cb90160cfe 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -144,25 +144,33 @@ int main(int argc, const char* argv[]) { #endif } + + // FIXME this method of checking the OpenGL version screws up the `QOpenGLContext::globalShareContext()` value, which in turn + // leads to crashes when creating the real OpenGL instance. Disabling for now until we come up with a better way of checking + // the GL version on the system without resorting to creating a full Qt application +#if 0 // Check OpenGL version. // This is done separately from the main Application so that start-up and shut-down logic within the main Application is // not made more complicated than it already is. - bool override = false; + bool overrideGLCheck = false; + QJsonObject glData; { OpenGLVersionChecker openGLVersionChecker(argc, const_cast(argv)); bool valid = true; - glData = openGLVersionChecker.checkVersion(valid, override); + glData = openGLVersionChecker.checkVersion(valid, overrideGLCheck); if (!valid) { - if (override) { + if (overrideGLCheck) { auto glVersion = glData["version"].toString(); - qCDebug(interfaceapp, "Running on insufficient OpenGL version: %s.", glVersion.toStdString().c_str()); + qCWarning(interfaceapp, "Running on insufficient OpenGL version: %s.", glVersion.toStdString().c_str()); } else { - qCDebug(interfaceapp, "Early exit due to OpenGL version."); + qCWarning(interfaceapp, "Early exit due to OpenGL version."); return 0; } } } +#endif + // Debug option to demonstrate that the client's local time does not // need to be in sync with any other network node. This forces clock @@ -223,8 +231,9 @@ int main(int argc, const char* argv[]) { Application app(argcExtended, const_cast(argvExtended.data()), startupTime, runningMarkerExisted); +#if 0 // If we failed the OpenGLVersion check, log it. - if (override) { + if (overrideGLcheck) { auto accountManager = DependencyManager::get(); if (accountManager->isLoggedIn()) { UserActivityLogger::getInstance().insufficientGLVersion(glData); @@ -238,6 +247,8 @@ int main(int argc, const char* argv[]) { }); } } +#endif + // Setup local server QLocalServer server { &app }; diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 9f4a9a3c4a..d754d59721 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -91,7 +91,12 @@ void entitiesScriptEngineDeleter(ScriptEngine* engine) { }; // Wait for the scripting thread from the thread pool to avoid hanging the main thread - QThreadPool::globalInstance()->start(new WaitRunnable(engine)); + auto threadPool = QThreadPool::globalInstance(); + if (threadPool) { + threadPool->start(new WaitRunnable(engine)); + } else { + delete engine; + } } void EntityTreeRenderer::resetEntitiesScriptEngine() { diff --git a/libraries/gl/src/gl/GLHelpers.cpp b/libraries/gl/src/gl/GLHelpers.cpp index ab91ca0902..28982703dd 100644 --- a/libraries/gl/src/gl/GLHelpers.cpp +++ b/libraries/gl/src/gl/GLHelpers.cpp @@ -40,8 +40,11 @@ const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() { int glVersionToInteger(QString glVersion) { QStringList versionParts = glVersion.split(QRegularExpression("[\\.\\s]")); - int majorNumber = versionParts[0].toInt(); - int minorNumber = versionParts[1].toInt(); + int majorNumber = 0, minorNumber = 0; + if (versionParts.size() >= 2) { + majorNumber = versionParts[0].toInt(); + minorNumber = versionParts[1].toInt(); + } return (majorNumber << 16) | minorNumber; } diff --git a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp index 7758ddaf49..943b8148ef 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp @@ -467,12 +467,14 @@ void GLVariableAllocationSupport::updateMemoryPressure() { _demoteQueue = WorkQueue(); // Populate the existing textures into the queue - for (const auto& texture : strongTextures) { - // Race conditions can still leave nulls in the list, so we need to check - if (!texture) { - continue; + if (_memoryPressureState != MemoryPressureState::Idle) { + for (const auto& texture : strongTextures) { + // Race conditions can still leave nulls in the list, so we need to check + if (!texture) { + continue; + } + addToWorkQueue(texture); } - addToWorkQueue(texture); } } } diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index 84466f41b0..11790041db 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -528,6 +528,12 @@ void OffscreenQmlSurface::create() { connect(_quickWindow, &QQuickWindow::focusObjectChanged, this, &OffscreenQmlSurface::onFocusObjectChanged); + // acquireEngine interrogates the GL context, so we need to have the context current here + if (!_canvas->makeCurrent()) { + qFatal("Failed to make context current for QML Renderer"); + return; + } + // Create a QML engine. auto qmlEngine = acquireEngine(_quickWindow); @@ -540,11 +546,6 @@ void OffscreenQmlSurface::create() { // FIXME Compatibility mechanism for existing HTML and JS that uses eventBridgeWrapper // Find a way to flag older scripts using this mechanism and wanr that this is deprecated _qmlContext->setContextProperty("eventBridgeWrapper", new EventBridgeWrapper(this, _qmlContext)); - - if (!_canvas->makeCurrent()) { - qWarning("Failed to make context current for QML Renderer"); - return; - } _renderControl->initialize(_canvas->getContext()); // When Quick says there is a need to render, we will not render immediately. Instead, From d6d36cbd43802776946375406eaa8f0a15fb7f0c Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Fri, 8 Sep 2017 11:14:06 +0200 Subject: [PATCH 37/48] Outline working on voxels --- libraries/render-utils/src/RenderDeferredTask.cpp | 12 +++++++++--- libraries/render/src/render/FilterTask.cpp | 13 ++++++++++--- libraries/render/src/render/FilterTask.h | 9 +++++---- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index b6e17b6fae..c67a1c7875 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -95,7 +95,13 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("PrepareStencil", primaryFramebuffer); // Select items that need to be outlined - const auto selectedMetas = task.addJob("PassTestSelection", metas, "contextOverlayHighlightList"); + const auto selectionName = "contextOverlayHighlightList"; + const auto selectMetaInput = SelectItems::Inputs(metas, Varying()).asVarying(); + const auto selectedMetas = task.addJob("PassTestMetaSelection", selectMetaInput, selectionName); + const auto selectMetaAndOpaqueInput = SelectItems::Inputs(opaques, selectedMetas).asVarying(); + const auto selectedMetasAndOpaques = task.addJob("PassTestOpaqueSelection", selectMetaAndOpaqueInput, selectionName); + const auto selectItemInput = SelectItems::Inputs(transparents, selectedMetasAndOpaques).asVarying(); + const auto selectedItems = task.addJob("PassTestTransparentSelection", selectItemInput, selectionName); // Render opaque objects in DeferredBuffer const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).asVarying(); @@ -167,7 +173,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("ToneMapping", toneMappingInputs); const auto outlineRangeTimer = task.addJob("BeginOutlineRangeTimer", "Outline"); - const auto outlineInputs = DrawOutlineTask::Inputs(selectedMetas, shapePlumber, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying(); + const auto outlineInputs = DrawOutlineTask::Inputs(selectedItems, shapePlumber, deferredFramebuffer, primaryFramebuffer, deferredFrameTransform).asVarying(); task.addJob("DrawOutline", outlineInputs); task.addJob("EndOutlineRangeTimer", outlineRangeTimer); @@ -221,7 +227,7 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("DrawZoneStack", deferredFrameTransform); // Render.getConfig("RenderMainView.DrawSelectionBounds").enabled = true - task.addJob("DrawSelectionBounds", selectedMetas); + task.addJob("DrawSelectionBounds", selectedItems); } // AA job to be revisited diff --git a/libraries/render/src/render/FilterTask.cpp b/libraries/render/src/render/FilterTask.cpp index 39bc19adc7..e0298c2a44 100644 --- a/libraries/render/src/render/FilterTask.cpp +++ b/libraries/render/src/render/FilterTask.cpp @@ -51,13 +51,20 @@ void SliceItems::run(const RenderContextPointer& renderContext, const ItemBounds } -void SelectItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { +void SelectItems::run(const RenderContextPointer& renderContext, const Inputs& inputs, ItemBounds& outItems) { auto selection = renderContext->_scene->getSelection(_name); const auto& selectedItems = selection.getItems(); - outItems.clear(); + const auto& inItems = inputs.get0(); + const auto itemsToAppend = inputs[1]; + + if (itemsToAppend.isNull()) { + outItems.clear(); + } else { + outItems = itemsToAppend.get(); + } if (!selectedItems.empty()) { - outItems.reserve(selectedItems.size()); + outItems.reserve(outItems.size()+selectedItems.size()); for (auto src : inItems) { if (selection.contains(src.id)) { diff --git a/libraries/render/src/render/FilterTask.h b/libraries/render/src/render/FilterTask.h index 2f8b53722f..1e023a8bb9 100644 --- a/libraries/render/src/render/FilterTask.h +++ b/libraries/render/src/render/FilterTask.h @@ -113,22 +113,23 @@ namespace render { // Keep items belonging to the job selection class SelectItems { public: - using JobModel = Job::ModelIO; + using Inputs = VaryingSet2; + using JobModel = Job::ModelIO; std::string _name; SelectItems(const Selection::Name& name) : _name(name) {} - void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); + void run(const RenderContextPointer& renderContext, const Inputs& inputs, ItemBounds& outItems); }; // Same as SelectItems but reorder the output to match the selection order class SelectSortItems { public: using JobModel = Job::ModelIO; - + std::string _name; SelectSortItems(const Selection::Name& name) : _name(name) {} - + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); }; From 48b6586d01f5f4eb27af3ad04b6ff80d2ab43e8d Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Fri, 8 Sep 2017 11:36:32 -0700 Subject: [PATCH 38/48] Modifying SDL initialization due to crash on OSX --- plugins/hifiSdl2/src/SDL2Manager.cpp | 98 +++++++++++++++------------- 1 file changed, 54 insertions(+), 44 deletions(-) diff --git a/plugins/hifiSdl2/src/SDL2Manager.cpp b/plugins/hifiSdl2/src/SDL2Manager.cpp index 021cb4dfec..a5376af24e 100644 --- a/plugins/hifiSdl2/src/SDL2Manager.cpp +++ b/plugins/hifiSdl2/src/SDL2Manager.cpp @@ -54,49 +54,6 @@ SDL_JoystickID SDL2Manager::getInstanceId(SDL_GameController* controller) { } void SDL2Manager::init() { - loadSettings(); - - auto preferences = DependencyManager::get(); - static const QString SDL2_PLUGIN { "Game Controller" }; - { - auto getter = [this]()->bool { return _isEnabled; }; - auto setter = [this](bool value) { - _isEnabled = value; - saveSettings(); - }; - auto preference = new CheckPreference(SDL2_PLUGIN, "Enabled", getter, setter); - preferences->addPreference(preference); - } - - bool initSuccess = (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) == 0); - - if (initSuccess) { - int joystickCount = SDL_NumJoysticks(); - - for (int i = 0; i < joystickCount; i++) { - SDL_GameController* controller = SDL_GameControllerOpen(i); - - if (controller) { - SDL_JoystickID id = getInstanceId(controller); - if (!_openJoysticks.contains(id)) { - //Joystick* joystick = new Joystick(id, SDL_GameControllerName(controller), controller); - Joystick::Pointer joystick = std::make_shared(id, controller); - _openJoysticks[id] = joystick; - auto userInputMapper = DependencyManager::get(); - userInputMapper->registerDevice(joystick); - auto name = SDL_GameControllerName(controller); - _subdeviceNames << name; - emit joystickAdded(joystick.get()); - emit subdeviceConnected(getName(), name); - } - } - } - - _isInitialized = true; - } - else { - qDebug() << "Error initializing SDL2 Manager"; - } } QStringList SDL2Manager::getSubdeviceNames() { @@ -110,8 +67,61 @@ void SDL2Manager::deinit() { } bool SDL2Manager::activate() { + + // FIXME for some reason calling this code in the `init` function triggers a crash + // on OSX in PR builds, but not on my local debug build. Attempting a workaround by + // + static std::once_flag once; + std::call_once(once, [&]{ + loadSettings(); + + auto preferences = DependencyManager::get(); + static const QString SDL2_PLUGIN { "Game Controller" }; + { + auto getter = [this]()->bool { return _isEnabled; }; + auto setter = [this](bool value) { + _isEnabled = value; + saveSettings(); + }; + auto preference = new CheckPreference(SDL2_PLUGIN, "Enabled", getter, setter); + preferences->addPreference(preference); + } + + bool initSuccess = (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) == 0); + + if (initSuccess) { + int joystickCount = SDL_NumJoysticks(); + + for (int i = 0; i < joystickCount; i++) { + SDL_GameController* controller = SDL_GameControllerOpen(i); + + if (controller) { + SDL_JoystickID id = getInstanceId(controller); + if (!_openJoysticks.contains(id)) { + //Joystick* joystick = new Joystick(id, SDL_GameControllerName(controller), controller); + Joystick::Pointer joystick = std::make_shared(id, controller); + _openJoysticks[id] = joystick; + auto userInputMapper = DependencyManager::get(); + userInputMapper->registerDevice(joystick); + auto name = SDL_GameControllerName(controller); + _subdeviceNames << name; + emit joystickAdded(joystick.get()); + emit subdeviceConnected(getName(), name); + } + } + } + + _isInitialized = true; + } else { + qDebug() << "Error initializing SDL2 Manager"; + } + }); + + if (!_isInitialized) { + return false; + } + InputPlugin::activate(); - auto userInputMapper = DependencyManager::get(); for (auto joystick : _openJoysticks) { userInputMapper->registerDevice(joystick); From 559ac6786d14b3c406d6baa17bf86b79b795ca78 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Fri, 8 Sep 2017 11:44:06 -0700 Subject: [PATCH 39/48] Fix MyAvatar getting stuck in T-pose on loading Before this change, there was a race condition between the main thread calling Model::initWhenReady, and the render thread calling Avatar::fixupModelsInScene(). They both would end up setting the Model::_addedToScene flag. This race caused Model::initWhenReady() to never return true, which resulted in the MyAvatar class never initializing the animation system. --- libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 7f4ebf39e1..bc6bb2a0ec 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -648,7 +648,9 @@ void Avatar::render(RenderArgs* renderArgs) { return; } - fixupModelsInScene(renderArgs->_scene); + if (!isMyAvatar()) { + fixupModelsInScene(renderArgs->_scene); + } if (showCollisionShapes && shouldRenderHead(renderArgs) && _skeletonModel->isRenderable()) { PROFILE_RANGE_BATCH(batch, __FUNCTION__":skeletonBoundingCollisionShapes"); From 3e0b222ec45d10c21912ac9cf9d661924c8d97fd Mon Sep 17 00:00:00 2001 From: David Kelly Date: Fri, 8 Sep 2017 11:44:19 -0700 Subject: [PATCH 40/48] fix wallet for new openssl --- interface/src/commerce/Wallet.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index 2faa08064d..0ee53f7769 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -31,6 +31,11 @@ #include #include +// I know, right? But per https://www.openssl.org/docs/faq.html +// this avoids OPENSSL_Uplink(00007FF847238000,08): no OPENSSL_Applink +// at runtime. +#include + static const char* KEY_FILE = "hifikey"; static const char* IMAGE_FILE = "hifi_image"; // eventually this will live in keyfile From c1422159350e7359cdddc79f791a5e462d549e0f Mon Sep 17 00:00:00 2001 From: David Kelly Date: Fri, 8 Sep 2017 12:52:12 -0700 Subject: [PATCH 41/48] oops -- this is a windows-only thing (like so many other problems) --- interface/src/commerce/Wallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index 0ee53f7769..a0664f4f9b 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -34,7 +34,9 @@ // I know, right? But per https://www.openssl.org/docs/faq.html // this avoids OPENSSL_Uplink(00007FF847238000,08): no OPENSSL_Applink // at runtime. +#ifdef Q_OS_WIN #include +#endif static const char* KEY_FILE = "hifikey"; static const char* IMAGE_FILE = "hifi_image"; // eventually this will live in keyfile From 99cdbbe306aab40c67a992fd330e67d54fc63d4f Mon Sep 17 00:00:00 2001 From: David Kelly Date: Fri, 8 Sep 2017 14:00:09 -0700 Subject: [PATCH 42/48] and lets fix the purchases flow too --- .../qml/hifi/commerce/purchases/Purchases.qml | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index 383223a49c..d95738fc08 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -35,12 +35,20 @@ Rectangle { Hifi.QmlCommerce { id: commerce; + onAccountResult: { + if(result.status === "success") { + commerce.getKeyFilePathIfExists(); + } else { + // unsure how to handle a failure here. We definitely cannot proceed. + } + } + onLoginStatusResult: { if (!isLoggedIn && root.activeView !== "needsLogIn") { root.activeView = "needsLogIn"; } else if (isLoggedIn) { root.activeView = "initialize"; - commerce.getKeyFilePathIfExists(); + commerce.account(); } } @@ -174,7 +182,7 @@ Rectangle { commerce.getLoginStatus(); } } - + HifiWallet.NeedsLogIn { id: needsLogIn; visible: root.activeView === "needsLogIn"; @@ -210,7 +218,7 @@ Rectangle { } } } - + // // "WALLET NOT SET UP" START // @@ -221,7 +229,7 @@ Rectangle { anchors.bottom: parent.bottom; anchors.left: parent.left; anchors.right: parent.right; - + RalewayRegular { id: notSetUpText; text: "Your wallet isn't set up.

Set up your Wallet (no credit card necessary) to claim your free HFC " + @@ -252,7 +260,7 @@ Rectangle { anchors.left: parent.left; anchors.bottom: parent.bottom; anchors.bottomMargin: 24; - + // "Cancel" button HifiControlsUit.Button { id: cancelButton; @@ -309,7 +317,7 @@ Rectangle { anchors.topMargin: 8; anchors.bottom: actionButtonsContainer.top; anchors.bottomMargin: 8; - + // // FILTER BAR START // @@ -383,7 +391,7 @@ Rectangle { itemHref: root_file_url; anchors.topMargin: 12; anchors.bottomMargin: 12; - + Connections { onSendToPurchases: { if (msg.method === 'purchases_itemInfoClicked') { @@ -402,7 +410,7 @@ Rectangle { anchors.left: parent.left; anchors.bottom: parent.bottom; width: parent.width; - + // Explanitory text RalewayRegular { id: haventPurchasedYet; From 967d3f69d3dfa7ff54faedf358f761bc75eb33f2 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 8 Sep 2017 14:13:58 -0700 Subject: [PATCH 43/48] suppress repeated 'item could not be rendered' messages --- libraries/render/src/render/DrawTask.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libraries/render/src/render/DrawTask.cpp b/libraries/render/src/render/DrawTask.cpp index 8372231597..710507bd79 100755 --- a/libraries/render/src/render/DrawTask.cpp +++ b/libraries/render/src/render/DrawTask.cpp @@ -9,6 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include + #include "DrawTask.h" #include "Logging.h" @@ -48,12 +50,14 @@ void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, cons if (args->_shapePipeline) { args->_shapePipeline->prepareShapeItem(args, key, item); item.render(args); - } + } args->_shapePipeline = nullptr; } else if (key.hasOwnPipeline()) { item.render(args); } else { qCDebug(renderlogging) << "Item could not be rendered with invalid key" << key; + static QString repeatedCouldNotBeRendered = LogHandler::getInstance().addRepeatedMessageRegex( + "Item could not be rendered with invalid key.*"); } args->_itemShapeKey = 0; } @@ -62,7 +66,7 @@ void render::renderShapes(const RenderContextPointer& renderContext, const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems, const ShapeKey& globalKey) { auto& scene = renderContext->_scene; RenderArgs* args = renderContext->args; - + int numItemsToDraw = (int)inItems.size(); if (maxDrawnItems != -1) { numItemsToDraw = glm::min(numItemsToDraw, maxDrawnItems); @@ -104,6 +108,8 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext, } else if (key.hasOwnPipeline()) { ownPipelineBucket.push_back( std::make_tuple(item, key) ); } else { + static QString repeatedCouldNotBeRendered = LogHandler::getInstance().addRepeatedMessageRegex( + "Item could not be rendered with invalid key.*"); qCDebug(renderlogging) << "Item could not be rendered with invalid key" << key; } } @@ -113,7 +119,7 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext, for (auto& pipelineKey : sortedPipelines) { auto& bucket = sortedShapes[pipelineKey]; args->_shapePipeline = shapeContext->pickPipeline(args, pipelineKey); - if (!args->_shapePipeline) { + if (!args->_shapePipeline) { continue; } args->_itemShapeKey = pipelineKey._flags.to_ulong(); @@ -182,7 +188,7 @@ void DrawBounds::run(const RenderContextPointer& renderContext, if (!_drawBuffer) { _drawBuffer = std::make_shared(sizeOfItemBound); } - + _drawBuffer->setData(numItems * sizeOfItemBound, (const gpu::Byte*) items.data()); gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { From 0a3958f7433129b83aaae434af34b52597918f1d Mon Sep 17 00:00:00 2001 From: David Kelly Date: Fri, 8 Sep 2017 16:06:30 -0700 Subject: [PATCH 44/48] cr feedback --- interface/resources/qml/hifi/commerce/purchases/Purchases.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index d95738fc08..697249f740 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -36,7 +36,7 @@ Rectangle { id: commerce; onAccountResult: { - if(result.status === "success") { + if (result.status === "success") { commerce.getKeyFilePathIfExists(); } else { // unsure how to handle a failure here. We definitely cannot proceed. From 1903f65e45dcf7152ec9eeaa8b507a2dcc4910eb Mon Sep 17 00:00:00 2001 From: David Kelly Date: Fri, 8 Sep 2017 16:58:12 -0700 Subject: [PATCH 45/48] oops --- .../qml/hifi/commerce/checkout/Checkout.qml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index 04f106d0f9..14a84311aa 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -40,12 +40,20 @@ Rectangle { Hifi.QmlCommerce { id: commerce; + onAccountResult: { + if (result.status === "success") { + commerce.getKeyFilePathIfExists(); + } else { + // unsure how to handle a failure here. We definitely cannot proceed. + } + } + onLoginStatusResult: { if (!isLoggedIn && root.activeView !== "needsLogIn") { root.activeView = "needsLogIn"; } else if (isLoggedIn) { root.activeView = "initialize"; - commerce.getKeyFilePathIfExists(); + commerce.account(); } } @@ -203,7 +211,7 @@ Rectangle { commerce.getLoginStatus(); } } - + HifiWallet.NeedsLogIn { id: needsLogIn; visible: root.activeView === "needsLogIn"; @@ -239,7 +247,7 @@ Rectangle { } } } - + // // "WALLET NOT SET UP" START // @@ -250,7 +258,7 @@ Rectangle { anchors.bottom: parent.bottom; anchors.left: parent.left; anchors.right: parent.right; - + RalewayRegular { id: notSetUpText; text: "Your wallet isn't set up.

Set up your Wallet (no credit card necessary) to claim your free HFC " + @@ -281,7 +289,7 @@ Rectangle { anchors.left: parent.left; anchors.bottom: parent.bottom; anchors.bottomMargin: 24; - + // "Cancel" button HifiControlsUit.Button { id: cancelButton; From 6ba6c6ee35b4001bbbd7401b8d0d4ef81b61f14d Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 9 Sep 2017 18:00:21 +1200 Subject: [PATCH 46/48] Reduce entity fade-in time --- libraries/shared/src/Interpolate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/shared/src/Interpolate.cpp b/libraries/shared/src/Interpolate.cpp index 35c164f0f2..cd595ee1ed 100644 --- a/libraries/shared/src/Interpolate.cpp +++ b/libraries/shared/src/Interpolate.cpp @@ -69,7 +69,7 @@ float Interpolate::simpleNonLinearBlend(float fraction) { } float Interpolate::calculateFadeRatio(quint64 start) { - const float FADE_TIME = 1.0f; + const float FADE_TIME = 0.5f; float t = 2.0f * std::min(((float)(usecTimestampNow() - start)) / ((float)(FADE_TIME * USECS_PER_SECOND)), 1.0f); float fadeRatio = (t < 1.0f) ? 0.5f * powf(2.0f, 10.0f * (t - 1.0f)) : 0.5f * (-powf(2.0f, -10.0f * (t - 1.0f)) + 2.0f); From dfaa8761e5d723403220b8b23c0608df126a4029 Mon Sep 17 00:00:00 2001 From: vladest Date: Sun, 10 Sep 2017 20:08:40 +0200 Subject: [PATCH 47/48] Make sure root item is created before lambda gets called for desktop loader --- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 27 ++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index d29dc7a0f9..9015cc91d7 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -690,7 +690,6 @@ void OffscreenQmlSurface::finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext return; } - QObject* newObject = qmlComponent->beginCreate(qmlContext); if (qmlComponent->isError()) { for (const auto& error : qmlComponent->errors()) { @@ -704,7 +703,20 @@ void OffscreenQmlSurface::finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext } qmlContext->engine()->setObjectOwnership(this, QQmlEngine::CppOwnership); - f(qmlContext, newObject); + + // All quick items should be focusable + QQuickItem* newItem = qobject_cast(newObject); + if (newItem) { + // Make sure we make items focusable (critical for + // supporting keyboard shortcuts) + newItem->setFlag(QQuickItem::ItemIsFocusScope, true); + } + + // Make sure we will call callback for this codepath + // Caal this before qmlComponent->completeCreate() otherwise ghost window appears + if (newItem && _rootItem) { + f(qmlContext, newObject); + } QObject* eventBridge = qmlContext->contextProperty("eventBridge").value(); if (qmlContext != _qmlContext && eventBridge && eventBridge != this) { @@ -716,15 +728,6 @@ void OffscreenQmlSurface::finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext qmlComponent->completeCreate(); qmlComponent->deleteLater(); - - // All quick items should be focusable - QQuickItem* newItem = qobject_cast(newObject); - if (newItem) { - // Make sure we make items focusable (critical for - // supporting keyboard shortcuts) - newItem->setFlag(QQuickItem::ItemIsFocusScope, true); - } - // If we already have a root, just set a couple of flags and the ancestry if (newItem && _rootItem) { // Allow child windows to be destroyed from JS @@ -747,6 +750,8 @@ void OffscreenQmlSurface::finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext _rootItem = newItem; _rootItem->setParentItem(_quickWindow->contentItem()); _rootItem->setSize(_quickWindow->renderTargetSize()); + // Call this callback after rootitem is set, otherwise VrMenu wont work + f(qmlContext, newObject); } void OffscreenQmlSurface::updateQuick() { From 34c1cb6579b88d3099411d8123745f6ad113263c Mon Sep 17 00:00:00 2001 From: vladest Date: Mon, 11 Sep 2017 19:42:05 +0200 Subject: [PATCH 48/48] Typos and naming fixes --- libraries/ui/src/ui/OffscreenQmlSurface.cpp | 24 ++++++++++----------- libraries/ui/src/ui/OffscreenQmlSurface.h | 12 +++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.cpp b/libraries/ui/src/ui/OffscreenQmlSurface.cpp index 9015cc91d7..ca088fa3fe 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.cpp +++ b/libraries/ui/src/ui/OffscreenQmlSurface.cpp @@ -639,7 +639,7 @@ void OffscreenQmlSurface::setBaseUrl(const QUrl& baseUrl) { _qmlContext->setBaseUrl(baseUrl); } -void OffscreenQmlSurface::load(const QUrl& qmlSource, bool createNewContext, std::function f) { +void OffscreenQmlSurface::load(const QUrl& qmlSource, bool createNewContext, std::function onQmlLoadedCallback) { if (QThread::currentThread() != thread()) { qCWarning(uiLogging) << "Called load on a non-surface thread"; } @@ -659,28 +659,28 @@ void OffscreenQmlSurface::load(const QUrl& qmlSource, bool createNewContext, std auto qmlComponent = new QQmlComponent(_qmlContext->engine(), finalQmlSource, QQmlComponent::PreferSynchronous); if (qmlComponent->isLoading()) { connect(qmlComponent, &QQmlComponent::statusChanged, this, - [this, qmlComponent, targetContext, f](QQmlComponent::Status) { - finishQmlLoad(qmlComponent, targetContext, f); + [this, qmlComponent, targetContext, onQmlLoadedCallback](QQmlComponent::Status) { + finishQmlLoad(qmlComponent, targetContext, onQmlLoadedCallback); }); return; } - finishQmlLoad(qmlComponent, targetContext, f); + finishQmlLoad(qmlComponent, targetContext, onQmlLoadedCallback); } -void OffscreenQmlSurface::loadInNewContext(const QUrl& qmlSource, std::function f) { - load(qmlSource, true, f); +void OffscreenQmlSurface::loadInNewContext(const QUrl& qmlSource, std::function onQmlLoadedCallback) { + load(qmlSource, true, onQmlLoadedCallback); } -void OffscreenQmlSurface::load(const QUrl& qmlSource, std::function f) { - load(qmlSource, false, f); +void OffscreenQmlSurface::load(const QUrl& qmlSource, std::function onQmlLoadedCallback) { + load(qmlSource, false, onQmlLoadedCallback); } void OffscreenQmlSurface::clearCache() { _qmlContext->engine()->clearComponentCache(); } -void OffscreenQmlSurface::finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext* qmlContext, std::function f) { +void OffscreenQmlSurface::finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext* qmlContext, std::function onQmlLoadedCallback) { disconnect(qmlComponent, &QQmlComponent::statusChanged, this, 0); if (qmlComponent->isError()) { for (const auto& error : qmlComponent->errors()) { @@ -713,9 +713,9 @@ void OffscreenQmlSurface::finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext } // Make sure we will call callback for this codepath - // Caal this before qmlComponent->completeCreate() otherwise ghost window appears + // Call this before qmlComponent->completeCreate() otherwise ghost window appears if (newItem && _rootItem) { - f(qmlContext, newObject); + onQmlLoadedCallback(qmlContext, newObject); } QObject* eventBridge = qmlContext->contextProperty("eventBridge").value(); @@ -751,7 +751,7 @@ void OffscreenQmlSurface::finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext _rootItem->setParentItem(_quickWindow->contentItem()); _rootItem->setSize(_quickWindow->renderTargetSize()); // Call this callback after rootitem is set, otherwise VrMenu wont work - f(qmlContext, newObject); + onQmlLoadedCallback(qmlContext, newObject); } void OffscreenQmlSurface::updateQuick() { diff --git a/libraries/ui/src/ui/OffscreenQmlSurface.h b/libraries/ui/src/ui/OffscreenQmlSurface.h index 7da929723c..95dabdef0f 100644 --- a/libraries/ui/src/ui/OffscreenQmlSurface.h +++ b/libraries/ui/src/ui/OffscreenQmlSurface.h @@ -50,11 +50,11 @@ public: void resize(const QSize& size, bool forceResize = false); QSize size() const; - Q_INVOKABLE void load(const QUrl& qmlSource, bool createNewContext, std::function f = [](QQmlContext*, QObject*) {}); - Q_INVOKABLE void loadInNewContext(const QUrl& qmlSource, std::function f = [](QQmlContext*, QObject*) {}); - Q_INVOKABLE void load(const QUrl& qmlSource, std::function f = [](QQmlContext*, QObject*) {}); - Q_INVOKABLE void load(const QString& qmlSourceFile, std::function f = [](QQmlContext*, QObject*) {}) { - return load(QUrl(qmlSourceFile), f); + Q_INVOKABLE void load(const QUrl& qmlSource, bool createNewContext, std::function onQmlLoadedCallback = [](QQmlContext*, QObject*) {}); + Q_INVOKABLE void loadInNewContext(const QUrl& qmlSource, std::function onQmlLoadedCallback = [](QQmlContext*, QObject*) {}); + Q_INVOKABLE void load(const QUrl& qmlSource, std::function onQmlLoadedCallback = [](QQmlContext*, QObject*) {}); + Q_INVOKABLE void load(const QString& qmlSourceFile, std::function onQmlLoadedCallback = [](QQmlContext*, QObject*) {}) { + return load(QUrl(qmlSourceFile), onQmlLoadedCallback); } void clearCache(); void setMaxFps(uint8_t maxFps) { _maxFps = maxFps; } @@ -120,7 +120,7 @@ protected: private: static QOpenGLContext* getSharedContext(); - void finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext* qmlContext, std::function f); + void finishQmlLoad(QQmlComponent* qmlComponent, QQmlContext* qmlContext, std::function onQmlLoadedCallback); QPointF mapWindowToUi(const QPointF& sourcePosition, QObject* sourceObject); void setupFbo(); bool allowNewFrame(uint8_t fps);