Skip to content

Commit 4da81fd

Browse files
committed
Updated builds.
1 parent 74efc68 commit 4da81fd

11 files changed

+701
-242
lines changed

build/three.cjs

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28064,7 +28064,7 @@ class BatchedMesh extends Mesh {
2806428064
const availableInstanceIds = this._availableInstanceIds;
2806528065
const instanceInfo = this._instanceInfo;
2806628066
availableInstanceIds.sort( ascIdSort );
28067-
while ( availableInstanceIds[ availableInstanceIds.length - 1 ] === instanceInfo.length ) {
28067+
while ( availableInstanceIds[ availableInstanceIds.length - 1 ] === instanceInfo.length - 1 ) {
2806828068

2806928069
instanceInfo.pop();
2807028070
availableInstanceIds.pop();
@@ -29573,8 +29573,8 @@ class FramebufferTexture extends Texture {
2957329573
/**
2957429574
* Constructs a new framebuffer texture.
2957529575
*
29576-
* @param {number} width - The width of the texture.
29577-
* @param {number} height - The height of the texture.
29576+
* @param {number} [width] - The width of the texture.
29577+
* @param {number} [height] - The height of the texture.
2957829578
*/
2957929579
constructor( width, height ) {
2958029580

@@ -43827,7 +43827,8 @@ class FileLoader extends Loader {
4382743827
super( manager );
4382843828

4382943829
/**
43830-
* The expected mime type.
43830+
* The expected mime type. Valid values can be found
43831+
* [here]{@link hhttps://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype}
4383143832
*
4383243833
* @type {string}
4383343834
*/
@@ -57156,17 +57157,44 @@ class CameraHelper extends LineSegments {
5715657157

5715757158
const w = 1, h = 1;
5715857159

57160+
let nearZ, farZ;
57161+
5715957162
// we need just camera projection matrix inverse
5716057163
// world matrix must be identity
5716157164

5716257165
_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );
5716357166

5716457167
// Adjust z values based on coordinate system
57165-
const nearZ = this.camera.coordinateSystem === WebGLCoordinateSystem ? -1 : 0;
57168+
57169+
if ( this.camera.reversedDepth === true ) {
57170+
57171+
nearZ = 1;
57172+
farZ = 0;
57173+
57174+
} else {
57175+
57176+
if ( this.camera.coordinateSystem === WebGLCoordinateSystem ) {
57177+
57178+
nearZ = -1;
57179+
farZ = 1;
57180+
57181+
} else if ( this.camera.coordinateSystem === WebGPUCoordinateSystem ) {
57182+
57183+
nearZ = 0;
57184+
farZ = 1;
57185+
57186+
} else {
57187+
57188+
throw new Error( 'THREE.CameraHelper.update(): Invalid coordinate system: ' + this.camera.coordinateSystem );
57189+
57190+
}
57191+
57192+
}
57193+
5716657194

5716757195
// center / target
5716857196
setPoint( 'c', pointMap, geometry, _camera, 0, 0, nearZ );
57169-
setPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );
57197+
setPoint( 't', pointMap, geometry, _camera, 0, 0, farZ );
5717057198

5717157199
// near
5717257200

@@ -57177,10 +57205,10 @@ class CameraHelper extends LineSegments {
5717757205

5717857206
// far
5717957207

57180-
setPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );
57181-
setPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );
57182-
setPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );
57183-
setPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );
57208+
setPoint( 'f1', pointMap, geometry, _camera, - w, - h, farZ );
57209+
setPoint( 'f2', pointMap, geometry, _camera, w, - h, farZ );
57210+
setPoint( 'f3', pointMap, geometry, _camera, - w, h, farZ );
57211+
setPoint( 'f4', pointMap, geometry, _camera, w, h, farZ );
5718457212

5718557213
// up
5718657214

@@ -57190,10 +57218,10 @@ class CameraHelper extends LineSegments {
5719057218

5719157219
// cross
5719257220

57193-
setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );
57194-
setPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );
57195-
setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );
57196-
setPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );
57221+
setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, farZ );
57222+
setPoint( 'cf2', pointMap, geometry, _camera, w, 0, farZ );
57223+
setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, farZ );
57224+
setPoint( 'cf4', pointMap, geometry, _camera, 0, h, farZ );
5719757225

