Explorar o código

WebGPURenderer: Prevent translation of skybox. (#32526)

Michael Herzog hai 2 meses
pai
achega
af2ccae936
Modificáronse 1 ficheiros con 3 adicións e 7 borrados
  1. 3 7
      src/renderers/common/Background.js

+ 3 - 7
src/renderers/common/Background.js

@@ -106,7 +106,9 @@ class Background extends DataMap {
 
 				// compute vertex position
 				const modifiedPosition = isOrtho.select( positionLocal.mul( orthoScale ), positionLocal );
-				let viewProj = cameraProjectionMatrix.mul( modelViewMatrix.mul( vec4( modifiedPosition, 1.0 ) ) );
+
+				// By using a w component of 0, the skybox will not translate when the camera moves through the scene
+				let viewProj = cameraProjectionMatrix.mul( modelViewMatrix.mul( vec4( modifiedPosition, 0.0 ) ) );
 
 				// force background to far plane so it does not occlude objects
 				viewProj = viewProj.setZ( viewProj.w );
@@ -127,12 +129,6 @@ class Background extends DataMap {
 				backgroundMesh.frustumCulled = false;
 				backgroundMesh.name = 'Background.mesh';
 
-				backgroundMesh.onBeforeRender = function ( renderer, scene, camera ) {
-
-					this.matrixWorld.copyPosition( camera.matrixWorld );
-
-				};
-
 				function onBackgroundDispose() {
 
 					background.removeEventListener( 'dispose', onBackgroundDispose );

粤ICP备19079148号