Skip to content

Commit

Permalink
WebGLRenderer: Simplify env map rotation. (#27788)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Feb 21, 2024
1 parent bbe78fe commit 7f65c01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/renderers/webgl/WebGLBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 2 additions & 5 deletions src/renderers/webgl/WebGLMaterials.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7f65c01

Please sign in to comment.