Skip to content

Commit

Permalink
Updated builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag committed Aug 22, 2024
1 parent 41928f7 commit 281f32a
Show file tree
Hide file tree
Showing 5 changed files with 773 additions and 425 deletions.
55 changes: 31 additions & 24 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27344,18 +27344,31 @@ class WebXRManager extends EventDispatcher {
camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );
camera.matrixWorldInverse.copy( camera.matrixWorld ).invert();

// Find the union of the frustum values of the cameras and scale
// the values so that the near plane's position does not change in world space,
// although must now be relative to the new union camera.
const near2 = near + zOffset;
const far2 = far + zOffset;
const left2 = left - xOffset;
const right2 = right + ( ipd - xOffset );
const top2 = topFov * far / far2 * near2;
const bottom2 = bottomFov * far / far2 * near2;
// Check if the projection uses an infinite far plane.
if ( projL[ 10 ] === - 1.0 ) {

camera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );
camera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();
// Use the projection matrix from the left eye.
// The camera offset is sufficient to include the view volumes
// of both eyes (assuming symmetric projections).
camera.projectionMatrix.copy( cameraL.projectionMatrix );
camera.projectionMatrixInverse.copy( cameraL.projectionMatrixInverse );

} else {

// Find the union of the frustum values of the cameras and scale
// the values so that the near plane's position does not change in world space,
// although must now be relative to the new union camera.
const near2 = near + zOffset;
const far2 = far + zOffset;
const left2 = left - xOffset;
const right2 = right + ( ipd - xOffset );
const top2 = topFov * far / far2 * near2;
const bottom2 = bottomFov * far / far2 * near2;

camera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );
camera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();

}

}

Expand All @@ -27379,15 +27392,18 @@ class WebXRManager extends EventDispatcher {

if ( session === null ) return;

let depthNear = camera.near;
let depthFar = camera.far;

if ( depthSensing.texture !== null ) {

camera.near = depthSensing.depthNear;
camera.far = depthSensing.depthFar;
if ( depthSensing.depthNear > 0 ) depthNear = depthSensing.depthNear;
if ( depthSensing.depthFar > 0 ) depthFar = depthSensing.depthFar;

}

cameraXR.near = cameraR.near = cameraL.near = camera.near;
cameraXR.far = cameraR.far = cameraL.far = camera.far;
cameraXR.near = cameraR.near = cameraL.near = depthNear;
cameraXR.far = cameraR.far = cameraL.far = depthFar;

if ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {

Expand All @@ -27401,15 +27417,6 @@ class WebXRManager extends EventDispatcher {
_currentDepthNear = cameraXR.near;
_currentDepthFar = cameraXR.far;

cameraL.near = _currentDepthNear;
cameraL.far = _currentDepthFar;
cameraR.near = _currentDepthNear;
cameraR.far = _currentDepthFar;

cameraL.updateProjectionMatrix();
cameraR.updateProjectionMatrix();
camera.updateProjectionMatrix();

}

const parent = camera.parent;
Expand Down
55 changes: 31 additions & 24 deletions build/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -27342,18 +27342,31 @@ class WebXRManager extends EventDispatcher {
camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );
camera.matrixWorldInverse.copy( camera.matrixWorld ).invert();

// Find the union of the frustum values of the cameras and scale
// the values so that the near plane's position does not change in world space,
// although must now be relative to the new union camera.
const near2 = near + zOffset;
const far2 = far + zOffset;
const left2 = left - xOffset;
const right2 = right + ( ipd - xOffset );
const top2 = topFov * far / far2 * near2;
const bottom2 = bottomFov * far / far2 * near2;
// Check if the projection uses an infinite far plane.
if ( projL[ 10 ] === - 1.0 ) {

camera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );
camera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();
// Use the projection matrix from the left eye.
// The camera offset is sufficient to include the view volumes
// of both eyes (assuming symmetric projections).
camera.projectionMatrix.copy( cameraL.projectionMatrix );
camera.projectionMatrixInverse.copy( cameraL.projectionMatrixInverse );

} else {

// Find the union of the frustum values of the cameras and scale
// the values so that the near plane's position does not change in world space,
// although must now be relative to the new union camera.
const near2 = near + zOffset;
const far2 = far + zOffset;
const left2 = left - xOffset;
const right2 = right + ( ipd - xOffset );
const top2 = topFov * far / far2 * near2;
const bottom2 = bottomFov * far / far2 * near2;

camera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );
camera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();

}

}

Expand All @@ -27377,15 +27390,18 @@ class WebXRManager extends EventDispatcher {

if ( session === null ) return;

let depthNear = camera.near;
let depthFar = camera.far;

if ( depthSensing.texture !== null ) {

camera.near = depthSensing.depthNear;
camera.far = depthSensing.depthFar;
if ( depthSensing.depthNear > 0 ) depthNear = depthSensing.depthNear;
if ( depthSensing.depthFar > 0 ) depthFar = depthSensing.depthFar;

}

cameraXR.near = cameraR.near = cameraL.near = camera.near;
cameraXR.far = cameraR.far = cameraL.far = camera.far;
cameraXR.near = cameraR.near = cameraL.near = depthNear;
cameraXR.far = cameraR.far = cameraL.far = depthFar;

if ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {

Expand All @@ -27399,15 +27415,6 @@ class WebXRManager extends EventDispatcher {
_currentDepthNear = cameraXR.near;
_currentDepthFar = cameraXR.far;

cameraL.near = _currentDepthNear;
cameraL.far = _currentDepthFar;
cameraR.near = _currentDepthNear;
cameraR.far = _currentDepthFar;

cameraL.updateProjectionMatrix();
cameraR.updateProjectionMatrix();
camera.updateProjectionMatrix();

}

const parent = camera.parent;
Expand Down
2 changes: 1 addition & 1 deletion build/three.module.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 281f32a

Please sign in to comment.