浏览代码

WebGLRenderer: Simplify env map rotation. (#27788)

Michael Herzog 1 年之前
父节点
当前提交
7f65c011ff
共有 2 个文件被更改,包括 3 次插入9 次删除
  1. 1 4
      src/renderers/webgl/WebGLBackground.js
  2. 2 5
      src/renderers/webgl/WebGLMaterials.js

+ 1 - 4
src/renderers/webgl/WebGLBackground.js

@@ -111,10 +111,7 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
 
 			_e1.copy( scene.backgroundRotation );
 
-			// accommodate left-handed frame
-			_e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
-
-			if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
+			if ( ( background.isCubeTexture && background.isRenderTargetTexture === true ) || background.mapping === CubeUVReflectionMapping ) {
 
 				// environment maps which are not cube render targets or PMREMs follow a different convention
 				_e1.y *= - 1;

+ 2 - 5
src/renderers/webgl/WebGLMaterials.js

@@ -1,4 +1,4 @@
-import { BackSide } from '../../constants.js';
+import { BackSide, CubeUVReflectionMapping } from '../../constants.js';
 import { getUnlitUniformColorSpace } from '../shaders/UniformsUtils.js';
 import { Euler } from '../../math/Euler.js';
 import { Matrix4 } from '../../math/Matrix4.js';
@@ -225,10 +225,7 @@ function WebGLMaterials( renderer, properties ) {
 
 			_e1.copy( envMapRotation );
 
-			// accommodate left-handed frame
-			_e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
-
-			if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
+			if ( ( envMap.isCubeTexture && envMap.isRenderTargetTexture === true ) || envMap.mapping === CubeUVReflectionMapping ) {
 
 				// environment maps which are not cube render targets or PMREMs follow a different convention
 				_e1.y *= - 1;