Skip to content

Commit 80cd24c

Browse files
committed
Updated builds.
1 parent 3c904f3 commit 80cd24c

File tree

3 files changed

+627
-621
lines changed

3 files changed

+627
-621
lines changed

build/three.js

Lines changed: 67 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -14656,6 +14656,7 @@
1465614656
boxMesh.material.uniforms.tCube.value = ( background.isWebGLRenderTargetCube ) ? background.texture : background;
1465714657
boxMesh.material.uniforms.tFlip.value = ( background.isWebGLRenderTargetCube ) ? 1 : - 1;
1465814658

14659+
// push to the pre-sorted opaque render list
1465914660
renderList.push( boxMesh, boxMesh.geometry, boxMesh.material, 0, null );
1466014661

1466114662
} else if ( background && background.isTexture ) {
@@ -14683,6 +14684,7 @@
1468314684

1468414685
planeMesh.material.uniforms.t2D.value = background;
1468514686

14687+
// push to the pre-sorted opaque render list
1468614688
renderList.push( planeMesh, planeMesh.geometry, planeMesh.material, 0, null );
1468714689

1468814690
}
@@ -21262,72 +21264,73 @@
2126221264

2126321265
constructor: ArrayCamera,
2126421266

21265-
isArrayCamera: true,
21267+
isArrayCamera: true
2126621268

21267-
/**
21268-
* Assumes 2 cameras that are perpendicular and share an X-axis, and that
21269-
* the cameras' projection and world matrices have already been set.
21270-
* And that near and far planes are identical for both cameras.
21271-
*/
21272-
setProjectionFromUnion: function () {
21273-
21274-
var cameraLPos = new Vector3();
21275-
var cameraRPos = new Vector3();
21276-
21277-
return function () {
21278-
21279-
cameraLPos.setFromMatrixPosition( this.cameras[ 0 ].matrixWorld );
21280-
cameraRPos.setFromMatrixPosition( this.cameras[ 1 ].matrixWorld );
21281-
21282-
var ipd = cameraLPos.distanceTo( cameraRPos );
21283-
21284-
var projL = this.cameras[ 0 ].projectionMatrix;
21285-
var projR = this.cameras[ 1 ].projectionMatrix;
21286-
21287-
// VR systems will have identical far and near planes, and
21288-
// most likely identical top and bottom frustum extents.
21289-
// via: https://computergraphics.stackexchange.com/a/4765
21290-
var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
21291-
var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
21292-
21293-
var leftFovL = ( projL[ 8 ] - 1 ) / projL[ 0 ];
21294-
var rightFovR = ( projR[ 8 ] + 1 ) / projR[ 0 ];
21295-
var leftL = leftFovL * near;
21296-
var rightR = rightFovR * near;
21297-
var topL = near * ( projL[ 9 ] + 1 ) / projL[ 5 ];
21298-
var topR = near * ( projR[ 9 ] + 1 ) / projR[ 5 ];
21299-
var bottomL = near * ( projL[ 9 ] - 1 ) / projL[ 5 ];
21300-
var bottomR = near * ( projR[ 9 ] - 1 ) / projR[ 5 ];
21301-
21302-
// Calculate the new camera's position offset from the
21303-
// left camera.
21304-
var zOffset = ipd / ( leftFovL + rightFovR );
21305-
var xOffset = zOffset * leftFovL;
21306-
21307-
// TODO: Better way to apply this offset?
21308-
this.cameras[ 0 ].matrixWorld.decompose( this.position, this.quaternion, this.scale );
21309-
this.translateX( xOffset );
21310-
this.translateZ( - zOffset );
21311-
this.matrixWorld.compose( this.position, this.quaternion, this.scale );
21312-
this.matrixWorldInverse.getInverse( this.matrixWorld );
21313-
21314-
// Find the union of the frustum values of the cameras and scale
21315-
// the values so that the near plane's position does not change in world space,
21316-
// although must now be relative to the new union camera.
21317-
var near2 = near + zOffset;
21318-
var far2 = far + zOffset;
21319-
var left = leftL - xOffset;
21320-
var right = rightR + ( ipd - xOffset );
21321-
var top = Math.max( topL, topR );
21322-
var bottom = Math.min( bottomL, bottomR );
21323-
21324-
this.projectionMatrix.makePerspective( left, right, top, bottom, near2, far2 );
21269+
} );
2132521270

