|
|
@@ -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 );
|