mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Fixed bug in outline.qml that associated outline tab to wrong outline job config
This commit is contained in:
parent
fc66dcfdea
commit
410b1904cd
6 changed files with 159 additions and 124 deletions
|
@ -98,7 +98,7 @@ DrawOutlineMask::DrawOutlineMask(unsigned int outlineIndex,
|
|||
render::ShapePlumberPointer shapePlumber, OutlineSharedParametersPointer parameters) :
|
||||
_outlineIndex{ outlineIndex },
|
||||
_shapePlumber { shapePlumber },
|
||||
_parameters{ parameters } {
|
||||
_sharedParameters{ parameters } {
|
||||
}
|
||||
|
||||
void DrawOutlineMask::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
|
||||
|
@ -115,8 +115,8 @@ void DrawOutlineMask::run(const render::RenderContextPointer& renderContext, con
|
|||
|
||||
// First thing we do is determine the projected bounding rect of all the outlined items
|
||||
auto outlinedRect = computeOutlineRect(inShapes, args->getViewFrustum(), framebufferSize);
|
||||
auto blurPixelWidth = _parameters->_blurPixelWidths[_outlineIndex];
|
||||
qCDebug(renderutils) << "Outline rect is " << outlinedRect.x << ' ' << outlinedRect.y << ' ' << outlinedRect.z << ' ' << outlinedRect.w;
|
||||
auto blurPixelWidth = _sharedParameters->_blurPixelWidths[_outlineIndex];
|
||||
//qCDebug(renderutils) << "Outline rect is " << outlinedRect.x << ' ' << outlinedRect.y << ' ' << outlinedRect.z << ' ' << outlinedRect.w;
|
||||
|
||||
// Add 1 pixel of extra margin to be on the safe side
|
||||
outputs = expandRect(outlinedRect, blurPixelWidth+1, framebufferSize);
|
||||
|
@ -236,25 +236,25 @@ gpu::PipelinePointer DrawOutline::_pipelineFilled;
|
|||
|
||||
DrawOutline::DrawOutline(unsigned int outlineIndex, OutlineSharedParametersPointer parameters) :
|
||||
_outlineIndex{ outlineIndex },
|
||||
_parameters{ parameters } {
|
||||
_sharedParameters{ parameters } {
|
||||
}
|
||||
|
||||
void DrawOutline::configure(const Config& config) {
|
||||
auto& configuration = _configuration.edit();
|
||||
const auto OPACITY_EPSILON = 5e-3f;
|
||||
|
||||
configuration._color = config.color;
|
||||
configuration._intensity = config.intensity * (config.glow ? 2.f : 1.f);
|
||||
configuration._unoccludedFillOpacity = config.unoccludedFillOpacity;
|
||||
configuration._occludedFillOpacity = config.occludedFillOpacity;
|
||||
configuration._threshold = config.glow ? 1.f : 1e-3f;
|
||||
configuration._blurKernelSize = std::min(10, std::max(2, (int)floorf(config.width * 3 + 0.5f)));
|
||||
_parameters._color = config.color;
|
||||
_parameters._intensity = config.intensity * (config.glow ? 2.0f : 1.0f);
|
||||
_parameters._unoccludedFillOpacity = config.unoccludedFillOpacity;
|
||||
_parameters._occludedFillOpacity = config.occludedFillOpacity;
|
||||
_parameters._threshold = config.glow ? 1.0f : 1e-3f;
|
||||
_parameters._blurKernelSize = std::min(10, std::max(2, (int)floorf(config.width * 3 + 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.0f;
|
||||
configuration._size.x = (_size * _framebufferSize.y) / _framebufferSize.x;
|
||||
configuration._size.y = _size;
|
||||
_parameters->_blurPixelWidths[_outlineIndex] = (int)ceilf(_size * _framebufferSize.y);
|
||||
_parameters._size.x = (_size * _framebufferSize.y) / _framebufferSize.x;
|
||||
_parameters._size.y = _size;
|
||||
_sharedParameters->_blurPixelWidths[_outlineIndex] = (int)ceilf(_size * _framebufferSize.y);
|
||||
_isFilled = (config.unoccludedFillOpacity > OPACITY_EPSILON || config.occludedFillOpacity > OPACITY_EPSILON);
|
||||
_configuration.edit() = _parameters;
|
||||
}
|
||||
|
||||
void DrawOutline::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) {
|
||||
|
@ -274,11 +274,11 @@ void DrawOutline::run(const render::RenderContextPointer& renderContext, const I
|
|||
|
||||
if (_framebufferSize != framebufferSize)
|
||||
{
|
||||
auto& configuration = _configuration.edit();
|
||||
configuration._size.x = (_size * framebufferSize.y) / framebufferSize.x;
|
||||
configuration._size.y = _size;
|
||||
_parameters._size.x = (_size * framebufferSize.y) / framebufferSize.x;
|
||||
_parameters._size.y = _size;
|
||||
_framebufferSize = framebufferSize;
|
||||
_parameters->_blurPixelWidths[_outlineIndex] = (int)ceilf(_size * _framebufferSize.y);
|
||||
_sharedParameters->_blurPixelWidths[_outlineIndex] = (int)ceilf(_size * _framebufferSize.y);
|
||||
_configuration.edit() = _parameters;
|
||||
}
|
||||
|
||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
|
|
|
@ -83,7 +83,7 @@ protected:
|
|||
|
||||
unsigned int _outlineIndex;
|
||||
render::ShapePlumberPointer _shapePlumber;
|
||||
OutlineSharedParametersPointer _parameters;
|
||||
OutlineSharedParametersPointer _sharedParameters;
|
||||
|
||||
static glm::ivec4 computeOutlineRect(const render::ShapeBounds& shapes, const ViewFrustum& viewFrustum, glm::ivec2 frameSize);
|
||||
static glm::ivec4 expandRect(glm::ivec4 rect, int amount, glm::ivec2 frameSize);
|
||||
|
@ -154,7 +154,8 @@ private:
|
|||
static gpu::PipelinePointer _pipelineFilled;
|
||||
|
||||
unsigned int _outlineIndex;
|
||||
OutlineSharedParametersPointer _parameters;
|
||||
OutlineParameters _parameters;
|
||||
OutlineSharedParametersPointer _sharedParameters;
|
||||
OutlineConfigurationBuffer _configuration;
|
||||
glm::ivec2 _framebufferSize{ 0,0 };
|
||||
bool _isFilled{ false };
|
||||
|
|
|
@ -104,7 +104,7 @@ class Scene {
|
|||
public:
|
||||
|
||||
enum {
|
||||
MAX_OUTLINE_COUNT = 16
|
||||
MAX_OUTLINE_COUNT = 8
|
||||
};
|
||||
|
||||
Scene(glm::vec3 origin, float size);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
import "configSlider"
|
||||
import "outlinePage"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
@ -39,110 +39,30 @@ Item {
|
|||
sendToScript(currentIndex)
|
||||
}
|
||||
|
||||
Component {
|
||||
id: paramWidgets
|
||||
|
||||
Column {
|
||||
spacing: 8
|
||||
|
||||
CheckBox {
|
||||
id: glow
|
||||
text: "Glow"
|
||||
checked: Render.getConfig("RenderMainView.OutlineEffect"+tabs.currentIndex)["glow"]
|
||||
onCheckedChanged: {
|
||||
Render.getConfig("RenderMainView.OutlineEffect"+tabs.currentIndex)["glow"] = checked;
|
||||
}
|
||||
}
|
||||
ConfigSlider {
|
||||
label: "Width"
|
||||
integral: false
|
||||
config: Render.getConfig("RenderMainView.OutlineEffect"+tabs.currentIndex)
|
||||
property: "width"
|
||||
max: 15.0
|
||||
min: 0.0
|
||||
width: 280
|
||||
}
|
||||
ConfigSlider {
|
||||
label: "Intensity"
|
||||
integral: false
|
||||
config: Render.getConfig("RenderMainView.OutlineEffect"+tabs.currentIndex)
|
||||
property: "intensity"
|
||||
max: 1.0
|
||||
min: 0.0
|
||||
width: 280
|
||||
}
|
||||
|
||||
GroupBox {
|
||||
title: "Color"
|
||||
width: 280
|
||||
Column {
|
||||
spacing: 8
|
||||
|
||||
ConfigSlider {
|
||||
label: "Red"
|
||||
integral: false
|
||||
config: Render.getConfig("RenderMainView.OutlineEffect"+tabs.currentIndex)
|
||||
property: "colorR"
|
||||
max: 1.0
|
||||
min: 0.0
|
||||
width: 270
|
||||
}
|
||||
ConfigSlider {
|
||||
label: "Green"
|
||||
integral: false
|
||||
config: Render.getConfig("RenderMainView.OutlineEffect"+tabs.currentIndex)
|
||||
property: "colorG"
|
||||
max: 1.0
|
||||
min: 0.0
|
||||
width: 270
|
||||
}
|
||||
ConfigSlider {
|
||||
label: "Blue"
|
||||
integral: false
|
||||
config: Render.getConfig("RenderMainView.OutlineEffect"+tabs.currentIndex)
|
||||
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: Render.getConfig("RenderMainView.OutlineEffect"+tabs.currentIndex)
|
||||
property: "unoccludedFillOpacity"
|
||||
max: 1.0
|
||||
min: 0.0
|
||||
width: 270
|
||||
}
|
||||
ConfigSlider {
|
||||
label: "Occluded"
|
||||
integral: false
|
||||
config: Render.getConfig("RenderMainView.OutlineEffect"+tabs.currentIndex)
|
||||
property: "occludedFillOpacity"
|
||||
max: 1.0
|
||||
min: 0.0
|
||||
width: 270
|
||||
}
|
||||
}
|
||||
}
|
||||
Tab {
|
||||
title: "Outl.0"
|
||||
OutlinePage {
|
||||
outlineIndex: 0
|
||||
}
|
||||
}
|
||||
Tab {
|
||||
title: "Outl.1"
|
||||
OutlinePage {
|
||||
outlineIndex: 1
|
||||
}
|
||||
}
|
||||
Tab {
|
||||
title: "Outl.2"
|
||||
OutlinePage {
|
||||
outlineIndex: 2
|
||||
}
|
||||
}
|
||||
Tab {
|
||||
title: "Outl.3"
|
||||
OutlinePage {
|
||||
outlineIndex: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
for (var i=0 ; i<4 ; i++) {
|
||||
var outlinePage = tabs.addTab("Outl. "+i, paramWidgets)
|
||||
outlinePage.active = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
113
scripts/developer/utilities/render/outlinePage/OutlinePage.qml
Normal file
113
scripts/developer/utilities/render/outlinePage/OutlinePage.qml
Normal file
|
@ -0,0 +1,113 @@
|
|||
//
|
||||
// outlinePage.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
|
||||
import "../configSlider"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property var outlineIndex: 0
|
||||
property var drawConfig: Render.getConfig("RenderMainView.OutlineEffect"+outlineIndex)
|
||||
|
||||
Column {
|
||||
spacing: 8
|
||||
|
||||
CheckBox {
|
||||
id: glow
|
||||
text: "Glow"
|
||||
checked: root.drawConfig["glow"]
|
||||
onCheckedChanged: {
|
||||
paramWidgets.drawConfig["glow"] = checked;
|
||||
}
|
||||
}
|
||||
ConfigSlider {
|
||||
label: "Width"
|
||||
integral: false
|
||||
config: root.drawConfig
|
||||
property: "width"
|
||||
max: 15.0
|
||||
min: 0.0
|
||||
width: 280
|
||||
}
|
||||
ConfigSlider {
|
||||
label: "Intensity"
|
||||
integral: false
|
||||
config: root.drawConfig
|
||||
property: "intensity"
|
||||
max: 1.0
|
||||
min: 0.0
|
||||
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: "unoccludedFillOpacity"
|
||||
max: 1.0
|
||||
min: 0.0
|
||||
width: 270
|
||||
}
|
||||
ConfigSlider {
|
||||
label: "Occluded"
|
||||
integral: false
|
||||
config: root.drawConfig
|
||||
property: "occludedFillOpacity"
|
||||
max: 1.0
|
||||
min: 0.0
|
||||
width: 270
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
scripts/developer/utilities/render/outlinePage/qmldir
Normal file
1
scripts/developer/utilities/render/outlinePage/qmldir
Normal file
|
@ -0,0 +1 @@
|
|||
OutlinePage 1.0 OutlinePage.qml
|
Loading…
Reference in a new issue