Skip to content

Commit 4eba3f5

Browse files
committed
CubeTexturePass: Minor fixes.
1 parent 952a482 commit 4eba3f5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/js/postprocessing/CubeTexturePass.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ THREE.CubeTexturePass = function ( camera, envMap, opacity ) {
1010
this.cubeMesh = new THREE.Mesh(
1111
new THREE.BoxGeometry( 10, 10, 10 ),
1212
new THREE.ShaderMaterial( {
13-
uniforms: this.cubeShader.uniforms,
13+
uniforms: THREE.UniformsUtils.clone( this.cubeShader.uniforms ),
1414
vertexShader: this.cubeShader.vertexShader,
1515
fragmentShader: this.cubeShader.fragmentShader,
1616
depthTest: false,
@@ -51,6 +51,7 @@ THREE.CubeTexturePass.prototype = Object.assign( Object.create( THREE.Pass.proto
5151
this.cubeCamera.quaternion.setFromRotationMatrix( this.camera.matrixWorld );
5252

5353
this.cubeMesh.material.uniforms.envMap.value = this.envMap;
54+
this.cubeMesh.material.uniforms.flipEnvMap.value = ( this.envMap.isCubeTexture && this.envMap._needsFlipEnvMap ) ? - 1 : 1;
5455
this.cubeMesh.material.uniforms.opacity.value = this.opacity;
5556
this.cubeMesh.material.transparent = ( this.opacity < 1.0 );
5657

examples/jsm/postprocessing/CubeTexturePass.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
PerspectiveCamera,
66
Scene,
77
ShaderLib,
8-
ShaderMaterial
8+
ShaderMaterial,
9+
UniformsUtils
910
} from '../../../build/three.module.js';
1011
import { Pass } from '../postprocessing/Pass.js';
1112

@@ -21,7 +22,7 @@ var CubeTexturePass = function ( camera, envMap, opacity ) {
2122
this.cubeMesh = new Mesh(
2223
new BoxGeometry( 10, 10, 10 ),
2324
new ShaderMaterial( {
24-
uniforms: this.cubeShader.uniforms,
25+
uniforms: UniformsUtils.clone( this.cubeShader.uniforms ),
2526
vertexShader: this.cubeShader.vertexShader,
2627
fragmentShader: this.cubeShader.fragmentShader,
2728
depthTest: false,
@@ -62,6 +63,7 @@ CubeTexturePass.prototype = Object.assign( Object.create( Pass.prototype ), {
6263
this.cubeCamera.quaternion.setFromRotationMatrix( this.camera.matrixWorld );
6364

6465
this.cubeMesh.material.uniforms.envMap.value = this.envMap;
66+
this.cubeMesh.material.uniforms.flipEnvMap.value = ( this.envMap.isCubeTexture && this.envMap._needsFlipEnvMap ) ? - 1 : 1;
6567
this.cubeMesh.material.uniforms.opacity.value = this.opacity;
6668
this.cubeMesh.material.transparent = ( this.opacity < 1.0 );
6769

0 commit comments

Comments
 (0)