From fc47e6799059af018053a71dd13cac172c5e7297 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 16 Feb 2018 13:56:59 -0800 Subject: [PATCH 01/27] Merging with master --- libraries/render-utils/src/AntialiasingEffect.cpp | 6 +++--- libraries/render-utils/src/VelocityBufferPass.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index 7bc5328100..eb1b98aa1f 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -202,7 +202,7 @@ const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline() { if (!_antialiasingPipeline) { auto vs = gpu::StandardShaderLib::getDrawUnitQuadTexcoordVS(); - auto ps = gpu::Shader::createPixel(std::string(taa_frag)); + auto ps = taa_frag::getShader(); gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); gpu::Shader::BindingSet slotBindings; @@ -233,7 +233,7 @@ const gpu::PipelinePointer& Antialiasing::getAntialiasingPipeline() { const gpu::PipelinePointer& Antialiasing::getBlendPipeline() { if (!_blendPipeline) { auto vs = gpu::StandardShaderLib::getDrawUnitQuadTexcoordVS(); - auto ps = gpu::Shader::createPixel(std::string(fxaa_blend_frag)); + auto ps = fxaa_blend_frag::getShader(); gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); gpu::Shader::BindingSet slotBindings; @@ -254,7 +254,7 @@ const gpu::PipelinePointer& Antialiasing::getBlendPipeline() { const gpu::PipelinePointer& Antialiasing::getDebugBlendPipeline() { if (!_debugBlendPipeline) { auto vs = gpu::StandardShaderLib::getDrawUnitQuadTexcoordVS(); - auto ps = gpu::Shader::createPixel(std::string(taa_blend_frag)); + auto ps = taa_blend_frag::getShader(); gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); gpu::Shader::BindingSet slotBindings; diff --git a/libraries/render-utils/src/VelocityBufferPass.cpp b/libraries/render-utils/src/VelocityBufferPass.cpp index 26dc1c6848..4f25604798 100644 --- a/libraries/render-utils/src/VelocityBufferPass.cpp +++ b/libraries/render-utils/src/VelocityBufferPass.cpp @@ -147,7 +147,7 @@ void VelocityBufferPass::run(const render::RenderContextPointer& renderContext, const gpu::PipelinePointer& VelocityBufferPass::getCameraMotionPipeline() { if (!_cameraMotionPipeline) { auto vs = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS(); - auto ps = gpu::Shader::createPixel(std::string(velocityBuffer_cameraMotion_frag)); + auto ps = velocityBuffer_cameraMotion_frag::getShader(); gpu::ShaderPointer program = gpu::Shader::createProgram(vs, ps); gpu::Shader::BindingSet slotBindings; From 27ba9172b8e9d19f31caddbc935181f8f9072518 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 16 Feb 2018 17:20:20 -0800 Subject: [PATCH 02/27] identifying the bug with defered transform in hmd and trying to apply fix for taa --- libraries/render-utils/src/DeferredFrameTransform.cpp | 2 ++ libraries/render-utils/src/DeferredFrameTransform.h | 2 ++ libraries/render-utils/src/DeferredTransform.slh | 9 +++++++++ .../render-utils/src/velocityBuffer_cameraMotion.slf | 5 +++-- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libraries/render-utils/src/DeferredFrameTransform.cpp b/libraries/render-utils/src/DeferredFrameTransform.cpp index cee5786847..781161a8af 100644 --- a/libraries/render-utils/src/DeferredFrameTransform.cpp +++ b/libraries/render-utils/src/DeferredFrameTransform.cpp @@ -48,6 +48,7 @@ void DeferredFrameTransform::update(RenderArgs* args) { frameTransformBuffer.projection[0] = frameTransformBuffer.projectionMono; frameTransformBuffer.stereoInfo = glm::vec4(0.0f, (float)args->_viewport.z, 0.0f, 0.0f); frameTransformBuffer.invpixelInfo = glm::vec4(1.0f / args->_viewport.z, 1.0f / args->_viewport.w, 0.0f, 0.0f); + frameTransformBuffer.invProjection[0] = glm::inverse(frameTransformBuffer.projection[0]); } else { mat4 projMats[2]; @@ -59,6 +60,7 @@ void DeferredFrameTransform::update(RenderArgs* args) { // Compose the mono Eye space to Stereo clip space Projection Matrix auto sideViewMat = projMats[i] * eyeViews[i]; frameTransformBuffer.projection[i] = sideViewMat; + frameTransformBuffer.invProjection[i] = glm::inverse(sideViewMat); } frameTransformBuffer.stereoInfo = glm::vec4(1.0f, (float)(args->_viewport.z >> 1), 0.0f, 1.0f); diff --git a/libraries/render-utils/src/DeferredFrameTransform.h b/libraries/render-utils/src/DeferredFrameTransform.h index a90effe053..0b5cb6a989 100644 --- a/libraries/render-utils/src/DeferredFrameTransform.h +++ b/libraries/render-utils/src/DeferredFrameTransform.h @@ -45,6 +45,8 @@ protected: glm::vec4 stereoInfo{ 0.0 }; // Mono proj matrix or Left and Right proj matrix going from Mono Eye space to side clip space glm::mat4 projection[2]; + // Inverse proj matrix or Left and Right proj matrix going from Mono Eye space to side clip space + glm::mat4 invProjection[2]; // THe mono projection for sure glm::mat4 projectionMono; // Inv View matrix from eye space (mono) to world space diff --git a/libraries/render-utils/src/DeferredTransform.slh b/libraries/render-utils/src/DeferredTransform.slh index 25d352387f..f1765978eb 100644 --- a/libraries/render-utils/src/DeferredTransform.slh +++ b/libraries/render-utils/src/DeferredTransform.slh @@ -31,6 +31,7 @@ struct DeferredFrameTransform { vec4 _depthInfo; vec4 _stereoInfo; mat4 _projection[2]; + mat4 _invProjection[2]; mat4 _projectionMono; mat4 _viewInverse; mat4 _view; @@ -128,6 +129,14 @@ vec3 evalEyePositionFromZeye(int side, float Zeye, vec2 texcoord) { return vec3(Xe, Ye, Zeye); } +vec3 evalEyePositionFromZdb(int side, float Zdb, vec2 texcoord) { + // compute the view space position using the depth + vec3 clipPos; + clipPos.xyz = vec3(texcoord.xy, Zdb) * 2.0 - 1.0; + vec4 eyePos = frameTransform._invProjection[side] * vec4(clipPos.xyz, 1.0); + return eyePos.xyz / eyePos.w; +} + ivec2 getPixelPosTexcoordPosAndSide(in vec2 glFragCoord, out ivec2 pixelPos, out vec2 texcoordPos, out ivec4 stereoSide) { ivec2 fragPos = ivec2(glFragCoord.xy); diff --git a/libraries/render-utils/src/velocityBuffer_cameraMotion.slf b/libraries/render-utils/src/velocityBuffer_cameraMotion.slf index 7488f42535..00d5cdfb3d 100644 --- a/libraries/render-utils/src/velocityBuffer_cameraMotion.slf +++ b/libraries/render-utils/src/velocityBuffer_cameraMotion.slf @@ -26,14 +26,15 @@ void main(void) { ivec2 framePixelPos = getPixelPosTexcoordPosAndSide(gl_FragCoord.xy, pixelPos, texcoordPos, stereoSide); float Zdb = texelFetch(depthMap, ivec2(gl_FragCoord.xy), 0).x; - float Zeye = evalZeyeFromZdb(Zdb); + // float Zeye = evalZeyeFromZdb(Zdb); /* if (Zeye <= -getPosLinearDepthFar()) { outFragColor = vec4(0.5, 0.5, 0.0, 0.0); return; }*/ // The position of the pixel fragment in Eye space then in world space - vec3 eyePos = evalEyePositionFromZeye(stereoSide.x, Zeye, texcoordPos); + //vec3 eyePos = evalEyePositionFromZeye(stereoSide.x, Zeye, texcoordPos); + vec3 eyePos = evalEyePositionFromZdb(stereoSide.x, Zdb, texcoordPos); vec3 worldPos = (frameTransform._viewInverse * cameraCorrection._correction * vec4(eyePos, 1.0)).xyz; vec3 prevEyePos = (cameraCorrection._prevCorrectionInverse * frameTransform._prevView * vec4(worldPos, 1.0)).xyz; From 6d02aa064a9b531c6d537f414d5fa9d425db5575 Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 13 Mar 2018 10:53:21 -0700 Subject: [PATCH 03/27] REmove any change --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 14db81d01e..df91e0ca7b 100644 --- a/.gitignore +++ b/.gitignore @@ -78,10 +78,8 @@ TAGS node_modules npm-debug.log - # ignore qmlc files generated from qml as cache *.qmlc - # Android studio files *___jb_old___ From c237e34b7119467c17a0bea75228ecef45d0abe9 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 28 Mar 2018 17:47:20 -0700 Subject: [PATCH 04/27] Adding script tools --- .../utilities/render/inspectEngine.js | 39 +++++++++++++++++++ .../utilities/render/inspectEngine.qml | 19 +++++++++ 2 files changed, 58 insertions(+) create mode 100644 scripts/developer/utilities/render/inspectEngine.js create mode 100644 scripts/developer/utilities/render/inspectEngine.qml diff --git a/scripts/developer/utilities/render/inspectEngine.js b/scripts/developer/utilities/render/inspectEngine.js new file mode 100644 index 0000000000..7abce8b477 --- /dev/null +++ b/scripts/developer/utilities/render/inspectEngine.js @@ -0,0 +1,39 @@ +(function() { // BEGIN LOCAL_SCOPE + +function traverse(root, functor, depth) { + var subs = root.findChildren(/.*/) + depth++; + for (var i = 0; i Date: Wed, 28 Mar 2018 18:27:21 -0700 Subject: [PATCH 05/27] i dont't know --- .../utilities/render/inspectEngine.js | 22 ++++++++++++++----- .../utilities/render/inspectEngine.qml | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/developer/utilities/render/inspectEngine.js b/scripts/developer/utilities/render/inspectEngine.js index 7abce8b477..82231b991e 100644 --- a/scripts/developer/utilities/render/inspectEngine.js +++ b/scripts/developer/utilities/render/inspectEngine.js @@ -1,17 +1,27 @@ (function() { // BEGIN LOCAL_SCOPE -function traverse(root, functor, depth) { +function task_traverse(root, functor, depth) { var subs = root.findChildren(/.*/) depth++; for (var i = 0; i Date: Wed, 28 Nov 2018 22:37:11 -0800 Subject: [PATCH 06/27] REmove cruft --- .../utilities/render/inspectEngine.js | 49 ------------------- .../utilities/render/inspectEngine.qml | 20 -------- 2 files changed, 69 deletions(-) delete mode 100644 scripts/developer/utilities/render/inspectEngine.js delete mode 100644 scripts/developer/utilities/render/inspectEngine.qml diff --git a/scripts/developer/utilities/render/inspectEngine.js b/scripts/developer/utilities/render/inspectEngine.js deleted file mode 100644 index 82231b991e..0000000000 --- a/scripts/developer/utilities/render/inspectEngine.js +++ /dev/null @@ -1,49 +0,0 @@ -(function() { // BEGIN LOCAL_SCOPE - -function task_traverse(root, functor, depth) { - var subs = root.findChildren(/.*/) - depth++; - for (var i = 0; i Date: Fri, 30 Nov 2018 00:42:49 -0800 Subject: [PATCH 07/27] exploring better stereo drawcall techniques --- .../hmd/DebugHmdDisplayPlugin.cpp | 5 +++ .../gpu-gl-common/src/gpu/gl/GLBackend.cpp | 8 +++- .../gpu-gl-common/src/gpu/gl/GLBackend.h | 10 ++++- .../src/gpu/gl/GLBackendTransform.cpp | 42 ++++++++++++++++++- libraries/gpu/src/gpu/Transform.slh | 9 +++- libraries/shaders/headers/450/header.glsl | 1 + tools/shadergen.py | 4 ++ 7 files changed, 73 insertions(+), 6 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp index 40063652c8..3de3e590b9 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp @@ -26,6 +26,8 @@ bool DebugHmdDisplayPlugin::isSupported() const { void DebugHmdDisplayPlugin::resetSensors() { _currentRenderFrameInfo.renderPose = glm::mat4(); // identity + _currentRenderFrameInfo.renderPose = glm::translate(glm::mat4(), glm::vec3(0.0f, 1.76f, 0.0f)); + } bool DebugHmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) { @@ -35,6 +37,8 @@ bool DebugHmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) { // FIXME simulate head movement //_currentRenderFrameInfo.renderPose = ; //_currentRenderFrameInfo.presentPose = _currentRenderFrameInfo.renderPose; + _currentRenderFrameInfo.renderPose = glm::translate(glm::mat4(), glm::vec3(0.0f, 1.76f, 0.0f)); + _currentRenderFrameInfo.presentPose = _currentRenderFrameInfo.renderPose; withNonPresentThreadLock([&] { _frameInfos[frameIndex] = _currentRenderFrameInfo; @@ -71,6 +75,7 @@ bool DebugHmdDisplayPlugin::internalActivate() { _eyeOffsets[1][3] = vec4{ 0.0327499993, 0.0, -0.0149999997, 1.0 }; _renderTargetSize = { 3024, 1680 }; _cullingProjection = _eyeProjections[0]; + // This must come after the initialization, so that the values calculated // above are available during the customizeContext call (when not running // in threaded present mode) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp index c1ce05c18b..00373eb196 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp @@ -410,20 +410,24 @@ void GLBackend::render(const Batch& batch) { renderPassTransfer(batch); } -#ifdef GPU_STEREO_DRAWCALL_INSTANCED +//#ifdef GPU_STEREO_DRAWCALL_INSTANCED +#ifdef GPU_STEREO_VIEWPORT_CLIPPED if (_stereo.isStereo()) { glEnable(GL_CLIP_DISTANCE0); } #endif +//#endif { PROFILE_RANGE(render_gpu_gl_detail, _stereo.isStereo() ? "Render Stereo" : "Render"); renderPassDraw(batch); } -#ifdef GPU_STEREO_DRAWCALL_INSTANCED +//#ifdef GPU_STEREO_DRAWCALL_INSTANCED +#ifdef GPU_STEREO_VIEWPORT_CLIPPED if (_stereo.isStereo()) { glDisable(GL_CLIP_DISTANCE0); } #endif +//#endif // Restore the saved stereo state for the next batch _stereo._enable = savedStereo; diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h index 37dde5b08e..8a459c86ca 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h @@ -36,7 +36,8 @@ #define GPU_STEREO_TECHNIQUE_DOUBLED_SIMPLE #else //#define GPU_STEREO_TECHNIQUE_DOUBLED_SMARTER -#define GPU_STEREO_TECHNIQUE_INSTANCED +//#define GPU_STEREO_TECHNIQUE_INSTANCED +#define GPU_STEREO_TECHNIQUE_INSTANCED_MULTIVIEWPORT #endif // Let these be configured by the one define picked above @@ -51,6 +52,13 @@ #ifdef GPU_STEREO_TECHNIQUE_INSTANCED #define GPU_STEREO_DRAWCALL_INSTANCED +#define GPU_STEREO_VIEWPORT_CLIPPED +#define GPU_STEREO_CAMERA_BUFFER +#endif + +#ifdef GPU_STEREO_TECHNIQUE_INSTANCED_MULTIVIEWPORT +#define GPU_STEREO_DRAWCALL_INSTANCED +#define GPU_STEREO_MULTI_VIEWPORT #define GPU_STEREO_CAMERA_BUFFER #endif diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp index 2c2a4e254c..caa194764d 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp @@ -39,6 +39,45 @@ void GLBackend::do_setViewportTransform(const Batch& batch, size_t paramOffset) #ifdef GPU_STEREO_DRAWCALL_INSTANCED { + #ifdef GPU_STEREO_MULTI_VIEWPORT + ivec4& vp = _transform._viewport; + auto sideWidth = vp.z / 2; + + vec4 leftRight[3]; + + // Mono + leftRight[0] = vp; + + // Left side + leftRight[1] = vp; + leftRight[1].x = 0; + leftRight[1].z = sideWidth; + + // right side + leftRight[2] = vp; + leftRight[2].x = sideWidth; + leftRight[2].z = sideWidth; + + glViewportArrayv(0, 3, (float*)leftRight); + + // Where we assign the GL viewport + if (_stereo.isStereo()) { + + // ivec4 leftRight[3]; + // leftRight[0] = vp; + vp.z /= 2; + /* leftRight[1] = vp; // left side + leftRight[2] = vp; // right side + leftRight[2].x += vp.z; + glViewportArrayv(0, 3, (float*) leftRight); +*/ + if (_stereo._pass) { + vp.x += vp.z; + } + } else { + // glViewport(vp.x, vp.y, vp.z, vp.w); + } + #else ivec4& vp = _transform._viewport; glViewport(vp.x, vp.y, vp.z, vp.w); @@ -49,6 +88,7 @@ void GLBackend::do_setViewportTransform(const Batch& batch, size_t paramOffset) vp.x += vp.z; } } + #endif } #else if (!_inRenderTransferPass && !isStereo()) { @@ -123,7 +163,7 @@ void GLBackend::TransformStageState::preUpdate(size_t commandIndex, const Stereo if (_invalidView || _invalidProj || _invalidViewport) { size_t offset = _cameraUboSize * _cameras.size(); - Vec2 finalJitter = _projectionJitter / Vec2(framebufferSize); + Vec2 finalJitter = _projectionJitter / Vec2(framebufferSize); _cameraOffsets.push_back(TransformStageState::Pair(commandIndex, offset)); if (stereo.isStereo()) { diff --git a/libraries/gpu/src/gpu/Transform.slh b/libraries/gpu/src/gpu/Transform.slh index 43205ba4c2..998204ce92 100644 --- a/libraries/gpu/src/gpu/Transform.slh +++ b/libraries/gpu/src/gpu/Transform.slh @@ -168,10 +168,15 @@ TransformObject getTransformObject() { vec2 eyeOffsetScale = vec2(-0.5, +0.5); uint eyeIndex = uint(_stereoSide); #ifndef GPU_GLES +#ifdef GPU_GL450 + gl_ViewportIndex = _stereoSide + 1; + // gl_ViewportIndex = 2 - _stereoSide; +#else gl_ClipDistance[0] = dot(<$clipPos$>, eyeClipEdge[eyeIndex]); #endif - float newClipPosX = <$clipPos$>.x * 0.5 + eyeOffsetScale[eyeIndex] * <$clipPos$>.w; - <$clipPos$>.x = newClipPosX; +#endif + // float newClipPosX = <$clipPos$>.x * 0.5 + eyeOffsetScale[eyeIndex] * <$clipPos$>.w; + // <$clipPos$>.x = newClipPosX; #endif #else diff --git a/libraries/shaders/headers/450/header.glsl b/libraries/shaders/headers/450/header.glsl index 6ce61b4378..a33b7634b1 100644 --- a/libraries/shaders/headers/450/header.glsl +++ b/libraries/shaders/headers/450/header.glsl @@ -1,4 +1,5 @@ #version 450 core +#extension GL_ARB_shader_viewport_layer_array : require #define GPU_GL450 #define GPU_SSBO_TRANSFORM_OBJECT #define BITFIELD int diff --git a/tools/shadergen.py b/tools/shadergen.py index ffbe1662ec..120fcc6bb7 100644 --- a/tools/shadergen.py +++ b/tools/shadergen.py @@ -190,6 +190,10 @@ def processCommand(line): if (dialect == '310es'): spirvCrossDialect = '320es' spirvCrossArgs = [spirvCrossExec, '--output', glslFile, spirvFile, '--version', spirvCrossDialect] if (dialect == '410'): spirvCrossArgs.append('--no-420pack-extension') + if (dialect == '450'): + spirvCrossArgs.append('--extension') + spirvCrossArgs.append('GL_ARB_shader_viewport_layer_array') + executeSubprocess(spirvCrossArgs) else: # This logic is necessary because cmake will agressively keep re-executing the shadergen From 9125f4ff41f43c5a1aaa0911a701cd5083a87a19 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 1 Mar 2019 17:45:33 -0800 Subject: [PATCH 08/27] Trying to hack the stereo for layered --- libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp | 3 +++ libraries/gpu/src/gpu/Transform.slh | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp index 130932238d..698a70af5a 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp @@ -47,6 +47,9 @@ void GLBackend::do_setViewportTransform(const Batch& batch, size_t paramOffset) // Mono leftRight[0] = vp; + // adding this here as im doing Layered, force the first viewport here to be half of it + leftRight[0].x = 0; + leftRight[0].z = sideWidth; // Left side leftRight[1] = vp; diff --git a/libraries/gpu/src/gpu/Transform.slh b/libraries/gpu/src/gpu/Transform.slh index 9298ddcba4..484ad7ebd2 100644 --- a/libraries/gpu/src/gpu/Transform.slh +++ b/libraries/gpu/src/gpu/Transform.slh @@ -169,8 +169,10 @@ TransformObject getTransformObject() { uint eyeIndex = uint(_stereoSide); #if !defined(GPU_GLES) || (defined(HAVE_EXT_clip_cull_distance) && !defined(VULKAN)) #ifdef GPU_GL450 - gl_ViewportIndex = _stereoSide + 1; + /* gl_ViewportIndex = _stereoSide + 1; // gl_ViewportIndex = 2 - _stereoSide; + */// THIs is the layered version + gl_Layer = _stereoSide; #else gl_ClipDistance[0] = dot(<$clipPos$>, eyeClipEdge[eyeIndex]); #endif From fe23ef1485e4a152e339d6f40b53deab374bdb31 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Sun, 3 Mar 2019 23:35:40 -0800 Subject: [PATCH 09/27] Adding the prop library --- .../developer/utilities/lib/prop/Global.qml | 44 +++++++ .../utilities/lib/prop/PropColor.qml | 0 .../developer/utilities/lib/prop/PropEnum.qml | 110 ++++++++++++++++++ .../developer/utilities/lib/prop/PropItem.qml | 62 ++++++++++ .../utilities/lib/prop/PropLabel.qml | 25 ++++ .../utilities/lib/prop/PropScalar.qml | 71 +++++++++++ .../utilities/lib/prop/PropSplitter.qml | 21 ++++ .../developer/utilities/lib/prop/PropText.qml | 24 ++++ scripts/developer/utilities/lib/prop/qmldir | 8 ++ scripts/developer/utilities/render/luci.qml | 59 ++++++++++ scripts/developer/utilities/render/luci2.js | 13 +++ 11 files changed, 437 insertions(+) create mode 100644 scripts/developer/utilities/lib/prop/Global.qml create mode 100644 scripts/developer/utilities/lib/prop/PropColor.qml create mode 100644 scripts/developer/utilities/lib/prop/PropEnum.qml create mode 100644 scripts/developer/utilities/lib/prop/PropItem.qml create mode 100644 scripts/developer/utilities/lib/prop/PropLabel.qml create mode 100644 scripts/developer/utilities/lib/prop/PropScalar.qml create mode 100644 scripts/developer/utilities/lib/prop/PropSplitter.qml create mode 100644 scripts/developer/utilities/lib/prop/PropText.qml create mode 100644 scripts/developer/utilities/lib/prop/qmldir create mode 100644 scripts/developer/utilities/render/luci.qml create mode 100644 scripts/developer/utilities/render/luci2.js diff --git a/scripts/developer/utilities/lib/prop/Global.qml b/scripts/developer/utilities/lib/prop/Global.qml new file mode 100644 index 0000000000..be189e3c96 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/Global.qml @@ -0,0 +1,44 @@ +// +// Prop/Global.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 + +import stylesUit 1.0 +import controlsUit 1.0 as HifiControls + + +Item { + HifiConstants { id: hifi } + id: root + + property real lineHeight: 32 + property real slimHeight: 24 + + property var color: hifi.colors.baseGray + property var colorBackHighlight: hifi.colors.baseGrayHighlight + property var colorBorderLight: hifi.colors.lightGray + property var colorBorderHighight: hifi.colors.blueHighlight + + property real fontSize: 12 + property var fontFamily: "Raleway" + property var fontWeight: Font.DemiBold + property var fontColor: hifi.colors.faintGray + + property var splitterRightWidthScale: 0.44 + property real splitterWidth: 4 + + property var labelTextAlign: Text.AlignRight + property var labelTextElide: Text.ElideMiddle + + property var valueAreaWidthScale: 0.3 * (1.0 - splitterRightWidthScale) + property var valueTextAlign: Text.AlignHCenter + property real valueBorderWidth: 1 + property real valueBorderRadius: 2 +} \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/PropColor.qml b/scripts/developer/utilities/lib/prop/PropColor.qml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/developer/utilities/lib/prop/PropEnum.qml b/scripts/developer/utilities/lib/prop/PropEnum.qml new file mode 100644 index 0000000000..fe6200d971 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/PropEnum.qml @@ -0,0 +1,110 @@ +// +// PropEnum.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 +import QtQuick.Controls 2.2 + +PropItem { + Global { id: global } + id: root + + property alias valueVar : valueCombo.currentIndex + property alias enums : valueCombo.model + + ComboBox { + id: valueCombo + + flat: true + + anchors.left: root.splitter.right + anchors.right: parent.right + anchors.verticalCenter: root.verticalCenter + height: global.slimHeight + + currentIndex: root.valueVarGetter() + onCurrentIndexChanged: { root.valueVarSetter(currentIndex); } + + delegate: ItemDelegate { + width: valueCombo.width + height: valueCombo.height + contentItem: PropText { + text: modelData + horizontalAlignment: global.valueTextAlign + } + background: Rectangle { + color:highlighted?global.colorBackHighlight:global.color; + } + highlighted: valueCombo.highlightedIndex === index + } + + indicator: Canvas { + id: canvas + x: valueCombo.width - width - valueCombo.rightPadding + y: valueCombo.topPadding + (valueCombo.availableHeight - height) / 2 + width: 12 + height: 8 + contextType: "2d" + + Connections { + target: valueCombo + onPressedChanged: canvas.requestPaint() + } + + onPaint: { + context.reset(); + context.moveTo(0, 0); + context.lineTo(width, 0); + context.lineTo(width / 2, height); + context.closePath(); + context.fillStyle = (valueCombo.pressed) ? global.colorBorderHighight : global.colorBorderLight; + context.fill(); + } + } + + contentItem: PropText { + leftPadding: 0 + rightPadding: valueCombo.indicator.width + valueCombo.spacing + + text: valueCombo.displayText + horizontalAlignment: global.valueTextAlign + } + + background: Rectangle { + implicitWidth: 120 + implicitHeight: 40 + color: global.color + border.color: valueCombo.popup.visible ? global.colorBorderHighight : global.colorBorderLight + border.width: global.valueBorderWidth + radius: global.valueBorderRadius + } + + popup: Popup { + y: valueCombo.height - 1 + width: valueCombo.width + implicitHeight: contentItem.implicitHeight + 2 + padding: 1 + + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: valueCombo.popup.visible ? valueCombo.delegateModel : null + currentIndex: valueCombo.highlightedIndex + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + color: global.color + border.color: global.colorBorderHighight + radius: global.valueBorderRadius + } + } + } +} diff --git a/scripts/developer/utilities/lib/prop/PropItem.qml b/scripts/developer/utilities/lib/prop/PropItem.qml new file mode 100644 index 0000000000..ee1e99a772 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/PropItem.qml @@ -0,0 +1,62 @@ +// +// PropItem.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 + +Item { + Global { id: global } + + id: root + + // Prop item is designed to author an object[property]: + property var object: NULL + property string property: "" + + // value is accessed through the "valueVarSetter" and "valueVarGetter" + // By default, these just go get or set the value from the object[property] + // + function defaultGet() { return root.object[root.property]; } + function defaultSet(value) { root.object[root.property] = value; } + property var valueVarSetter: defaultSet + property var valueVarGetter: defaultGet + + // PropItem is stretching horizontally accross its parent + // Fixed height + anchors.left: parent.left + anchors.right: parent.right + height: global.lineHeight + + + // LabelControl And SplitterControl are on the left side of the PropItem + property bool showLabel: true + property alias labelControl: labelControl + property alias label: labelControl.text + + property var labelAreaWidth: root.width * global.splitterRightWidthScale - global.splitterWidth + + PropText { + id: labelControl + text: root.label + enabled: root.showLabel + + anchors.left: root.left + anchors.verticalCenter: root.verticalCenter + width: labelAreaWidth + } + + property alias splitter: splitterControl + PropSplitter { + id: splitterControl + + anchors.left: labelControl.right + size: global.splitterWidth + } + +} diff --git a/scripts/developer/utilities/lib/prop/PropLabel.qml b/scripts/developer/utilities/lib/prop/PropLabel.qml new file mode 100644 index 0000000000..9dbeffe0ec --- /dev/null +++ b/scripts/developer/utilities/lib/prop/PropLabel.qml @@ -0,0 +1,25 @@ +// +// PropLabel.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 +import QtQuick.Controls 2.2 + +Label { + Global { id: global } + + color: global.fontColor + font.pixelSize: global.fontSize + font.family: global.fontFamily + font.weight: global.fontWeight + verticalAlignment: Text.AlignVCenter + horizontalAlignment: global.labelTextAlign + elide: global.labelTextElide +} + diff --git a/scripts/developer/utilities/lib/prop/PropScalar.qml b/scripts/developer/utilities/lib/prop/PropScalar.qml new file mode 100644 index 0000000000..29b42e2801 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/PropScalar.qml @@ -0,0 +1,71 @@ +// +// PropItem.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 + +import controlsUit 1.0 as HifiControls + +PropItem { + Global { id: global } + id: root + + // Scalar Prop + property bool integral: false + property var numDigits: 2 + + + property alias valueVar : sliderControl.value + property alias min: sliderControl.minimumValue + property alias max: sliderControl.maximumValue + + + + property bool showValue: true + + + signal valueChanged(real value) + + Component.onCompleted: { + valueVar = root.valueVarGetter(); + } + + PropLabel { + id: valueLabel + enabled: root.showValue + + anchors.left: root.splitter.right + anchors.verticalCenter: root.verticalCenter + width: root.width * global.valueAreaWidthScale + horizontalAlignment: global.valueTextAlign + height: global.slimHeight + + text: sliderControl.value.toFixed(root.integral ? 0 : root.numDigits) + + background: Rectangle { + color: global.color + border.color: global.colorBorderLight + border.width: global.valueBorderWidth + radius: global.valueBorderRadius + } + } + + HifiControls.Slider { + id: sliderControl + stepSize: root.integral ? 1.0 : 0.0 + anchors.left: valueLabel.right + anchors.right: root.right + anchors.rightMargin: 0 + anchors.verticalCenter: root.verticalCenter + + onValueChanged: { root.valueVarSetter(value) } + } + + +} diff --git a/scripts/developer/utilities/lib/prop/PropSplitter.qml b/scripts/developer/utilities/lib/prop/PropSplitter.qml new file mode 100644 index 0000000000..25f668a6eb --- /dev/null +++ b/scripts/developer/utilities/lib/prop/PropSplitter.qml @@ -0,0 +1,21 @@ +// +// PropSplitter.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 + +Item { + id: root + property real size + + width: size // Must be non-zero + height: size + + anchors.verticalCenter: parent.verticalCenter +} diff --git a/scripts/developer/utilities/lib/prop/PropText.qml b/scripts/developer/utilities/lib/prop/PropText.qml new file mode 100644 index 0000000000..b1669f3836 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/PropText.qml @@ -0,0 +1,24 @@ +// +// Prop/Text.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 + +Text { + Global { id: global } + + color: global.fontColor + font.pixelSize: global.fontSize + font.family: global.fontFamily + font.weight: global.fontWeight + verticalAlignment: Text.AlignVCenter + horizontalAlignment: global.labelTextAlign + elide: global.labelTextElide +} + diff --git a/scripts/developer/utilities/lib/prop/qmldir b/scripts/developer/utilities/lib/prop/qmldir new file mode 100644 index 0000000000..44e4889ab6 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/qmldir @@ -0,0 +1,8 @@ +PropGlobal 1.0 PropGlobal.qml +PropText 1.0 PropText.qml +PropLabel 1.0 PropLabel.qml +PropSplitter 1.0 PropSplitter.qml +PropItem 1.0 PropItem.qml +PropScalar 1.0 PropScalar.qml +PropEnum 1.0 PropEnum.qml +PropColor 1.0 PropColor.qml diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml new file mode 100644 index 0000000000..959a24e9be --- /dev/null +++ b/scripts/developer/utilities/render/luci.qml @@ -0,0 +1,59 @@ +// +// luci.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.3 + +import controlsUit 1.0 as HifiControls + +import "../lib/prop" as Prop + +Rectangle { + Prop.Global { id: prop;} + id: render; + anchors.fill: parent + color: prop.color; + + property var mainViewTask: Render.getConfig("RenderMainView") + + Column { + anchors.left: parent.left + anchors.right: parent.right + Repeater { + model: [ "Tone mapping exposure:ToneMapping:exposure:5.0:-5.0", + "Tone:ToneMapping:exposure:5.0:-5.0" + ] + Prop.PropScalar { + label: qsTr(modelData.split(":")[0]) + integral: false + object: render.mainViewTask.getConfig(modelData.split(":")[1]) + property: modelData.split(":")[2] + max: modelData.split(":")[3] + min: modelData.split(":")[4] + + anchors.left: parent.left + anchors.right: parent.right + } + } + Prop.PropEnum { + label: "Tone Curve" + object: render.mainViewTask.getConfig("ToneMapping") + property: "curve" + enums: [ + "RGB", + "SRGB", + "Reinhard", + "Filmic", + ] + anchors.left: parent.left + anchors.right: parent.right + } + } +} \ No newline at end of file diff --git a/scripts/developer/utilities/render/luci2.js b/scripts/developer/utilities/render/luci2.js new file mode 100644 index 0000000000..4aea49a059 --- /dev/null +++ b/scripts/developer/utilities/render/luci2.js @@ -0,0 +1,13 @@ +function openEngineTaskView() { + // Set up the qml ui + var qml = Script.resolvePath('luci.qml'); + var window = new OverlayWindow({ + title: 'luci qml', + source: qml, + width: 300, + height: 400 + }); + window.setPosition(200, 50); + //window.closed.connect(function() { Script.stop(); }); + } + openEngineTaskView(); \ No newline at end of file From 3d2614498be2de804e86d73527be5e26e88d3b7b Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 4 Mar 2019 18:07:02 -0800 Subject: [PATCH 10/27] ANd fuck --- .../developer/utilities/lib/prop/PropBool.qml | 35 +++++++ .../utilities/lib/prop/PropGroup.qml | 60 ++++++++++++ .../utilities/lib/prop/style/Global.qml | 44 +++++++++ .../utilities/lib/prop/style/PiComboBox.qml | 98 +++++++++++++++++++ .../utilities/lib/prop/style/PiLabel.qml | 25 +++++ .../utilities/lib/prop/style/PiSplitter.qml | 21 ++++ .../utilities/lib/prop/style/PiText.qml | 24 +++++ 7 files changed, 307 insertions(+) create mode 100644 scripts/developer/utilities/lib/prop/PropBool.qml create mode 100644 scripts/developer/utilities/lib/prop/PropGroup.qml create mode 100644 scripts/developer/utilities/lib/prop/style/Global.qml create mode 100644 scripts/developer/utilities/lib/prop/style/PiComboBox.qml create mode 100644 scripts/developer/utilities/lib/prop/style/PiLabel.qml create mode 100644 scripts/developer/utilities/lib/prop/style/PiSplitter.qml create mode 100644 scripts/developer/utilities/lib/prop/style/PiText.qml diff --git a/scripts/developer/utilities/lib/prop/PropBool.qml b/scripts/developer/utilities/lib/prop/PropBool.qml new file mode 100644 index 0000000000..e355398375 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/PropBool.qml @@ -0,0 +1,35 @@ +// +// PropBool.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 +import controlsUit 1.0 as HifiControls + +PropItem { + Global { id: global } + id: root + + property alias valueVar : checkboxControl.checked + + Component.onCompleted: { + valueVar = root.valueVarGetter(); + } + + HifiControls.CheckBox { + id: checkboxControl + + anchors.left: root.splitter.right + anchors.verticalCenter: root.verticalCenter + width: root.width * global.valueAreaWidthScale + height: global.slimHeight + + checked: root.valueVar + onCheckedChanged: { root.valueVarSetter(checked); } + } +} \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml new file mode 100644 index 0000000000..39294743b6 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -0,0 +1,60 @@ +// +// PropGroup.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 + +Item { + Global { id: global } + id: root + + // Prop Group is designed to author an array of ProItems, they are defined with an array of the tuplets describing each individual item: + // [ ..., PropItemInfo, ...] + // PropItemInfo { + // "type": "PropXXXX", "object": object, "property": "propName" + // } + // + property var propItems: [] + + + property var label: "group" + + Column { + id: column + anchors.left: parent.left + anchors.right: parent.right + + PropLabel { + anchors.left: parent.left + anchors.right: parent.right + text: root.label + } + + + Component.onCompleted: { + var component = Qt.createComponent("PropBool.qml"); + component.label = "Test"; + for (var i=0; i Date: Mon, 4 Mar 2019 23:44:14 -0800 Subject: [PATCH 11/27] Fixing the bins and exploring the REpeater --- .../developer/utilities/lib/prop/Global.qml | 44 ---------- .../developer/utilities/lib/prop/PropBool.qml | 1 - .../developer/utilities/lib/prop/PropEnum.qml | 83 ++----------------- .../utilities/lib/prop/PropGroup.qml | 42 ++++++---- .../developer/utilities/lib/prop/PropItem.qml | 3 +- .../utilities/lib/prop/PropLabel.qml | 25 ------ .../utilities/lib/prop/PropSplitter.qml | 21 ----- .../developer/utilities/lib/prop/PropText.qml | 24 ------ scripts/developer/utilities/lib/prop/qmldir | 11 ++- .../utilities/lib/prop/style/Global.qml | 2 + .../utilities/lib/prop/style/PiComboBox.qml | 2 +- scripts/developer/utilities/render/luci.qml | 17 ++++ 12 files changed, 58 insertions(+), 217 deletions(-) delete mode 100644 scripts/developer/utilities/lib/prop/Global.qml delete mode 100644 scripts/developer/utilities/lib/prop/PropLabel.qml delete mode 100644 scripts/developer/utilities/lib/prop/PropSplitter.qml delete mode 100644 scripts/developer/utilities/lib/prop/PropText.qml diff --git a/scripts/developer/utilities/lib/prop/Global.qml b/scripts/developer/utilities/lib/prop/Global.qml deleted file mode 100644 index be189e3c96..0000000000 --- a/scripts/developer/utilities/lib/prop/Global.qml +++ /dev/null @@ -1,44 +0,0 @@ -// -// Prop/Global.qml -// -// Created by Sam Gateau on 3/2/2019 -// Copyright 2019 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.7 - -import stylesUit 1.0 -import controlsUit 1.0 as HifiControls - - -Item { - HifiConstants { id: hifi } - id: root - - property real lineHeight: 32 - property real slimHeight: 24 - - property var color: hifi.colors.baseGray - property var colorBackHighlight: hifi.colors.baseGrayHighlight - property var colorBorderLight: hifi.colors.lightGray - property var colorBorderHighight: hifi.colors.blueHighlight - - property real fontSize: 12 - property var fontFamily: "Raleway" - property var fontWeight: Font.DemiBold - property var fontColor: hifi.colors.faintGray - - property var splitterRightWidthScale: 0.44 - property real splitterWidth: 4 - - property var labelTextAlign: Text.AlignRight - property var labelTextElide: Text.ElideMiddle - - property var valueAreaWidthScale: 0.3 * (1.0 - splitterRightWidthScale) - property var valueTextAlign: Text.AlignHCenter - property real valueBorderWidth: 1 - property real valueBorderRadius: 2 -} \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/PropBool.qml b/scripts/developer/utilities/lib/prop/PropBool.qml index e355398375..d8e4bad589 100644 --- a/scripts/developer/utilities/lib/prop/PropBool.qml +++ b/scripts/developer/utilities/lib/prop/PropBool.qml @@ -29,7 +29,6 @@ PropItem { width: root.width * global.valueAreaWidthScale height: global.slimHeight - checked: root.valueVar onCheckedChanged: { root.valueVarSetter(checked); } } } \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/PropEnum.qml b/scripts/developer/utilities/lib/prop/PropEnum.qml index fe6200d971..9446a267b3 100644 --- a/scripts/developer/utilities/lib/prop/PropEnum.qml +++ b/scripts/developer/utilities/lib/prop/PropEnum.qml @@ -18,7 +18,11 @@ PropItem { property alias valueVar : valueCombo.currentIndex property alias enums : valueCombo.model - ComboBox { + Component.onCompleted: { + valueVar = root.valueVarGetter(); + } + + PropComboBox { id: valueCombo flat: true @@ -28,83 +32,6 @@ PropItem { anchors.verticalCenter: root.verticalCenter height: global.slimHeight - currentIndex: root.valueVarGetter() onCurrentIndexChanged: { root.valueVarSetter(currentIndex); } - - delegate: ItemDelegate { - width: valueCombo.width - height: valueCombo.height - contentItem: PropText { - text: modelData - horizontalAlignment: global.valueTextAlign - } - background: Rectangle { - color:highlighted?global.colorBackHighlight:global.color; - } - highlighted: valueCombo.highlightedIndex === index - } - - indicator: Canvas { - id: canvas - x: valueCombo.width - width - valueCombo.rightPadding - y: valueCombo.topPadding + (valueCombo.availableHeight - height) / 2 - width: 12 - height: 8 - contextType: "2d" - - Connections { - target: valueCombo - onPressedChanged: canvas.requestPaint() - } - - onPaint: { - context.reset(); - context.moveTo(0, 0); - context.lineTo(width, 0); - context.lineTo(width / 2, height); - context.closePath(); - context.fillStyle = (valueCombo.pressed) ? global.colorBorderHighight : global.colorBorderLight; - context.fill(); - } - } - - contentItem: PropText { - leftPadding: 0 - rightPadding: valueCombo.indicator.width + valueCombo.spacing - - text: valueCombo.displayText - horizontalAlignment: global.valueTextAlign - } - - background: Rectangle { - implicitWidth: 120 - implicitHeight: 40 - color: global.color - border.color: valueCombo.popup.visible ? global.colorBorderHighight : global.colorBorderLight - border.width: global.valueBorderWidth - radius: global.valueBorderRadius - } - - popup: Popup { - y: valueCombo.height - 1 - width: valueCombo.width - implicitHeight: contentItem.implicitHeight + 2 - padding: 1 - - contentItem: ListView { - clip: true - implicitHeight: contentHeight - model: valueCombo.popup.visible ? valueCombo.delegateModel : null - currentIndex: valueCombo.highlightedIndex - - ScrollIndicator.vertical: ScrollIndicator { } - } - - background: Rectangle { - color: global.color - border.color: global.colorBorderHighight - radius: global.valueBorderRadius - } - } } } diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 39294743b6..dd579af7eb 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -25,6 +25,19 @@ Item { property var label: "group" + /* Component.onCompleted: { + var component1 = Qt.createComponent("PropBool.qml"); + component1.label = "Test"; + for (var i=0; i Date: Tue, 5 Mar 2019 14:27:32 -0800 Subject: [PATCH 12/27] Dynamic creation of the propItem in the propGRoup! --- .../developer/utilities/lib/prop/PropEnum.qml | 3 +- .../utilities/lib/prop/PropGroup.qml | 62 ++++++++++++------- scripts/developer/utilities/render/luci.qml | 12 +++- 3 files changed, 49 insertions(+), 28 deletions(-) diff --git a/scripts/developer/utilities/lib/prop/PropEnum.qml b/scripts/developer/utilities/lib/prop/PropEnum.qml index 9446a267b3..ff5dfd8161 100644 --- a/scripts/developer/utilities/lib/prop/PropEnum.qml +++ b/scripts/developer/utilities/lib/prop/PropEnum.qml @@ -19,7 +19,7 @@ PropItem { property alias enums : valueCombo.model Component.onCompleted: { - valueVar = root.valueVarGetter(); + // valueVar = root.valueVarGetter(); } PropComboBox { @@ -32,6 +32,7 @@ PropItem { anchors.verticalCenter: root.verticalCenter height: global.slimHeight + currentIndex: root.valueVarGetter() onCurrentIndexChanged: { root.valueVarSetter(currentIndex); } } } diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index dd579af7eb..1dfb957536 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -17,7 +17,7 @@ Item { // Prop Group is designed to author an array of ProItems, they are defined with an array of the tuplets describing each individual item: // [ ..., PropItemInfo, ...] // PropItemInfo { - // "type": "PropXXXX", "object": object, "property": "propName" + // type: "PropXXXX", object: JSobject, property: "propName" // } // property var propItems: [] @@ -25,18 +25,6 @@ Item { property var label: "group" - /* Component.onCompleted: { - var component1 = Qt.createComponent("PropBool.qml"); - component1.label = "Test"; - for (var i=0; i Date: Tue, 5 Mar 2019 20:22:19 -0800 Subject: [PATCH 13/27] This is working !!!! --- .../utilities/lib/jet/qml/TaskPropView.qml | 40 +++++++++++++++++++ .../developer/utilities/lib/jet/qml/qmldir | 1 + .../utilities/lib/prop/PropGroup.qml | 7 +++- scripts/developer/utilities/render/luci.qml | 11 ++++- 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 scripts/developer/utilities/lib/jet/qml/TaskPropView.qml diff --git a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml new file mode 100644 index 0000000000..350103021a --- /dev/null +++ b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml @@ -0,0 +1,40 @@ +// +// jet/TaskListView.qml +// +// Created by Sam Gateau, 2018/05/09 +// Copyright 2018 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +import QtQuick 2.7 +import QtQuick.Controls 1.4 as Original +import QtQuick.Controls.Styles 1.4 + +import stylesUit 1.0 +import controlsUit 1.0 as HifiControls + +import "../../prop" as Prop + +import "../jet.js" as Jet + +Prop.PropGroup { + + id: root; + + property var rootConfig : Render + property var jobPath: "" + property alias jobName: root.label + + Component.onCompleted: { + var props = Jet.job_propKeys(rootConfig.getConfig(jobPath)); + //console.log(JSON.stringify(props)); + for (var p in props) { + root.propItems.push({"type": "PropBool", "object": rootConfig.getConfig(jobPath), "property":props[p] }) + } + root.updatePropItems(); + } + + +} \ No newline at end of file diff --git a/scripts/developer/utilities/lib/jet/qml/qmldir b/scripts/developer/utilities/lib/jet/qml/qmldir index e16820914b..2914c27c23 100644 --- a/scripts/developer/utilities/lib/jet/qml/qmldir +++ b/scripts/developer/utilities/lib/jet/qml/qmldir @@ -1,3 +1,4 @@ TaskList 1.0 TaskList.qml TaskViewList 1.0 TaskViewList.qml TaskTimeFrameView 1.0 TaskTimeFrameView.qml +TaskPropView 1.0 TaskPropView.qml \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 1dfb957536..6f5607def4 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -42,8 +42,8 @@ Item { } height: column.height - Component.onCompleted: { - for (var i = 0; i < root.propItems.length; i++) { + function updatePropItems() { + for (var i = 0; i < root.propItems.length; i++) { var proItem = root.propItems[i]; switch(proItem.type) { case 'PropBool': { @@ -77,4 +77,7 @@ Item { } } } + Component.onCompleted: { + updatePropItems(); + } } diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index d009d52f55..d5156c3cf7 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -14,6 +14,7 @@ import QtQuick.Layouts 1.3 import controlsUit 1.0 as HifiControls import "../lib/prop" as Prop +import "../lib/jet/qml" as Jet Rectangle { Prop.Global { id: prop;} @@ -62,7 +63,7 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right }*/ - Prop.PropGroup { + /* Prop.PropGroup { label: "My group" propItems: [ {"type": "PropBool", "object": render.mainViewTask.getConfig("LightingModel"), "property": "enableBackground"}, @@ -75,6 +76,14 @@ Rectangle { "Filmic", ]}, ] + anchors.left: parent.left + anchors.right: parent.right + }*/ + + Jet.TaskPropView { + jobPath: "RenderMainView.LightingModel" + label: "Le tone mapping Job" + anchors.left: parent.left anchors.right: parent.right } From f7896b64079b90bfed7a9474f8260307053a7f92 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 6 Mar 2019 22:24:43 -0800 Subject: [PATCH 14/27] Better propGroup --- .../utilities/lib/jet/qml/TaskPropView.qml | 6 +- .../utilities/lib/prop/PropGroup.qml | 126 ++++++++++++------ scripts/developer/utilities/render/luci.qml | 11 +- 3 files changed, 98 insertions(+), 45 deletions(-) diff --git a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml index 350103021a..2188df7cc0 100644 --- a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml +++ b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml @@ -25,13 +25,13 @@ Prop.PropGroup { property var rootConfig : Render property var jobPath: "" - property alias jobName: root.label + property alias label: root.label Component.onCompleted: { var props = Jet.job_propKeys(rootConfig.getConfig(jobPath)); - //console.log(JSON.stringify(props)); + console.log(JSON.stringify(props)); for (var p in props) { - root.propItems.push({"type": "PropBool", "object": rootConfig.getConfig(jobPath), "property":props[p] }) + root.propItems.push({"object": rootConfig.getConfig(jobPath), "property":props[p] }) } root.updatePropItems(); } diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 6f5607def4..7b901b079d 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -25,56 +25,102 @@ Item { property var label: "group" - - Column { - id: column - anchors.left: parent.left - anchors.right: parent.right + Item { + id: header + height: global.slimHeight + anchors.left: parent.left + anchors.right: parent.right PropLabel { - anchors.left: parent.left - anchors.right: parent.right + id: labelControl + anchors.left: header.left + width: 0.8 * header.width + anchors.verticalCenter: header.verticalCenter text: root.label horizontalAlignment: Text.AlignHCenter } - - + Rectangle { + id: headerRect + color: global.color + border.color: global.colorBorderLight + border.width: global.valueBorderWidth + radius: global.valueBorderRadius + + anchors.left: labelControl.right + anchors.right: header.right + anchors.verticalCenter: header.verticalCenter + height: parent.height + } } - height: column.height + + Column { + id: column + anchors.top: header.bottom + anchors.left: parent.left + anchors.right: parent.right + clip: true + + // Where the propItems are added + } + height: header.height + column.height function updatePropItems() { for (var i = 0; i < root.propItems.length; i++) { var proItem = root.propItems[i]; - switch(proItem.type) { - case 'PropBool': { - var component = Qt.createComponent("PropBool.qml"); - component.createObject(column, { - "label": proItem.property, - "object": proItem.object, - "property": proItem.property - }) - } break; - case 'PropScalar': { - var component = Qt.createComponent("PropScalar.qml"); - component.createObject(column, { - "label": proItem.property, - "object": proItem.object, - "property": proItem.property, - "min": (proItem["min"] !== undefined ? proItem.min : 0.0), - "max": (proItem["max"] !== undefined ? proItem.max : 1.0), - "integer": (proItem["integral"] !== undefined ? proItem.integral : false), - }) - } break; - case 'PropEnum': { - var component = Qt.createComponent("PropEnum.qml"); - component.createObject(column, { - "label": proItem.property, - "object": proItem.object, - "property": proItem.property, - "enums": (proItem["enums"] !== undefined ? proItem.enums : ["Undefined Enums !!!"]), - }) - } break; - } + // valid object + if (proItem['object'] !== undefined && proItem['object'] !== null ) { + // valid property + if (proItem['property'] !== undefined && proItem.object[proItem.property] !== undefined) { + // check type + if (proItem['type'] === undefined) { + proItem['type'] = typeof(proItem.object[proItem.property]) + } + switch(proItem.type) { + case 'boolean': + case 'PropBool': { + var component = Qt.createComponent("PropBool.qml"); + component.createObject(column, { + "label": proItem.property, + "object": proItem.object, + "property": proItem.property + }) + } break; + case 'number': + case 'PropScalar': { + var component = Qt.createComponent("PropScalar.qml"); + component.createObject(column, { + "label": proItem.property, + "object": proItem.object, + "property": proItem.property, + "min": (proItem["min"] !== undefined ? proItem.min : 0.0), + "max": (proItem["max"] !== undefined ? proItem.max : 1.0), + "integer": (proItem["integral"] !== undefined ? proItem.integral : false), + }) + } break; + case 'PropEnum': { + var component = Qt.createComponent("PropEnum.qml"); + component.createObject(column, { + "label": proItem.property, + "object": proItem.object, + "property": proItem.property, + "enums": (proItem["enums"] !== undefined ? proItem.enums : ["Undefined Enums !!!"]), + }) + } break; + case 'object': { + var component = Qt.createComponent("PropItem.qml"); + component.createObject(column, { + "label": proItem.property, + "object": proItem.object, + "property": proItem.property, + }) + } break; + } + } else { + console.log('Invalid property: ' + JSON.stringify(proItem)); + } + } else { + console.log('Invalid object: ' + JSON.stringify(proItem)); + } } } Component.onCompleted: { diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index d5156c3cf7..091a287e02 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -81,8 +81,15 @@ Rectangle { }*/ Jet.TaskPropView { - jobPath: "RenderMainView.LightingModel" - label: "Le tone mapping Job" + jobPath: "RenderMainView.ToneMapping" + label: "Le ToneMapping Job" + + anchors.left: parent.left + anchors.right: parent.right + } + Jet.TaskPropView { + jobPath: "RenderMainView.Antialiasing" + label: "Le Antialiasing Job" anchors.left: parent.left anchors.right: parent.right From 5b8116bec4046af2ed36e9b3a1749c0dbbd2a047 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 7 Mar 2019 17:52:11 -0800 Subject: [PATCH 15/27] make the group foldable --- scripts/developer/utilities/lib/prop/PropGroup.qml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 7b901b079d..0b8d5621f4 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -25,6 +25,8 @@ Item { property var label: "group" + property var isUnfold: false + Item { id: header height: global.slimHeight @@ -39,6 +41,7 @@ Item { text: root.label horizontalAlignment: Text.AlignHCenter } + Rectangle { id: headerRect color: global.color @@ -50,11 +53,20 @@ Item { anchors.right: header.right anchors.verticalCenter: header.verticalCenter height: parent.height + + MouseArea{ + id: mousearea + anchors.fill: parent + onDoubleClicked: { + root.isUnfold = !root.isUnfold + } + } } } Column { id: column + visible: root.isUnfold anchors.top: header.bottom anchors.left: parent.left anchors.right: parent.right @@ -62,7 +74,7 @@ Item { // Where the propItems are added } - height: header.height + column.height + height: header.height + isUnfold * column.height function updatePropItems() { for (var i = 0; i < root.propItems.length; i++) { From a303f803ebe1933805fac15e986dd5d23042e887 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 8 Mar 2019 18:14:38 -0800 Subject: [PATCH 16/27] BReaking group --- scripts/developer/utilities/lib/prop/PropGroup.qml | 4 ++-- scripts/developer/utilities/render/luci.qml | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 0b8d5621f4..eaba9d299f 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -36,7 +36,7 @@ Item { PropLabel { id: labelControl anchors.left: header.left - width: 0.8 * header.width + width: 0.9 * header.width anchors.verticalCenter: header.verticalCenter text: root.label horizontalAlignment: Text.AlignHCenter @@ -57,7 +57,7 @@ Item { MouseArea{ id: mousearea anchors.fill: parent - onDoubleClicked: { + onClicked: { root.isUnfold = !root.isUnfold } } diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index 091a287e02..3f6b5b5c01 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -16,14 +16,17 @@ import controlsUit 1.0 as HifiControls import "../lib/prop" as Prop import "../lib/jet/qml" as Jet -Rectangle { + Original.ScrollView { Prop.Global { id: prop;} id: render; - anchors.fill: parent - color: prop.color; + anchors.fill: parent + + // color: prop.color; + + property var mainViewTask: Render.getConfig("RenderMainView") - + Column { anchors.left: parent.left anchors.right: parent.right From 530b871eef09bc74257cbaf9772cf7e60dfee1ea Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 11 Mar 2019 00:08:31 -0700 Subject: [PATCH 17/27] Getting the group styled and scrollview working all together --- .../developer/utilities/lib/prop/PropEnum.qml | 2 +- .../utilities/lib/prop/PropGroup.qml | 93 +++++++++------ .../utilities/lib/prop/PropScalar.qml | 1 - scripts/developer/utilities/lib/prop/qmldir | 1 + .../utilities/lib/prop/style/Global.qml | 5 +- .../utilities/lib/prop/style/PiCanvasIcon.qml | 50 ++++++++ .../utilities/lib/prop/style/PiComboBox.qml | 22 +--- scripts/developer/utilities/render/luci.qml | 112 ++++++------------ 8 files changed, 159 insertions(+), 127 deletions(-) create mode 100644 scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml diff --git a/scripts/developer/utilities/lib/prop/PropEnum.qml b/scripts/developer/utilities/lib/prop/PropEnum.qml index ff5dfd8161..87c2845c90 100644 --- a/scripts/developer/utilities/lib/prop/PropEnum.qml +++ b/scripts/developer/utilities/lib/prop/PropEnum.qml @@ -28,7 +28,7 @@ PropItem { flat: true anchors.left: root.splitter.right - anchors.right: parent.right + anchors.right: root.right anchors.verticalCenter: root.verticalCenter height: global.slimHeight diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index eaba9d299f..4465ec420e 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -25,56 +25,83 @@ Item { property var label: "group" - property var isUnfold: false - + property alias isUnfold: headerRect.icon + Item { id: header height: global.slimHeight anchors.left: parent.left anchors.right: parent.right - + + Item { + id: folder + anchors.left: header.left + width: headerRect.width * 2 + anchors.verticalCenter: header.verticalCenter + height: parent.height + + PropCanvasIcon { + id: headerRect + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + + MouseArea{ + id: mousearea + anchors.fill: parent + onClicked: { + root.isUnfold = !root.isUnfold + } + } + } + } + PropLabel { id: labelControl - anchors.left: header.left - width: 0.9 * header.width + anchors.left: folder.right + anchors.right: header.right anchors.verticalCenter: header.verticalCenter text: root.label horizontalAlignment: Text.AlignHCenter } - Rectangle { - id: headerRect - color: global.color - border.color: global.colorBorderLight - border.width: global.valueBorderWidth - radius: global.valueBorderRadius - - anchors.left: labelControl.right - anchors.right: header.right - anchors.verticalCenter: header.verticalCenter - height: parent.height + /* Rectangle { + anchors.left: parent.left + anchors.right: parent.right + height: 1 + anchors.bottom: parent.bottom + color: global.colorBorderHighight + + visible: root.isUnfold + }*/ + } - MouseArea{ - id: mousearea - anchors.fill: parent - onClicked: { - root.isUnfold = !root.isUnfold - } - } + Rectangle { + visible: root.isUnfold + + color: "transparent" + border.color: global.colorBorderLight + border.width: global.valueBorderWidth + radius: global.valueBorderRadius + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: header.bottom + anchors.bottom: root.bottom + + Column { + id: column + // anchors.top: header.bottom + anchors.left: parent.left + anchors.right: parent.right + clip: true + + // Where the propItems are added } } - - Column { - id: column - visible: root.isUnfold - anchors.top: header.bottom - anchors.left: parent.left - anchors.right: parent.right - clip: true - // Where the propItems are added - } height: header.height + isUnfold * column.height + anchors.leftMargin: global.horizontalMargin + anchors.rightMargin: global.horizontalMargin function updatePropItems() { for (var i = 0; i < root.propItems.length; i++) { diff --git a/scripts/developer/utilities/lib/prop/PropScalar.qml b/scripts/developer/utilities/lib/prop/PropScalar.qml index 29b42e2801..684dd4fed4 100644 --- a/scripts/developer/utilities/lib/prop/PropScalar.qml +++ b/scripts/developer/utilities/lib/prop/PropScalar.qml @@ -61,7 +61,6 @@ PropItem { stepSize: root.integral ? 1.0 : 0.0 anchors.left: valueLabel.right anchors.right: root.right - anchors.rightMargin: 0 anchors.verticalCenter: root.verticalCenter onValueChanged: { root.valueVarSetter(value) } diff --git a/scripts/developer/utilities/lib/prop/qmldir b/scripts/developer/utilities/lib/prop/qmldir index 3e52395dab..2cd06d58ac 100644 --- a/scripts/developer/utilities/lib/prop/qmldir +++ b/scripts/developer/utilities/lib/prop/qmldir @@ -4,6 +4,7 @@ PropText 1.0 style/PiText.qml PropLabel 1.0 style/PiLabel.qml PropSplitter 1.0 style/PiSplitter.qml PropComboBox 1.0 style/PiComboBox.qml +PropCanvasIcon 1.0 style/PiCanvasIcon.qml PropItem 1.0 PropItem.qml PropScalar 1.0 PropScalar.qml diff --git a/scripts/developer/utilities/lib/prop/style/Global.qml b/scripts/developer/utilities/lib/prop/style/Global.qml index e772477611..6066a4f99b 100644 --- a/scripts/developer/utilities/lib/prop/style/Global.qml +++ b/scripts/developer/utilities/lib/prop/style/Global.qml @@ -21,7 +21,7 @@ Item { property real lineHeight: 32 property real slimHeight: 24 - property real horizontalMargin: 2 + property real horizontalMargin: 4 property var color: hifi.colors.baseGray property var colorBackHighlight: hifi.colors.baseGrayHighlight @@ -35,6 +35,9 @@ Item { property var splitterRightWidthScale: 0.45 property real splitterWidth: 8 + + property real iconWidth: fontSize + property real iconHeight: fontSize property var labelTextAlign: Text.AlignRight property var labelTextElide: Text.ElideMiddle diff --git a/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml b/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml new file mode 100644 index 0000000000..6a805ea4c6 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml @@ -0,0 +1,50 @@ +// +// Prop/style/PiFoldCanvas.qml +// +// Created by Sam Gateau on 3/9/2019 +// Copyright 2019 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.7 +import QtQuick.Controls 2.2 + +Canvas { + Global { id: global } + + width: global.iconWidth + height: global.iconHeight + + property var icon: 0 + onIconChanged: function () { requestPaint() } + property var fillColor: global.colorBorderHighight + + contextType: "2d" + onPaint: { + context.reset(); + switch (icon) { + case 0: + case 1: + case 2: + default: { + if ((icon % 3) == 0) { + context.moveTo(width * 0.25, 0); + context.lineTo(width * 0.25, height); + context.lineTo(width, height / 2); + } else if ((icon % 3) == 1) { + context.moveTo(0, height * 0.25); + context.lineTo(width, height * 0.25); + context.lineTo(width / 2, height); + } else { + context.moveTo(0, height * 0.75); + context.lineTo(width, height* 0.75); + context.lineTo(width / 2, 0); + } + context.closePath(); + context.fillStyle = fillColor; + context.fill(); + }} + } +} \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/style/PiComboBox.qml b/scripts/developer/utilities/lib/prop/style/PiComboBox.qml index 9d002ed2b9..d9e029b702 100644 --- a/scripts/developer/utilities/lib/prop/style/PiComboBox.qml +++ b/scripts/developer/utilities/lib/prop/style/PiComboBox.qml @@ -33,28 +33,16 @@ ComboBox { highlighted: valueCombo.highlightedIndex === index } - indicator: Canvas { + indicator: PiCanvasIcon { id: canvas x: valueCombo.width - width - valueCombo.rightPadding y: valueCombo.topPadding + (valueCombo.availableHeight - height) / 2 - width: 12 - height: 8 - contextType: "2d" - Connections { + icon: 1 + /*Connections { target: valueCombo - onPressedChanged: canvas.requestPaint() - } - - onPaint: { - context.reset(); - context.moveTo(0, 0); - context.lineTo(width, 0); - context.lineTo(width / 2, height); - context.closePath(); - context.fillStyle = (valueCombo.pressed) ? global.colorBorderHighight : global.colorBorderLight; - context.fill(); - } + onPressedChanged: { canvas.icon = control.down + 1 } + }*/ } contentItem: PiText { diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index 3f6b5b5c01..89794b037e 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -8,7 +8,7 @@ // See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html // import QtQuick 2.7 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import controlsUit 1.0 as HifiControls @@ -16,86 +16,50 @@ import controlsUit 1.0 as HifiControls import "../lib/prop" as Prop import "../lib/jet/qml" as Jet - Original.ScrollView { - Prop.Global { id: prop;} - id: render; +Rectangle { anchors.fill: parent - - // color: prop.color; - - - + id: render; property var mainViewTask: Render.getConfig("RenderMainView") - Column { - anchors.left: parent.left - anchors.right: parent.right - /* Repeater { - model: [ "Tone mapping exposure:ToneMapping:exposure:5.0:-5.0", - "Tone:ToneMapping:exposure:5.0:-5.0" + Prop.Global { id: global;} + color: global.color + + ScrollView { + id: control + anchors.fill: parent + clip: true + + Column { + width: render.width + + Prop.PropEnum { + label: "Tone Curve" + object: render.mainViewTask.getConfig("ToneMapping") + property: "curve" + enums: [ + "RGB", + "SRGB", + "Reinhard", + "Filmic", ] - Prop.PropScalar { - label: qsTr(modelData.split(":")[0]) - integral: false - object: render.mainViewTask.getConfig(modelData.split(":")[1]) - property: modelData.split(":")[2] - max: modelData.split(":")[3] - min: modelData.split(":")[4] + anchors.left: parent.left + anchors.right: parent.right + } + + Jet.TaskPropView { + jobPath: "RenderMainView.ToneMapping" + label: "Le ToneMapping Job" - anchors.left: parent.left - anchors.right: parent.right + anchors.left: parent.left + anchors.right: parent.right } - } - Prop.PropEnum { - label: "Tone Curve" - object: render.mainViewTask.getConfig("ToneMapping") - property: "curve" - enums: [ - "RGB", - "SRGB", - "Reinhard", - "Filmic", - ] - anchors.left: parent.left - anchors.right: parent.right - } - Prop.PropBool { - label: "Background" - object: render.mainViewTask.getConfig("LightingModel") - property: "enableBackground" - anchors.left: parent.left - anchors.right: parent.right - }*/ - /* Prop.PropGroup { - label: "My group" - propItems: [ - {"type": "PropBool", "object": render.mainViewTask.getConfig("LightingModel"), "property": "enableBackground"}, - {"type": "PropScalar", "object": render.mainViewTask.getConfig("ToneMapping"), "property": "exposure"}, - {"type": "PropBool", "object": render.mainViewTask.getConfig("LightingModel"), "property": "enableEmissive"}, - {"type": "PropEnum", "object": render.mainViewTask.getConfig("ToneMapping"), "property": "curve", enums: [ - "RGB", - "SRGB", - "Reinhard", - "Filmic", - ]}, - ] - anchors.left: parent.left - anchors.right: parent.right - }*/ + Jet.TaskPropView { + jobPath: "RenderMainView.Antialiasing" + label: "Le Antialiasing Job" - Jet.TaskPropView { - jobPath: "RenderMainView.ToneMapping" - label: "Le ToneMapping Job" - - anchors.left: parent.left - anchors.right: parent.right - } - Jet.TaskPropView { - jobPath: "RenderMainView.Antialiasing" - label: "Le Antialiasing Job" - - anchors.left: parent.left - anchors.right: parent.right + anchors.left: parent.left + anchors.right: parent.right + } } } } \ No newline at end of file From f2fc9c010219dd97f62e6517bf48f9b60c05f019 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Tue, 12 Mar 2019 16:40:28 -0700 Subject: [PATCH 18/27] Multiple task view --- scripts/developer/utilities/lib/jet/jet.js | 10 +++- .../utilities/lib/jet/qml/TaskPropView.qml | 32 ++++++++++-- .../utilities/lib/prop/PropGroup.qml | 51 +++++++++++-------- .../developer/utilities/lib/prop/PropItem.qml | 2 +- scripts/developer/utilities/render/luci.qml | 18 +++++-- 5 files changed, 83 insertions(+), 30 deletions(-) diff --git a/scripts/developer/utilities/lib/jet/jet.js b/scripts/developer/utilities/lib/jet/jet.js index 40563e4b2c..52c13c5279 100644 --- a/scripts/developer/utilities/lib/jet/jet.js +++ b/scripts/developer/utilities/lib/jet/jet.js @@ -10,7 +10,12 @@ // "use strict"; - // traverse task tree + // traverse task tree recursively + // + // @param root: the root job config from where to traverse + // @param functor: the functor function() which is applied on every subjobs of root traversed + // if return true, then 'task_tree' is called recursively on that subjob + // @param depth: the depth of the recurse loop since the initial call. function task_traverse(root, functor, depth) { if (root.isTask()) { depth++; @@ -22,6 +27,9 @@ function task_traverse(root, functor, depth) { } } } + +// same function as 'task_traverse' with the depth being 0 +// and visisting the root job first. function task_traverseTree(root, functor) { if (functor(root, 0, 0)) { task_traverse(root, functor, 0) diff --git a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml index 2188df7cc0..af4cbb1c9a 100644 --- a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml +++ b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml @@ -1,5 +1,5 @@ // -// jet/TaskListView.qml +// jet/TaskPropView.qml // // Created by Sam Gateau, 2018/05/09 // Copyright 2018 High Fidelity, Inc. @@ -27,13 +27,37 @@ Prop.PropGroup { property var jobPath: "" property alias label: root.label - Component.onCompleted: { + function populatePropItems() { + var propsModel = [] var props = Jet.job_propKeys(rootConfig.getConfig(jobPath)); console.log(JSON.stringify(props)); for (var p in props) { - root.propItems.push({"object": rootConfig.getConfig(jobPath), "property":props[p] }) + propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p] }) } - root.updatePropItems(); + root.updatePropItems(propsModel); + + + Jet.task_traverse(rootConfig.getConfig(jobPath), + function(job, depth, index) { + var component = Qt.createComponent("./TaskPropView.qml"); + component.createObject(root.propItemsPanel, { + "label": job.objectName, + "rootConfig": root.rootConfig, + "jobPath": root.jobPath + '.' + job.objectName + }) + /* var component = Qt.createComponent("../../prop/PropItem.qml"); + component.createObject(root.propItemsPanel, { + "label": root.jobPath + '.' + job.objectName + ' num=' + index, + })*/ + // propsModel.push({"type": "printLabel", "label": root.jobPath + '.' + job.objectName + ' num=' + index }) + + return (depth < 1); + }, 0) + + } + + Component.onCompleted: { + populatePropItems() } diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 4465ec420e..544a687f70 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -13,20 +13,12 @@ import QtQuick 2.7 Item { Global { id: global } id: root - - // Prop Group is designed to author an array of ProItems, they are defined with an array of the tuplets describing each individual item: - // [ ..., PropItemInfo, ...] - // PropItemInfo { - // type: "PropXXXX", object: JSobject, property: "propName" - // } - // - property var propItems: [] - property var label: "group" property alias isUnfold: headerRect.icon - + property alias propItemsPanel: propItemsContainer + Item { id: header height: global.slimHeight @@ -89,7 +81,7 @@ Item { anchors.bottom: root.bottom Column { - id: column + id: propItemsContainer // anchors.top: header.bottom anchors.left: parent.left anchors.right: parent.right @@ -99,13 +91,22 @@ Item { } } - height: header.height + isUnfold * column.height + height: header.height + isUnfold * propItemsContainer.height anchors.leftMargin: global.horizontalMargin anchors.rightMargin: global.horizontalMargin + anchors.left: parent.left + anchors.right: parent.right - function updatePropItems() { - for (var i = 0; i < root.propItems.length; i++) { - var proItem = root.propItems[i]; + + // Prop Group is designed to author an array of ProItems, they are defined with an array of the tuplets describing each individual item: + // [ ..., PropItemInfo, ...] + // PropItemInfo { + // type: "PropXXXX", object: JSobject, property: "propName" + // } + // + function updatePropItems(propItemsModel) { + for (var i = 0; i < propItemsModel.length; i++) { + var proItem = propItemsModel[i]; // valid object if (proItem['object'] !== undefined && proItem['object'] !== null ) { // valid property @@ -118,7 +119,7 @@ Item { case 'boolean': case 'PropBool': { var component = Qt.createComponent("PropBool.qml"); - component.createObject(column, { + component.createObject(propItemsContainer, { "label": proItem.property, "object": proItem.object, "property": proItem.property @@ -127,7 +128,7 @@ Item { case 'number': case 'PropScalar': { var component = Qt.createComponent("PropScalar.qml"); - component.createObject(column, { + component.createObject(propItemsContainer, { "label": proItem.property, "object": proItem.object, "property": proItem.property, @@ -138,7 +139,7 @@ Item { } break; case 'PropEnum': { var component = Qt.createComponent("PropEnum.qml"); - component.createObject(column, { + component.createObject(propItemsContainer, { "label": proItem.property, "object": proItem.object, "property": proItem.property, @@ -147,22 +148,32 @@ Item { } break; case 'object': { var component = Qt.createComponent("PropItem.qml"); - component.createObject(column, { + component.createObject(propItemsContainer, { "label": proItem.property, "object": proItem.object, "property": proItem.property, }) } break; + case 'printLabel': { + var component = Qt.createComponent("PropItem.qml"); + component.createObject(propItemsContainer, { + "label": proItem.property + }) + } break; } } else { console.log('Invalid property: ' + JSON.stringify(proItem)); } + } else if (proItem['type'] === 'printLabel') { + var component = Qt.createComponent("PropItem.qml"); + component.createObject(propItemsContainer, { + "label": proItem.label + }) } else { console.log('Invalid object: ' + JSON.stringify(proItem)); } } } Component.onCompleted: { - updatePropItems(); } } diff --git a/scripts/developer/utilities/lib/prop/PropItem.qml b/scripts/developer/utilities/lib/prop/PropItem.qml index 00314512f2..339ff10422 100644 --- a/scripts/developer/utilities/lib/prop/PropItem.qml +++ b/scripts/developer/utilities/lib/prop/PropItem.qml @@ -16,7 +16,7 @@ Item { id: root // Prop item is designed to author an object[property]: - property var object: NULL + property var object: {} property string property: "" // value is accessed through the "valueVarSetter" and "valueVarGetter" diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index 89794b037e..85ca69e998 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -32,7 +32,7 @@ Rectangle { Column { width: render.width - Prop.PropEnum { + /* Prop.PropEnum { label: "Tone Curve" object: render.mainViewTask.getConfig("ToneMapping") property: "curve" @@ -44,9 +44,16 @@ Rectangle { ] anchors.left: parent.left anchors.right: parent.right - } - + } */ Jet.TaskPropView { + id: "the" + jobPath: "RenderMainView.RenderDeferredTask" + label: "Le Render Deferred Job" + + anchors.left: parent.left + anchors.right: parent.right + } + /* Jet.TaskPropView { jobPath: "RenderMainView.ToneMapping" label: "Le ToneMapping Job" @@ -59,7 +66,10 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right - } + }*/ } } + + Component.onCompleted: { + } } \ No newline at end of file From 9581f5c958c17b830b617f87c0953ed7bb7b4e50 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 5 Apr 2019 08:44:49 -0700 Subject: [PATCH 19/27] separating the group header container --- .../utilities/lib/prop/PropGroup.qml | 43 +++++++++++-------- scripts/developer/utilities/render/luci.qml | 16 +++++++ 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 544a687f70..f4b1ba02d6 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -16,24 +16,27 @@ Item { property var label: "group" - property alias isUnfold: headerRect.icon + property alias isUnfold: headerFolderIcon.icon property alias propItemsPanel: propItemsContainer + property alias headerContainer: headerContainer + // Header Item Item { id: header height: global.slimHeight anchors.left: parent.left anchors.right: parent.right + // First in the header, the folder button / indicator Item { - id: folder + id: headerFolder anchors.left: header.left - width: headerRect.width * 2 + width: headerFolderIcon.width * 2 anchors.verticalCenter: header.verticalCenter height: parent.height PropCanvasIcon { - id: headerRect + id: headerFolderIcon anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter @@ -47,26 +50,28 @@ Item { } } - PropLabel { - id: labelControl - anchors.left: folder.right + // Next the header container + // by default containing a Label showing the root.label + Item { + id: headerContainer + anchors.left: headerFolder.right anchors.right: header.right anchors.verticalCenter: header.verticalCenter - text: root.label - horizontalAlignment: Text.AlignHCenter - } + height: parent.height - /* Rectangle { - anchors.left: parent.left - anchors.right: parent.right - height: 1 - anchors.bottom: parent.bottom - color: global.colorBorderHighight - - visible: root.isUnfold - }*/ + PropLabel { + id: labelControl + anchors.left: headerContainer.left + anchors.right: headerContainer.right + anchors.verticalCenter: headerContainer.verticalCenter + text: root.label + horizontalAlignment: Text.AlignHCenter + } + + } } + // The Panel container Rectangle { visible: root.isUnfold diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index 85ca69e998..8c68d654a1 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -45,6 +45,22 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right } */ + Jet.TaskPropView { + id: "lightingModel" + jobPath: "RenderMainView.LightingModel" + label: "Le LightingModel" + + anchors.left: parent.left + anchors.right: parent.right + } + Jet.TaskPropView { + id: "theView" + jobPath: "RenderMainView" + label: "Le Render Main View" + + anchors.left: parent.left + anchors.right: parent.right + } Jet.TaskPropView { id: "the" jobPath: "RenderMainView.RenderDeferredTask" From e7e9715e106949a7a2a7bd0c91b0d92d0f4fe633 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 15 Apr 2019 09:16:59 -0700 Subject: [PATCH 20/27] merging up --- .../utilities/lib/jet/qml/TaskPropView.qml | 47 +++++++++++-------- .../utilities/lib/prop/PropGroup.qml | 18 ++++--- .../utilities/lib/prop/style/Global.qml | 46 +++++++++--------- .../utilities/lib/prop/style/PiCanvasIcon.qml | 10 +++- scripts/developer/utilities/render/luci2.js | 21 ++++----- 5 files changed, 81 insertions(+), 61 deletions(-) diff --git a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml index af4cbb1c9a..be3cda66b3 100644 --- a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml +++ b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml @@ -27,33 +27,40 @@ Prop.PropGroup { property var jobPath: "" property alias label: root.label + property var showProps: true + property var showSubs: true + function populatePropItems() { var propsModel = [] var props = Jet.job_propKeys(rootConfig.getConfig(jobPath)); console.log(JSON.stringify(props)); - for (var p in props) { - propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p] }) + if (showProps) { + for (var p in props) { + propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p] }) + } + root.updatePropItems(propsModel); } - root.updatePropItems(propsModel); - - Jet.task_traverse(rootConfig.getConfig(jobPath), - function(job, depth, index) { - var component = Qt.createComponent("./TaskPropView.qml"); - component.createObject(root.propItemsPanel, { - "label": job.objectName, - "rootConfig": root.rootConfig, - "jobPath": root.jobPath + '.' + job.objectName - }) - /* var component = Qt.createComponent("../../prop/PropItem.qml"); - component.createObject(root.propItemsPanel, { - "label": root.jobPath + '.' + job.objectName + ' num=' + index, - })*/ - // propsModel.push({"type": "printLabel", "label": root.jobPath + '.' + job.objectName + ' num=' + index }) - - return (depth < 1); - }, 0) + if (showSubs) { + Jet.task_traverse(rootConfig.getConfig(jobPath), + function(job, depth, index) { + var component = Qt.createComponent("./TaskPropView.qml"); + component.createObject(root.propItemsPanel, { + "label": job.objectName, + "rootConfig": root.rootConfig, + "jobPath": root.jobPath + '.' + job.objectName, + "showProps": root.showProps, + "showSubs": root.showSubs + }) + /* var component = Qt.createComponent("../../prop/PropItem.qml"); + component.createObject(root.propItemsPanel, { + "label": root.jobPath + '.' + job.objectName + ' num=' + index, + })*/ + // propsModel.push({"type": "printLabel", "label": root.jobPath + '.' + job.objectName + ' num=' + index }) + return (depth < 1); + }, 0) + } } Component.onCompleted: { diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index f4b1ba02d6..4c37eecc80 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -18,7 +18,7 @@ Item { property alias isUnfold: headerFolderIcon.icon property alias propItemsPanel: propItemsContainer - property alias headerContainer: headerContainer + default property alias extHeader: headerContainer.data // Header Item Item { @@ -39,7 +39,9 @@ Item { id: headerFolderIcon anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - + fillColor: global.colorOrangeAccent + filled: root.propItemsPanel.height > 4 + MouseArea{ id: mousearea anchors.fill: parent @@ -80,6 +82,7 @@ Item { border.width: global.valueBorderWidth radius: global.valueBorderRadius + anchors.margins: 0 anchors.left: parent.left anchors.right: parent.right anchors.top: header.bottom @@ -87,9 +90,11 @@ Item { Column { id: propItemsContainer - // anchors.top: header.bottom anchors.left: parent.left - anchors.right: parent.right + anchors.right: parent.right + anchors.leftMargin: 0 + anchors.rightMargin: 0 + clip: true // Where the propItems are added @@ -97,8 +102,9 @@ Item { } height: header.height + isUnfold * propItemsContainer.height - anchors.leftMargin: global.horizontalMargin - anchors.rightMargin: global.horizontalMargin +// anchors.leftMargin: global.horizontalMargin +// anchors.rightMargin: global.horizontalMargin + anchors.margins: 0 anchors.left: parent.left anchors.right: parent.right diff --git a/scripts/developer/utilities/lib/prop/style/Global.qml b/scripts/developer/utilities/lib/prop/style/Global.qml index 6066a4f99b..e348338df1 100644 --- a/scripts/developer/utilities/lib/prop/style/Global.qml +++ b/scripts/developer/utilities/lib/prop/style/Global.qml @@ -18,32 +18,36 @@ Item { HifiConstants { id: hifi } id: root - property real lineHeight: 32 - property real slimHeight: 24 + readonly property real lineHeight: 32 + readonly property real slimHeight: 24 - property real horizontalMargin: 4 + readonly property real horizontalMargin: 4 - property var color: hifi.colors.baseGray - property var colorBackHighlight: hifi.colors.baseGrayHighlight - property var colorBorderLight: hifi.colors.lightGray - property var colorBorderHighight: hifi.colors.blueHighlight + readonly property color color: hifi.colors.baseGray + readonly property color colorBackHighlight: hifi.colors.baseGrayHighlight + readonly property color colorBorderLight: hifi.colors.lightGray + readonly property color colorBorderHighight: hifi.colors.blueHighlight - property real fontSize: 12 - property var fontFamily: "Raleway" - property var fontWeight: Font.DemiBold - property var fontColor: hifi.colors.faintGray + readonly property color colorOrangeAccent: "#FF6309" + readonly property color colorRedAccent: "#C62147" + readonly property color colorGreenHighlight: "#1ac567" - property var splitterRightWidthScale: 0.45 - property real splitterWidth: 8 + readonly property real fontSize: 12 + readonly property var fontFamily: "Raleway" + readonly property var fontWeight: Font.DemiBold + readonly property color fontColor: hifi.colors.faintGray - property real iconWidth: fontSize - property real iconHeight: fontSize + readonly property var splitterRightWidthScale: 0.45 + readonly property real splitterWidth: 8 + + readonly property real iconWidth: fontSize + readonly property real iconHeight: fontSize - property var labelTextAlign: Text.AlignRight - property var labelTextElide: Text.ElideMiddle + readonly property var labelTextAlign: Text.AlignRight + readonly property var labelTextElide: Text.ElideMiddle - property var valueAreaWidthScale: 0.3 * (1.0 - splitterRightWidthScale) - property var valueTextAlign: Text.AlignHCenter - property real valueBorderWidth: 1 - property real valueBorderRadius: 2 + readonly property var valueAreaWidthScale: 0.3 * (1.0 - splitterRightWidthScale) + readonly property var valueTextAlign: Text.AlignHCenter + readonly property real valueBorderWidth: 1 + readonly property real valueBorderRadius: 2 } \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml b/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml index 6a805ea4c6..b8e80f1c3b 100644 --- a/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml +++ b/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml @@ -18,6 +18,7 @@ Canvas { height: global.iconHeight property var icon: 0 + property var filled: true onIconChanged: function () { requestPaint() } property var fillColor: global.colorBorderHighight @@ -43,8 +44,13 @@ Canvas { context.lineTo(width / 2, 0); } context.closePath(); - context.fillStyle = fillColor; - context.fill(); + if (filled) { + context.fillStyle = fillColor; + context.fill(); + } else { + context.strokeStyle = fillColor; + context.stroke(); + } }} } } \ No newline at end of file diff --git a/scripts/developer/utilities/render/luci2.js b/scripts/developer/utilities/render/luci2.js index 4aea49a059..d6bb005795 100644 --- a/scripts/developer/utilities/render/luci2.js +++ b/scripts/developer/utilities/render/luci2.js @@ -1,13 +1,10 @@ -function openEngineTaskView() { +function openView() { // Set up the qml ui - var qml = Script.resolvePath('luci.qml'); - var window = new OverlayWindow({ - title: 'luci qml', - source: qml, - width: 300, - height: 400 - }); - window.setPosition(200, 50); - //window.closed.connect(function() { Script.stop(); }); - } - openEngineTaskView(); \ No newline at end of file + var window = Desktop.createWindow(Script.resolvePath('luci.qml'), { + title: this.title, + presentationMode: Desktop.PresentationMode.NATIVE, + size: {x: 300, y: 400} + }); + //window.closed.connect(function() { Script.stop(); }); +} +openView(); \ No newline at end of file From f2b747a68da13937ff85af386fc6c130f95890db Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Tue, 16 Apr 2019 18:15:00 -0700 Subject: [PATCH 21/27] Adding indentation of the folder in the header and refining background color --- .../utilities/lib/jet/qml/TaskPropView.qml | 6 ++++-- .../utilities/lib/prop/PropGroup.qml | 19 ++++++++++++++++--- .../utilities/lib/prop/style/Global.qml | 1 + 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml index be3cda66b3..9f64f12291 100644 --- a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml +++ b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml @@ -26,6 +26,7 @@ Prop.PropGroup { property var rootConfig : Render property var jobPath: "" property alias label: root.label + property alias indentDepth: root.indentDepth property var showProps: true property var showSubs: true @@ -33,7 +34,7 @@ Prop.PropGroup { function populatePropItems() { var propsModel = [] var props = Jet.job_propKeys(rootConfig.getConfig(jobPath)); - console.log(JSON.stringify(props)); + // console.log(JSON.stringify(props)); if (showProps) { for (var p in props) { propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p] }) @@ -50,7 +51,8 @@ Prop.PropGroup { "rootConfig": root.rootConfig, "jobPath": root.jobPath + '.' + job.objectName, "showProps": root.showProps, - "showSubs": root.showSubs + "showSubs": root.showSubs, + "indentDepth": root.indentDepth + 1, }) /* var component = Qt.createComponent("../../prop/PropItem.qml"); component.createObject(root.propItemsPanel, { diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 4c37eecc80..a4e192308d 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -17,20 +17,33 @@ Item { property var label: "group" property alias isUnfold: headerFolderIcon.icon + property var indentDepth: 0 + property alias propItemsPanel: propItemsContainer default property alias extHeader: headerContainer.data // Header Item - Item { + Rectangle { id: header height: global.slimHeight anchors.left: parent.left anchors.right: parent.right - // First in the header, the folder button / indicator + color: global.colorBackShadow // header of group is darker + + // First in the header, some indentation spacer + Item { + id: indentSpacer + width: (headerFolderIcon.width * root.indentDepth) + global.horizontalMargin // Must be non-zero + height: parent.height + + anchors.verticalCenter: parent.verticalCenter + } + + // Second, the folder button / indicator Item { id: headerFolder - anchors.left: header.left + anchors.left: indentSpacer.right width: headerFolderIcon.width * 2 anchors.verticalCenter: header.verticalCenter height: parent.height diff --git a/scripts/developer/utilities/lib/prop/style/Global.qml b/scripts/developer/utilities/lib/prop/style/Global.qml index e348338df1..4cdee70244 100644 --- a/scripts/developer/utilities/lib/prop/style/Global.qml +++ b/scripts/developer/utilities/lib/prop/style/Global.qml @@ -24,6 +24,7 @@ Item { readonly property real horizontalMargin: 4 readonly property color color: hifi.colors.baseGray + readonly property color colorBackShadow: hifi.colors.baseGrayShadow readonly property color colorBackHighlight: hifi.colors.baseGrayHighlight readonly property color colorBorderLight: hifi.colors.lightGray readonly property color colorBorderHighight: hifi.colors.blueHighlight From 4ce7d75720ee92015037f6fd0b10edb2d0ea5a61 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Tue, 16 Apr 2019 23:38:40 -0700 Subject: [PATCH 22/27] FInding a path --- .../utilities/lib/jet/qml/TaskPropView.qml | 30 +++++++++++++++++++ .../utilities/lib/prop/PropGroup.qml | 27 ++++++++--------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml index 9f64f12291..2f7ee71a5f 100644 --- a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml +++ b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml @@ -30,6 +30,36 @@ Prop.PropGroup { property var showProps: true property var showSubs: true + property var jobEnabled: true + + // Panel Header Data Component + panelHeaderData: Component { + Item { + id: header + Prop.PropLabel { + text: root.label + horizontalAlignment: Text.AlignHCenter + anchors.left: parent.left + anchors.right: enabledIcon.left + anchors.verticalCenter: parent.verticalCenter + } + Prop.PropCanvasIcon { + id: enabledIcon + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + fillColor: global.colorOrangeAccent + filled: jobEnabled + + MouseArea{ + id: mousearea + anchors.fill: parent + onClicked: { + root.jobEnabled = !root.jobEnabled + } + } + } + } + } function populatePropItems() { var propsModel = [] diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index a4e192308d..6836e85e25 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -20,7 +20,16 @@ Item { property var indentDepth: 0 property alias propItemsPanel: propItemsContainer - default property alias extHeader: headerContainer.data + + // Panel Header Data Component + property Component panelHeaderData: defaultPanelHeaderData + Component { // default is a Label + id: defaultPanelHeaderData + PropLabel { + text: root.label + horizontalAlignment: Text.AlignHCenter + } + } // Header Item Rectangle { @@ -67,22 +76,12 @@ Item { // Next the header container // by default containing a Label showing the root.label - Item { - id: headerContainer + Loader { + sourceComponent: panelHeaderData anchors.left: headerFolder.right anchors.right: header.right anchors.verticalCenter: header.verticalCenter height: parent.height - - PropLabel { - id: labelControl - anchors.left: headerContainer.left - anchors.right: headerContainer.right - anchors.verticalCenter: headerContainer.verticalCenter - text: root.label - horizontalAlignment: Text.AlignHCenter - } - } } @@ -115,8 +114,6 @@ Item { } height: header.height + isUnfold * propItemsContainer.height -// anchors.leftMargin: global.horizontalMargin -// anchors.rightMargin: global.horizontalMargin anchors.margins: 0 anchors.left: parent.left anchors.right: parent.right From 9873c10353486c861dd1c484e9a4b6e63655cc4b Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 17 Apr 2019 17:58:48 -0700 Subject: [PATCH 23/27] Better canvas ICon qml and activation of the jobs --- .../utilities/lib/jet/qml/TaskPropView.qml | 33 +++++--- .../utilities/lib/prop/PropGroup.qml | 9 +-- .../utilities/lib/prop/style/PiCanvasIcon.qml | 80 +++++++++++++++---- 3 files changed, 85 insertions(+), 37 deletions(-) diff --git a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml index 2f7ee71a5f..e53932a9f9 100644 --- a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml +++ b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml @@ -32,31 +32,40 @@ Prop.PropGroup { property var showSubs: true property var jobEnabled: true + property var toggleJobActivation: function() { + console.log("the button has been pressed and jobEnabled is " + jobEnabled ) + jobEnabled = !jobEnabled; + rootConfig.getConfig(jobPath).enabled = jobEnabled; + } + // Panel Header Data Component panelHeaderData: Component { Item { id: header Prop.PropLabel { text: root.label - horizontalAlignment: Text.AlignHCenter + //horizontalAlignment: Text.AlignHCenter anchors.left: parent.left anchors.right: enabledIcon.left anchors.verticalCenter: parent.verticalCenter - } + } Prop.PropCanvasIcon { id: enabledIcon + anchors.right: enabledIcon2.left + anchors.verticalCenter: parent.verticalCenter + filled: root.jobEnabled + fillColor: (root.jobEnabled ? global.colorGreenHighlight : global.colorOrangeAccent) + icon: 5 + iconMouseArea.onClicked: { toggleJobActivation() } + } + Prop.PropCanvasIcon { + id: enabledIcon2 anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - fillColor: global.colorOrangeAccent - filled: jobEnabled - - MouseArea{ - id: mousearea - anchors.fill: parent - onClicked: { - root.jobEnabled = !root.jobEnabled - } - } + filled: root.jobEnabled + fillColor: (root.jobEnabled ? global.colorGreenHighlight : global.colorOrangeAccent) + icon: 7 + iconMouseArea.onClicked: { toggleJobActivation() } } } } diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 6836e85e25..38f19389aa 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -63,14 +63,7 @@ Item { anchors.verticalCenter: parent.verticalCenter fillColor: global.colorOrangeAccent filled: root.propItemsPanel.height > 4 - - MouseArea{ - id: mousearea - anchors.fill: parent - onClicked: { - root.isUnfold = !root.isUnfold - } - } + iconMouseArea.onClicked: { root.isUnfold = !root.isUnfold } } } diff --git a/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml b/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml index b8e80f1c3b..3feed342b8 100644 --- a/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml +++ b/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml @@ -18,39 +18,85 @@ Canvas { height: global.iconHeight property var icon: 0 + + onIconChanged: function () { //console.log("Icon changed to: " + icon ); + requestPaint() + } + property var filled: true - onIconChanged: function () { requestPaint() } + onFilledChanged: function () { //console.log("Filled changed to: " + filled ); + requestPaint() + } + property var fillColor: global.colorBorderHighight + onFillColorChanged: function () { //console.log("fillColor changed to: " + filled ); + requestPaint() + } + + property alias iconMouseArea: mousearea contextType: "2d" onPaint: { context.reset(); switch (icon) { - case 0: - case 1: - case 2: - default: { - if ((icon % 3) == 0) { + case false: + case 0:{ // Right Arrow context.moveTo(width * 0.25, 0); context.lineTo(width * 0.25, height); context.lineTo(width, height / 2); - } else if ((icon % 3) == 1) { + context.closePath(); + } break; + case true: + case 1:{ // Up Arrow context.moveTo(0, height * 0.25); context.lineTo(width, height * 0.25); context.lineTo(width / 2, height); - } else { + context.closePath(); + } break; + case 2:{ // Down Arrow context.moveTo(0, height * 0.75); context.lineTo(width, height* 0.75); context.lineTo(width / 2, 0); + context.closePath(); + } break; + case 3:{ // Left Arrow + context.moveTo(width * 0.75, 0); + context.lineTo(width * 0.75, height); + context.lineTo(0, height / 2); + context.closePath(); + } break; + case 4:{ // Square + context.moveTo(0,0); + context.lineTo(0, height); + context.lineTo(width, height); + context.lineTo(width, 0); + context.closePath(); + } break; + case 5:{ // Small Square + context.moveTo(width * 0.25, height * 0.25); + context.lineTo(width * 0.25, height * 0.75); + context.lineTo(width * 0.75, height * 0.75); + context.lineTo(width * 0.75, height * 0.25); + context.closePath(); + } break; + default: {// Down Arrow + /* context.moveTo(0, height * 0.25); + context.lineTo(width, height * 0.25); + context.lineTo(width / 2, height); + context.closePath();*/ } - context.closePath(); - if (filled) { - context.fillStyle = fillColor; - context.fill(); - } else { - context.strokeStyle = fillColor; - context.stroke(); - } - }} + } + if (filled) { + context.fillStyle = fillColor; + context.fill(); + } else { + context.strokeStyle = fillColor; + context.stroke(); + } + } + + MouseArea{ + id: mousearea + anchors.fill: parent } } \ No newline at end of file From 3d78592bb84ddc417bfde7f8acb83e98dd32eaed Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 18 Apr 2019 00:19:19 -0700 Subject: [PATCH 24/27] Adding more style widgets andbringing luci1 into the panels of luci2 --- .../developer/utilities/lib/prop/PropBool.qml | 4 +- .../utilities/lib/prop/PropGroup.qml | 30 +++- scripts/developer/utilities/lib/prop/qmldir | 2 + .../utilities/lib/prop/style/PiCheckBox.qml | 25 ++++ .../lib/prop/style/PiFolderPanel.qml | 133 ++++++++++++++++++ .../utilities/render/deferredLighting.qml | 71 +--------- scripts/developer/utilities/render/luci.qml | 32 ++--- .../utilities/render/luci/ShadingModel.qml | 105 ++++++++++++++ .../developer/utilities/render/luci/qmldir | 2 + 9 files changed, 306 insertions(+), 98 deletions(-) create mode 100644 scripts/developer/utilities/lib/prop/style/PiCheckBox.qml create mode 100644 scripts/developer/utilities/lib/prop/style/PiFolderPanel.qml create mode 100644 scripts/developer/utilities/render/luci/ShadingModel.qml create mode 100644 scripts/developer/utilities/render/luci/qmldir diff --git a/scripts/developer/utilities/lib/prop/PropBool.qml b/scripts/developer/utilities/lib/prop/PropBool.qml index d8e4bad589..1d50ec7dd3 100644 --- a/scripts/developer/utilities/lib/prop/PropBool.qml +++ b/scripts/developer/utilities/lib/prop/PropBool.qml @@ -9,7 +9,6 @@ // import QtQuick 2.7 -import controlsUit 1.0 as HifiControls PropItem { Global { id: global } @@ -21,13 +20,12 @@ PropItem { valueVar = root.valueVarGetter(); } - HifiControls.CheckBox { + PropCheckBox { id: checkboxControl anchors.left: root.splitter.right anchors.verticalCenter: root.verticalCenter width: root.width * global.valueAreaWidthScale - height: global.slimHeight onCheckedChanged: { root.valueVarSetter(checked); } } diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 38f19389aa..2f15e60a0c 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -10,19 +10,35 @@ import QtQuick 2.7 -Item { +//Item { +PropFolderPanel { Global { id: global } id: root - property var label: "group" + // property var label: "group" - property alias isUnfold: headerFolderIcon.icon - property var indentDepth: 0 + // property alias isUnfold: headerFolderIcon.icon + // property var indentDepth: 0 - property alias propItemsPanel: propItemsContainer + //property alias propItemsPanel: _panelFrameData + // property alias propItemsPanel: propItemsContainer + //property var propItemsPanel: propItemsContainer + + panelFrameData: Component { // default is a column + id: groupPanelFrameData + Column { + id: propItemsContainer + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 0 + anchors.rightMargin: 0 + + clip: true + } + } // Panel Header Data Component - property Component panelHeaderData: defaultPanelHeaderData +/* property Component panelHeaderData: defaultPanelHeaderData Component { // default is a Label id: defaultPanelHeaderData PropLabel { @@ -110,7 +126,7 @@ Item { anchors.margins: 0 anchors.left: parent.left anchors.right: parent.right - +*/ // Prop Group is designed to author an array of ProItems, they are defined with an array of the tuplets describing each individual item: // [ ..., PropItemInfo, ...] diff --git a/scripts/developer/utilities/lib/prop/qmldir b/scripts/developer/utilities/lib/prop/qmldir index 2cd06d58ac..c67ab6a41a 100644 --- a/scripts/developer/utilities/lib/prop/qmldir +++ b/scripts/developer/utilities/lib/prop/qmldir @@ -5,6 +5,8 @@ PropLabel 1.0 style/PiLabel.qml PropSplitter 1.0 style/PiSplitter.qml PropComboBox 1.0 style/PiComboBox.qml PropCanvasIcon 1.0 style/PiCanvasIcon.qml +PropCheckBox 1.0 style/PiCheckBox.qml +PropFolderPanel 1.0 style/PiFolderPanel.qml PropItem 1.0 PropItem.qml PropScalar 1.0 PropScalar.qml diff --git a/scripts/developer/utilities/lib/prop/style/PiCheckBox.qml b/scripts/developer/utilities/lib/prop/style/PiCheckBox.qml new file mode 100644 index 0000000000..108a763be3 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/style/PiCheckBox.qml @@ -0,0 +1,25 @@ +// +// Prop/style/PiCheckBox.qml +// +// Created by Sam Gateau on 3/2/2019 +// Copyright 2019 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.7 +import controlsUit 1.0 as HifiControls + +HifiControls.CheckBox { + Global { id: global } + + color: global.fontColor + + //anchors.left: root.splitter.right + //anchors.verticalCenter: root.verticalCenter + //width: root.width * global.valueAreaWidthScale + height: global.slimHeight + + onCheckedChanged: { root.valueVarSetter(checked); } +} \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/style/PiFolderPanel.qml b/scripts/developer/utilities/lib/prop/style/PiFolderPanel.qml new file mode 100644 index 0000000000..b80ab47fc6 --- /dev/null +++ b/scripts/developer/utilities/lib/prop/style/PiFolderPanel.qml @@ -0,0 +1,133 @@ +// +// Prop/style/PiFoldedPanel.qml +// +// Created by Sam Gateau on 4/17/2019 +// Copyright 2019 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.7 + +Item { + Global { id: global } + id: root + + property var label: "panel" + + property alias isUnfold: headerFolderIcon.icon + property var indentDepth: 0 + + // Panel Header Data Component + property Component panelHeaderData: defaultPanelHeaderData + Component { // default is a Label + id: defaultPanelHeaderData + PiLabel { + text: root.label + horizontalAlignment: Text.AlignHCenter + } + } + + // Panel Frame Data Component + property Component panelFrameData: defaultPanelFrameData + Component { // default is a column + id: defaultPanelFrameData + Column { + } + } + + //property alias panelFrameContent: frame._panelFrameData.data + + // Header Item + Rectangle { + id: header + height: global.slimHeight + anchors.left: parent.left + anchors.right: parent.right + + color: global.colorBackShadow // header of group is darker + + // First in the header, some indentation spacer + Item { + id: indentSpacer + width: (headerFolderIcon.width * root.indentDepth) + global.horizontalMargin // Must be non-zero + height: parent.height + + anchors.verticalCenter: parent.verticalCenter + } + + // Second, the folder button / indicator + Item { + id: headerFolder + anchors.left: indentSpacer.right + width: headerFolderIcon.width * 2 + anchors.verticalCenter: header.verticalCenter + height: parent.height + + PiCanvasIcon { + id: headerFolderIcon + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + fillColor: global.colorOrangeAccent + filled: root.frame.height > 4 + iconMouseArea.onClicked: { root.isUnfold = !root.isUnfold } + } + } + + // Next the header container + // by default containing a Label showing the root.label + Loader { + sourceComponent: panelHeaderData + anchors.left: headerFolder.right + anchors.right: header.right + anchors.verticalCenter: header.verticalCenter + height: parent.height + } + } + + // The Panel container + Rectangle { + id: frame + visible: root.isUnfold + + color: "transparent" + border.color: global.colorBorderLight + border.width: global.valueBorderWidth + radius: global.valueBorderRadius + + anchors.margins: 0 + anchors.left: parent.left + anchors.right: parent.right + anchors.top: header.bottom + anchors.bottom: root.bottom + + // Next the panel frame data + Loader { + sourceComponent: panelFrameData + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 0 + anchors.rightMargin: 0 + id: _panelFrameData + clip: true + } + + /* Column { + id: propItemsContainer + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 0 + anchors.rightMargin: 0 + + clip: true + + // Where the propItems are added + }*/ + } + + height: header.height + isUnfold * _panelFrameData.height + anchors.margins: 0 + anchors.left: parent.left + anchors.right: parent.right +} \ No newline at end of file diff --git a/scripts/developer/utilities/render/deferredLighting.qml b/scripts/developer/utilities/render/deferredLighting.qml index d147585212..63c2af1b0f 100644 --- a/scripts/developer/utilities/render/deferredLighting.qml +++ b/scripts/developer/utilities/render/deferredLighting.qml @@ -14,6 +14,7 @@ import QtQuick.Layouts 1.3 import stylesUit 1.0 import controlsUit 1.0 as HifiControls import "configSlider" +import "luci" Rectangle { HifiConstants { id: hifi;} @@ -32,76 +33,8 @@ Rectangle { HifiControls.Label { text: "Shading" } - Row { - anchors.left: parent.left - anchors.right: parent.right - - spacing: 5 - Column { - spacing: 5 - // padding: 10 - Repeater { - model: [ - "Unlit:LightingModel:enableUnlit", - "Emissive:LightingModel:enableEmissive", - "Lightmap:LightingModel:enableLightmap", - "Background:LightingModel:enableBackground", - "Haze:LightingModel:enableHaze", - "AO:LightingModel:enableAmbientOcclusion", - "Textures:LightingModel:enableMaterialTexturing" - ] - HifiControls.CheckBox { - boxSize: 20 - text: modelData.split(":")[0] - checked: render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] - onCheckedChanged: { render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } - } - } - } + ShadingModel { - - Column { - spacing: 5 - Repeater { - model: [ - "Obscurance:LightingModel:enableObscurance", - "Scattering:LightingModel:enableScattering", - "Diffuse:LightingModel:enableDiffuse", - "Specular:LightingModel:enableSpecular", - "Albedo:LightingModel:enableAlbedo", - "Wireframe:LightingModel:enableWireframe", - "Skinning:LightingModel:enableSkinning", - "Blendshape:LightingModel:enableBlendshape" - ] - HifiControls.CheckBox { - boxSize: 20 - text: modelData.split(":")[0] - checked: render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] - onCheckedChanged: { render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } - } - } - } - - Column { - spacing: 5 - Repeater { - model: [ - "Ambient:LightingModel:enableAmbientLight", - "Directional:LightingModel:enableDirectionalLight", - "Point:LightingModel:enablePointLight", - "Spot:LightingModel:enableSpotLight", - "Light Contour:LightingModel:showLightContour", - "Zone Stack:DrawZoneStack:enabled", - "Shadow:LightingModel:enableShadow" - ] - HifiControls.CheckBox { - boxSize: 20 - text: modelData.split(":")[0] - checked: render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] - onCheckedChanged: { render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } - } - } - } } Separator {} Column { diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index 8c68d654a1..7bce087fda 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -15,6 +15,7 @@ import controlsUit 1.0 as HifiControls import "../lib/prop" as Prop import "../lib/jet/qml" as Jet +import "luci" Rectangle { anchors.fill: parent @@ -31,7 +32,14 @@ Rectangle { Column { width: render.width - + Prop.PropFolderPanel { + id: "shadingModel" + label: "Shading Model" + panelFrameData: Component { + ShadingModel { + } + } + } /* Prop.PropEnum { label: "Tone Curve" object: render.mainViewTask.getConfig("ToneMapping") @@ -45,14 +53,6 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right } */ - Jet.TaskPropView { - id: "lightingModel" - jobPath: "RenderMainView.LightingModel" - label: "Le LightingModel" - - anchors.left: parent.left - anchors.right: parent.right - } Jet.TaskPropView { id: "theView" jobPath: "RenderMainView" @@ -69,20 +69,14 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right } - /* Jet.TaskPropView { - jobPath: "RenderMainView.ToneMapping" - label: "Le ToneMapping Job" + Jet.TaskPropView { + id: "le" + jobPath: "" + label: "Le Render Engine" anchors.left: parent.left anchors.right: parent.right } - Jet.TaskPropView { - jobPath: "RenderMainView.Antialiasing" - label: "Le Antialiasing Job" - - anchors.left: parent.left - anchors.right: parent.right - }*/ } } diff --git a/scripts/developer/utilities/render/luci/ShadingModel.qml b/scripts/developer/utilities/render/luci/ShadingModel.qml new file mode 100644 index 0000000000..2c16492e80 --- /dev/null +++ b/scripts/developer/utilities/render/luci/ShadingModel.qml @@ -0,0 +1,105 @@ +// +// ShadingModel.qml +// +// Created by Sam Gateau on 4/17/2019 +// Copyright 2019 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.7 + +import stylesUit 1.0 +import controlsUit 1.0 as HifiControls + +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.3 + +import stylesUit 1.0 +import controlsUit 1.0 as HifiControls + +import "../../lib/prop" as Prop + + +Column { + + id: shadingModel; + + property var mainViewTask: Render.getConfig("RenderMainView") + + spacing: 5 + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: hifi.dimensions.contentMargin.x + HifiControls.Label { + text: "Shading" + } + Row { + anchors.left: parent.left + anchors.right: parent.right + + spacing: 5 + Column { + spacing: 5 + Repeater { + model: [ + "Unlit:LightingModel:enableUnlit", + "Emissive:LightingModel:enableEmissive", + "Lightmap:LightingModel:enableLightmap", + "Background:LightingModel:enableBackground", + "Haze:LightingModel:enableHaze", + "AO:LightingModel:enableAmbientOcclusion", + "Textures:LightingModel:enableMaterialTexturing" + ] + Prop.PropCheckBox { + text: modelData.split(":")[0] + checked: render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] + onCheckedChanged: { render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } + } + } + } + + + Column { + spacing: 5 + Repeater { + model: [ + "Obscurance:LightingModel:enableObscurance", + "Scattering:LightingModel:enableScattering", + "Diffuse:LightingModel:enableDiffuse", + "Specular:LightingModel:enableSpecular", + "Albedo:LightingModel:enableAlbedo", + "Wireframe:LightingModel:enableWireframe", + "Skinning:LightingModel:enableSkinning", + "Blendshape:LightingModel:enableBlendshape" + ] + Prop.PropCheckBox { + text: modelData.split(":")[0] + checked: render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] + onCheckedChanged: { render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } + } + } + } + + Column { + spacing: 5 + Repeater { + model: [ + "Ambient:LightingModel:enableAmbientLight", + "Directional:LightingModel:enableDirectionalLight", + "Point:LightingModel:enablePointLight", + "Spot:LightingModel:enableSpotLight", + "Light Contour:LightingModel:showLightContour", + "Zone Stack:DrawZoneStack:enabled", + "Shadow:LightingModel:enableShadow" + ] + Prop.PropCheckBox { + text: modelData.split(":")[0] + checked: render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] + onCheckedChanged: { render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } + } + } + } + } +} diff --git a/scripts/developer/utilities/render/luci/qmldir b/scripts/developer/utilities/render/luci/qmldir new file mode 100644 index 0000000000..cf63b1c2b7 --- /dev/null +++ b/scripts/developer/utilities/render/luci/qmldir @@ -0,0 +1,2 @@ + +ShadingModel 1.0 ShadingModel.qml \ No newline at end of file From af3d981ad163be12a9d4d66ff7049c04c11067d1 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 18 Apr 2019 17:44:08 -0700 Subject: [PATCH 25/27] Bringing the Luci interface into the new Prop framework and moving some tools there too --- .../utilities/lib/jet/qml/TaskPropView.qml | 35 ++-- .../utilities/lib/prop/PropGroup.qml | 121 +----------- .../utilities/lib/prop/style/PiCanvasIcon.qml | 9 +- .../utilities/lib/prop/style/PiCheckBox.qml | 2 - .../lib/prop/style/PiFolderPanel.qml | 24 +-- .../utilities/render/antialiasing.js | 2 +- .../utilities/render/antialiasing.qml | 182 ------------------ .../utilities/render/deferredLighting.qml | 177 +---------------- scripts/developer/utilities/render/luci.qml | 60 +++--- .../utilities/render/luci/Antialiasing.qml | 176 +++++++++++++++++ .../utilities/render/luci/BoundingBoxes.qml | 84 ++++++++ .../utilities/render/luci/Framebuffer.qml | 69 +++++++ .../utilities/render/luci/ShadingModel.qml | 25 +-- .../utilities/render/luci/ToneMapping.qml | 40 ++++ .../developer/utilities/render/luci/qmldir | 6 +- 15 files changed, 449 insertions(+), 563 deletions(-) delete mode 100644 scripts/developer/utilities/render/antialiasing.qml create mode 100644 scripts/developer/utilities/render/luci/Antialiasing.qml create mode 100644 scripts/developer/utilities/render/luci/BoundingBoxes.qml create mode 100644 scripts/developer/utilities/render/luci/Framebuffer.qml create mode 100644 scripts/developer/utilities/render/luci/ToneMapping.qml diff --git a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml index e53932a9f9..0587352b4e 100644 --- a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml +++ b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml @@ -30,9 +30,10 @@ Prop.PropGroup { property var showProps: true property var showSubs: true - property var jobEnabled: true + property var jobEnabled: rootConfig.getConfig(jobPath).enabled + property var jobCpuTime: rootConfig.getConfig(jobPath).cpuRunTime.toPrecision(3) - property var toggleJobActivation: function() { + property var toggleJobActivation: function() { console.log("the button has been pressed and jobEnabled is " + jobEnabled ) jobEnabled = !jobEnabled; rootConfig.getConfig(jobPath).enabled = jobEnabled; @@ -44,29 +45,31 @@ Prop.PropGroup { id: header Prop.PropLabel { text: root.label - //horizontalAlignment: Text.AlignHCenter + horizontalAlignment: Text.AlignHCenter anchors.left: parent.left - anchors.right: enabledIcon.left + anchors.right: cpuTime.left anchors.verticalCenter: parent.verticalCenter - } + } + Prop.PropLabel { + id: cpuTime + visible: root.jobEnabled + width: 50 + text: jobCpuTime + horizontalAlignment: Text.AlignLeft + anchors.rightMargin: 5 + anchors.right:enabledIcon.right + anchors.verticalCenter: parent.verticalCenter + } Prop.PropCanvasIcon { id: enabledIcon - anchors.right: enabledIcon2.left + anchors.right:parent.right anchors.verticalCenter: parent.verticalCenter filled: root.jobEnabled fillColor: (root.jobEnabled ? global.colorGreenHighlight : global.colorOrangeAccent) icon: 5 iconMouseArea.onClicked: { toggleJobActivation() } } - Prop.PropCanvasIcon { - id: enabledIcon2 - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - filled: root.jobEnabled - fillColor: (root.jobEnabled ? global.colorGreenHighlight : global.colorOrangeAccent) - icon: 7 - iconMouseArea.onClicked: { toggleJobActivation() } - } + } } @@ -78,7 +81,7 @@ Prop.PropGroup { for (var p in props) { propsModel.push({"object": rootConfig.getConfig(jobPath), "property":props[p] }) } - root.updatePropItems(propsModel); + root.updatePropItems(root.propItemsPanel, propsModel); } if (showSubs) { diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 2f15e60a0c..384b50ecad 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -10,123 +10,14 @@ import QtQuick 2.7 -//Item { +// PropGroup is mostly reusing the look and feel of the PropFolderPanel +// It is populated by calling "updatePropItems" +// or adding manually new Items to the "propItemsPanel" PropFolderPanel { Global { id: global } id: root - - // property var label: "group" - - // property alias isUnfold: headerFolderIcon.icon - // property var indentDepth: 0 - //property alias propItemsPanel: _panelFrameData - // property alias propItemsPanel: propItemsContainer - //property var propItemsPanel: propItemsContainer - - panelFrameData: Component { // default is a column - id: groupPanelFrameData - Column { - id: propItemsContainer - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 0 - anchors.rightMargin: 0 - - clip: true - } - } - - // Panel Header Data Component -/* property Component panelHeaderData: defaultPanelHeaderData - Component { // default is a Label - id: defaultPanelHeaderData - PropLabel { - text: root.label - horizontalAlignment: Text.AlignHCenter - } - } - - // Header Item - Rectangle { - id: header - height: global.slimHeight - anchors.left: parent.left - anchors.right: parent.right - - color: global.colorBackShadow // header of group is darker - - // First in the header, some indentation spacer - Item { - id: indentSpacer - width: (headerFolderIcon.width * root.indentDepth) + global.horizontalMargin // Must be non-zero - height: parent.height - - anchors.verticalCenter: parent.verticalCenter - } - - // Second, the folder button / indicator - Item { - id: headerFolder - anchors.left: indentSpacer.right - width: headerFolderIcon.width * 2 - anchors.verticalCenter: header.verticalCenter - height: parent.height - - PropCanvasIcon { - id: headerFolderIcon - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - fillColor: global.colorOrangeAccent - filled: root.propItemsPanel.height > 4 - iconMouseArea.onClicked: { root.isUnfold = !root.isUnfold } - } - } - - // Next the header container - // by default containing a Label showing the root.label - Loader { - sourceComponent: panelHeaderData - anchors.left: headerFolder.right - anchors.right: header.right - anchors.verticalCenter: header.verticalCenter - height: parent.height - } - } - - // The Panel container - Rectangle { - visible: root.isUnfold - - color: "transparent" - border.color: global.colorBorderLight - border.width: global.valueBorderWidth - radius: global.valueBorderRadius - - anchors.margins: 0 - anchors.left: parent.left - anchors.right: parent.right - anchors.top: header.bottom - anchors.bottom: root.bottom - - Column { - id: propItemsContainer - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 0 - anchors.rightMargin: 0 - - clip: true - - // Where the propItems are added - } - } - - height: header.height + isUnfold * propItemsContainer.height - anchors.margins: 0 - anchors.left: parent.left - anchors.right: parent.right -*/ + property alias propItemsPanel: root.panelFrameContent // Prop Group is designed to author an array of ProItems, they are defined with an array of the tuplets describing each individual item: // [ ..., PropItemInfo, ...] @@ -134,7 +25,8 @@ PropFolderPanel { // type: "PropXXXX", object: JSobject, property: "propName" // } // - function updatePropItems(propItemsModel) { + function updatePropItems(propItemsContainer, propItemsModel) { + root.hasContent = false for (var i = 0; i < propItemsModel.length; i++) { var proItem = propItemsModel[i]; // valid object @@ -191,6 +83,7 @@ PropFolderPanel { }) } break; } + root.hasContent = true } else { console.log('Invalid property: ' + JSON.stringify(proItem)); } diff --git a/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml b/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml index 3feed342b8..2fc3ed10ec 100644 --- a/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml +++ b/scripts/developer/utilities/lib/prop/style/PiCanvasIcon.qml @@ -79,12 +79,9 @@ Canvas { context.lineTo(width * 0.75, height * 0.25); context.closePath(); } break; - default: {// Down Arrow - /* context.moveTo(0, height * 0.25); - context.lineTo(width, height * 0.25); - context.lineTo(width / 2, height); - context.closePath();*/ - } + default: { + + } } if (filled) { context.fillStyle = fillColor; diff --git a/scripts/developer/utilities/lib/prop/style/PiCheckBox.qml b/scripts/developer/utilities/lib/prop/style/PiCheckBox.qml index 108a763be3..1e1f03669b 100644 --- a/scripts/developer/utilities/lib/prop/style/PiCheckBox.qml +++ b/scripts/developer/utilities/lib/prop/style/PiCheckBox.qml @@ -20,6 +20,4 @@ HifiControls.CheckBox { //anchors.verticalCenter: root.verticalCenter //width: root.width * global.valueAreaWidthScale height: global.slimHeight - - onCheckedChanged: { root.valueVarSetter(checked); } } \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/style/PiFolderPanel.qml b/scripts/developer/utilities/lib/prop/style/PiFolderPanel.qml index b80ab47fc6..d66c0708d3 100644 --- a/scripts/developer/utilities/lib/prop/style/PiFolderPanel.qml +++ b/scripts/developer/utilities/lib/prop/style/PiFolderPanel.qml @@ -17,6 +17,7 @@ Item { property var label: "panel" property alias isUnfold: headerFolderIcon.icon + property alias hasContent: headerFolderIcon.filled property var indentDepth: 0 // Panel Header Data Component @@ -37,7 +38,7 @@ Item { } } - //property alias panelFrameContent: frame._panelFrameData.data + property alias panelFrameContent: _panelFrameData.item // Header Item Rectangle { @@ -45,13 +46,14 @@ Item { height: global.slimHeight anchors.left: parent.left anchors.right: parent.right + anchors.margins: 0 color: global.colorBackShadow // header of group is darker // First in the header, some indentation spacer Item { id: indentSpacer - width: (headerFolderIcon.width * root.indentDepth) + global.horizontalMargin // Must be non-zero + width: (headerFolderIcon.width * root.indentDepth) + global.horizontalMargin // Must be non-zero height: parent.height anchors.verticalCenter: parent.verticalCenter @@ -70,7 +72,6 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter fillColor: global.colorOrangeAccent - filled: root.frame.height > 4 iconMouseArea.onClicked: { root.isUnfold = !root.isUnfold } } } @@ -81,6 +82,7 @@ Item { sourceComponent: panelHeaderData anchors.left: headerFolder.right anchors.right: header.right + anchors.rightMargin: global.horizontalMargin * 2 anchors.verticalCenter: header.verticalCenter height: parent.height } @@ -104,29 +106,17 @@ Item { // Next the panel frame data Loader { + id: _panelFrameData sourceComponent: panelFrameData anchors.left: parent.left anchors.right: parent.right anchors.leftMargin: 0 anchors.rightMargin: 0 - id: _panelFrameData clip: true } - - /* Column { - id: propItemsContainer - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 0 - anchors.rightMargin: 0 - - clip: true - - // Where the propItems are added - }*/ } - height: header.height + isUnfold * _panelFrameData.height + height: header.height + isUnfold * _panelFrameData.item.height anchors.margins: 0 anchors.left: parent.left anchors.right: parent.right diff --git a/scripts/developer/utilities/render/antialiasing.js b/scripts/developer/utilities/render/antialiasing.js index e915d75e93..5484565b36 100644 --- a/scripts/developer/utilities/render/antialiasing.js +++ b/scripts/developer/utilities/render/antialiasing.js @@ -13,7 +13,7 @@ (function() { var TABLET_BUTTON_NAME = "TAA"; - var QMLAPP_URL = Script.resolvePath("./antialiasing.qml"); + var QMLAPP_URL = Script.resolvePath("./luci/Antialiasing.qml"); var onLuciScreen = false; diff --git a/scripts/developer/utilities/render/antialiasing.qml b/scripts/developer/utilities/render/antialiasing.qml deleted file mode 100644 index 5abfd30935..0000000000 --- a/scripts/developer/utilities/render/antialiasing.qml +++ /dev/null @@ -1,182 +0,0 @@ -// -// Antialiasing.qml -// -// Created by Sam Gateau on 8/14/2017 -// Copyright 2016 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.7 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.3 - -import stylesUit 1.0 -import controlsUit 1.0 as HifiControls - -import "configSlider" -import "../lib/plotperf" - -Item { -Rectangle { - id: root; - - HifiConstants { id: hifi; } - color: hifi.colors.baseGray; - - Column { - id: antialiasing - spacing: 20 - padding: 10 - - Column{ - spacing: 10 - - Row { - spacing: 10 - id: fxaaOnOff - property bool debugFXAA: false - HifiControls.Button { - function getTheText() { - if (Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff) { - return "FXAA" - } else { - return "TAA" - } - } - text: getTheText() - onClicked: { - var onOff = !Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff; - if (onOff) { - Render.getConfig("RenderMainView.JitterCam").none(); - Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = true; - } else { - Render.getConfig("RenderMainView.JitterCam").play(); - Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = false; - } - - } - } - } - Separator {} - Row { - spacing: 10 - - HifiControls.Button { - text: { - var state = 2 - (Render.getConfig("RenderMainView.JitterCam").freeze * 1 - Render.getConfig("RenderMainView.JitterCam").stop * 2); - if (state === 2) { - return "Jitter" - } else if (state === 1) { - return "Paused at " + Render.getConfig("RenderMainView.JitterCam").index + "" - } else { - return "No Jitter" - } - } - onClicked: { Render.getConfig("RenderMainView.JitterCam").cycleStopPauseRun(); } - } - HifiControls.Button { - text: "<" - onClicked: { Render.getConfig("RenderMainView.JitterCam").prev(); } - } - HifiControls.Button { - text: ">" - onClicked: { Render.getConfig("RenderMainView.JitterCam").next(); } - } - } - Separator {} - HifiControls.CheckBox { - boxSize: 20 - text: "Constrain color" - checked: Render.getConfig("RenderMainView.Antialiasing")["constrainColor"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["constrainColor"] = checked } - } - ConfigSlider { - label: qsTr("Covariance gamma") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") - property: "covarianceGamma" - max: 1.5 - min: 0.5 - height: 38 - } - Separator {} - HifiControls.CheckBox { - boxSize: 20 - text: "Feedback history color" - checked: Render.getConfig("RenderMainView.Antialiasing")["feedbackColor"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["feedbackColor"] = checked } - } - - ConfigSlider { - label: qsTr("Source blend") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") - property: "blend" - max: 1.0 - min: 0.0 - height: 38 - } - - ConfigSlider { - label: qsTr("Post sharpen") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") - property: "sharpen" - max: 1.0 - min: 0.0 - } - Separator {} - Row { - - spacing: 10 - HifiControls.CheckBox { - boxSize: 20 - text: "Debug" - checked: Render.getConfig("RenderMainView.Antialiasing")["debug"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["debug"] = checked } - } - HifiControls.CheckBox { - boxSize: 20 - text: "Show Debug Cursor" - checked: Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"] = checked } - } - } - ConfigSlider { - label: qsTr("Debug Region <") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") - property: "debugX" - max: 1.0 - min: 0.0 - } - HifiControls.CheckBox { - boxSize: 20 - text: "Closest Fragment" - checked: Render.getConfig("RenderMainView.Antialiasing")["showClosestFragment"] - onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showClosestFragment"] = checked } - } - ConfigSlider { - label: qsTr("Debug Velocity Threshold [pix]") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") - property: "debugShowVelocityThreshold" - max: 50 - min: 0.0 - height: 38 - } - ConfigSlider { - label: qsTr("Debug Orb Zoom") - integral: false - config: Render.getConfig("RenderMainView.Antialiasing") - property: "debugOrbZoom" - max: 32.0 - min: 1.0 - height: 38 - } - } - } -} -} diff --git a/scripts/developer/utilities/render/deferredLighting.qml b/scripts/developer/utilities/render/deferredLighting.qml index 63c2af1b0f..80ca8b09e1 100644 --- a/scripts/developer/utilities/render/deferredLighting.qml +++ b/scripts/developer/utilities/render/deferredLighting.qml @@ -29,57 +29,16 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right anchors.margins: hifi.dimensions.contentMargin.x - //padding: hifi.dimensions.contentMargin.x + + HifiControls.Label { text: "Shading" } - ShadingModel { + ShadingModel {} - } - Separator {} - Column { - anchors.left: parent.left - anchors.right: parent.right - spacing: 5 - Repeater { - model: [ "Tone Mapping Exposure:ToneMapping:exposure:5.0:-5.0" - ] - ConfigSlider { - label: qsTr(modelData.split(":")[0]) - integral: false - config: render.mainViewTask.getConfig(modelData.split(":")[1]) - property: modelData.split(":")[2] - max: modelData.split(":")[3] - min: modelData.split(":")[4] + Separator {} + ToneMapping {} - anchors.left: parent.left - anchors.right: parent.right - } - } - Item { - height: childrenRect.height - anchors.left: parent.left - anchors.right: parent.right - - HifiControls.Label { - text: "Tone Mapping Curve" - anchors.left: parent.left - } - - ComboBox { - anchors.right: parent.right - currentIndex: 1 - model: [ - "RGB", - "SRGB", - "Reinhard", - "Filmic", - ] - width: 200 - onCurrentIndexChanged: { render.mainViewTask.getConfig("ToneMapping")["curve"] = currentIndex; } - } - } - } Separator {} Column { anchors.left: parent.left @@ -102,133 +61,11 @@ Rectangle { } } Separator {} + Framebuffer {} - Item { - height: childrenRect.height - anchors.left: parent.left - anchors.right: parent.right - - id: framebuffer - - HifiControls.Label { - text: "Debug Framebuffer" - anchors.left: parent.left - } - - property var config: render.mainViewTask.getConfig("DebugDeferredBuffer") - - function setDebugMode(mode) { - framebuffer.config.enabled = (mode != 0); - framebuffer.config.mode = mode; - } - - ComboBox { - anchors.right: parent.right - currentIndex: 0 - model: ListModel { - id: cbItemsFramebuffer - ListElement { text: "Off"; color: "Yellow" } - ListElement { text: "Depth"; color: "Green" } - ListElement { text: "Albedo"; color: "Yellow" } - ListElement { text: "Normal"; color: "White" } - ListElement { text: "Roughness"; color: "White" } - ListElement { text: "Metallic"; color: "White" } - ListElement { text: "Emissive"; color: "White" } - ListElement { text: "Unlit"; color: "White" } - ListElement { text: "Occlusion"; color: "White" } - ListElement { text: "Lightmap"; color: "White" } - ListElement { text: "Scattering"; color: "White" } - ListElement { text: "Lighting"; color: "White" } - ListElement { text: "Shadow Cascade 0"; color: "White" } - ListElement { text: "Shadow Cascade 1"; color: "White" } - ListElement { text: "Shadow Cascade 2"; color: "White" } - ListElement { text: "Shadow Cascade 3"; color: "White" } - ListElement { text: "Shadow Cascade Indices"; color: "White" } - ListElement { text: "Linear Depth"; color: "White" } - ListElement { text: "Half Linear Depth"; color: "White" } - ListElement { text: "Half Normal"; color: "White" } - ListElement { text: "Mid Curvature"; color: "White" } - ListElement { text: "Mid Normal"; color: "White" } - ListElement { text: "Low Curvature"; color: "White" } - ListElement { text: "Low Normal"; color: "White" } - ListElement { text: "Curvature Occlusion"; color: "White" } - ListElement { text: "Debug Scattering"; color: "White" } - ListElement { text: "Ambient Occlusion"; color: "White" } - ListElement { text: "Ambient Occlusion Blurred"; color: "White" } - ListElement { text: "Ambient Occlusion Normal"; color: "White" } - ListElement { text: "Velocity"; color: "White" } - ListElement { text: "Custom"; color: "White" } - } - width: 200 - onCurrentIndexChanged: { framebuffer.setDebugMode(currentIndex) } - } - } - Separator {} - Row { - spacing: 5 - Column { - spacing: 5 + BoundingBoxes { - HifiControls.CheckBox { - boxSize: 20 - text: "Opaques" - checked: render.mainViewTask.getConfig("DrawOpaqueBounds")["enabled"] - onCheckedChanged: { render.mainViewTask.getConfig("DrawOpaqueBounds")["enabled"] = checked } - } - HifiControls.CheckBox { - boxSize: 20 - text: "Transparents" - checked: render.mainViewTask.getConfig("DrawTransparentBounds")["enabled"] - onCheckedChanged: { render.mainViewTask.getConfig("DrawTransparentBounds")["enabled"] = checked } - } - HifiControls.CheckBox { - boxSize: 20 - text: "Opaques in Front" - checked: render.mainViewTask.getConfig("DrawOverlayInFrontOpaqueBounds")["enabled"] - onCheckedChanged: { render.mainViewTask.getConfig("DrawOverlayInFrontOpaqueBounds")["enabled"] = checked } - } - HifiControls.CheckBox { - boxSize: 20 - text: "Transparents in Front" - checked: render.mainViewTask.getConfig("DrawOverlayInFrontTransparentBounds")["enabled"] - onCheckedChanged: { render.mainViewTask.getConfig("DrawOverlayInFrontTransparentBounds")["enabled"] = checked } - } - HifiControls.CheckBox { - boxSize: 20 - text: "Opaques in HUD" - checked: render.mainViewTask.getConfig("DrawOverlayHUDOpaqueBounds")["enabled"] - onCheckedChanged: { render.mainViewTask.getConfig("DrawOverlayHUDOpaqueBounds")["enabled"] = checked } - } - - } - Column { - spacing: 5 - HifiControls.CheckBox { - boxSize: 20 - text: "Metas" - checked: render.mainViewTask.getConfig("DrawMetaBounds")["enabled"] - onCheckedChanged: { render.mainViewTask.getConfig("DrawMetaBounds")["enabled"] = checked } - } - HifiControls.CheckBox { - boxSize: 20 - text: "Lights" - checked: render.mainViewTask.getConfig("DrawLightBounds")["enabled"] - onCheckedChanged: { render.mainViewTask.getConfig("DrawLightBounds")["enabled"] = checked; } - } - HifiControls.CheckBox { - boxSize: 20 - text: "Zones" - checked: render.mainViewTask.getConfig("DrawZones")["enabled"] - onCheckedChanged: { render.mainViewTask.getConfig("ZoneRenderer")["enabled"] = checked; render.mainViewTask.getConfig("DrawZones")["enabled"] = checked; } - } - HifiControls.CheckBox { - boxSize: 20 - text: "Transparents in HUD" - checked: render.mainViewTask.getConfig("DrawOverlayHUDTransparentBounds")["enabled"] - onCheckedChanged: { render.mainViewTask.getConfig("DrawOverlayHUDTransparentBounds")["enabled"] = checked } - } - } } Separator {} Row { diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index 7bce087fda..6ceee9a8d0 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -33,53 +33,43 @@ Rectangle { Column { width: render.width Prop.PropFolderPanel { - id: "shadingModel" label: "Shading Model" panelFrameData: Component { - ShadingModel { - } + ShadingModel {} } } - /* Prop.PropEnum { - label: "Tone Curve" - object: render.mainViewTask.getConfig("ToneMapping") - property: "curve" - enums: [ - "RGB", - "SRGB", - "Reinhard", - "Filmic", - ] - anchors.left: parent.left - anchors.right: parent.right - } */ - Jet.TaskPropView { - id: "theView" - jobPath: "RenderMainView" - label: "Le Render Main View" - - anchors.left: parent.left - anchors.right: parent.right + Prop.PropFolderPanel { + label: "Bounding Boxes" + panelFrameData: Component { + BoundingBoxes {} + } } - Jet.TaskPropView { - id: "the" - jobPath: "RenderMainView.RenderDeferredTask" - label: "Le Render Deferred Job" - - anchors.left: parent.left - anchors.right: parent.right + Prop.PropFolderPanel { + label: "Framebuffer" + panelFrameData: Component { + Framebuffer {} + } + } + Prop.PropFolderPanel { + label: "Tone Mapping" + panelFrameData: Component { + ToneMapping {} + } + } + Prop.PropFolderPanel { + label: "Antialiasing" + panelFrameData: Component { + Antialiasing {} + } } Jet.TaskPropView { id: "le" jobPath: "" label: "Le Render Engine" - anchors.left: parent.left - anchors.right: parent.right + // anchors.left: parent.left + // anchors.right: parent.right } } } - - Component.onCompleted: { - } } \ No newline at end of file diff --git a/scripts/developer/utilities/render/luci/Antialiasing.qml b/scripts/developer/utilities/render/luci/Antialiasing.qml new file mode 100644 index 0000000000..e29bca43eb --- /dev/null +++ b/scripts/developer/utilities/render/luci/Antialiasing.qml @@ -0,0 +1,176 @@ +// +// Antialiasing.qml +// +// Created by Sam Gateau on 8/14/2017 +// Copyright 2016 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.7 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.3 + +import stylesUit 1.0 +import controlsUit 1.0 as HifiControls + +import "../configSlider" +import "../../lib/plotperf" + + +Column{ + HifiConstants { id: hifi; } + + id: antialiasing + padding: 10 + anchors.left: parent.left + anchors.right: parent.right + + spacing: 10 + + Row { + spacing: 10 + id: fxaaOnOff + property bool debugFXAA: false + HifiControls.Button { + function getTheText() { + if (Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff) { + return "FXAA" + } else { + return "TAA" + } + } + text: getTheText() + onClicked: { + var onOff = !Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff; + if (onOff) { + Render.getConfig("RenderMainView.JitterCam").none(); + Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = true; + } else { + Render.getConfig("RenderMainView.JitterCam").play(); + Render.getConfig("RenderMainView.Antialiasing").fxaaOnOff = false; + } + + } + } + } + Separator {} + Row { + spacing: 10 + + HifiControls.Button { + text: { + var state = 2 - (Render.getConfig("RenderMainView.JitterCam").freeze * 1 - Render.getConfig("RenderMainView.JitterCam").stop * 2); + if (state === 2) { + return "Jitter" + } else if (state === 1) { + return "Paused at " + Render.getConfig("RenderMainView.JitterCam").index + "" + } else { + return "No Jitter" + } + } + onClicked: { Render.getConfig("RenderMainView.JitterCam").cycleStopPauseRun(); } + } + HifiControls.Button { + text: "<" + onClicked: { Render.getConfig("RenderMainView.JitterCam").prev(); } + } + HifiControls.Button { + text: ">" + onClicked: { Render.getConfig("RenderMainView.JitterCam").next(); } + } + } + Separator {} + HifiControls.CheckBox { + boxSize: 20 + text: "Constrain color" + checked: Render.getConfig("RenderMainView.Antialiasing")["constrainColor"] + onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["constrainColor"] = checked } + } + ConfigSlider { + label: qsTr("Covariance gamma") + integral: false + config: Render.getConfig("RenderMainView.Antialiasing") + property: "covarianceGamma" + max: 1.5 + min: 0.5 + height: 38 + } + Separator {} + HifiControls.CheckBox { + boxSize: 20 + text: "Feedback history color" + checked: Render.getConfig("RenderMainView.Antialiasing")["feedbackColor"] + onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["feedbackColor"] = checked } + } + + ConfigSlider { + label: qsTr("Source blend") + integral: false + config: Render.getConfig("RenderMainView.Antialiasing") + property: "blend" + max: 1.0 + min: 0.0 + height: 38 + } + + ConfigSlider { + label: qsTr("Post sharpen") + integral: false + config: Render.getConfig("RenderMainView.Antialiasing") + property: "sharpen" + max: 1.0 + min: 0.0 + } + Separator {} + Row { + + spacing: 10 + HifiControls.CheckBox { + boxSize: 20 + text: "Debug" + checked: Render.getConfig("RenderMainView.Antialiasing")["debug"] + onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["debug"] = checked } + } + HifiControls.CheckBox { + boxSize: 20 + text: "Show Debug Cursor" + checked: Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"] + onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showCursorPixel"] = checked } + } + } + ConfigSlider { + label: qsTr("Debug Region <") + integral: false + config: Render.getConfig("RenderMainView.Antialiasing") + property: "debugX" + max: 1.0 + min: 0.0 + } + HifiControls.CheckBox { + boxSize: 20 + text: "Closest Fragment" + checked: Render.getConfig("RenderMainView.Antialiasing")["showClosestFragment"] + onCheckedChanged: { Render.getConfig("RenderMainView.Antialiasing")["showClosestFragment"] = checked } + } + ConfigSlider { + label: qsTr("Debug Velocity Threshold [pix]") + integral: false + config: Render.getConfig("RenderMainView.Antialiasing") + property: "debugShowVelocityThreshold" + max: 50 + min: 0.0 + height: 38 + } + ConfigSlider { + label: qsTr("Debug Orb Zoom") + integral: false + config: Render.getConfig("RenderMainView.Antialiasing") + property: "debugOrbZoom" + max: 32.0 + min: 1.0 + height: 38 + } +} + diff --git a/scripts/developer/utilities/render/luci/BoundingBoxes.qml b/scripts/developer/utilities/render/luci/BoundingBoxes.qml new file mode 100644 index 0000000000..636267729c --- /dev/null +++ b/scripts/developer/utilities/render/luci/BoundingBoxes.qml @@ -0,0 +1,84 @@ +// +// BoundingBoxes.qml +// +// Created by Sam Gateau on 4/18/2019 +// Copyright 2019 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.7 + +import "../../lib/prop" as Prop + +Column { + + id: root; + + property var mainViewTask: Render.getConfig("RenderMainView") + + spacing: 5 + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: hifi.dimensions.contentMargin.x + + Row { + anchors.left: parent.left + anchors.right: parent.right + + spacing: 5 + Column { + spacing: 5 + + Prop.PropCheckBox { + text: "Opaques" + checked: root.mainViewTask.getConfig("DrawOpaqueBounds")["enabled"] + onCheckedChanged: { root.mainViewTask.getConfig("DrawOpaqueBounds")["enabled"] = checked } + } + Prop.PropCheckBox { + text: "Transparents" + checked: root.mainViewTask.getConfig("DrawTransparentBounds")["enabled"] + onCheckedChanged: { root.mainViewTask.getConfig("DrawTransparentBounds")["enabled"] = checked } + } + Prop.PropCheckBox { + text: "Metas" + checked: root.mainViewTask.getConfig("DrawMetaBounds")["enabled"] + onCheckedChanged: { root.mainViewTask.getConfig("DrawMetaBounds")["enabled"] = checked } + } + Prop.PropCheckBox { + text: "Lights" + checked: root.mainViewTask.getConfig("DrawLightBounds")["enabled"] + onCheckedChanged: { root.mainViewTask.getConfig("DrawLightBounds")["enabled"] = checked; } + } + Prop.PropCheckBox { + text: "Zones" + checked: root.mainViewTask.getConfig("DrawZones")["enabled"] + onCheckedChanged: { root.mainViewTask.getConfig("ZoneRenderer")["enabled"] = checked; root.mainViewTask.getConfig("DrawZones")["enabled"] = checked; } + } + } + Column { + spacing: 5 + Prop.PropCheckBox { + text: "Opaques in Front" + checked: root.mainViewTask.getConfig("DrawOverlayInFrontOpaqueBounds")["enabled"] + onCheckedChanged: { root.mainViewTask.getConfig("DrawOverlayInFrontOpaqueBounds")["enabled"] = checked } + } + Prop.PropCheckBox { + text: "Transparents in Front" + checked: root.mainViewTask.getConfig("DrawOverlayInFrontTransparentBounds")["enabled"] + onCheckedChanged: { root.mainViewTask.getConfig("DrawOverlayInFrontTransparentBounds")["enabled"] = checked } + } + Prop.PropCheckBox { + text: "Opaques in HUD" + checked: root.mainViewTask.getConfig("DrawOverlayHUDOpaqueBounds")["enabled"] + onCheckedChanged: { root.mainViewTask.getConfig("DrawOverlayHUDOpaqueBounds")["enabled"] = checked } + } + Prop.PropCheckBox { + text: "Transparents in HUD" + checked: root.mainViewTask.getConfig("DrawOverlayHUDTransparentBounds")["enabled"] + onCheckedChanged: { root.mainViewTask.getConfig("DrawOverlayHUDTransparentBounds")["enabled"] = checked } + } + } + } +} diff --git a/scripts/developer/utilities/render/luci/Framebuffer.qml b/scripts/developer/utilities/render/luci/Framebuffer.qml new file mode 100644 index 0000000000..89d5e59002 --- /dev/null +++ b/scripts/developer/utilities/render/luci/Framebuffer.qml @@ -0,0 +1,69 @@ +// +// Framebuffer.qml +// +// Created by Sam Gateau on 4/18/2019 +// Copyright 2019 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.7 + +import "../../lib/prop" as Prop + +Column { + anchors.left: parent.left + anchors.right: parent.right + + id: framebuffer + + property var config: Render.getConfig("RenderMainView.DebugDeferredBuffer") + + function setDebugMode(mode) { + framebuffer.config.enabled = (mode != 0); + framebuffer.config.mode = mode; + } + + Prop.PropEnum { + label: "Debug Buffer" + object: config + property: "mode" + valueVar: 0 + enums: [ + "Off", + "Depth", + "Albedo", + "Normal", + "Roughness", + "Metallic", + "Emissive", + "Unlit", + "Occlusion", + "Lightmap", + "Scattering", + "Lighting", + "Shadow Cascade 0", + "Shadow Cascade 1", + "Shadow Cascade 2", + "Shadow Cascade 3", + "Shadow Cascade Indices", + "Linear Depth", + "Half Linear Depth", + "Half Normal", + "Mid Curvature", + "Mid Normal", + "Low Curvature", + "Low Normal", + "Curvature Occlusion", + "Debug Scattering", + "Ambient Occlusion", + "Ambient Occlusion Blurred", + "Ambient Occlusion Normal", + "Velocity", + "Custom", + ] + + valueVarSetter: function (mode) { framebuffer.setDebugMode(mode) } + } +} \ No newline at end of file diff --git a/scripts/developer/utilities/render/luci/ShadingModel.qml b/scripts/developer/utilities/render/luci/ShadingModel.qml index 2c16492e80..78ca7f1740 100644 --- a/scripts/developer/utilities/render/luci/ShadingModel.qml +++ b/scripts/developer/utilities/render/luci/ShadingModel.qml @@ -10,18 +10,8 @@ import QtQuick 2.7 -import stylesUit 1.0 -import controlsUit 1.0 as HifiControls - -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.3 - -import stylesUit 1.0 -import controlsUit 1.0 as HifiControls - import "../../lib/prop" as Prop - Column { id: shadingModel; @@ -32,9 +22,6 @@ Column { anchors.left: parent.left anchors.right: parent.right anchors.margins: hifi.dimensions.contentMargin.x - HifiControls.Label { - text: "Shading" - } Row { anchors.left: parent.left anchors.right: parent.right @@ -54,8 +41,8 @@ Column { ] Prop.PropCheckBox { text: modelData.split(":")[0] - checked: render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] - onCheckedChanged: { render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } + checked: shadingModel.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] + onCheckedChanged: { shadingModel.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } } } } @@ -76,8 +63,8 @@ Column { ] Prop.PropCheckBox { text: modelData.split(":")[0] - checked: render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] - onCheckedChanged: { render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } + checked: shadingModel.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] + onCheckedChanged: { shadingModel.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } } } } @@ -96,8 +83,8 @@ Column { ] Prop.PropCheckBox { text: modelData.split(":")[0] - checked: render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] - onCheckedChanged: { render.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } + checked: shadingModel.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] + onCheckedChanged: { shadingModel.mainViewTask.getConfig(modelData.split(":")[1])[modelData.split(":")[2]] = checked } } } } diff --git a/scripts/developer/utilities/render/luci/ToneMapping.qml b/scripts/developer/utilities/render/luci/ToneMapping.qml new file mode 100644 index 0000000000..a76990e37c --- /dev/null +++ b/scripts/developer/utilities/render/luci/ToneMapping.qml @@ -0,0 +1,40 @@ +// +// ToneMapping.qml +// +// Created by Sam Gateau on 4/17/2019 +// Copyright 2019 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.7 + +import "../../lib/prop" as Prop + +Column { + anchors.left: parent.left + anchors.right: parent.right + Prop.PropScalar { + label: "Exposure" + object: Render.getConfig("RenderMainView.ToneMapping") + property: "exposure" + min: -4 + max: 4 + anchors.left: parent.left + anchors.right: parent.right + } + Prop.PropEnum { + label: "Tone Curve" + object: Render.getConfig("RenderMainView.ToneMapping") + property: "curve" + enums: [ + "RGB", + "SRGB", + "Reinhard", + "Filmic", + ] + anchors.left: parent.left + anchors.right: parent.right + } +} diff --git a/scripts/developer/utilities/render/luci/qmldir b/scripts/developer/utilities/render/luci/qmldir index cf63b1c2b7..c88dfee714 100644 --- a/scripts/developer/utilities/render/luci/qmldir +++ b/scripts/developer/utilities/render/luci/qmldir @@ -1,2 +1,6 @@ -ShadingModel 1.0 ShadingModel.qml \ No newline at end of file +ShadingModel 1.0 ShadingModel.qml +ToneMapping 1.0 ToneMapping.qml +BoundingBoxes 1.0 BoundingBoxes.qml +Framebuffer 1.0 Framebuffer.qml +Antialiasing 1.0 Antialiasing.qml \ No newline at end of file From ba02aa7098324996ec877a3caa3108d7c1537675 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 19 Apr 2019 16:56:55 -0700 Subject: [PATCH 26/27] making luci2 better --- .../utilities/lib/jet/qml/TaskPropView.qml | 12 ++- .../utilities/render/debugCulling.js | 2 +- scripts/developer/utilities/render/luci.js | 85 ++---------------- scripts/developer/utilities/render/luci.qml | 25 ++++++ .../render/{culling.qml => luci/Culling.qml} | 21 +++-- .../developer/utilities/render/luci/Page.js | 90 +++++++++++++++++++ .../developer/utilities/render/luci/qmldir | 3 +- scripts/developer/utilities/render/luci2.js | 87 ++++++++++++++++-- .../utilities/render/materialInspector.js | 8 +- 9 files changed, 236 insertions(+), 97 deletions(-) rename scripts/developer/utilities/render/{culling.qml => luci/Culling.qml} (86%) create mode 100644 scripts/developer/utilities/render/luci/Page.js diff --git a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml index 0587352b4e..165edcf2e1 100644 --- a/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml +++ b/scripts/developer/utilities/lib/jet/qml/TaskPropView.qml @@ -31,7 +31,15 @@ Prop.PropGroup { property var showProps: true property var showSubs: true property var jobEnabled: rootConfig.getConfig(jobPath).enabled - property var jobCpuTime: rootConfig.getConfig(jobPath).cpuRunTime.toPrecision(3) + property var jobCpuTime: pullCpuTime() + + function pullCpuTime() { + if (jobEnabled) { + return rootConfig.getConfig(jobPath).cpuRunTime.toPrecision(3); + } else { + return '.' + } + } property var toggleJobActivation: function() { console.log("the button has been pressed and jobEnabled is " + jobEnabled ) @@ -52,7 +60,7 @@ Prop.PropGroup { } Prop.PropLabel { id: cpuTime - visible: root.jobEnabled + visible: false // root.jobEnabled width: 50 text: jobCpuTime horizontalAlignment: Text.AlignLeft diff --git a/scripts/developer/utilities/render/debugCulling.js b/scripts/developer/utilities/render/debugCulling.js index 788c7cb4a0..e7c68fd717 100644 --- a/scripts/developer/utilities/render/debugCulling.js +++ b/scripts/developer/utilities/render/debugCulling.js @@ -10,7 +10,7 @@ // // Set up the qml ui -var qml = Script.resolvePath('culling.qml'); +var qml = Script.resolvePath('luci/Culling.qml'); var window = new OverlayWindow({ title: 'Render Draws', source: qml, diff --git a/scripts/developer/utilities/render/luci.js b/scripts/developer/utilities/render/luci.js index bae5c4646d..fd84f55e65 100644 --- a/scripts/developer/utilities/render/luci.js +++ b/scripts/developer/utilities/render/luci.js @@ -10,10 +10,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // + + (function() { var AppUi = Script.require('appUi'); var MaterialInspector = Script.require('./materialInspector.js'); + var Page = Script.require('./luci/Page.js'); var moveDebugCursor = false; var onMousePressEvent = function (e) { @@ -43,83 +46,12 @@ Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = { x: nx, y: ny, z: 1.0, w: 1.0 }; } - function Page(title, qmlurl, width, height, handleWindowFunc) { - this.title = title; - this.qml = qmlurl; - this.width = width; - this.height = height; - this.handleWindowFunc = handleWindowFunc; - this.window; - - print("Page: New Page:" + JSON.stringify(this)); - } - - Page.prototype.killView = function () { - print("Page: Kill window for page:" + JSON.stringify(this)); - if (this.window) { - print("Page: Kill window for page:" + this.title); - //this.window.closed.disconnect(function () { - // this.killView(); - //}); - this.window.close(); - this.window = false; - } - }; - - Page.prototype.createView = function () { - var that = this; - if (!this.window) { - print("Page: New window for page:" + this.title); - this.window = Desktop.createWindow(Script.resolvePath(this.qml), { - title: this.title, - presentationMode: Desktop.PresentationMode.NATIVE, - size: {x: this.width, y: this.height} - }); - this.handleWindowFunc(this.window); - this.window.closed.connect(function () { - that.killView(); - this.handleWindowFunc(undefined); - }); - } - }; - - - var Pages = function () { - this._pages = {}; - }; - - Pages.prototype.addPage = function (command, title, qmlurl, width, height, handleWindowFunc) { - if (handleWindowFunc === undefined) { - // Workaround for bad linter - handleWindowFunc = function(window){}; - } - this._pages[command] = new Page(title, qmlurl, width, height, handleWindowFunc); - }; - - Pages.prototype.open = function (command) { - print("Pages: command = " + command); - if (!this._pages[command]) { - print("Pages: unknown command = " + command); - return; - } - this._pages[command].createView(); - }; - - Pages.prototype.clear = function () { - for (var p in this._pages) { - print("Pages: kill page: " + p); - this._pages[p].killView(); - delete this._pages[p]; - } - this._pages = {}; - }; var pages = new Pages(); - pages.addPage('openEngineView', 'Render Engine', 'engineInspector.qml', 300, 400); - pages.addPage('openEngineLODView', 'Render LOD', 'lod.qml', 300, 400); - pages.addPage('openCullInspectorView', 'Cull Inspector', 'culling.qml', 300, 400); - pages.addPage('openMaterialInspectorView', 'Material Inspector', 'materialInspector.qml', 300, 400, MaterialInspector.setWindow); + pages.addPage('openEngineLODView', 'Render LOD', '../lod.qml', 300, 400); + pages.addPage('openCullInspectorView', 'Cull Inspector', '../luci/Culling.qml', 300, 400); + pages.addPage('openMaterialInspectorView', 'Material Inspector', '../materialInspector.qml', 300, 400, MaterialInspector.setWindow); function fromQml(message) { if (pages.open(message.method)) { @@ -132,7 +64,7 @@ ui = new AppUi({ buttonName: "LUCI", home: Script.resolvePath("deferredLighting.qml"), - additionalAppScreens: Script.resolvePath("engineInspector.qml"), + additionalAppScreens : Script.resolvePath("engineInspector.qml"), onMessage: fromQml, normalButton: Script.resolvePath("../../../system/assets/images/luci-i.svg"), activeButton: Script.resolvePath("../../../system/assets/images/luci-a.svg") @@ -144,8 +76,5 @@ Controller.mouseReleaseEvent.disconnect(onMouseReleaseEvent); Controller.mouseMoveEvent.disconnect(onMouseMoveEvent); pages.clear(); - // killEngineInspectorView(); - // killCullInspectorView(); - // killEngineLODWindow(); }); }()); diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index 6ceee9a8d0..a904ec52fc 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -62,6 +62,31 @@ Rectangle { Antialiasing {} } } + Prop.PropFolderPanel { + label: "Culling" + panelFrameData: Component { + Culling {} + } + } + Prop.PropFolderPanel { + label: "Tools" + panelFrameData: Component { + Row { + HifiControls.Button { + text: "LOD" + onClicked: { + sendToScript({method: "openEngineLODView"}); + } + } + HifiControls.Button { + text: "Material" + onClicked: { + sendToScript({method: "openMaterialInspectorView"}); + } + } + } + } + } Jet.TaskPropView { id: "le" jobPath: "" diff --git a/scripts/developer/utilities/render/culling.qml b/scripts/developer/utilities/render/luci/Culling.qml similarity index 86% rename from scripts/developer/utilities/render/culling.qml rename to scripts/developer/utilities/render/luci/Culling.qml index 801cb5b573..d881ddf7a6 100644 --- a/scripts/developer/utilities/render/culling.qml +++ b/scripts/developer/utilities/render/luci/Culling.qml @@ -9,11 +9,16 @@ // import QtQuick 2.5 import QtQuick.Controls 1.4 -import "configSlider" + +import "../../lib/prop" as Prop Column { id: root spacing: 8 + + anchors.left: parent.left; + anchors.right: parent.right; + property var sceneOctree: Render.getConfig("RenderMainView.DrawSceneOctree"); property var itemSelection: Render.getConfig("RenderMainView.DrawItemSelection"); @@ -36,6 +41,10 @@ Column { GroupBox { title: "Culling" + + anchors.left: parent.left; + anchors.right: parent.right; + Row { spacing: 8 Column { @@ -91,6 +100,7 @@ Column { } } } + } GroupBox { @@ -103,13 +113,14 @@ Column { anchors.right: parent.right; Repeater { model: [ "Opaque:RenderMainView.DrawOpaqueDeferred", "Transparent:RenderMainView.DrawTransparentDeferred", "Light:RenderMainView.DrawLight", - "Opaque Overlays:RenderMainView.DrawOverlay3DOpaque", "Transparent Overlays:RenderMainView.DrawOverlay3DTransparent" ] - ConfigSlider { + "Opaque InFront:RenderMainView.DrawInFrontOpaque", "Transparent InFront:RenderMainView.DrawInFrontTransparent", + "Opaque HUD:RenderMainView.DrawHUDOpaque", "Transparent HUD:RenderMainView.DrawHUDTransparent" ] + Prop.PropScalar { label: qsTr(modelData.split(":")[0]) integral: true - config: Render.getConfig(modelData.split(":")[1]) + object: Render.getConfig(modelData.split(":")[1]) property: "maxDrawn" - max: config.numDrawn + max: object.numDrawn min: -1 } } diff --git a/scripts/developer/utilities/render/luci/Page.js b/scripts/developer/utilities/render/luci/Page.js new file mode 100644 index 0000000000..06c9704abf --- /dev/null +++ b/scripts/developer/utilities/render/luci/Page.js @@ -0,0 +1,90 @@ +// +// Page.js +// +// Sam Gateau, created on 4/19/2019 +// Copyright 2019 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 +// +"use strict"; + +(function() { +function Page(title, qmlurl, width, height, onViewCreated, onViewClosed) { + this.title = title; + this.qml = qmlurl; + this.width = width; + this.height = height; + this.onViewCreated = onViewCreated; + this.onViewClosed = onViewClosed; + + this.window; + + print("Page: New Page:" + JSON.stringify(this)); +} + +Page.prototype.killView = function () { + print("Page: Kill window for page:" + JSON.stringify(this)); + if (this.window) { + print("Page: Kill window for page:" + this.title); + //this.window.closed.disconnect(function () { + // this.killView(); + //}); + this.window.close(); + this.window = false; + } +}; + +Page.prototype.createView = function () { + var that = this; + if (!this.window) { + print("Page: New window for page:" + this.title); + this.window = Desktop.createWindow(Script.resolvePath(this.qml), { + title: this.title, + presentationMode: Desktop.PresentationMode.NATIVE, + size: {x: this.width, y: this.height} + }); + this.onViewCreated(this.window); + this.window.closed.connect(function () { + that.killView(); + that.onViewClosed(); + }); + } +}; + + +Pages = function () { + this._pages = {}; +}; + +Pages.prototype.addPage = function (command, title, qmlurl, width, height, onViewCreated, onViewClosed) { + if (onViewCreated === undefined) { + // Workaround for bad linter + onViewCreated = function(window) {}; + } + if (onViewClosed === undefined) { + // Workaround for bad linter + onViewClosed = function() {}; + } + this._pages[command] = new Page(title, qmlurl, width, height, onViewCreated, onViewClosed); +}; + +Pages.prototype.open = function (command) { + print("Pages: command = " + command); + if (!this._pages[command]) { + print("Pages: unknown command = " + command); + return; + } + this._pages[command].createView(); +}; + +Pages.prototype.clear = function () { + for (var p in this._pages) { + print("Pages: kill page: " + p); + this._pages[p].killView(); + delete this._pages[p]; + } + this._pages = {}; +}; + +}()); diff --git a/scripts/developer/utilities/render/luci/qmldir b/scripts/developer/utilities/render/luci/qmldir index c88dfee714..7a7d6a8ca6 100644 --- a/scripts/developer/utilities/render/luci/qmldir +++ b/scripts/developer/utilities/render/luci/qmldir @@ -3,4 +3,5 @@ ShadingModel 1.0 ShadingModel.qml ToneMapping 1.0 ToneMapping.qml BoundingBoxes 1.0 BoundingBoxes.qml Framebuffer 1.0 Framebuffer.qml -Antialiasing 1.0 Antialiasing.qml \ No newline at end of file +Antialiasing 1.0 Antialiasing.qml +Culling 1.0 Culling.qml \ No newline at end of file diff --git a/scripts/developer/utilities/render/luci2.js b/scripts/developer/utilities/render/luci2.js index d6bb005795..a34cf88415 100644 --- a/scripts/developer/utilities/render/luci2.js +++ b/scripts/developer/utilities/render/luci2.js @@ -1,10 +1,83 @@ + + +var MaterialInspector = Script.require('./materialInspector.js'); +var Page = Script.require('./luci/Page.js'); + + function openView() { - // Set up the qml ui - var window = Desktop.createWindow(Script.resolvePath('luci.qml'), { - title: this.title, - presentationMode: Desktop.PresentationMode.NATIVE, - size: {x: 300, y: 400} - }); //window.closed.connect(function() { Script.stop(); }); + + + var pages = new Pages(); + function fromQml(message) { + if (pages.open(message.method)) { + return; + } + } + + var luciWindow + function openLuciWindow(window) { + if (luciWindow !== undefined) { + activeWindow.fromQml.disconnect(fromQml); + } + if (window !== undefined) { + window.fromQml.connect(fromQml); + } + luciWindow = window; + + + var moveDebugCursor = false; + var onMousePressEvent = function (e) { + if (e.isMiddleButton) { + moveDebugCursor = true; + setDebugCursor(e.x, e.y); + } + }; + Controller.mousePressEvent.connect(onMousePressEvent); + + var onMouseReleaseEvent = function () { + moveDebugCursor = false; + }; + Controller.mouseReleaseEvent.connect(onMouseReleaseEvent); + + var onMouseMoveEvent = function (e) { + if (moveDebugCursor) { + setDebugCursor(e.x, e.y); + } + }; + Controller.mouseMoveEvent.connect(onMouseMoveEvent); + + function setDebugCursor(x, y) { + var nx = 2.0 * (x / Window.innerWidth) - 1.0; + var ny = 1.0 - 2.0 * ((y) / (Window.innerHeight)); + + Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = { x: nx, y: ny, z: 1.0, w: 1.0 }; + } + + } + + function closeLuciWindow() { + if (luciWindow !== undefined) { + activeWindow.fromQml.disconnect(fromQml); + } + luciWindow = {}; + + Controller.mousePressEvent.disconnect(onMousePressEvent); + Controller.mouseReleaseEvent.disconnect(onMouseReleaseEvent); + Controller.mouseMoveEvent.disconnect(onMouseMoveEvent); + pages.clear(); + } + + pages.addPage('Luci', 'Luci', '../luci.qml', 300, 420, openLuciWindow, closeLuciWindow); + pages.addPage('openEngineLODView', 'Render LOD', '../lod.qml', 300, 400); + pages.addPage('openMaterialInspectorView', 'Material Inspector', '../materialInspector.qml', 300, 400, MaterialInspector.setWindow, MaterialInspector.setWindow); + + pages.open('Luci'); + + + return pages; } -openView(); \ No newline at end of file + + +openView(); + diff --git a/scripts/developer/utilities/render/materialInspector.js b/scripts/developer/utilities/render/materialInspector.js index 76e5da5cd0..98d9f769fb 100644 --- a/scripts/developer/utilities/render/materialInspector.js +++ b/scripts/developer/utilities/render/materialInspector.js @@ -109,7 +109,9 @@ function mouseReleaseEvent(event) { } function killWindow() { - setWindow(undefined); + activeWindow = undefined; + + // setWindow(undefined); } function toQml(message) { @@ -138,14 +140,14 @@ function setSelectedObject(id, type) { function setWindow(window) { if (activeWindow !== undefined) { setSelectedObject(Uuid.NULL, ""); - activeWindow.closed.disconnect(killWindow); + // activeWindow.closed.disconnect(killWindow); activeWindow.fromQml.disconnect(fromQml); Controller.mousePressEvent.disconnect(mousePressEvent); Controller.mouseReleaseEvent.disconnect(mouseReleaseEvent); activeWindow.close(); } if (window !== undefined) { - window.closed.connect(killWindow); + // window.closed.connect(killWindow); window.fromQml.connect(fromQml); Controller.mousePressEvent.connect(mousePressEvent); Controller.mouseReleaseEvent.connect(mouseReleaseEvent); From 97632534e52434776023946f7546457737b3a654 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 22 Apr 2019 09:14:32 -0700 Subject: [PATCH 27/27] REvert unecessary modified files to upstream master, just leaving the true new feature in this branch --- .../hmd/DebugHmdDisplayPlugin.cpp | 5 - .../gpu-gl-common/src/gpu/gl/GLBackend.cpp | 8 +- .../gpu-gl-common/src/gpu/gl/GLBackend.h | 10 +- .../src/gpu/gl/GLBackendTransform.cpp | 45 +- .../gpu-gl/src/gpu/gl45/GL45BackendOutput.cpp | 21 +- libraries/gpu/src/gpu/Context.cpp | 945 ------------------ libraries/gpu/src/gpu/Framebuffer.cpp | 30 +- libraries/gpu/src/gpu/Framebuffer.h | 11 +- libraries/gpu/src/gpu/Texture.h | 8 +- libraries/gpu/src/gpu/Transform.slh | 11 +- libraries/shaders/headers/450/header.glsl | 1 - tools/shadergen.py | 4 - 12 files changed, 21 insertions(+), 1078 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp index cd7478d002..b4527ff90c 100644 --- a/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/hmd/DebugHmdDisplayPlugin.cpp @@ -26,8 +26,6 @@ bool DebugHmdDisplayPlugin::isSupported() const { void DebugHmdDisplayPlugin::resetSensors() { _currentRenderFrameInfo.renderPose = glm::mat4(); // identity - _currentRenderFrameInfo.renderPose = glm::translate(glm::mat4(), glm::vec3(0.0f, 1.76f, 0.0f)); - } bool DebugHmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) { @@ -37,8 +35,6 @@ bool DebugHmdDisplayPlugin::beginFrameRender(uint32_t frameIndex) { // FIXME simulate head movement //_currentRenderFrameInfo.renderPose = ; //_currentRenderFrameInfo.presentPose = _currentRenderFrameInfo.renderPose; - _currentRenderFrameInfo.renderPose = glm::translate(glm::mat4(), glm::vec3(0.0f, 1.76f, 0.0f)); - _currentRenderFrameInfo.presentPose = _currentRenderFrameInfo.renderPose; withNonPresentThreadLock([&] { _frameInfos[frameIndex] = _currentRenderFrameInfo; @@ -78,7 +74,6 @@ bool DebugHmdDisplayPlugin::internalActivate() { // uncomment to capture a quarter size frame //_renderTargetSize /= 2; _cullingProjection = _eyeProjections[0]; - // This must come after the initialization, so that the values calculated // above are available during the customizeContext call (when not running // in threaded present mode) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp index 844c1ce2bf..fef458f536 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp @@ -447,24 +447,20 @@ void GLBackend::render(const Batch& batch) { renderPassTransfer(batch); } -//#ifdef GPU_STEREO_DRAWCALL_INSTANCED -#ifdef GPU_STEREO_VIEWPORT_CLIPPED +#ifdef GPU_STEREO_DRAWCALL_INSTANCED if (_stereo.isStereo()) { glEnable(GL_CLIP_DISTANCE0); } #endif -//#endif { GL_PROFILE_RANGE(render_gpu_gl_detail, _stereo.isStereo() ? "Render Stereo" : "Render"); renderPassDraw(batch); } -//#ifdef GPU_STEREO_DRAWCALL_INSTANCED -#ifdef GPU_STEREO_VIEWPORT_CLIPPED +#ifdef GPU_STEREO_DRAWCALL_INSTANCED if (_stereo.isStereo()) { glDisable(GL_CLIP_DISTANCE0); } #endif -//#endif // Restore the saved stereo state for the next batch _stereo._enable = savedStereo; diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h index 327488da36..ffd0466b79 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.h @@ -36,8 +36,7 @@ #define GPU_STEREO_TECHNIQUE_DOUBLED_SIMPLE #else //#define GPU_STEREO_TECHNIQUE_DOUBLED_SMARTER -//#define GPU_STEREO_TECHNIQUE_INSTANCED -#define GPU_STEREO_TECHNIQUE_INSTANCED_MULTIVIEWPORT +#define GPU_STEREO_TECHNIQUE_INSTANCED #endif // Let these be configured by the one define picked above @@ -52,13 +51,6 @@ #ifdef GPU_STEREO_TECHNIQUE_INSTANCED #define GPU_STEREO_DRAWCALL_INSTANCED -#define GPU_STEREO_VIEWPORT_CLIPPED -#define GPU_STEREO_CAMERA_BUFFER -#endif - -#ifdef GPU_STEREO_TECHNIQUE_INSTANCED_MULTIVIEWPORT -#define GPU_STEREO_DRAWCALL_INSTANCED -#define GPU_STEREO_MULTI_VIEWPORT #define GPU_STEREO_CAMERA_BUFFER #endif diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp index 698a70af5a..555a0a1e41 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackendTransform.cpp @@ -39,48 +39,6 @@ void GLBackend::do_setViewportTransform(const Batch& batch, size_t paramOffset) #ifdef GPU_STEREO_DRAWCALL_INSTANCED { - #ifdef GPU_STEREO_MULTI_VIEWPORT - ivec4& vp = _transform._viewport; - auto sideWidth = vp.z / 2; - - vec4 leftRight[3]; - - // Mono - leftRight[0] = vp; - // adding this here as im doing Layered, force the first viewport here to be half of it - leftRight[0].x = 0; - leftRight[0].z = sideWidth; - - // Left side - leftRight[1] = vp; - leftRight[1].x = 0; - leftRight[1].z = sideWidth; - - // right side - leftRight[2] = vp; - leftRight[2].x = sideWidth; - leftRight[2].z = sideWidth; - - glViewportArrayv(0, 3, (float*)leftRight); - - // Where we assign the GL viewport - if (_stereo.isStereo()) { - - // ivec4 leftRight[3]; - // leftRight[0] = vp; - vp.z /= 2; - /* leftRight[1] = vp; // left side - leftRight[2] = vp; // right side - leftRight[2].x += vp.z; - glViewportArrayv(0, 3, (float*) leftRight); -*/ - if (_stereo._pass) { - vp.x += vp.z; - } - } else { - // glViewport(vp.x, vp.y, vp.z, vp.w); - } - #else ivec4& vp = _transform._viewport; glViewport(vp.x, vp.y, vp.z, vp.w); @@ -91,7 +49,6 @@ void GLBackend::do_setViewportTransform(const Batch& batch, size_t paramOffset) vp.x += vp.z; } } - #endif } #else if (!_inRenderTransferPass && !isStereo()) { @@ -166,7 +123,7 @@ void GLBackend::TransformStageState::preUpdate(size_t commandIndex, const Stereo if (_invalidView || _invalidProj || _invalidViewport) { size_t offset = _cameraUboSize * _cameras.size(); - Vec2 finalJitter = _projectionJitter / Vec2(framebufferSize); + Vec2 finalJitter = _projectionJitter / Vec2(framebufferSize); _cameraOffsets.push_back(TransformStageState::Pair(commandIndex, offset)); if (stereo.isStereo()) { diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendOutput.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendOutput.cpp index a86e6637a2..7a299e792b 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendOutput.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendOutput.cpp @@ -60,23 +60,12 @@ public: } if (gltexture) { - if (!_gpuObject.isLayered()) { - if (gltexture->_target == GL_TEXTURE_2D) { - glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0); - } else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) { - glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0); - } else { - glNamedFramebufferTextureLayer(_id, colorAttachments[unit], gltexture->_texture, 0, b._subresource); - } + if (gltexture->_target == GL_TEXTURE_2D) { + glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0); + } else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) { + glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0); } else { - if (gltexture->_target == GL_TEXTURE_2D) { - glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0); - } else if (gltexture->_target == GL_TEXTURE_2D_MULTISAMPLE) { - glNamedFramebufferTexture(_id, colorAttachments[unit], gltexture->_texture, 0); - } else { - glNamedFramebufferTextureLayer(_id, colorAttachments[unit], gltexture->_texture, 0, - b._subresource); - } + glNamedFramebufferTextureLayer(_id, colorAttachments[unit], gltexture->_texture, 0, b._subresource); } _colorBuffers.push_back(colorAttachments[unit]); } else { diff --git a/libraries/gpu/src/gpu/Context.cpp b/libraries/gpu/src/gpu/Context.cpp index e3c75a24d6..45ee4263a3 100644 --- a/libraries/gpu/src/gpu/Context.cpp +++ b/libraries/gpu/src/gpu/Context.cpp @@ -421,951 +421,6 @@ void gpu::doInBatch(const char* name, const std::shared_ptr& context, const std::function& f) { auto batch = Context::acquireBatch(name); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - f(*batch); context->appendFrameBatch(batch); } diff --git a/libraries/gpu/src/gpu/Framebuffer.cpp b/libraries/gpu/src/gpu/Framebuffer.cpp index 41406b4b93..e88d986da6 100755 --- a/libraries/gpu/src/gpu/Framebuffer.cpp +++ b/libraries/gpu/src/gpu/Framebuffer.cpp @@ -82,14 +82,6 @@ uint32 Framebuffer::getFrameCount() const { } } -uint16 evalRenderBufferNumLayers(const Texture& texture, uint16 subresource) { - if (subresource == TextureView::UNDEFINED_SUBRESOURCE) { - return texture.getNumSlices(); - } else { - return 1; - } -} - bool Framebuffer::validateTargetCompatibility(const Texture& texture, uint32 subresource) const { if (texture.getType() == Texture::TEX_1D) { return false; @@ -100,8 +92,7 @@ bool Framebuffer::validateTargetCompatibility(const Texture& texture, uint32 sub } else { if ((texture.getWidth() == getWidth()) && (texture.getHeight() == getHeight()) && - (texture.getNumSamples() == getNumSamples()) && - (evalRenderBufferNumLayers(texture, subresource) == getNumLayers())) { + (texture.getNumSamples() == getNumSamples())) { return true; } else { return false; @@ -109,7 +100,7 @@ bool Framebuffer::validateTargetCompatibility(const Texture& texture, uint32 sub } } -void Framebuffer::updateSize(const TexturePointer& texture, uint32 subresource) { +void Framebuffer::updateSize(const TexturePointer& texture) { if (!isEmpty()) { return; } @@ -118,9 +109,8 @@ void Framebuffer::updateSize(const TexturePointer& texture, uint32 subresource) _width = texture->getWidth(); _height = texture->getHeight(); _numSamples = texture->getNumSamples(); - _numLayers = evalRenderBufferNumLayers(*texture, subresource); } else { - _width = _height = _numSamples = _numLayers = 0; + _width = _height = _numSamples = 0; } } @@ -148,14 +138,6 @@ uint16 Framebuffer::getNumSamples() const { } } -uint16 Framebuffer::getNumLayers() const { - if (isSwapchain()) { - return getSwapchain()->getNumLayers(); - } else { - return _numLayers; - } -} - // Render buffers int Framebuffer::setRenderBuffer(uint32 slot, const TexturePointer& texture, uint32 subresource) { if (isSwapchain()) { @@ -182,7 +164,7 @@ int Framebuffer::setRenderBuffer(uint32 slot, const TexturePointer& texture, uin ++_colorStamps[slot]; - updateSize(texture, subresource); + updateSize(texture); // assign the new one _renderBuffers[slot] = TextureView(texture, subresource); @@ -209,7 +191,7 @@ void Framebuffer::removeRenderBuffers() { renderBuffer._texture.reset(); } - updateSize(TexturePointer(nullptr), TextureView::UNDEFINED_SUBRESOURCE); + updateSize(TexturePointer(nullptr)); } @@ -258,7 +240,7 @@ bool Framebuffer::assignDepthStencilBuffer(const TexturePointer& texture, const } ++_depthStamp; - updateSize(texture, subresource); + updateSize(texture); // assign the new one _depthStencilBuffer = TextureView(texture, subresource, format); diff --git a/libraries/gpu/src/gpu/Framebuffer.h b/libraries/gpu/src/gpu/Framebuffer.h index 3d2b869958..47b2775d52 100755 --- a/libraries/gpu/src/gpu/Framebuffer.h +++ b/libraries/gpu/src/gpu/Framebuffer.h @@ -27,7 +27,6 @@ public: uint16 getWidth() const { return _width; } uint16 getHeight() const { return _height; } uint16 getNumSamples() const { return _numSamples; } - uint16 getNumLayers() const { return _numLayers; } bool hasDepthStencil() const { return _hasDepthStencil; } bool isFullscreen() const { return _isFullscreen; } @@ -55,7 +54,6 @@ protected: uint16 _width = 1; uint16 _height = 1; uint16 _numSamples = 1; - uint16 _numLayers = 1; uint16 _swapInterval = 0; bool _hasDepthStencil = false; @@ -117,6 +115,7 @@ public: uint32 getDepthStencilBufferSubresource() const; Format getDepthStencilBufferFormat() const; + // Properties Masks getBufferMask() const { return _bufferMask; } bool isEmpty() const { return (_bufferMask == 0); } @@ -131,10 +130,6 @@ public: uint16 getWidth() const; uint16 getHeight() const; uint16 getNumSamples() const; - - uint16 getNumLayers() const; - bool isLayered() const { return getNumLayers() > 1; } - const std::string& getName() const { return _name; } void setName(const std::string& name) { _name = name; } @@ -175,9 +170,7 @@ protected: uint16 _height = 0; uint16 _numSamples = 0; - uint16 _numLayers = 0; - - void updateSize(const TexturePointer& texture, uint32 subresource); + void updateSize(const TexturePointer& texture); bool assignDepthStencilBuffer(const TexturePointer& texture, const Format& format, uint32 subresource); friend class Serializer; diff --git a/libraries/gpu/src/gpu/Texture.h b/libraries/gpu/src/gpu/Texture.h index 537169bf67..26ff86af9c 100755 --- a/libraries/gpu/src/gpu/Texture.h +++ b/libraries/gpu/src/gpu/Texture.h @@ -646,11 +646,9 @@ typedef std::vector< TexturePointer > Textures; class TextureView { public: typedef Resource::Size Size; - - static const uint16 UNDEFINED_SUBRESOURCE { uint16(-1) }; TexturePointer _texture = TexturePointer(NULL); - uint16 _subresource = UNDEFINED_SUBRESOURCE; + uint16 _subresource = 0; Element _element = Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA); TextureView() {}; @@ -662,7 +660,7 @@ public: // create the TextureView and own the Texture TextureView(Texture* newTexture, const Element& element) : _texture(newTexture), - _subresource(UNDEFINED_SUBRESOURCE), + _subresource(0), _element(element) {}; TextureView(const TexturePointer& texture, uint16 subresource, const Element& element) : @@ -684,8 +682,6 @@ public: bool operator !() const { return (!_texture); } bool isValid() const { return bool(_texture); } - - bool isSubresource() const { return (_subresource != UNDEFINED_SUBRESOURCE); } }; typedef std::vector TextureViews; diff --git a/libraries/gpu/src/gpu/Transform.slh b/libraries/gpu/src/gpu/Transform.slh index 484ad7ebd2..3015de7e0e 100644 --- a/libraries/gpu/src/gpu/Transform.slh +++ b/libraries/gpu/src/gpu/Transform.slh @@ -168,17 +168,10 @@ TransformObject getTransformObject() { vec2 eyeOffsetScale = vec2(-0.5, +0.5); uint eyeIndex = uint(_stereoSide); #if !defined(GPU_GLES) || (defined(HAVE_EXT_clip_cull_distance) && !defined(VULKAN)) -#ifdef GPU_GL450 - /* gl_ViewportIndex = _stereoSide + 1; - // gl_ViewportIndex = 2 - _stereoSide; - */// THIs is the layered version - gl_Layer = _stereoSide; -#else gl_ClipDistance[0] = dot(<$clipPos$>, eyeClipEdge[eyeIndex]); #endif -#endif - // float newClipPosX = <$clipPos$>.x * 0.5 + eyeOffsetScale[eyeIndex] * <$clipPos$>.w; - // <$clipPos$>.x = newClipPosX; + float newClipPosX = <$clipPos$>.x * 0.5 + eyeOffsetScale[eyeIndex] * <$clipPos$>.w; + <$clipPos$>.x = newClipPosX; #endif #else diff --git a/libraries/shaders/headers/450/header.glsl b/libraries/shaders/headers/450/header.glsl index e3f0021d16..ef0ec09414 100644 --- a/libraries/shaders/headers/450/header.glsl +++ b/libraries/shaders/headers/450/header.glsl @@ -1,4 +1,3 @@ -#extension GL_ARB_shader_viewport_layer_array : require #define GPU_SSBO_TRANSFORM_OBJECT #define BITFIELD int #define LAYOUT(X) layout(X) diff --git a/tools/shadergen.py b/tools/shadergen.py index 4ce4d2818f..f82b471f17 100644 --- a/tools/shadergen.py +++ b/tools/shadergen.py @@ -215,10 +215,6 @@ def processCommand(line): if (dialect == '310es'): spirvCrossDialect = '320es' spirvCrossArgs = [spirvCrossExec, '--output', glslFile, spirvFile, '--version', spirvCrossDialect] if (dialect == '410'): spirvCrossArgs.append('--no-420pack-extension') - if (dialect == '450'): - spirvCrossArgs.append('--extension') - spirvCrossArgs.append('GL_ARB_shader_viewport_layer_array') - executeSubprocess(spirvCrossArgs) else: # This logic is necessary because cmake will agressively keep re-executing the shadergen