5719857226
setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, nearZ );
5719957227
setPoint( 'cn2', pointMap, geometry, _camera, w, 0, nearZ );
@@ -64192,7 +64220,9 @@ function getEncodingComponents( colorSpace ) {
6419264220
function getShaderErrors( gl, shader, type ) {
6419364221

6419464222
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
64195-
const errors = gl.getShaderInfoLog( shader ).trim();
64223+
64224+
const shaderInfoLog = gl.getShaderInfoLog( shader ) || '';
64225+
const errors = shaderInfoLog.trim();
6419664226

6419764227
if ( status && errors === '' ) return '';
6419864228

@@ -65053,9 +65083,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6505365083
// check for link errors
6505465084
if ( renderer.debug.checkShaderErrors ) {
6505565085

65056-
const programLog = gl.getProgramInfoLog( program ).trim();
65057-
const vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();
65058-
const fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();
65086+
const programInfoLog = gl.getProgramInfoLog( program ) || '';
65087+
const vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';
65088+
const fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';
65089+
65090+
const programLog = programInfoLog.trim();
65091+
const vertexLog = vertexShaderInfoLog.trim();
65092+
const fragmentLog = fragmentShaderInfoLog.trim();
6505965093

6506065094
let runnable = true;
6506165095
let haveDiagnostics = true;
@@ -71767,9 +71801,15 @@ class WebXRManager extends EventDispatcher {
7176771801
currentPixelRatio = renderer.getPixelRatio();
7176871802
renderer.getSize( currentSize );
7176971803

71804+
if ( typeof XRWebGLBinding !== 'undefined' ) {
71805+
71806+
glBinding = new XRWebGLBinding( session, gl );
71807+
71808+
}
71809+
7177071810
// Check that the browser implements the necessary APIs to use an
7177171811
// XRProjectionLayer rather than an XRWebGLLayer
71772-
const useLayers = typeof XRWebGLBinding !== 'undefined' && 'createProjectionLayer' in XRWebGLBinding.prototype;
71812+
const useLayers = glBinding !== null && 'createProjectionLayer' in XRWebGLBinding.prototype;
7177371813

7177471814
if ( ! useLayers ) {
7177571815

@@ -71822,8 +71862,6 @@ class WebXRManager extends EventDispatcher {
7182271862
scaleFactor: framebufferScaleFactor
7182371863
};
7182471864

71825-
glBinding = new XRWebGLBinding( session, gl );
71826-
7182771865
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
7182871866

7182971867
session.updateRenderState( { layers: [ glProjLayer ] } );
@@ -72091,9 +72129,10 @@ class WebXRManager extends EventDispatcher {
7209172129

7209272130
}
7209372131

72094-
cameraL.layers.mask = camera.layers.mask | 0b010;
72095-
cameraR.layers.mask = camera.layers.mask | 0b100;
72096-
cameraXR.layers.mask = cameraL.layers.mask | cameraR.layers.mask;
72132+
// inherit camera layers and enable eye layers (1 = left, 2 = right)
72133+
cameraXR.layers.mask = camera.layers.mask | 0b110;
72134+
cameraL.layers.mask = cameraXR.layers.mask & 0b011;
72135+
cameraR.layers.mask = cameraXR.layers.mask & 0b101;
7209772136

7209872137
const parent = camera.parent;
7209972138
const cameras = cameraXR.cameras;
@@ -72174,7 +72213,7 @@ class WebXRManager extends EventDispatcher {
7217472213
/**
7217572214
* Returns the amount of foveation used by the XR compositor for the projection layer.
7217672215
*
72177-
* @return {number} The amount of foveation.
72216+
* @return {number|undefined} The amount of foveation.
7217872217
*/
7217972218
this.getFoveation = function () {
7218072219

@@ -76278,7 +76317,7 @@ class WebGLRenderer {
7627876317
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
7627976318
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
7628076319

76281-
// when using MRT, select the corect color buffer for the subsequent read command
76320+
// when using MRT, select the correct color buffer for the subsequent read command
7628276321

7628376322
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
7628476323

build/three.core.js

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28062,7 +28062,7 @@ class BatchedMesh extends Mesh {
2806228062
const availableInstanceIds = this._availableInstanceIds;
2806328063
const instanceInfo = this._instanceInfo;
2806428064
availableInstanceIds.sort( ascIdSort );
28065-
while ( availableInstanceIds[ availableInstanceIds.length - 1 ] === instanceInfo.length ) {
28065+
while ( availableInstanceIds[ availableInstanceIds.length - 1 ] === instanceInfo.length - 1 ) {
2806628066

2806728067
instanceInfo.pop();
2806828068
availableInstanceIds.pop();
@@ -29571,8 +29571,8 @@ class FramebufferTexture extends Texture {
2957129571
/**
2957229572
* Constructs a new framebuffer texture.
2957329573
*
29574-
* @param {number} width - The width of the texture.
29575-
* @param {number} height - The height of the texture.
29574+
* @param {number} [width] - The width of the texture.
29575+
* @param {number} [height] - The height of the texture.
2957629576
*/
2957729577
constructor( width, height ) {
2957829578

@@ -43825,7 +43825,8 @@ class FileLoader extends Loader {
4382543825
super( manager );
4382643826

4382743827
/**
43828-
* The expected mime type.
43828+
* The expected mime type. Valid values can be found
43829+
* [here]{@link hhttps://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype}
4382943830
*
4383043831
* @type {string}
4383143832
*/
@@ -57154,17 +57155,44 @@ class CameraHelper extends LineSegments {
5715457155

5715557156
const w = 1, h = 1;
5715657157

57158+
let nearZ, farZ;
57159+
5715757160
// we need just camera projection matrix inverse
5715857161
// world matrix must be identity
5715957162

5716057163
_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );
5716157164

5716257165
// Adjust z values based on coordinate system
57163-
const nearZ = this.camera.coordinateSystem === WebGLCoordinateSystem ? -1 : 0;
57166+
57167+
if ( this.camera.reversedDepth === true ) {
57168+
57169+
nearZ = 1;
57170+
farZ = 0;
57171+
57172+
} else {
57173+
57174+
if ( this.camera.coordinateSystem === WebGLCoordinateSystem ) {
57175+
57176+
nearZ = -1;
57177+
farZ = 1;
57178+
57179+
} else if ( this.camera.coordinateSystem === WebGPUCoordinateSystem ) {
57180+
57181+
nearZ = 0;
57182+
farZ = 1;
57183+
57184+
} else {
57185+
57186+
throw new Error( 'THREE.CameraHelper.update(): Invalid coordinate system: ' + this.camera.coordinateSystem );
57187+
57188+
}
57189+
57190+
}
57191+
5716457192

5716557193
// center / target
5716657194
setPoint( 'c', pointMap, geometry, _camera, 0, 0, nearZ );
57167-
setPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );
57195+
setPoint( 't', pointMap, geometry, _camera, 0, 0, farZ );
5716857196

5716957197
// near
5717057198

@@ -57175,10 +57203,10 @@ class CameraHelper extends LineSegments {
5717557203

5717657204
// far
5717757205

57178-
setPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );
57179-
setPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );
57180-
setPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );
57181-
setPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );
57206+
setPoint( 'f1', pointMap, geometry, _camera, - w, - h, farZ );
57207+
setPoint( 'f2', pointMap, geometry, _camera, w, - h, farZ );
57208+
setPoint( 'f3', pointMap, geometry, _camera, - w, h, farZ );
57209+
setPoint( 'f4', pointMap, geometry, _camera, w, h, farZ );
5718257210

5718357211
// up
5718457212

@@ -57188,10 +57216,10 @@ class CameraHelper extends LineSegments {
5718857216

5718957217
// cross
5719057218

57191-
setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );
57192-
setPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );
57193-
setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );
57194-
setPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );
57219+
setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, farZ );
57220+
setPoint( 'cf2', pointMap, geometry, _camera, w, 0, farZ );
57221+
setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, farZ );
57222+
setPoint( 'cf4', pointMap, geometry, _camera, 0, h, farZ );
5719557223

5719657224
setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, nearZ );
5719757225
setPoint( 'cn2', pointMap, geometry, _camera, w, 0, nearZ );

build/three.core.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/three.module.js

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5619,7 +5619,9 @@ function getEncodingComponents( colorSpace ) {
56195619
function getShaderErrors( gl, shader, type ) {
56205620

56215621
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
5622-
const errors = gl.getShaderInfoLog( shader ).trim();
5622+
5623+
const shaderInfoLog = gl.getShaderInfoLog( shader ) || '';
5624+
const errors = shaderInfoLog.trim();
56235625

56245626
if ( status && errors === '' ) return '';
56255627

@@ -6480,9 +6482,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
64806482
// check for link errors
64816483
if ( renderer.debug.checkShaderErrors ) {
64826484

6483-
const programLog = gl.getProgramInfoLog( program ).trim();
6484-
const vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();
6485-
const fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();
6485+
const programInfoLog = gl.getProgramInfoLog( program ) || '';
6486+
const vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';
6487+
const fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';
6488+
6489+
const programLog = programInfoLog.trim();
6490+
const vertexLog = vertexShaderInfoLog.trim();
6491+
const fragmentLog = fragmentShaderInfoLog.trim();
64866492

64876493
let runnable = true;
64886494
let haveDiagnostics = true;
@@ -13194,9 +13200,15 @@ class WebXRManager extends EventDispatcher {
1319413200
currentPixelRatio = renderer.getPixelRatio();
1319513201
renderer.getSize( currentSize );
1319613202

13203+
if ( typeof XRWebGLBinding !== 'undefined' ) {
13204+
13205+
glBinding = new XRWebGLBinding( session, gl );
13206+
13207+
}
13208+
1319713209
// Check that the browser implements the necessary APIs to use an
1319813210
// XRProjectionLayer rather than an XRWebGLLayer
13199-
const useLayers = typeof XRWebGLBinding !== 'undefined' && 'createProjectionLayer' in XRWebGLBinding.prototype;
13211+
const useLayers = glBinding !== null && 'createProjectionLayer' in XRWebGLBinding.prototype;
1320013212

1320113213
if ( ! useLayers ) {
1320213214

@@ -13249,8 +13261,6 @@ class WebXRManager extends EventDispatcher {
1324913261
scaleFactor: framebufferScaleFactor
1325013262
};
1325113263

13252-
glBinding = new XRWebGLBinding( session, gl );
13253-
1325413264
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
1325513265

1325613266
session.updateRenderState( { layers: [ glProjLayer ] } );
@@ -13518,9 +13528,10 @@ class WebXRManager extends EventDispatcher {
1351813528

1351913529
}
1352013530

13521-
cameraL.layers.mask = camera.layers.mask | 0b010;
13522-
cameraR.layers.mask = camera.layers.mask | 0b100;
13523-
cameraXR.layers.mask = cameraL.layers.mask | cameraR.layers.mask;
13531+
// inherit camera layers and enable eye layers (1 = left, 2 = right)
13532+
cameraXR.layers.mask = camera.layers.mask | 0b110;
13533+
cameraL.layers.mask = cameraXR.layers.mask & 0b011;
13534+
cameraR.layers.mask = cameraXR.layers.mask & 0b101;
1352413535

1352513536
const parent = camera.parent;
1352613537
const cameras = cameraXR.cameras;
@@ -13601,7 +13612,7 @@ class WebXRManager extends EventDispatcher {
1360113612
/**
1360213613
* Returns the amount of foveation used by the XR compositor for the projection layer.
1360313614
*
13604-
* @return {number} The amount of foveation.
13615+
* @return {number|undefined} The amount of foveation.
1360513616
*/
1360613617
this.getFoveation = function () {
1360713618

@@ -17705,7 +17716,7 @@ class WebGLRenderer {
1770517716
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
1770617717
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
1770717718

17708-
// when using MRT, select the corect color buffer for the subsequent read command
17719+
// when using MRT, select the correct color buffer for the subsequent read command
1770917720

1771017721
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
1771117722

build/three.module.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)