|
@@ -209,6 +209,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
const _SRGBAFormat = 1035; // fallback for WebGL 1
|
|
|
|
|
|
+ const WebGLCoordinateSystem = 2000;
|
|
|
+ const WebGPUCoordinateSystem = 2001;
|
|
|
+
|
|
|
/**
|
|
|
* https://github.com/mrdoob/eventdispatcher.js/
|
|
|
*/
|
|
@@ -6585,7 +6588,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
}
|
|
|
|
|
|
- makePerspective( left, right, top, bottom, near, far ) {
|
|
|
+ makePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
|
|
|
|
|
|
const te = this.elements;
|
|
|
const x = 2 * near / ( right - left );
|
|
@@ -6593,19 +6596,35 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
const a = ( right + left ) / ( right - left );
|
|
|
const b = ( top + bottom ) / ( top - bottom );
|
|
|
- const c = - ( far + near ) / ( far - near );
|
|
|
- const d = - 2 * far * near / ( far - near );
|
|
|
|
|
|
- te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
|
|
|
- te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
|
|
|
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
|
|
|
+ let c, d;
|
|
|
+
|
|
|
+ if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
|
+
|
|
|
+ c = - ( far + near ) / ( far - near );
|
|
|
+ d = ( - 2 * far * near ) / ( far - near );
|
|
|
+
|
|
|
+ } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
|
+
|
|
|
+ c = - far / ( far - near );
|
|
|
+ d = ( - far * near ) / ( far - near );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ throw new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
|
|
|
+ te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
|
|
|
+ te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
|
|
|
te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
|
|
|
|
|
|
return this;
|
|
|
|
|
|
}
|
|
|
|
|
|
- makeOrthographic( left, right, top, bottom, near, far ) {
|
|
|
+ makeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
|
|
|
|
|
|
const te = this.elements;
|
|
|
const w = 1.0 / ( right - left );
|
|
@@ -6614,12 +6633,29 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
const x = ( right + left ) * w;
|
|
|
const y = ( top + bottom ) * h;
|
|
|
- const z = ( far + near ) * p;
|
|
|
|
|
|
- te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
|
|
|
- te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
|
|
|
- te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 2 * p; te[ 14 ] = - z;
|
|
|
- te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
|
|
|
+ let z, zInv;
|
|
|
+
|
|
|
+ if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
|
+
|
|
|
+ z = ( far + near ) * p;
|
|
|
+ zInv = - 2 * p;
|
|
|
+
|
|
|
+ } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
|
+
|
|
|
+ z = near * p;
|
|
|
+ zInv = - 1 * p;
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ throw new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
|
|
|
+ te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
|
|
|
+ te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = zInv; te[ 14 ] = - z;
|
|
|
+ te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -9738,6 +9774,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
this.usage = StaticDrawUsage;
|
|
|
this.updateRange = { offset: 0, count: - 1 };
|
|
|
+ this.gpuType = FloatType;
|
|
|
|
|
|
this.version = 0;
|
|
|
|
|
@@ -9768,6 +9805,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
this.normalized = source.normalized;
|
|
|
|
|
|
this.usage = source.usage;
|
|
|
+ this.gpuType = source.gpuType;
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -10088,18 +10126,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
super( new Int8Array( array ), itemSize, normalized );
|
|
|
|
|
|
- this.gpuType = FloatType;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- copy( source ) {
|
|
|
-
|
|
|
- super.copy( source );
|
|
|
-
|
|
|
- this.gpuType = source.gpuType;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -10110,18 +10136,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
super( new Uint8Array( array ), itemSize, normalized );
|
|
|
|
|
|
- this.gpuType = FloatType;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- copy( source ) {
|
|
|
-
|
|
|
- super.copy( source );
|
|
|
-
|
|
|
- this.gpuType = source.gpuType;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -10142,18 +10156,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
super( new Int16Array( array ), itemSize, normalized );
|
|
|
|
|
|
- this.gpuType = FloatType;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- copy( source ) {
|
|
|
-
|
|
|
- super.copy( source );
|
|
|
-
|
|
|
- this.gpuType = source.gpuType;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -10164,18 +10166,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
super( new Uint16Array( array ), itemSize, normalized );
|
|
|
|
|
|
- this.gpuType = FloatType;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- copy( source ) {
|
|
|
-
|
|
|
- super.copy( source );
|
|
|
-
|
|
|
- this.gpuType = source.gpuType;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -12338,6 +12328,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
this.projectionMatrix = new Matrix4();
|
|
|
this.projectionMatrixInverse = new Matrix4();
|
|
|
|
|
|
+ this.coordinateSystem = WebGLCoordinateSystem;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
copy( source, recursive ) {
|
|
@@ -12349,6 +12341,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
this.projectionMatrix.copy( source.projectionMatrix );
|
|
|
this.projectionMatrixInverse.copy( source.projectionMatrixInverse );
|
|
|
|
|
|
+ this.coordinateSystem = source.coordinateSystem;
|
|
|
+
|
|
|
return this;
|
|
|
|
|
|
}
|
|
@@ -12586,7 +12580,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
const skew = this.filmOffset;
|
|
|
if ( skew !== 0 ) left += near * skew / this.getFilmWidth();
|
|
|
|
|
|
- this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far );
|
|
|
+ this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );
|
|
|
|
|
|
this.projectionMatrixInverse.copy( this.projectionMatrix ).invert();
|
|
|
|
|
@@ -12628,51 +12622,114 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
this.type = 'CubeCamera';
|
|
|
|
|
|
this.renderTarget = renderTarget;
|
|
|
+ this.coordinateSystem = null;
|
|
|
|
|
|
const cameraPX = new PerspectiveCamera( fov, aspect, near, far );
|
|
|
cameraPX.layers = this.layers;
|
|
|
- cameraPX.up.set( 0, 1, 0 );
|
|
|
- cameraPX.lookAt( 1, 0, 0 );
|
|
|
this.add( cameraPX );
|
|
|
|
|
|
const cameraNX = new PerspectiveCamera( fov, aspect, near, far );
|
|
|
cameraNX.layers = this.layers;
|
|
|
- cameraNX.up.set( 0, 1, 0 );
|
|
|
- cameraNX.lookAt( - 1, 0, 0 );
|
|
|
this.add( cameraNX );
|
|
|
|
|
|
const cameraPY = new PerspectiveCamera( fov, aspect, near, far );
|
|
|
cameraPY.layers = this.layers;
|
|
|
- cameraPY.up.set( 0, 0, - 1 );
|
|
|
- cameraPY.lookAt( 0, 1, 0 );
|
|
|
this.add( cameraPY );
|
|
|
|
|
|
const cameraNY = new PerspectiveCamera( fov, aspect, near, far );
|
|
|
cameraNY.layers = this.layers;
|
|
|
- cameraNY.up.set( 0, 0, 1 );
|
|
|
- cameraNY.lookAt( 0, - 1, 0 );
|
|
|
this.add( cameraNY );
|
|
|
|
|
|
const cameraPZ = new PerspectiveCamera( fov, aspect, near, far );
|
|
|
cameraPZ.layers = this.layers;
|
|
|
- cameraPZ.up.set( 0, 1, 0 );
|
|
|
- cameraPZ.lookAt( 0, 0, 1 );
|
|
|
this.add( cameraPZ );
|
|
|
|
|
|
const cameraNZ = new PerspectiveCamera( fov, aspect, near, far );
|
|
|
cameraNZ.layers = this.layers;
|
|
|
- cameraNZ.up.set( 0, 1, 0 );
|
|
|
- cameraNZ.lookAt( 0, 0, - 1 );
|
|
|
this.add( cameraNZ );
|
|
|
|
|
|
}
|
|
|
|
|
|
+ updateCoordinateSystem() {
|
|
|
+
|
|
|
+ const coordinateSystem = this.coordinateSystem;
|
|
|
+
|
|
|
+ const cameras = this.children.concat();
|
|
|
+
|
|
|
+ const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = cameras;
|
|
|
+
|
|
|
+ for ( const camera of cameras ) this.remove( camera );
|
|
|
+
|
|
|
+ if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
|
+
|
|
|
+ cameraPX.up.set( 0, 1, 0 );
|
|
|
+ cameraPX.lookAt( 1, 0, 0 );
|
|
|
+
|
|
|
+ cameraNX.up.set( 0, 1, 0 );
|
|
|
+ cameraNX.lookAt( - 1, 0, 0 );
|
|
|
+
|
|
|
+ cameraPY.up.set( 0, 0, - 1 );
|
|
|
+ cameraPY.lookAt( 0, 1, 0 );
|
|
|
+
|
|
|
+ cameraNY.up.set( 0, 0, 1 );
|
|
|
+ cameraNY.lookAt( 0, - 1, 0 );
|
|
|
+
|
|
|
+ cameraPZ.up.set( 0, 1, 0 );
|
|
|
+ cameraPZ.lookAt( 0, 0, 1 );
|
|
|
+
|
|
|
+ cameraNZ.up.set( 0, 1, 0 );
|
|
|
+ cameraNZ.lookAt( 0, 0, - 1 );
|
|
|
+
|
|
|
+ } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
|
+
|
|
|
+ cameraPX.up.set( 0, - 1, 0 );
|
|
|
+ cameraPX.lookAt( - 1, 0, 0 );
|
|
|
+
|
|
|
+ cameraNX.up.set( 0, - 1, 0 );
|
|
|
+ cameraNX.lookAt( 1, 0, 0 );
|
|
|
+
|
|
|
+ cameraPY.up.set( 0, 0, 1 );
|
|
|
+ cameraPY.lookAt( 0, 1, 0 );
|
|
|
+
|
|
|
+ cameraNY.up.set( 0, 0, - 1 );
|
|
|
+ cameraNY.lookAt( 0, - 1, 0 );
|
|
|
+
|
|
|
+ cameraPZ.up.set( 0, - 1, 0 );
|
|
|
+ cameraPZ.lookAt( 0, 0, 1 );
|
|
|
+
|
|
|
+ cameraNZ.up.set( 0, - 1, 0 );
|
|
|
+ cameraNZ.lookAt( 0, 0, - 1 );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ throw new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ for ( const camera of cameras ) {
|
|
|
+
|
|
|
+ this.add( camera );
|
|
|
+
|
|
|
+ camera.updateMatrixWorld();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
update( renderer, scene ) {
|
|
|
|
|
|
if ( this.parent === null ) this.updateMatrixWorld();
|
|
|
|
|
|
const renderTarget = this.renderTarget;
|
|
|
|
|
|
+ if ( this.coordinateSystem !== renderer.coordinateSystem ) {
|
|
|
+
|
|
|
+ this.coordinateSystem = renderer.coordinateSystem;
|
|
|
+
|
|
|
+ this.updateCoordinateSystem();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;
|
|
|
|
|
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
@@ -13132,7 +13189,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
}
|
|
|
|
|
|
- setFromProjectionMatrix( m ) {
|
|
|
+ setFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {
|
|
|
|
|
|
const planes = this.planes;
|
|
|
const me = m.elements;
|
|
@@ -13146,7 +13203,20 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();
|
|
|
planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();
|
|
|
planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();
|
|
|
- planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();
|
|
|
+
|
|
|
+ if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
|
+
|
|
|
+ planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();
|
|
|
+
|
|
|
+ } else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
|
+
|
|
|
+ planes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ throw new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -15994,7 +16064,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
}
|
|
|
|
|
|
- this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far );
|
|
|
+ this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );
|
|
|
|
|
|
this.projectionMatrixInverse.copy( this.projectionMatrix ).invert();
|
|
|
|
|
@@ -30205,6 +30275,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
}
|
|
|
|
|
|
+ get coordinateSystem() {
|
|
|
+
|
|
|
+ return WebGLCoordinateSystem;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
get physicallyCorrectLights() { // @deprecated, r150
|
|
|
|
|
|
console.warn( 'THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
|
|
@@ -42200,6 +42276,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
load( urls, onLoad, onProgress, onError ) {
|
|
|
|
|
|
const texture = new CubeTexture();
|
|
|
+ texture.colorSpace = SRGBColorSpace;
|
|
|
|
|
|
const loader = new ImageLoader( this.manager );
|
|
|
loader.setCrossOrigin( this.crossOrigin );
|
|
@@ -45874,6 +45951,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
|
|
|
}
|
|
|
|
|
|
+ connect() {
|
|
|
+
|
|
|
+ super.connect();
|
|
|
+
|
|
|
+ this.panner.connect( this.gain );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
disconnect() {
|
|
|
|
|
|
super.disconnect();
|
|
@@ -51806,11 +51891,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
|
|
|
exports.WebGL1Renderer = WebGL1Renderer;
|
|
|
exports.WebGL3DRenderTarget = WebGL3DRenderTarget;
|
|
|
exports.WebGLArrayRenderTarget = WebGLArrayRenderTarget;
|
|
|
+ exports.WebGLCoordinateSystem = WebGLCoordinateSystem;
|
|
|
exports.WebGLCubeRenderTarget = WebGLCubeRenderTarget;
|
|
|
exports.WebGLMultipleRenderTargets = WebGLMultipleRenderTargets;
|
|
|
exports.WebGLRenderTarget = WebGLRenderTarget;
|
|
|
exports.WebGLRenderer = WebGLRenderer;
|
|
|
exports.WebGLUtils = WebGLUtils;
|
|
|
+ exports.WebGPUCoordinateSystem = WebGPUCoordinateSystem;
|
|
|
exports.WireframeGeometry = WireframeGeometry;
|
|
|
exports.WrapAroundEnding = WrapAroundEnding;
|
|
|
exports.ZeroCurvatureEnding = ZeroCurvatureEnding;
|