From 20629186aedf10e801b002f309d887ee3a7b6b6c Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sat, 21 Dec 2019 14:09:13 +0100 Subject: [PATCH] CubeTexturePass: Fix usage of cube shader. --- examples/js/postprocessing/CubeTexturePass.js | 14 ++++++++++++-- examples/jsm/postprocessing/CubeTexturePass.js | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/examples/js/postprocessing/CubeTexturePass.js b/examples/js/postprocessing/CubeTexturePass.js index ee149c5c1c..628cf9b7dd 100644 --- a/examples/js/postprocessing/CubeTexturePass.js +++ b/examples/js/postprocessing/CubeTexturePass.js @@ -23,6 +23,16 @@ THREE.CubeTexturePass = function ( camera, envMap, opacity ) { } ) ); + Object.defineProperty( this.cubeMesh.material, 'envMap', { + + get: function () { + + return this.uniforms.envMap.value; + + } + + } ); + this.envMap = envMap; this.opacity = ( opacity !== undefined ) ? opacity : 1.0; @@ -44,8 +54,8 @@ THREE.CubeTexturePass.prototype = Object.assign( Object.create( THREE.Pass.proto this.cubeCamera.projectionMatrix.copy( this.camera.projectionMatrix ); this.cubeCamera.quaternion.setFromRotationMatrix( this.camera.matrixWorld ); - this.cubeMesh.material.envMap = this.envMap; - this.cubeMesh.material.opacity = this.opacity; + this.cubeMesh.material.uniforms.envMap.value = this.envMap; + this.cubeMesh.material.uniforms.opacity.value = this.opacity; this.cubeMesh.material.transparent = ( this.opacity < 1.0 ); renderer.setRenderTarget( this.renderToScreen ? null : readBuffer ); diff --git a/examples/jsm/postprocessing/CubeTexturePass.js b/examples/jsm/postprocessing/CubeTexturePass.js index ab627eb843..b85553247a 100644 --- a/examples/jsm/postprocessing/CubeTexturePass.js +++ b/examples/jsm/postprocessing/CubeTexturePass.js @@ -34,6 +34,16 @@ var CubeTexturePass = function ( camera, envMap, opacity ) { } ) ); + Object.defineProperty( this.cubeMesh.material, 'envMap', { + + get: function () { + + return this.uniforms.envMap.value; + + } + + } ); + this.envMap = envMap; this.opacity = ( opacity !== undefined ) ? opacity : 1.0; @@ -55,8 +65,8 @@ CubeTexturePass.prototype = Object.assign( Object.create( Pass.prototype ), { this.cubeCamera.projectionMatrix.copy( this.camera.projectionMatrix ); this.cubeCamera.quaternion.setFromRotationMatrix( this.camera.matrixWorld ); - this.cubeMesh.material.envMap = this.envMap; - this.cubeMesh.material.opacity = this.opacity; + this.cubeMesh.material.uniforms.envMap.value = this.envMap; + this.cubeMesh.material.uniforms.opacity.value = this.opacity; this.cubeMesh.material.transparent = ( this.opacity < 1.0 ); renderer.setRenderTarget( this.renderToScreen ? null : readBuffer ); -- GitLab