21326-
};
21271+
/**
21272+
* @author jsantell / https://www.jsantell.com/
21273+
* @author mrdoob / http://mrdoob.com/
21274+
*/
2132721275

21328-
}(),
21276+
var cameraLPos = new Vector3();
21277+
var cameraRPos = new Vector3();
2132921278

21330-
} );
21279+
/**
21280+
* Assumes 2 cameras that are perpendicular and share an X-axis, and that
21281+
* the cameras' projection and world matrices have already been set.
21282+
* And that near and far planes are identical for both cameras.
21283+
*/
21284+
function setProjectionFromUnion( camera, cameraL, cameraR ) {
21285+
21286+
cameraLPos.setFromMatrixPosition( cameraL.matrixWorld );
21287+
cameraRPos.setFromMatrixPosition( cameraR.matrixWorld );
21288+
21289+
var ipd = cameraLPos.distanceTo( cameraRPos );
21290+
21291+
var projL = cameraL.projectionMatrix;
21292+
var projR = cameraR.projectionMatrix;
21293+
21294+
// VR systems will have identical far and near planes, and
21295+
// most likely identical top and bottom frustum extents.
21296+
// via: https://computergraphics.stackexchange.com/a/4765
21297+
var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
21298+
var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
21299+
21300+
var leftFovL = ( projL[ 8 ] - 1 ) / projL[ 0 ];
21301+
var rightFovR = ( projR[ 8 ] + 1 ) / projR[ 0 ];
21302+
var leftL = leftFovL * near;
21303+
var rightR = rightFovR * near;
21304+
var topL = near * ( projL[ 9 ] + 1 ) / projL[ 5 ];
21305+
var topR = near * ( projR[ 9 ] + 1 ) / projR[ 5 ];
21306+
var bottomL = near * ( projL[ 9 ] - 1 ) / projL[ 5 ];
21307+
var bottomR = near * ( projR[ 9 ] - 1 ) / projR[ 5 ];
21308+
21309+
// Calculate the new camera's position offset from the
21310+
// left camera.
21311+
var zOffset = ipd / ( leftFovL + rightFovR );
21312+
var xOffset = zOffset * leftFovL;
21313+
21314+
// TODO: Better way to apply this offset?
21315+
cameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );
21316+
camera.translateX( xOffset );
21317+
camera.translateZ( - zOffset );
21318+
camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );
21319+
camera.matrixWorldInverse.getInverse( camera.matrixWorld );
21320+
21321+
// Find the union of the frustum values of the cameras and scale
21322+
// the values so that the near plane's position does not change in world space,
21323+
// although must now be relative to the new union camera.
21324+
var near2 = near + zOffset;
21325+
var far2 = far + zOffset;
21326+
var left = leftL - xOffset;
21327+
var right = rightR + ( ipd - xOffset );
21328+
var top = Math.max( topL, topR );
21329+
var bottom = Math.min( bottomL, bottomR );
21330+
21331+
camera.projectionMatrix.makePerspective( left, right, top, bottom, near2, far2 );
21332+
21333+
}
2133121334

2133221335
/**
2133321336
* @author mrdoob / http://mrdoob.com/
@@ -21645,7 +21648,7 @@
2164521648
cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
2164621649
cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
2164721650

21648-
cameraVR.setProjectionFromUnion();
21651+
setProjectionFromUnion( cameraVR, cameraL, cameraR );
2164921652

2165021653
//
2165121654

@@ -21888,7 +21891,7 @@
2188821891

2188921892
}
2189021893

21891-
cameraVR.setProjectionFromUnion();
21894+
setProjectionFromUnion( cameraVR, cameraL, cameraR );
2189221895

2189321896
return cameraVR;
2189421897

0 commit comments

Comments
 (0)