diff --git a/examples/js/postprocessing/OutlinePass.js b/examples/js/postprocessing/OutlinePass.js index 84d93a730a0780a67b59aa4948ce6aa5c92aa33d..ea228727a9e80a5ef90f68262d42dce22b5001cd 100644 --- a/examples/js/postprocessing/OutlinePass.js +++ b/examples/js/postprocessing/OutlinePass.js @@ -67,10 +67,10 @@ THREE.OutlinePass = function ( resolution, scene, camera, selectedObjects ) { var MAX_EDGE_GLOW = 4; this.separableBlurMaterial1 = this.getSeperableBlurMaterial( MAX_EDGE_THICKNESS ); - this.separableBlurMaterial1.uniforms[ "texSize" ].value = new THREE.Vector2( resx, resy ); + this.separableBlurMaterial1.uniforms[ "texSize" ].value.set( 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.set( Math.round( resx / 2 ), Math.round( resy / 2 ) ); this.separableBlurMaterial2.uniforms[ "kernelRadius" ].value = MAX_EDGE_GLOW; // Overlay material @@ -142,7 +142,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype this.renderTargetMaskDownSampleBuffer.setSize( resx, resy ); this.renderTargetBlurBuffer1.setSize( resx, resy ); this.renderTargetEdgeBuffer1.setSize( resx, resy ); - this.separableBlurMaterial1.uniforms[ "texSize" ].value = new THREE.Vector2( resx, resy ); + this.separableBlurMaterial1.uniforms[ "texSize" ].value.set( resx, resy ); resx = Math.round( resx / 2 ); resy = Math.round( resy / 2 ); @@ -150,7 +150,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype this.renderTargetBlurBuffer2.setSize( resx, resy ); this.renderTargetEdgeBuffer2.setSize( resx, resy ); - this.separableBlurMaterial2.uniforms[ "texSize" ].value = new THREE.Vector2( resx, resy ); + this.separableBlurMaterial2.uniforms[ "texSize" ].value.set( resx, resy ); }, @@ -285,7 +285,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype // Make non selected objects invisible, and draw only the selected objects, by comparing the depth buffer of non selected objects this.changeVisibilityOfNonSelectedObjects( false ); this.renderScene.overrideMaterial = this.prepareMaskMaterial; - this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value = new THREE.Vector2( this.renderCamera.near, this.renderCamera.far ); + this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value.set( this.renderCamera.near, this.renderCamera.far ); this.prepareMaskMaterial.uniforms[ "depthTexture" ].value = this.renderTargetDepthBuffer.texture; this.prepareMaskMaterial.uniforms[ "textureMatrix" ].value = this.textureMatrix; renderer.setRenderTarget( this.renderTargetMaskBuffer ); @@ -317,7 +317,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype // 3. Apply Edge Detection Pass this.fsQuad.material = this.edgeDetectionMaterial; this.edgeDetectionMaterial.uniforms[ "maskTexture" ].value = this.renderTargetMaskDownSampleBuffer.texture; - this.edgeDetectionMaterial.uniforms[ "texSize" ].value = new THREE.Vector2( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height ); + this.edgeDetectionMaterial.uniforms[ "texSize" ].value.set( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height ); this.edgeDetectionMaterial.uniforms[ "visibleEdgeColor" ].value = this.tempPulseColor1; this.edgeDetectionMaterial.uniforms[ "hiddenEdgeColor" ].value = this.tempPulseColor2; renderer.setRenderTarget( this.renderTargetEdgeBuffer1 ); @@ -390,7 +390,7 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype uniforms: { "depthTexture": { value: null }, "cameraNearFar": { value: new THREE.Vector2( 0.5, 0.5 ) }, - "textureMatrix": { value: new THREE.Matrix4() } + "textureMatrix": { value: null } }, vertexShader: [ diff --git a/examples/jsm/postprocessing/OutlinePass.js b/examples/jsm/postprocessing/OutlinePass.js index 7f909b5195e34d1a32994509ece1b6d369278c23..e4ca91286804bec338e0ccde98ce023b849029d6 100644 --- a/examples/jsm/postprocessing/OutlinePass.js +++ b/examples/jsm/postprocessing/OutlinePass.js @@ -87,10 +87,10 @@ var OutlinePass = function ( resolution, scene, camera, selectedObjects ) { var MAX_EDGE_GLOW = 4; this.separableBlurMaterial1 = this.getSeperableBlurMaterial( MAX_EDGE_THICKNESS ); - this.separableBlurMaterial1.uniforms[ "texSize" ].value = new Vector2( resx, resy ); + this.separableBlurMaterial1.uniforms[ "texSize" ].value.set( resx, resy ); this.separableBlurMaterial1.uniforms[ "kernelRadius" ].value = 1; this.separableBlurMaterial2 = this.getSeperableBlurMaterial( MAX_EDGE_GLOW ); - this.separableBlurMaterial2.uniforms[ "texSize" ].value = new Vector2( Math.round( resx / 2 ), Math.round( resy / 2 ) ); + this.separableBlurMaterial2.uniforms[ "texSize" ].value.set( Math.round( resx / 2 ), Math.round( resy / 2 ) ); this.separableBlurMaterial2.uniforms[ "kernelRadius" ].value = MAX_EDGE_GLOW; // Overlay material @@ -162,7 +162,7 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), { this.renderTargetMaskDownSampleBuffer.setSize( resx, resy ); this.renderTargetBlurBuffer1.setSize( resx, resy ); this.renderTargetEdgeBuffer1.setSize( resx, resy ); - this.separableBlurMaterial1.uniforms[ "texSize" ].value = new Vector2( resx, resy ); + this.separableBlurMaterial1.uniforms[ "texSize" ].value.set( resx, resy ); resx = Math.round( resx / 2 ); resy = Math.round( resy / 2 ); @@ -170,7 +170,7 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), { this.renderTargetBlurBuffer2.setSize( resx, resy ); this.renderTargetEdgeBuffer2.setSize( resx, resy ); - this.separableBlurMaterial2.uniforms[ "texSize" ].value = new Vector2( resx, resy ); + this.separableBlurMaterial2.uniforms[ "texSize" ].value.set( resx, resy ); }, @@ -305,7 +305,7 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), { // Make non selected objects invisible, and draw only the selected objects, by comparing the depth buffer of non selected objects this.changeVisibilityOfNonSelectedObjects( false ); this.renderScene.overrideMaterial = this.prepareMaskMaterial; - this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value = new Vector2( this.renderCamera.near, this.renderCamera.far ); + this.prepareMaskMaterial.uniforms[ "cameraNearFar" ].value.set( this.renderCamera.near, this.renderCamera.far ); this.prepareMaskMaterial.uniforms[ "depthTexture" ].value = this.renderTargetDepthBuffer.texture; this.prepareMaskMaterial.uniforms[ "textureMatrix" ].value = this.textureMatrix; renderer.setRenderTarget( this.renderTargetMaskBuffer ); @@ -337,7 +337,7 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), { // 3. Apply Edge Detection Pass this.fsQuad.material = this.edgeDetectionMaterial; this.edgeDetectionMaterial.uniforms[ "maskTexture" ].value = this.renderTargetMaskDownSampleBuffer.texture; - this.edgeDetectionMaterial.uniforms[ "texSize" ].value = new Vector2( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height ); + this.edgeDetectionMaterial.uniforms[ "texSize" ].value.set( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height ); this.edgeDetectionMaterial.uniforms[ "visibleEdgeColor" ].value = this.tempPulseColor1; this.edgeDetectionMaterial.uniforms[ "hiddenEdgeColor" ].value = this.tempPulseColor2; renderer.setRenderTarget( this.renderTargetEdgeBuffer1 ); @@ -410,7 +410,7 @@ OutlinePass.prototype = Object.assign( Object.create( Pass.prototype ), { uniforms: { "depthTexture": { value: null }, "cameraNearFar": { value: new Vector2( 0.5, 0.5 ) }, - "textureMatrix": { value: new Matrix4() } + "textureMatrix": { value: null } }, vertexShader: [