From 9c21e02837df7e23053ded8118fc64d0df81a7db Mon Sep 17 00:00:00 2001 From: Mourtz <alex.mourtziapis@gmail.com> Date: Wed, 24 Apr 2019 16:04:15 +0200 Subject: [PATCH] Configurable glowDownSampleRatio --- js/scripts/JSRootGeoPainter.js | 9 +++++---- ui5/eve7/lib/EveManager.js | 4 ++-- ui5/eve7/lib/OutlinePass.js | 17 +++++++++-------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/js/scripts/JSRootGeoPainter.js b/js/scripts/JSRootGeoPainter.js index bbce068c44b..9fc1e773460 100644 --- a/js/scripts/JSRootGeoPainter.js +++ b/js/scripts/JSRootGeoPainter.js @@ -1922,11 +1922,12 @@ this._effectComposer.addPass( new THREE.RenderPass( this._scene, this._camera ) ); this._outlinePass = new THREE.OutlinePass( new THREE.Vector2( w, h ), this._scene, this._camera ); - this._outlinePass.edgeStrength = 7.5; - this._outlinePass.edgeGlow = 0.5; - this._outlinePass.edgeThickness = 1.0; + this._outlinePass.edgeStrength = 5.5; + this._outlinePass.edgeGlow = 0.7; + this._outlinePass.edgeThickness = 1.5; this._outlinePass.usePatternTexture = false; - this._outlinePass.downSampleRatio = 2; + this._outlinePass.downSampleRatio = 1; + this._outlinePass.glowDownSampleRatio = 3; // const sh = THREE.OutlinePass.selection_enum["select"]; // doesnt stand for spherical harmonics :P // THREE.OutlinePass.selection_atts[sh].visibleEdgeColor.set('#dd1111'); diff --git a/ui5/eve7/lib/EveManager.js b/ui5/eve7/lib/EveManager.js index 8633252733e..89bf1cdde00 100644 --- a/ui5/eve7/lib/EveManager.js +++ b/ui5/eve7/lib/EveManager.js @@ -582,7 +582,7 @@ sap.ui.define([], function() { if (el.fName == "Global Selection") this.global_selection_id = el.fElementId; if (el.fName == "Global Highlight") this.global_highlight_id = el.fElementId; el._is_registered = true; - el.prev_sel_list = []; + el.prev_sel_list = []; } console.log("==============================And now process the bloody selection.", el.prev_sel_list, el.sel_list); @@ -595,7 +595,7 @@ sap.ui.define([], function() { }); console.log("-- oldMap", oldMap); - var newMap = new Map ; + var newMap = new Map(); el.sel_list.forEach(function(rec) { console.log("add new primary ", rec.primary); var iset = new Set(rec.sec_idcs); diff --git a/ui5/eve7/lib/OutlinePass.js b/ui5/eve7/lib/OutlinePass.js index ed250b7fe23..5bfa9b2d9af 100644 --- a/ui5/eve7/lib/OutlinePass.js +++ b/ui5/eve7/lib/OutlinePass.js @@ -20,6 +20,7 @@ THREE.OutlinePass = function ( resolution, scene, camera ) { this.edgeThickness = 1.0; this.edgeStrength = 3.0; this.downSampleRatio = 2; + this.glowDownSampleRatio = 2; THREE.Pass.call( this ); @@ -67,7 +68,7 @@ THREE.OutlinePass = function ( resolution, scene, camera ) { this.renderTargetBlurBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars ); this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1"; this.renderTargetBlurBuffer1.texture.generateMipmaps = false; - this.renderTargetBlurBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), pars ); + this.renderTargetBlurBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / this.glowDownSampleRatio ), Math.round( resy / this.glowDownSampleRatio ), pars ); this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2"; this.renderTargetBlurBuffer2.texture.generateMipmaps = false; @@ -75,7 +76,7 @@ THREE.OutlinePass = function ( resolution, scene, camera ) { this.renderTargetEdgeBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars ); this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1"; this.renderTargetEdgeBuffer1.texture.generateMipmaps = false; - this.renderTargetEdgeBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), pars ); + this.renderTargetEdgeBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / this.glowDownSampleRatio ), Math.round( resy / this.glowDownSampleRatio ), pars ); this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2"; this.renderTargetEdgeBuffer2.texture.generateMipmaps = false; @@ -86,7 +87,7 @@ THREE.OutlinePass = function ( resolution, scene, camera ) { this.separableBlurMaterial1.uniforms[ "texSize" ].value = new THREE.Vector2( resx, resy ); this.separableBlurMaterial1.uniforms[ "kernelRadius" ].value = 1; this.separableBlurMaterial2 = this.getSeperableBlurMaterial( MAX_EDGE_GLOW ); - this.separableBlurMaterial2.uniforms[ "texSize" ].value = new THREE.Vector2( Math.round( resx / 2 ), Math.round( resy / 2 ) ); + this.separableBlurMaterial2.uniforms[ "texSize" ].value = new THREE.Vector2( Math.round( resx / this.glowDownSampleRatio ), Math.round( resy / this.glowDownSampleRatio ) ); this.separableBlurMaterial2.uniforms[ "kernelRadius" ].value = MAX_EDGE_GLOW; // Overlay material @@ -287,8 +288,8 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype this.renderTargetEdgeBuffer1.setSize( resx, resy ); this.separableBlurMaterial1.uniforms[ "texSize" ].value = new THREE.Vector2( resx, resy ); - resx = Math.round( resx / 2 ); - resy = Math.round( resy / 2 ); + resx = Math.round( resx / this.glowDownSampleRatio ); + resy = Math.round( resy / this.glowDownSampleRatio ); this.renderTargetBlurBuffer2.setSize( resx, resy ); this.renderTargetEdgeBuffer2.setSize( resx, resy ); @@ -504,7 +505,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype this.renderScene.background = currentBackground; - // 2. Downsample to Half resolution + // 2. Downsample to "downSampleRatio" res // clear stuff renderer.setRenderTarget( this.renderTargetEdgeBuffer1 ); @@ -554,7 +555,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype // } // this.changeVisibilityOfSelectedObjects(true); - // 4. Apply Blur on Half res + // 4. Apply Blur on "glowDownSampleRatio" res this.quad.material = this.separableBlurMaterial1; this.separableBlurMaterial1.uniforms[ "colorTexture" ].value = this.renderTargetEdgeBuffer1.texture; this.separableBlurMaterial1.uniforms[ "direction" ].value = THREE.OutlinePass.BlurDirectionX; @@ -568,7 +569,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype renderer.clear(); renderer.render( this.scene, this.camera ); - // Apply Blur on quarter res + // Apply Blur on "downSampleRatio*glowDownSampleRatio" res this.quad.material = this.separableBlurMaterial2; this.separableBlurMaterial2.uniforms[ "colorTexture" ].value = this.renderTargetEdgeBuffer1.texture; this.separableBlurMaterial2.uniforms[ "direction" ].value = THREE.OutlinePass.BlurDirectionX; -- GitLab