2
0
Эх сурвалжийг харах

CubeTexturePass: Fix usage of cube shader.

Mugen87 5 жил өмнө
parent
commit
20629186ae

+ 12 - 2
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 );

+ 12 - 2
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 );