|
|
@@ -3007,13 +3007,7 @@ const MathUtils = {
|
|
|
*/
|
|
|
class Vector2 {
|
|
|
|
|
|
- /**
|
|
|
- * Constructs a new 2D vector.
|
|
|
- *
|
|
|
- * @param {number} [x=0] - The x value of this vector.
|
|
|
- * @param {number} [y=0] - The y value of this vector.
|
|
|
- */
|
|
|
- constructor( x = 0, y = 0 ) {
|
|
|
+ static {
|
|
|
|
|
|
/**
|
|
|
* This flag can be used for type testing.
|
|
|
@@ -3024,6 +3018,16 @@ class Vector2 {
|
|
|
*/
|
|
|
Vector2.prototype.isVector2 = true;
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Constructs a new 2D vector.
|
|
|
+ *
|
|
|
+ * @param {number} [x=0] - The x value of this vector.
|
|
|
+ * @param {number} [y=0] - The y value of this vector.
|
|
|
+ */
|
|
|
+ constructor( x = 0, y = 0 ) {
|
|
|
+
|
|
|
/**
|
|
|
* The x value of this vector.
|
|
|
*
|
|
|
@@ -4784,14 +4788,7 @@ class Quaternion {
|
|
|
*/
|
|
|
class Vector3 {
|
|
|
|
|
|
- /**
|
|
|
- * Constructs a new 3D vector.
|
|
|
- *
|
|
|
- * @param {number} [x=0] - The x value of this vector.
|
|
|
- * @param {number} [y=0] - The y value of this vector.
|
|
|
- * @param {number} [z=0] - The z value of this vector.
|
|
|
- */
|
|
|
- constructor( x = 0, y = 0, z = 0 ) {
|
|
|
+ static {
|
|
|
|
|
|
/**
|
|
|
* This flag can be used for type testing.
|
|
|
@@ -4802,6 +4799,17 @@ class Vector3 {
|
|
|
*/
|
|
|
Vector3.prototype.isVector3 = true;
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Constructs a new 3D vector.
|
|
|
+ *
|
|
|
+ * @param {number} [x=0] - The x value of this vector.
|
|
|
+ * @param {number} [y=0] - The y value of this vector.
|
|
|
+ * @param {number} [z=0] - The z value of this vector.
|
|
|
+ */
|
|
|
+ constructor( x = 0, y = 0, z = 0 ) {
|
|
|
+
|
|
|
/**
|
|
|
* The x value of this vector.
|
|
|
*
|
|
|
@@ -6042,6 +6050,19 @@ const _quaternion$5 = /*@__PURE__*/ new Quaternion();
|
|
|
*/
|
|
|
class Matrix3 {
|
|
|
|
|
|
+ static {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This flag can be used for type testing.
|
|
|
+ *
|
|
|
+ * @type {boolean}
|
|
|
+ * @readonly
|
|
|
+ * @default true
|
|
|
+ */
|
|
|
+ Matrix3.prototype.isMatrix3 = true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Constructs a new 3x3 matrix. The arguments are supposed to be
|
|
|
* in row-major order. If no arguments are provided, the constructor
|
|
|
@@ -6059,15 +6080,6 @@ class Matrix3 {
|
|
|
*/
|
|
|
constructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
|
|
|
|
|
|
- /**
|
|
|
- * This flag can be used for type testing.
|
|
|
- *
|
|
|
- * @type {boolean}
|
|
|
- * @readonly
|
|
|
- * @default true
|
|
|
- */
|
|
|
- Matrix3.prototype.isMatrix3 = true;
|
|
|
-
|
|
|
/**
|
|
|
* A column-major list of matrix values.
|
|
|
*
|
|
|
@@ -8001,15 +8013,7 @@ Texture.DEFAULT_ANISOTROPY = 1;
|
|
|
*/
|
|
|
class Vector4 {
|
|
|
|
|
|
- /**
|
|
|
- * Constructs a new 4D vector.
|
|
|
- *
|
|
|
- * @param {number} [x=0] - The x value of this vector.
|
|
|
- * @param {number} [y=0] - The y value of this vector.
|
|
|
- * @param {number} [z=0] - The z value of this vector.
|
|
|
- * @param {number} [w=1] - The w value of this vector.
|
|
|
- */
|
|
|
- constructor( x = 0, y = 0, z = 0, w = 1 ) {
|
|
|
+ static {
|
|
|
|
|
|
/**
|
|
|
* This flag can be used for type testing.
|
|
|
@@ -8020,6 +8024,18 @@ class Vector4 {
|
|
|
*/
|
|
|
Vector4.prototype.isVector4 = true;
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Constructs a new 4D vector.
|
|
|
+ *
|
|
|
+ * @param {number} [x=0] - The x value of this vector.
|
|
|
+ * @param {number} [y=0] - The y value of this vector.
|
|
|
+ * @param {number} [z=0] - The z value of this vector.
|
|
|
+ * @param {number} [w=1] - The w value of this vector.
|
|
|
+ */
|
|
|
+ constructor( x = 0, y = 0, z = 0, w = 1 ) {
|
|
|
+
|
|
|
/**
|
|
|
* The x value of this vector.
|
|
|
*
|
|
|
@@ -9816,6 +9832,19 @@ class WebGL3DRenderTarget extends WebGLRenderTarget {
|
|
|
*/
|
|
|
class Matrix4 {
|
|
|
|
|
|
+ static {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This flag can be used for type testing.
|
|
|
+ *
|
|
|
+ * @type {boolean}
|
|
|
+ * @readonly
|
|
|
+ * @default true
|
|
|
+ */
|
|
|
+ Matrix4.prototype.isMatrix4 = true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Constructs a new 4x4 matrix. The arguments are supposed to be
|
|
|
* in row-major order. If no arguments are provided, the constructor
|
|
|
@@ -9840,15 +9869,6 @@ class Matrix4 {
|
|
|
*/
|
|
|
constructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
|
|
|
|
|
|
- /**
|
|
|
- * This flag can be used for type testing.
|
|
|
- *
|
|
|
- * @type {boolean}
|
|
|
- * @readonly
|
|
|
- * @default true
|
|
|
- */
|
|
|
- Matrix4.prototype.isMatrix4 = true;
|
|
|
-
|
|
|
/**
|
|
|
* A column-major list of matrix values.
|
|
|
*
|
|
|
@@ -13228,11 +13248,7 @@ class Object3D extends EventDispatcher {
|
|
|
this.quaternion.copy( source.quaternion );
|
|
|
this.scale.copy( source.scale );
|
|
|
|
|
|
- if ( source.pivot !== null ) {
|
|
|
-
|
|
|
- this.pivot = source.pivot.clone();
|
|
|
-
|
|
|
- }
|
|
|
+ this.pivot = ( source.pivot !== null ) ? source.pivot.clone() : null;
|
|
|
|
|
|
this.matrix.copy( source.matrix );
|
|
|
this.matrixWorld.copy( source.matrixWorld );
|
|
|
@@ -44782,15 +44798,15 @@ class DataTextureLoader extends Loader {
|
|
|
|
|
|
texData = scope.parse( buffer );
|
|
|
|
|
|
- } catch ( error ) {
|
|
|
+ } catch ( e ) {
|
|
|
|
|
|
if ( onError !== undefined ) {
|
|
|
|
|
|
- onError( error );
|
|
|
+ onError( e );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- error( error );
|
|
|
+ error( e );
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
@@ -56169,6 +56185,19 @@ class Cylindrical {
|
|
|
*/
|
|
|
class Matrix2 {
|
|
|
|
|
|
+ static {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This flag can be used for type testing.
|
|
|
+ *
|
|
|
+ * @type {boolean}
|
|
|
+ * @readonly
|
|
|
+ * @default true
|
|
|
+ */
|
|
|
+ Matrix2.prototype.isMatrix2 = true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Constructs a new 2x2 matrix. The arguments are supposed to be
|
|
|
* in row-major order. If no arguments are provided, the constructor
|
|
|
@@ -56181,15 +56210,6 @@ class Matrix2 {
|
|
|
*/
|
|
|
constructor( n11, n12, n21, n22 ) {
|
|
|
|
|
|
- /**
|
|
|
- * This flag can be used for type testing.
|
|
|
- *
|
|
|
- * @type {boolean}
|
|
|
- * @readonly
|
|
|
- * @default true
|
|
|
- */
|
|
|
- Matrix2.prototype.isMatrix2 = true;
|
|
|
-
|
|
|
/**
|
|
|
* A column-major list of matrix values.
|
|
|
*
|
|
|
@@ -59561,6 +59581,7 @@ function WebGLAnimation() {
|
|
|
|
|
|
if ( isAnimating === true ) return;
|
|
|
if ( animationLoop === null ) return;
|
|
|
+ if ( context === null ) return;
|
|
|
|
|
|
requestId = context.requestAnimationFrame( onAnimationFrame );
|
|
|
|
|
|
@@ -59570,7 +59591,7 @@ function WebGLAnimation() {
|
|
|
|
|
|
stop: function () {
|
|
|
|
|
|
- context.cancelAnimationFrame( requestId );
|
|
|
+ if ( context !== null ) context.cancelAnimationFrame( requestId );
|
|
|
|
|
|
isAnimating = false;
|
|
|
|
|
|
@@ -74401,7 +74422,11 @@ function WebGLMaterials( renderer, properties ) {
|
|
|
|
|
|
function refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {
|
|
|
|
|
|
- if ( material.isMeshBasicMaterial ) {
|
|
|
+ if ( material.isNodeMaterial ) {
|
|
|
+
|
|
|
+ material.uniformsNeedUpdate = false;
|
|
|
+
|
|
|
+ } else if ( material.isMeshBasicMaterial ) {
|
|
|
|
|
|
refreshUniformsCommon( uniforms, material );
|
|
|
|
|
|
@@ -75096,6 +75121,11 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
uniform.__data[ 10 ] = value.elements[ 8 ];
|
|
|
uniform.__data[ 11 ] = 0;
|
|
|
|
|
|
+ } else if ( ArrayBuffer.isView( value ) ) {
|
|
|
+
|
|
|
+ // copy the buffer data using "set"
|
|
|
+ uniform.__data.set( new value.constructor( value.buffer, value.byteOffset, uniform.__data.length ) );
|
|
|
+
|
|
|
} else {
|
|
|
|
|
|
value.toArray( uniform.__data, arrayOffset );
|
|
|
@@ -75131,6 +75161,10 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
|
|
|
cache[ indexString ] = value;
|
|
|
|
|
|
+ } else if ( ArrayBuffer.isView( value ) ) {
|
|
|
+
|
|
|
+ cache[ indexString ] = value.slice();
|
|
|
+
|
|
|
} else {
|
|
|
|
|
|
cache[ indexString ] = value.clone();
|
|
|
@@ -75154,6 +75188,11 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ } else if ( ArrayBuffer.isView( value ) ) {
|
|
|
+
|
|
|
+ // always update the array buffers
|
|
|
+ return true;
|
|
|
+
|
|
|
} else {
|
|
|
|
|
|
if ( cachedObject.equals( value ) === false ) {
|
|
|
@@ -75294,6 +75333,11 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
|
|
|
warn( 'WebGLRenderer: Texture samplers can not be part of an uniforms group.' );
|
|
|
|
|
|
+ } else if ( ArrayBuffer.isView( value ) ) {
|
|
|
+
|
|
|
+ info.boundary = 16;
|
|
|
+ info.storage = value.byteLength;
|
|
|
+
|
|
|
} else {
|
|
|
|
|
|
warn( 'WebGLRenderer: Unsupported uniform value type.', value );
|
|
|
@@ -75630,6 +75674,7 @@ class WebGLRenderer {
|
|
|
const _this = this;
|
|
|
|
|
|
let _isContextLost = false;
|
|
|
+ let _nodesHandler = null;
|
|
|
|
|
|
// internal state cache
|
|
|
|
|
|
@@ -76380,6 +76425,20 @@ class WebGLRenderer {
|
|
|
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * Sets a compatibility node builder for rendering node materials with WebGLRenderer.
|
|
|
+ * This enables using TSL (Three.js Shading Language) node materials to prepare
|
|
|
+ * for migration to WebGPURenderer.
|
|
|
+ *
|
|
|
+ * @param {WebGLNodesHandler} nodesHandler - The node builder instance.
|
|
|
+ */
|
|
|
+ this.setNodesHandler = function ( nodesHandler ) {
|
|
|
+
|
|
|
+ nodesHandler.setRenderer( this );
|
|
|
+ _nodesHandler = nodesHandler;
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* Frees the GPU-related resources allocated by this instance. Call this
|
|
|
* method whenever this instance is no longer used in your app.
|
|
|
@@ -76940,6 +76999,13 @@ class WebGLRenderer {
|
|
|
|
|
|
if ( _isContextLost === true ) return;
|
|
|
|
|
|
+ // update node builder if available
|
|
|
+ if ( _nodesHandler !== null ) {
|
|
|
+
|
|
|
+ _nodesHandler.renderStart( scene, camera );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
// use internal render target for HalfFloatType color buffer (only when tone mapping is enabled)
|
|
|
|
|
|
const isXRPresenting = xr.enabled === true && xr.isPresenting === true;
|
|
|
@@ -77133,6 +77199,12 @@ class WebGLRenderer {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if ( _nodesHandler !== null ) {
|
|
|
+
|
|
|
+ _nodesHandler.renderEnd();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
};
|
|
|
|
|
|
function projectObject( object, camera, groupOrder, sortObjects ) {
|
|
|
@@ -77509,6 +77581,13 @@ class WebGLRenderer {
|
|
|
|
|
|
parameters.uniforms = programCache.getUniforms( material );
|
|
|
|
|
|
+ // Use node builder for node materials if available
|
|
|
+ if ( _nodesHandler !== null && material.isNodeMaterial ) {
|
|
|
+
|
|
|
+ _nodesHandler.build( material, object, parameters );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
material.onBeforeCompile( parameters, _this );
|
|
|
|
|
|
program = programCache.acquireProgram( parameters, programCacheKey );
|
|
|
@@ -77774,6 +77853,14 @@ class WebGLRenderer {
|
|
|
|
|
|
program = getProgram( material, scene, object );
|
|
|
|
|
|
+ // notify the node builder that the program has changed so uniforms and update nodes can
|
|
|
+ // be cached and triggered.
|
|
|
+ if ( _nodesHandler && material.isNodeMaterial ) {
|
|
|
+
|
|
|
+ _nodesHandler.onUpdateProgram( material, program, materialProperties );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
let refreshProgram = false;
|
|
|
@@ -78003,7 +78090,7 @@ class WebGLRenderer {
|
|
|
|
|
|
// UBOs
|
|
|
|
|
|
- if ( material.isShaderMaterial || material.isRawShaderMaterial ) {
|
|
|
+ if ( material.uniformsGroups !== undefined ) {
|
|
|
|
|
|
const groups = material.uniformsGroups;
|
|
|
|
|
|
@@ -78579,6 +78666,8 @@ class WebGLRenderer {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ state.activeTexture( _gl.TEXTURE0 ); // see #33153
|
|
|
+
|
|
|
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );
|
|
|
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|