From 3221209633efee66c81123043f073041742c2ca9 Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 23 Mar 2025 23:21:07 -0300 Subject: [PATCH 1/2] improve warnings --- examples/jsm/tsl/display/BloomNode.js | 2 +- src/nodes/accessors/BatchNode.js | 2 +- src/nodes/accessors/BuiltinNode.js | 2 +- src/nodes/accessors/CubeTextureNode.js | 2 +- src/nodes/accessors/InstanceNode.js | 2 +- src/nodes/accessors/InstancedMeshNode.js | 2 +- src/nodes/accessors/MorphNode.js | 2 +- src/nodes/accessors/Object3DNode.js | 24 ++--- src/nodes/accessors/StorageTextureNode.js | 2 +- src/nodes/accessors/Texture3DNode.js | 2 +- src/nodes/accessors/TextureNode.js | 2 +- src/nodes/accessors/TextureSizeNode.js | 2 +- src/nodes/code/CodeNode.js | 8 +- src/nodes/code/ExpressionNode.js | 6 +- src/nodes/code/ScriptableNode.js | 8 +- src/nodes/code/ScriptableValueNode.js | 4 +- src/nodes/core/AssignNode.js | 2 +- src/nodes/core/BypassNode.js | 2 +- src/nodes/core/ContextNode.js | 2 +- src/nodes/core/StackNode.js | 2 +- src/nodes/core/VaryingNode.js | 2 +- src/nodes/display/BumpMapNode.js | 2 +- src/nodes/display/NormalMapNode.js | 2 +- src/nodes/display/PosterizeNode.js | 2 +- src/nodes/display/ViewportDepthNode.js | 4 +- src/nodes/display/ViewportDepthTextureNode.js | 4 +- .../display/ViewportSharedTextureNode.js | 4 +- src/nodes/display/ViewportTextureNode.js | 8 +- src/nodes/geometry/RangeNode.js | 2 +- src/nodes/math/ConditionalNode.js | 2 +- src/nodes/math/MathNode.js | 102 +++++++++--------- src/nodes/math/OperatorNode.js | 55 +++++----- src/nodes/pmrem/PMREMNode.js | 6 +- src/nodes/tsl/TSLCore.js | 60 +++++++++-- src/nodes/utils/CubeMapNode.js | 4 +- src/nodes/utils/EquirectUVNode.js | 4 +- src/nodes/utils/MaxMipLevelNode.js | 2 +- src/nodes/utils/RemapNode.js | 12 +-- src/nodes/utils/RotateNode.js | 2 +- src/nodes/utils/SpriteSheetUVNode.js | 6 +- src/nodes/utils/StorageArrayElementNode.js | 2 +- src/nodes/utils/TriplanarTexturesNode.js | 2 +- 42 files changed, 206 insertions(+), 163 deletions(-) diff --git a/examples/jsm/tsl/display/BloomNode.js b/examples/jsm/tsl/display/BloomNode.js index 40effdde035295..8d386f791a0d26 100644 --- a/examples/jsm/tsl/display/BloomNode.js +++ b/examples/jsm/tsl/display/BloomNode.js @@ -457,7 +457,7 @@ class BloomNode extends TempNode { // - const colorTexture = texture(); + const colorTexture = texture( null ); const gaussianCoefficients = uniformArray( coefficients ); const invSize = uniform( new Vector2() ); const direction = uniform( new Vector2( 0.5, 0.5 ) ); diff --git a/src/nodes/accessors/BatchNode.js b/src/nodes/accessors/BatchNode.js index 5c1bd92889b70e..ad34ac3c5768c5 100644 --- a/src/nodes/accessors/BatchNode.js +++ b/src/nodes/accessors/BatchNode.js @@ -160,4 +160,4 @@ export default BatchNode; * @param {BatchedMesh} batchMesh - A reference to batched mesh. * @returns {BatchNode} */ -export const batch = /*@__PURE__*/ nodeProxy( BatchNode ); +export const batch = /*@__PURE__*/ nodeProxy( BatchNode ).setParameterLength( 1 ); diff --git a/src/nodes/accessors/BuiltinNode.js b/src/nodes/accessors/BuiltinNode.js index b23abdf1fc237f..0dc6b682b966aa 100644 --- a/src/nodes/accessors/BuiltinNode.js +++ b/src/nodes/accessors/BuiltinNode.js @@ -60,4 +60,4 @@ export default BuiltinNode; * @param {string} name - The name of the built-in shader variable. * @returns {BuiltinNode} */ -export const builtin = nodeProxy( BuiltinNode ); +export const builtin = nodeProxy( BuiltinNode ).setParameterLength( 1 ); diff --git a/src/nodes/accessors/CubeTextureNode.js b/src/nodes/accessors/CubeTextureNode.js index 996f175e08d449..091e3df0c5e8b3 100644 --- a/src/nodes/accessors/CubeTextureNode.js +++ b/src/nodes/accessors/CubeTextureNode.js @@ -138,4 +138,4 @@ export default CubeTextureNode; * @param {?Node} [biasNode=null] - The bias node. * @returns {CubeTextureNode} */ -export const cubeTexture = /*@__PURE__*/ nodeProxy( CubeTextureNode ); +export const cubeTexture = /*@__PURE__*/ nodeProxy( CubeTextureNode ).setParameterLength( 1, 4 ).setName( 'cubeTexture' ); diff --git a/src/nodes/accessors/InstanceNode.js b/src/nodes/accessors/InstanceNode.js index b369c60b8a11dc..6c9370f90461f7 100644 --- a/src/nodes/accessors/InstanceNode.js +++ b/src/nodes/accessors/InstanceNode.js @@ -220,4 +220,4 @@ export default InstanceNode; * @param {InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors. * @returns {InstanceNode} */ -export const instance = /*@__PURE__*/ nodeProxy( InstanceNode ); +export const instance = /*@__PURE__*/ nodeProxy( InstanceNode ).setParameterLength( 3 ); diff --git a/src/nodes/accessors/InstancedMeshNode.js b/src/nodes/accessors/InstancedMeshNode.js index 822e0dcf27a6d4..d5542ea4059938 100644 --- a/src/nodes/accessors/InstancedMeshNode.js +++ b/src/nodes/accessors/InstancedMeshNode.js @@ -47,4 +47,4 @@ export default InstancedMeshNode; * @param {InstancedMesh} instancedMesh - The instancedMesh. * @returns {InstancedMeshNode} */ -export const instancedMesh = /*@__PURE__*/ nodeProxy( InstancedMeshNode ); +export const instancedMesh = /*@__PURE__*/ nodeProxy( InstancedMeshNode ).setParameterLength( 1 ); diff --git a/src/nodes/accessors/MorphNode.js b/src/nodes/accessors/MorphNode.js index c2d7b7922e119d..c05620b3ef66d8 100644 --- a/src/nodes/accessors/MorphNode.js +++ b/src/nodes/accessors/MorphNode.js @@ -307,4 +307,4 @@ export default MorphNode; * @param {Mesh} mesh - The mesh holding the morph targets. * @returns {MorphNode} */ -export const morphReference = /*@__PURE__*/ nodeProxy( MorphNode ); +export const morphReference = /*@__PURE__*/ nodeProxy( MorphNode ).setParameterLength( 1 ); diff --git a/src/nodes/accessors/Object3DNode.js b/src/nodes/accessors/Object3DNode.js index 846e0ed3352f69..0a7b14b37cf96e 100644 --- a/src/nodes/accessors/Object3DNode.js +++ b/src/nodes/accessors/Object3DNode.js @@ -213,57 +213,57 @@ export default Object3DNode; * * @tsl * @function - * @param {?Object3D} [object3d=null] - The 3D object. + * @param {?Object3D} [object3d] - The 3D object. * @returns {Object3DNode} */ -export const objectDirection = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.DIRECTION ); +export const objectDirection = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.DIRECTION ).setParameterLength( 1 ); /** * TSL function for creating an object 3D node that represents the object's world matrix. * * @tsl * @function - * @param {?Object3D} [object3d=null] - The 3D object. + * @param {?Object3D} [object3d] - The 3D object. * @returns {Object3DNode} */ -export const objectWorldMatrix = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.WORLD_MATRIX ); +export const objectWorldMatrix = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.WORLD_MATRIX ).setParameterLength( 1 ); /** * TSL function for creating an object 3D node that represents the object's position in world space. * * @tsl * @function - * @param {?Object3D} [object3d=null] - The 3D object. + * @param {?Object3D} [object3d] - The 3D object. * @returns {Object3DNode} */ -export const objectPosition = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.POSITION ); +export const objectPosition = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.POSITION ).setParameterLength( 1 ); /** * TSL function for creating an object 3D node that represents the object's scale in world space. * * @tsl * @function - * @param {?Object3D} [object3d=null] - The 3D object. + * @param {?Object3D} [object3d] - The 3D object. * @returns {Object3DNode} */ -export const objectScale = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.SCALE ); +export const objectScale = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.SCALE ).setParameterLength( 1 ); /** * TSL function for creating an object 3D node that represents the object's position in view/camera space. * * @tsl * @function - * @param {?Object3D} [object3d=null] - The 3D object. + * @param {?Object3D} [object3d] - The 3D object. * @returns {Object3DNode} */ -export const objectViewPosition = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.VIEW_POSITION ); +export const objectViewPosition = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.VIEW_POSITION ).setParameterLength( 1 ); /** * TSL function for creating an object 3D node that represents the object's radius. * * @tsl * @function - * @param {?Object3D} [object3d=null] - The 3D object. + * @param {?Object3D} [object3d] - The 3D object. * @returns {Object3DNode} */ -export const objectRadius = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.RADIUS ); +export const objectRadius = /*@__PURE__*/ nodeProxy( Object3DNode, Object3DNode.RADIUS ).setParameterLength( 1 ); diff --git a/src/nodes/accessors/StorageTextureNode.js b/src/nodes/accessors/StorageTextureNode.js index 6d27e0d85d1606..7bf7fe890341cc 100644 --- a/src/nodes/accessors/StorageTextureNode.js +++ b/src/nodes/accessors/StorageTextureNode.js @@ -207,7 +207,7 @@ export default StorageTextureNode; * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. * @returns {StorageTextureNode} */ -export const storageTexture = /*@__PURE__*/ nodeProxy( StorageTextureNode ); +export const storageTexture = /*@__PURE__*/ nodeProxy( StorageTextureNode ).setParameterLength( 2, 3 ); /** diff --git a/src/nodes/accessors/Texture3DNode.js b/src/nodes/accessors/Texture3DNode.js index f042b2bbe92364..cc1c0ce7eaad3f 100644 --- a/src/nodes/accessors/Texture3DNode.js +++ b/src/nodes/accessors/Texture3DNode.js @@ -183,4 +183,4 @@ export default Texture3DNode; * @param {?Node} [levelNode=null] - The level node. * @returns {Texture3DNode} */ -export const texture3D = /*@__PURE__*/ nodeProxy( Texture3DNode ); +export const texture3D = /*@__PURE__*/ nodeProxy( Texture3DNode ).setParameterLength( 1, 3 ); diff --git a/src/nodes/accessors/TextureNode.js b/src/nodes/accessors/TextureNode.js index 79a649e0606dd5..d56353f9807b22 100644 --- a/src/nodes/accessors/TextureNode.js +++ b/src/nodes/accessors/TextureNode.js @@ -740,7 +740,7 @@ export default TextureNode; * @param {?Node} [biasNode=null] - The bias node. * @returns {TextureNode} */ -export const texture = /*@__PURE__*/ nodeProxy( TextureNode ); +export const texture = /*@__PURE__*/ nodeProxy( TextureNode ).setParameterLength( 1, 4 ); /** * TSL function for creating a texture node that fetches/loads texels without interpolation. diff --git a/src/nodes/accessors/TextureSizeNode.js b/src/nodes/accessors/TextureSizeNode.js index 1fa6af63327d83..d4668281657ef8 100644 --- a/src/nodes/accessors/TextureSizeNode.js +++ b/src/nodes/accessors/TextureSizeNode.js @@ -74,4 +74,4 @@ export default TextureSizeNode; * @param {?Node} [levelNode=null] - A level node which defines the requested mip. * @returns {TextureSizeNode} */ -export const textureSize = /*@__PURE__*/ nodeProxy( TextureSizeNode ); +export const textureSize = /*@__PURE__*/ nodeProxy( TextureSizeNode ).setParameterLength( 1, 2 ); diff --git a/src/nodes/code/CodeNode.js b/src/nodes/code/CodeNode.js index 7cf21b4c0ed0f5..5a51e61555b0bb 100644 --- a/src/nodes/code/CodeNode.js +++ b/src/nodes/code/CodeNode.js @@ -143,12 +143,12 @@ export default CodeNode; * * @tsl * @function - * @param {string} [code=''] - The native code. - * @param {Array} [includes=[]] - An array of includes. - * @param {('js'|'wgsl'|'glsl')} [language=''] - The used language. + * @param {string} [code] - The native code. + * @param {?Array} [includes=[]] - An array of includes. + * @param {?('js'|'wgsl'|'glsl')} [language=''] - The used language. * @returns {CodeNode} */ -export const code = /*@__PURE__*/ nodeProxy( CodeNode ); +export const code = /*@__PURE__*/ nodeProxy( CodeNode ).setParameterLength( 1, 3 ); /** * TSL function for creating a JS code node. diff --git a/src/nodes/code/ExpressionNode.js b/src/nodes/code/ExpressionNode.js index 00bb3ae1d2768e..48bdb7b15d82c4 100644 --- a/src/nodes/code/ExpressionNode.js +++ b/src/nodes/code/ExpressionNode.js @@ -61,8 +61,8 @@ export default ExpressionNode; * * @tsl * @function - * @param {string} [snippet=''] - The native code snippet. - * @param {string} [nodeType='void'] - The node type. + * @param {string} [snippet] - The native code snippet. + * @param {?string} [nodeType='void'] - The node type. * @returns {ExpressionNode} */ -export const expression = /*@__PURE__*/ nodeProxy( ExpressionNode ); +export const expression = /*@__PURE__*/ nodeProxy( ExpressionNode ).setParameterLength( 1, 2 ); diff --git a/src/nodes/code/ScriptableNode.js b/src/nodes/code/ScriptableNode.js index d4b73359472324..3c8a6446db6a0b 100644 --- a/src/nodes/code/ScriptableNode.js +++ b/src/nodes/code/ScriptableNode.js @@ -141,7 +141,7 @@ class ScriptableNode extends Node { this.parameters = parameters; this._local = new Resources(); - this._output = scriptableValue(); + this._output = scriptableValue( null ); this._outputs = {}; this._source = this.source; this._method = null; @@ -719,8 +719,8 @@ export default ScriptableNode; * * @tsl * @function - * @param {?CodeNode} [codeNode=null] - The code node. - * @param {Object} [parameters={}] - The parameters definition. + * @param {CodeNode} [codeNode] - The code node. + * @param {?Object} [parameters={}] - The parameters definition. * @returns {ScriptableNode} */ -export const scriptable = /*@__PURE__*/ nodeProxy( ScriptableNode ); +export const scriptable = /*@__PURE__*/ nodeProxy( ScriptableNode ).setParameterLength( 1, 2 ); diff --git a/src/nodes/code/ScriptableValueNode.js b/src/nodes/code/ScriptableValueNode.js index aa68c0fb64a8a3..28722f2bef1ec7 100644 --- a/src/nodes/code/ScriptableValueNode.js +++ b/src/nodes/code/ScriptableValueNode.js @@ -247,7 +247,7 @@ export default ScriptableValueNode; * * @tsl * @function - * @param {any} [value=null] - The value. + * @param {any} [value] - The value. * @returns {ScriptableValueNode} */ -export const scriptableValue = /*@__PURE__*/ nodeProxy( ScriptableValueNode ); +export const scriptableValue = /*@__PURE__*/ nodeProxy( ScriptableValueNode ).setParameterLength( 1 ); diff --git a/src/nodes/core/AssignNode.js b/src/nodes/core/AssignNode.js index 13c3bac31674f3..cc00fd07a3ab7f 100644 --- a/src/nodes/core/AssignNode.js +++ b/src/nodes/core/AssignNode.js @@ -171,6 +171,6 @@ export default AssignNode; * @param {Node} sourceNode - The source type. * @returns {AssignNode} */ -export const assign = /*@__PURE__*/ nodeProxy( AssignNode ); +export const assign = /*@__PURE__*/ nodeProxy( AssignNode ).setParameterLength( 2 ); addMethodChaining( 'assign', assign ); diff --git a/src/nodes/core/BypassNode.js b/src/nodes/core/BypassNode.js index f7b080f310a19c..fe3f67f574b1c7 100644 --- a/src/nodes/core/BypassNode.js +++ b/src/nodes/core/BypassNode.js @@ -88,6 +88,6 @@ export default BypassNode; * @param {Node} callNode - The call node. * @returns {BypassNode} */ -export const bypass = /*@__PURE__*/ nodeProxy( BypassNode ); +export const bypass = /*@__PURE__*/ nodeProxy( BypassNode ).setParameterLength( 2 ); addMethodChaining( 'bypass', bypass ); diff --git a/src/nodes/core/ContextNode.js b/src/nodes/core/ContextNode.js index b16c4a95f8d507..34bfdf63c284c2 100644 --- a/src/nodes/core/ContextNode.js +++ b/src/nodes/core/ContextNode.js @@ -125,7 +125,7 @@ export default ContextNode; * @param {Object} [value={}] - The modified context data. * @returns {ContextNode} */ -export const context = /*@__PURE__*/ nodeProxy( ContextNode ); +export const context = /*@__PURE__*/ nodeProxy( ContextNode ).setParameterLength( 1, 2 ); /** * TSL function for defining a label context value for a given node. diff --git a/src/nodes/core/StackNode.js b/src/nodes/core/StackNode.js index 7e69744f596be5..ffe242373b1310 100644 --- a/src/nodes/core/StackNode.js +++ b/src/nodes/core/StackNode.js @@ -202,4 +202,4 @@ export default StackNode; * @param {?StackNode} [parent=null] - The parent stack node. * @returns {StackNode} */ -export const stack = /*@__PURE__*/ nodeProxy( StackNode ); +export const stack = /*@__PURE__*/ nodeProxy( StackNode ).setParameterLength( 0, 1 ); diff --git a/src/nodes/core/VaryingNode.js b/src/nodes/core/VaryingNode.js index 9e4a05594720bf..c81db42a6b0dc7 100644 --- a/src/nodes/core/VaryingNode.js +++ b/src/nodes/core/VaryingNode.js @@ -173,7 +173,7 @@ export default VaryingNode; * @param {?string} name - The name of the varying in the shader. * @returns {VaryingNode} */ -export const varying = /*@__PURE__*/ nodeProxy( VaryingNode ); +export const varying = /*@__PURE__*/ nodeProxy( VaryingNode ).setParameterLength( 1, 2 ); /** * Computes a node in the vertex stage. diff --git a/src/nodes/display/BumpMapNode.js b/src/nodes/display/BumpMapNode.js index a754376ab58055..8e3ff12cfe750b 100644 --- a/src/nodes/display/BumpMapNode.js +++ b/src/nodes/display/BumpMapNode.js @@ -114,4 +114,4 @@ export default BumpMapNode; * @param {?Node} [scaleNode=null] - Controls the intensity of the bump effect. * @returns {BumpMapNode} */ -export const bumpMap = /*@__PURE__*/ nodeProxy( BumpMapNode ); +export const bumpMap = /*@__PURE__*/ nodeProxy( BumpMapNode ).setParameterLength( 1, 2 ); diff --git a/src/nodes/display/NormalMapNode.js b/src/nodes/display/NormalMapNode.js index 3845bb4c3233f1..cdcdf16bcad505 100644 --- a/src/nodes/display/NormalMapNode.js +++ b/src/nodes/display/NormalMapNode.js @@ -145,4 +145,4 @@ export default NormalMapNode; * @param {?Node} [scaleNode=null] - Controls the intensity of the effect. * @returns {NormalMapNode} */ -export const normalMap = /*@__PURE__*/ nodeProxy( NormalMapNode ); +export const normalMap = /*@__PURE__*/ nodeProxy( NormalMapNode ).setParameterLength( 1, 2 ); diff --git a/src/nodes/display/PosterizeNode.js b/src/nodes/display/PosterizeNode.js index 71c8fe17c2e324..d31767c6fb2376 100644 --- a/src/nodes/display/PosterizeNode.js +++ b/src/nodes/display/PosterizeNode.js @@ -62,4 +62,4 @@ export default PosterizeNode; * @param {Node} stepsNode - Controls the intensity of the posterization effect. A lower number results in a more blocky appearance. * @returns {PosterizeNode} */ -export const posterize = /*@__PURE__*/ nodeProxy( PosterizeNode ); +export const posterize = /*@__PURE__*/ nodeProxy( PosterizeNode ).setParameterLength( 2 ); diff --git a/src/nodes/display/ViewportDepthNode.js b/src/nodes/display/ViewportDepthNode.js index b8c4e8a8293307..83fa1a44e2e81c 100644 --- a/src/nodes/display/ViewportDepthNode.js +++ b/src/nodes/display/ViewportDepthNode.js @@ -278,10 +278,10 @@ export const depth = /*@__PURE__*/ nodeImmutable( ViewportDepthNode, ViewportDep * * @tsl * @function - * @param {Node} value - The perspective depth. + * @param {?Node} [value=null] - The perspective depth. If `null` is provided, the current fragment's depth is used. * @returns {ViewportDepthNode} */ -export const linearDepth = /*@__PURE__*/ nodeProxy( ViewportDepthNode, ViewportDepthNode.LINEAR_DEPTH ); +export const linearDepth = /*@__PURE__*/ nodeProxy( ViewportDepthNode, ViewportDepthNode.LINEAR_DEPTH ).setParameterLength( 0, 1 ); /** * TSL object that represents the linear (orthographic) depth value of the current fragment diff --git a/src/nodes/display/ViewportDepthTextureNode.js b/src/nodes/display/ViewportDepthTextureNode.js index c21e7b8065b6dd..9cd48f79a31d14 100644 --- a/src/nodes/display/ViewportDepthTextureNode.js +++ b/src/nodes/display/ViewportDepthTextureNode.js @@ -48,8 +48,8 @@ export default ViewportDepthTextureNode; * * @tsl * @function - * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [uvNode=screenUV] - The uv node. * @param {?Node} [levelNode=null] - The level node. * @returns {ViewportDepthTextureNode} */ -export const viewportDepthTexture = /*@__PURE__*/ nodeProxy( ViewportDepthTextureNode ); +export const viewportDepthTexture = /*@__PURE__*/ nodeProxy( ViewportDepthTextureNode ).setParameterLength( 0, 2 ); diff --git a/src/nodes/display/ViewportSharedTextureNode.js b/src/nodes/display/ViewportSharedTextureNode.js index c9e6033850c632..5fa6205e508cd7 100644 --- a/src/nodes/display/ViewportSharedTextureNode.js +++ b/src/nodes/display/ViewportSharedTextureNode.js @@ -54,8 +54,8 @@ export default ViewportSharedTextureNode; * * @tsl * @function - * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [uvNode=screenUV] - The uv node. * @param {?Node} [levelNode=null] - The level node. * @returns {ViewportSharedTextureNode} */ -export const viewportSharedTexture = /*@__PURE__*/ nodeProxy( ViewportSharedTextureNode ); +export const viewportSharedTexture = /*@__PURE__*/ nodeProxy( ViewportSharedTextureNode ).setParameterLength( 0, 2 ); diff --git a/src/nodes/display/ViewportTextureNode.js b/src/nodes/display/ViewportTextureNode.js index 288454df3eb91c..9f793d35fe751e 100644 --- a/src/nodes/display/ViewportTextureNode.js +++ b/src/nodes/display/ViewportTextureNode.js @@ -118,21 +118,21 @@ export default ViewportTextureNode; * * @tsl * @function - * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [uvNode=screenUV] - The uv node. * @param {?Node} [levelNode=null] - The level node. * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. * @returns {ViewportTextureNode} */ -export const viewportTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode ); +export const viewportTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode ).setParameterLength( 0, 3 ); /** * TSL function for creating a viewport texture node with enabled mipmap generation. * * @tsl * @function - * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [uvNode=screenUV] - The uv node. * @param {?Node} [levelNode=null] - The level node. * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. * @returns {ViewportTextureNode} */ -export const viewportMipTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } ); +export const viewportMipTexture = /*@__PURE__*/ nodeProxy( ViewportTextureNode, null, null, { generateMipmaps: true } ).setParameterLength( 0, 3 ); diff --git a/src/nodes/geometry/RangeNode.js b/src/nodes/geometry/RangeNode.js index 9c3101cd9d4917..4a954bf8bb1372 100644 --- a/src/nodes/geometry/RangeNode.js +++ b/src/nodes/geometry/RangeNode.js @@ -169,4 +169,4 @@ export default RangeNode; * @param {Node} [maxNode=float()] - A node defining the upper bound of the range. * @returns {RangeNode} */ -export const range = /*@__PURE__*/ nodeProxy( RangeNode ); +export const range = /*@__PURE__*/ nodeProxy( RangeNode ).setParameterLength( 2 ); diff --git a/src/nodes/math/ConditionalNode.js b/src/nodes/math/ConditionalNode.js index 8635965f3215cf..85aa9449cfcb38 100644 --- a/src/nodes/math/ConditionalNode.js +++ b/src/nodes/math/ConditionalNode.js @@ -206,7 +206,7 @@ export default ConditionalNode; * @param {?Node} [elseNode=null] - The node that is evaluate when the condition ends up `false`. * @returns {ConditionalNode} */ -export const select = /*@__PURE__*/ nodeProxy( ConditionalNode ); +export const select = /*@__PURE__*/ nodeProxy( ConditionalNode ).setParameterLength( 2, 3 ); addMethodChaining( 'select', select ); diff --git a/src/nodes/math/MathNode.js b/src/nodes/math/MathNode.js index c28dc6ae6b89cd..c207e88c7c824e 100644 --- a/src/nodes/math/MathNode.js +++ b/src/nodes/math/MathNode.js @@ -380,7 +380,7 @@ export const PI2 = /*@__PURE__*/ float( Math.PI * 2 ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const all = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ALL ); +export const all = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ALL ).setParameterLength( 1 ); /** * Returns `true` if any components of `x` are `true`. @@ -390,7 +390,7 @@ export const all = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ALL ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const any = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ANY ); +export const any = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ANY ).setParameterLength( 1 ); /** * Converts a quantity in degrees to radians. @@ -400,7 +400,7 @@ export const any = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ANY ); * @param {Node | number} x - The input in degrees. * @returns {Node} */ -export const radians = /*@__PURE__*/ nodeProxy( MathNode, MathNode.RADIANS ); +export const radians = /*@__PURE__*/ nodeProxy( MathNode, MathNode.RADIANS ).setParameterLength( 1 ); /** * Convert a quantity in radians to degrees. @@ -410,7 +410,7 @@ export const radians = /*@__PURE__*/ nodeProxy( MathNode, MathNode.RADIANS ); * @param {Node | number} x - The input in radians. * @returns {Node} */ -export const degrees = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DEGREES ); +export const degrees = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DEGREES ).setParameterLength( 1 ); /** * Returns the natural exponentiation of the parameter. @@ -420,7 +420,7 @@ export const degrees = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DEGREES ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const exp = /*@__PURE__*/ nodeProxy( MathNode, MathNode.EXP ); +export const exp = /*@__PURE__*/ nodeProxy( MathNode, MathNode.EXP ).setParameterLength( 1 ); /** * Returns 2 raised to the power of the parameter. @@ -430,7 +430,7 @@ export const exp = /*@__PURE__*/ nodeProxy( MathNode, MathNode.EXP ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const exp2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.EXP2 ); +export const exp2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.EXP2 ).setParameterLength( 1 ); /** * Returns the natural logarithm of the parameter. @@ -440,7 +440,7 @@ export const exp2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.EXP2 ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const log = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LOG ); +export const log = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LOG ).setParameterLength( 1 ); /** * Returns the base 2 logarithm of the parameter. @@ -450,7 +450,7 @@ export const log = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LOG ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const log2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LOG2 ); +export const log2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LOG2 ).setParameterLength( 1 ); /** * Returns the square root of the parameter. @@ -460,7 +460,7 @@ export const log2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LOG2 ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const sqrt = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SQRT ); +export const sqrt = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SQRT ).setParameterLength( 1 ); /** * Returns the inverse of the square root of the parameter. @@ -470,7 +470,7 @@ export const sqrt = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SQRT ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const inverseSqrt = /*@__PURE__*/ nodeProxy( MathNode, MathNode.INVERSE_SQRT ); +export const inverseSqrt = /*@__PURE__*/ nodeProxy( MathNode, MathNode.INVERSE_SQRT ).setParameterLength( 1 ); /** * Finds the nearest integer less than or equal to the parameter. @@ -480,7 +480,7 @@ export const inverseSqrt = /*@__PURE__*/ nodeProxy( MathNode, MathNode.INVERSE_S * @param {Node | number} x - The parameter. * @returns {Node} */ -export const floor = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FLOOR ); +export const floor = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FLOOR ).setParameterLength( 1 ); /** * Finds the nearest integer that is greater than or equal to the parameter. @@ -490,7 +490,7 @@ export const floor = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FLOOR ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const ceil = /*@__PURE__*/ nodeProxy( MathNode, MathNode.CEIL ); +export const ceil = /*@__PURE__*/ nodeProxy( MathNode, MathNode.CEIL ).setParameterLength( 1 ); /** * Calculates the unit vector in the same direction as the original vector. @@ -500,7 +500,7 @@ export const ceil = /*@__PURE__*/ nodeProxy( MathNode, MathNode.CEIL ); * @param {Node} x - The input vector. * @returns {Node} */ -export const normalize = /*@__PURE__*/ nodeProxy( MathNode, MathNode.NORMALIZE ); +export const normalize = /*@__PURE__*/ nodeProxy( MathNode, MathNode.NORMALIZE ).setParameterLength( 1 ); /** * Computes the fractional part of the parameter. @@ -510,7 +510,7 @@ export const normalize = /*@__PURE__*/ nodeProxy( MathNode, MathNode.NORMALIZE ) * @param {Node | number} x - The parameter. * @returns {Node} */ -export const fract = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FRACT ); +export const fract = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FRACT ).setParameterLength( 1 ); /** * Returns the sine of the parameter. @@ -520,7 +520,7 @@ export const fract = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FRACT ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const sin = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SIN ); +export const sin = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SIN ).setParameterLength( 1 ); /** * Returns the cosine of the parameter. @@ -530,7 +530,7 @@ export const sin = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SIN ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const cos = /*@__PURE__*/ nodeProxy( MathNode, MathNode.COS ); +export const cos = /*@__PURE__*/ nodeProxy( MathNode, MathNode.COS ).setParameterLength( 1 ); /** * Returns the tangent of the parameter. @@ -540,7 +540,7 @@ export const cos = /*@__PURE__*/ nodeProxy( MathNode, MathNode.COS ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const tan = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TAN ); +export const tan = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TAN ).setParameterLength( 1 ); /** * Returns the arcsine of the parameter. @@ -550,7 +550,7 @@ export const tan = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TAN ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const asin = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ASIN ); +export const asin = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ASIN ).setParameterLength( 1 ); /** * Returns the arccosine of the parameter. @@ -560,7 +560,7 @@ export const asin = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ASIN ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const acos = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ACOS ); +export const acos = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ACOS ).setParameterLength( 1 ); /** * Returns the arc-tangent of the parameter. @@ -572,7 +572,7 @@ export const acos = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ACOS ); * @param {?(Node | number)} x - The x parameter. * @returns {Node} */ -export const atan = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ATAN ); +export const atan = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ATAN ).setParameterLength( 1, 2 ); /** * Returns the absolute value of the parameter. @@ -582,7 +582,7 @@ export const atan = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ATAN ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const abs = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ABS ); +export const abs = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ABS ).setParameterLength( 1 ); /** * Extracts the sign of the parameter. @@ -592,7 +592,7 @@ export const abs = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ABS ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const sign = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SIGN ); +export const sign = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SIGN ).setParameterLength( 1 ); /** * Calculates the length of a vector. @@ -602,7 +602,7 @@ export const sign = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SIGN ); * @param {Node} x - The parameter. * @returns {Node} */ -export const length = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LENGTH ); +export const length = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LENGTH ).setParameterLength( 1 ); /** * Negates the value of the parameter (-x). @@ -612,7 +612,7 @@ export const length = /*@__PURE__*/ nodeProxy( MathNode, MathNode.LENGTH ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const negate = /*@__PURE__*/ nodeProxy( MathNode, MathNode.NEGATE ); +export const negate = /*@__PURE__*/ nodeProxy( MathNode, MathNode.NEGATE ).setParameterLength( 1 ); /** * Return `1` minus the parameter. @@ -622,7 +622,7 @@ export const negate = /*@__PURE__*/ nodeProxy( MathNode, MathNode.NEGATE ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const oneMinus = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ONE_MINUS ); +export const oneMinus = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ONE_MINUS ).setParameterLength( 1 ); /** * Returns the partial derivative of the parameter with respect to x. @@ -632,7 +632,7 @@ export const oneMinus = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ONE_MINUS ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const dFdx = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DFDX ); +export const dFdx = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DFDX ).setParameterLength( 1 ); /** * Returns the partial derivative of the parameter with respect to y. @@ -642,7 +642,7 @@ export const dFdx = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DFDX ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const dFdy = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DFDY ); +export const dFdy = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DFDY ).setParameterLength( 1 ); /** * Rounds the parameter to the nearest integer. @@ -652,7 +652,7 @@ export const dFdy = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DFDY ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const round = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ROUND ); +export const round = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ROUND ).setParameterLength( 1 ); /** * Returns the reciprocal of the parameter `(1/x)`. @@ -662,7 +662,7 @@ export const round = /*@__PURE__*/ nodeProxy( MathNode, MathNode.ROUND ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const reciprocal = /*@__PURE__*/ nodeProxy( MathNode, MathNode.RECIPROCAL ); +export const reciprocal = /*@__PURE__*/ nodeProxy( MathNode, MathNode.RECIPROCAL ).setParameterLength( 1 ); /** * Truncates the parameter, removing the fractional part. @@ -672,7 +672,7 @@ export const reciprocal = /*@__PURE__*/ nodeProxy( MathNode, MathNode.RECIPROCAL * @param {Node | number} x - The parameter. * @returns {Node} */ -export const trunc = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRUNC ); +export const trunc = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRUNC ).setParameterLength( 1 ); /** * Returns the sum of the absolute derivatives in x and y. @@ -682,7 +682,7 @@ export const trunc = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRUNC ); * @param {Node | number} x - The parameter. * @returns {Node} */ -export const fwidth = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FWIDTH ); +export const fwidth = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FWIDTH ).setParameterLength( 1 ); /** * Returns the transpose of a matrix. @@ -692,7 +692,7 @@ export const fwidth = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FWIDTH ); * @param {Node} x - The parameter. * @returns {Node} */ -export const transpose = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRANSPOSE ); +export const transpose = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRANSPOSE ).setParameterLength( 1 ); // 2 inputs @@ -705,7 +705,7 @@ export const transpose = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRANSPOSE ) * @param {string} y - The new type. * @returns {Node} */ -export const bitcast = /*@__PURE__*/ nodeProxy( MathNode, MathNode.BITCAST ); +export const bitcast = /*@__PURE__*/ nodeProxy( MathNode, MathNode.BITCAST ).setParameterLength( 2 ); /** * Returns `true` if `x` equals `y`. @@ -733,7 +733,7 @@ export const equals = ( x, y ) => { // @deprecated, r172 * @param {Node | number} y - The x parameter. * @returns {Node} */ -export const min = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MIN ); +export const min = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MIN ).setParameterLength( 2, Infinity ); /** * Returns the greater of two values. @@ -744,7 +744,7 @@ export const min = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MIN ); * @param {Node | number} y - The x parameter. * @returns {Node} */ -export const max = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MAX ); +export const max = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MAX ).setParameterLength( 2, Infinity ); /** * Computes the remainder of dividing the first node by the second one. @@ -755,7 +755,7 @@ export const max = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MAX ); * @param {Node | number} y - The x parameter. * @returns {Node} */ -export const mod = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MOD ); +export const mod = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MOD ).setParameterLength( 2 ); /** * Generate a step function by comparing two values. @@ -766,7 +766,7 @@ export const mod = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MOD ); * @param {Node | number} y - The x parameter. * @returns {Node} */ -export const step = /*@__PURE__*/ nodeProxy( MathNode, MathNode.STEP ); +export const step = /*@__PURE__*/ nodeProxy( MathNode, MathNode.STEP ).setParameterLength( 2 ); /** * Calculates the reflection direction for an incident vector. @@ -777,7 +777,7 @@ export const step = /*@__PURE__*/ nodeProxy( MathNode, MathNode.STEP ); * @param {Node} N - The normal vector. * @returns {Node} */ -export const reflect = /*@__PURE__*/ nodeProxy( MathNode, MathNode.REFLECT ); +export const reflect = /*@__PURE__*/ nodeProxy( MathNode, MathNode.REFLECT ).setParameterLength( 2 ); /** * Calculates the distance between two points. @@ -788,7 +788,7 @@ export const reflect = /*@__PURE__*/ nodeProxy( MathNode, MathNode.REFLECT ); * @param {Node} y - The second point. * @returns {Node} */ -export const distance = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DISTANCE ); +export const distance = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DISTANCE ).setParameterLength( 2 ); /** * Calculates the absolute difference between two values. @@ -799,7 +799,7 @@ export const distance = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DISTANCE ); * @param {Node | number} y - The second parameter. * @returns {Node} */ -export const difference = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DIFFERENCE ); +export const difference = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DIFFERENCE ).setParameterLength( 2 ); /** * Calculates the dot product of two vectors. @@ -810,7 +810,7 @@ export const difference = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DIFFERENCE * @param {Node} y - The second vector. * @returns {Node} */ -export const dot = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DOT ); +export const dot = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DOT ).setParameterLength( 2 ); /** * Calculates the cross product of two vectors. @@ -821,7 +821,7 @@ export const dot = /*@__PURE__*/ nodeProxy( MathNode, MathNode.DOT ); * @param {Node} y - The second vector. * @returns {Node} */ -export const cross = /*@__PURE__*/ nodeProxy( MathNode, MathNode.CROSS ); +export const cross = /*@__PURE__*/ nodeProxy( MathNode, MathNode.CROSS ).setParameterLength( 2 ); /** * Return the value of the first parameter raised to the power of the second one. @@ -832,7 +832,7 @@ export const cross = /*@__PURE__*/ nodeProxy( MathNode, MathNode.CROSS ); * @param {Node | number} y - The second parameter. * @returns {Node} */ -export const pow = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW ); +export const pow = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW ).setParameterLength( 2 ); /** * Returns the square of the parameter. @@ -842,7 +842,7 @@ export const pow = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW ); * @param {Node | number} x - The first parameter. * @returns {Node} */ -export const pow2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 2 ); +export const pow2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 2 ).setParameterLength( 1 ); /** * Returns the cube of the parameter. @@ -852,7 +852,7 @@ export const pow2 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 2 ); * @param {Node | number} x - The first parameter. * @returns {Node} */ -export const pow3 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 3 ); +export const pow3 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 3 ).setParameterLength( 1 ); /** * Returns the fourth power of the parameter. @@ -862,7 +862,7 @@ export const pow3 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 3 ); * @param {Node | number} x - The first parameter. * @returns {Node} */ -export const pow4 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 4 ); +export const pow4 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 4 ).setParameterLength( 1 ); /** * Transforms the direction of a vector by a matrix and then normalizes the result. @@ -873,7 +873,7 @@ export const pow4 = /*@__PURE__*/ nodeProxy( MathNode, MathNode.POW, 4 ); * @param {Node} matrix - The transformation matrix. * @returns {Node} */ -export const transformDirection = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRANSFORM_DIRECTION ); +export const transformDirection = /*@__PURE__*/ nodeProxy( MathNode, MathNode.TRANSFORM_DIRECTION ).setParameterLength( 2 ); /** * Returns the cube root of a number. @@ -905,7 +905,7 @@ export const lengthSq = ( a ) => dot( a, a ); * @param {Node | number} t - The interpolation value. * @returns {Node} */ -export const mix = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MIX ); +export const mix = /*@__PURE__*/ nodeProxy( MathNode, MathNode.MIX ).setParameterLength( 3 ); /** * Constrains a value to lie between two further values. @@ -939,7 +939,7 @@ export const saturate = ( value ) => clamp( value ); * @param {Node} eta - The ratio of indices of refraction. * @returns {Node} */ -export const refract = /*@__PURE__*/ nodeProxy( MathNode, MathNode.REFRACT ); +export const refract = /*@__PURE__*/ nodeProxy( MathNode, MathNode.REFRACT ).setParameterLength( 3 ); /** * Performs a Hermite interpolation between two values. @@ -951,7 +951,7 @@ export const refract = /*@__PURE__*/ nodeProxy( MathNode, MathNode.REFRACT ); * @param {Node | number} x - The source value for interpolation. * @returns {Node} */ -export const smoothstep = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SMOOTHSTEP ); +export const smoothstep = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SMOOTHSTEP ).setParameterLength( 3 ); /** * Returns a vector pointing in the same direction as another. @@ -963,7 +963,7 @@ export const smoothstep = /*@__PURE__*/ nodeProxy( MathNode, MathNode.SMOOTHSTEP * @param {Node} Nref - The reference vector. * @returns {Node} */ -export const faceForward = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FACEFORWARD ); +export const faceForward = /*@__PURE__*/ nodeProxy( MathNode, MathNode.FACEFORWARD ).setParameterLength( 3 ); /** * Returns a random value for the given uv. diff --git a/src/nodes/math/OperatorNode.js b/src/nodes/math/OperatorNode.js index f43d97b77fb028..4df574af7d1f10 100644 --- a/src/nodes/math/OperatorNode.js +++ b/src/nodes/math/OperatorNode.js @@ -434,7 +434,7 @@ export default OperatorNode; * @param {...Node} params - Additional input parameters. * @returns {OperatorNode} */ -export const add = /*@__PURE__*/ nodeProxy( OperatorNode, '+' ); +export const add = /*@__PURE__*/ nodeProxy( OperatorNode, '+' ).setParameterLength( 2, Infinity ).setName( 'add' ); /** * Returns the subtraction of two or more value. @@ -446,7 +446,7 @@ export const add = /*@__PURE__*/ nodeProxy( OperatorNode, '+' ); * @param {...Node} params - Additional input parameters. * @returns {OperatorNode} */ -export const sub = /*@__PURE__*/ nodeProxy( OperatorNode, '-' ); +export const sub = /*@__PURE__*/ nodeProxy( OperatorNode, '-' ).setParameterLength( 2, Infinity ).setName( 'sub' ); /** * Returns the multiplication of two or more value. @@ -458,7 +458,7 @@ export const sub = /*@__PURE__*/ nodeProxy( OperatorNode, '-' ); * @param {...Node} params - Additional input parameters. * @returns {OperatorNode} */ -export const mul = /*@__PURE__*/ nodeProxy( OperatorNode, '*' ); +export const mul = /*@__PURE__*/ nodeProxy( OperatorNode, '*' ).setParameterLength( 2, Infinity ).setName( 'mul' ); /** * Returns the division of two or more value. @@ -470,7 +470,7 @@ export const mul = /*@__PURE__*/ nodeProxy( OperatorNode, '*' ); * @param {...Node} params - Additional input parameters. * @returns {OperatorNode} */ -export const div = /*@__PURE__*/ nodeProxy( OperatorNode, '/' ); +export const div = /*@__PURE__*/ nodeProxy( OperatorNode, '/' ).setParameterLength( 2, Infinity ).setName( 'div' ); /** * Computes the remainder of dividing the first node by the second, for integer values. @@ -481,7 +481,7 @@ export const div = /*@__PURE__*/ nodeProxy( OperatorNode, '/' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const modInt = /*@__PURE__*/ nodeProxy( OperatorNode, '%' ); +export const modInt = /*@__PURE__*/ nodeProxy( OperatorNode, '%' ).setParameterLength( 2 ).setName( 'modInt' ); /** * Checks if two nodes are equal. @@ -492,7 +492,7 @@ export const modInt = /*@__PURE__*/ nodeProxy( OperatorNode, '%' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const equal = /*@__PURE__*/ nodeProxy( OperatorNode, '==' ); +export const equal = /*@__PURE__*/ nodeProxy( OperatorNode, '==' ).setParameterLength( 2 ).setName( 'equal' ); /** * Checks if two nodes are not equal. @@ -503,7 +503,7 @@ export const equal = /*@__PURE__*/ nodeProxy( OperatorNode, '==' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const notEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '!=' ); +export const notEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '!=' ).setParameterLength( 2 ).setName( 'notEqual' ); /** * Checks if the first node is less than the second. @@ -514,7 +514,7 @@ export const notEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '!=' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const lessThan = /*@__PURE__*/ nodeProxy( OperatorNode, '<' ); +export const lessThan = /*@__PURE__*/ nodeProxy( OperatorNode, '<' ).setParameterLength( 2 ).setName( 'lessThan' ); /** * Checks if the first node is greater than the second. @@ -525,7 +525,7 @@ export const lessThan = /*@__PURE__*/ nodeProxy( OperatorNode, '<' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const greaterThan = /*@__PURE__*/ nodeProxy( OperatorNode, '>' ); +export const greaterThan = /*@__PURE__*/ nodeProxy( OperatorNode, '>' ).setParameterLength( 2 ).setName( 'greaterThan' ); /** * Checks if the first node is less than or equal to the second. @@ -536,7 +536,7 @@ export const greaterThan = /*@__PURE__*/ nodeProxy( OperatorNode, '>' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const lessThanEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '<=' ); +export const lessThanEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '<=' ).setParameterLength( 2 ).setName( 'lessThanEqual' ); /** * Checks if the first node is greater than or equal to the second. @@ -547,40 +547,37 @@ export const lessThanEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '<=' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const greaterThanEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '>=' ); +export const greaterThanEqual = /*@__PURE__*/ nodeProxy( OperatorNode, '>=' ).setParameterLength( 2 ).setName( 'greaterThanEqual' ); /** - * Performs logical AND on two nodes. + * Performs a logical AND operation on multiple nodes. * * @tsl * @function - * @param {Node} aNode - The first input. - * @param {Node} bNode - The second input. + * @param {...Node} nodes - The input nodes to be combined using AND. * @returns {OperatorNode} */ -export const and = /*@__PURE__*/ nodeProxy( OperatorNode, '&&' ); +export const and = /*@__PURE__*/ nodeProxy( OperatorNode, '&&' ).setParameterLength( 2, Infinity ).setName( 'and' ); /** - * Performs logical OR on two nodes. + * Performs a logical OR operation on multiple nodes. * * @tsl * @function - * @param {Node} aNode - The first input. - * @param {Node} bNode - The second input. + * @param {...Node} nodes - The input nodes to be combined using OR. * @returns {OperatorNode} */ -export const or = /*@__PURE__*/ nodeProxy( OperatorNode, '||' ); +export const or = /*@__PURE__*/ nodeProxy( OperatorNode, '||' ).setParameterLength( 2, Infinity ).setName( 'or' ); /** * Performs logical NOT on a node. * * @tsl * @function - * @param {Node} aNode - The first input. - * @param {Node} bNode - The second input. + * @param {Node} value - The value. * @returns {OperatorNode} */ -export const not = /*@__PURE__*/ nodeProxy( OperatorNode, '!' ); +export const not = /*@__PURE__*/ nodeProxy( OperatorNode, '!' ).setParameterLength( 1 ).setName( 'not' ); /** * Performs logical XOR on two nodes. @@ -591,7 +588,7 @@ export const not = /*@__PURE__*/ nodeProxy( OperatorNode, '!' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const xor = /*@__PURE__*/ nodeProxy( OperatorNode, '^^' ); +export const xor = /*@__PURE__*/ nodeProxy( OperatorNode, '^^' ).setParameterLength( 2 ).setName( 'xor' ); /** * Performs bitwise AND on two nodes. @@ -602,7 +599,7 @@ export const xor = /*@__PURE__*/ nodeProxy( OperatorNode, '^^' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const bitAnd = /*@__PURE__*/ nodeProxy( OperatorNode, '&' ); +export const bitAnd = /*@__PURE__*/ nodeProxy( OperatorNode, '&' ).setParameterLength( 2 ).setName( 'bitAnd' ); /** * Performs bitwise NOT on a node. @@ -613,7 +610,7 @@ export const bitAnd = /*@__PURE__*/ nodeProxy( OperatorNode, '&' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const bitNot = /*@__PURE__*/ nodeProxy( OperatorNode, '~' ); +export const bitNot = /*@__PURE__*/ nodeProxy( OperatorNode, '~' ).setParameterLength( 2 ).setName( 'bitNot' ); /** * Performs bitwise OR on two nodes. @@ -624,7 +621,7 @@ export const bitNot = /*@__PURE__*/ nodeProxy( OperatorNode, '~' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const bitOr = /*@__PURE__*/ nodeProxy( OperatorNode, '|' ); +export const bitOr = /*@__PURE__*/ nodeProxy( OperatorNode, '|' ).setParameterLength( 2 ).setName( 'bitOr' ); /** * Performs bitwise XOR on two nodes. @@ -635,7 +632,7 @@ export const bitOr = /*@__PURE__*/ nodeProxy( OperatorNode, '|' ); * @param {Node} bNode - The second input. * @returns {OperatorNode} */ -export const bitXor = /*@__PURE__*/ nodeProxy( OperatorNode, '^' ); +export const bitXor = /*@__PURE__*/ nodeProxy( OperatorNode, '^' ).setParameterLength( 2 ).setName( 'bitXor' ); /** * Shifts a node to the left. @@ -646,7 +643,7 @@ export const bitXor = /*@__PURE__*/ nodeProxy( OperatorNode, '^' ); * @param {Node} bNode - The value to shift. * @returns {OperatorNode} */ -export const shiftLeft = /*@__PURE__*/ nodeProxy( OperatorNode, '<<' ); +export const shiftLeft = /*@__PURE__*/ nodeProxy( OperatorNode, '<<' ).setParameterLength( 2 ).setName( 'shiftLeft' ); /** * Shifts a node to the right. @@ -657,7 +654,7 @@ export const shiftLeft = /*@__PURE__*/ nodeProxy( OperatorNode, '<<' ); * @param {Node} bNode - The value to shift. * @returns {OperatorNode} */ -export const shiftRight = /*@__PURE__*/ nodeProxy( OperatorNode, '>>' ); +export const shiftRight = /*@__PURE__*/ nodeProxy( OperatorNode, '>>' ).setParameterLength( 2 ).setName( 'shiftRight' ); addMethodChaining( 'add', add ); addMethodChaining( 'sub', sub ); diff --git a/src/nodes/pmrem/PMREMNode.js b/src/nodes/pmrem/PMREMNode.js index 7dea0494286236..da68832663a3b4 100644 --- a/src/nodes/pmrem/PMREMNode.js +++ b/src/nodes/pmrem/PMREMNode.js @@ -390,8 +390,8 @@ function isEquirectangularMapReady( image ) { * @tsl * @function * @param {Texture} value - The input texture. - * @param {Node} [uvNode=null] - The uv node. - * @param {Node} [levelNode=null] - The level node. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. * @returns {PMREMNode} */ -export const pmremTexture = /*@__PURE__*/ nodeProxy( PMREMNode ); +export const pmremTexture = /*@__PURE__*/ nodeProxy( PMREMNode ).setParameterLength( 1, 3 ); diff --git a/src/nodes/tsl/TSLCore.js b/src/nodes/tsl/TSLCore.js index 5f0c29a470422c..4a8a2f49051ba7 100644 --- a/src/nodes/tsl/TSLCore.js +++ b/src/nodes/tsl/TSLCore.js @@ -213,11 +213,38 @@ const ShaderNodeProxy = function ( NodeClass, scope = null, factor = null, setti const assignNode = ( node ) => nodeObject( settings !== null ? Object.assign( node, settings ) : node ); + let fn, name = scope, minParams, maxParams; + + function verifyParamsLimit( params ) { + + let tslName; + + if ( name ) tslName = /[a-z]/i.test( name ) ? name + '()' : name; + else name = NodeClass.type; + + if ( minParams !== undefined && params.length < minParams ) { + + console.warn( `THREE.TSL: "${ tslName }" parameter length is less than minimum required.` ); + + return params.concat( new Array( minParams - params.length ).fill( 0 ) ); + + } else if ( maxParams !== undefined && params.length > maxParams ) { + + console.warn( `THREE.TSL: } "${ tslName }" parameter length exceeds limit.` ); + + return params.slice( 0, maxParams ); + + } + + return params; + + } + if ( scope === null ) { - return ( ...params ) => { + fn = ( ...params ) => { - return assignNode( new NodeClass( ...nodeArray( params ) ) ); + return assignNode( new NodeClass( ...nodeArray( verifyParamsLimit( params ) ) ) ); }; @@ -225,22 +252,41 @@ const ShaderNodeProxy = function ( NodeClass, scope = null, factor = null, setti factor = nodeObject( factor ); - return ( ...params ) => { + fn = ( ...params ) => { - return assignNode( new NodeClass( scope, ...nodeArray( params ), factor ) ); + return assignNode( new NodeClass( scope, ...nodeArray( verifyParamsLimit( params ) ), factor ) ); }; } else { - return ( ...params ) => { + fn = ( ...params ) => { - return assignNode( new NodeClass( scope, ...nodeArray( params ) ) ); + return assignNode( new NodeClass( scope, ...nodeArray( verifyParamsLimit( params ) ) ) ); }; } + fn.setParameterLength = ( ...params ) => { + + if ( params.length === 1 ) minParams = maxParams = params[ 0 ]; + else if ( params.length === 2 ) [ minParams, maxParams ] = params; + + return fn; + + }; + + fn.setName = ( value ) => { + + name = value; + + return fn; + + }; + + return fn; + }; const ShaderNodeImmutable = function ( NodeClass, ...params ) { @@ -667,7 +713,7 @@ addMethodChaining( 'toMat4', mat4 ); // basic nodes -export const element = /*@__PURE__*/ nodeProxy( ArrayElementNode ); +export const element = /*@__PURE__*/ nodeProxy( ArrayElementNode ).setParameterLength( 2 ); export const convert = ( node, types ) => nodeObject( new ConvertNode( nodeObject( node ), types ) ); export const split = ( node, channels ) => nodeObject( new SplitNode( nodeObject( node ), channels ) ); diff --git a/src/nodes/utils/CubeMapNode.js b/src/nodes/utils/CubeMapNode.js index eed1f9502c2c0a..9f26e7a47625c0 100644 --- a/src/nodes/utils/CubeMapNode.js +++ b/src/nodes/utils/CubeMapNode.js @@ -53,7 +53,7 @@ class CubeMapNode extends TempNode { * @private * @type {CubeTextureNode} */ - this._cubeTextureNode = cubeTexture(); + this._cubeTextureNode = cubeTexture( null ); const defaultTexture = new CubeTexture(); defaultTexture.isRenderTargetTexture = true; @@ -234,4 +234,4 @@ function mapTextureMapping( texture, mapping ) { * @param {Node} envNode - The node representing the environment map. * @returns {CubeMapNode} */ -export const cubeMapNode = /*@__PURE__*/ nodeProxy( CubeMapNode ); +export const cubeMapNode = /*@__PURE__*/ nodeProxy( CubeMapNode ).setParameterLength( 1 ); diff --git a/src/nodes/utils/EquirectUVNode.js b/src/nodes/utils/EquirectUVNode.js index 0bcf9e1d396775..85670c08f567f7 100644 --- a/src/nodes/utils/EquirectUVNode.js +++ b/src/nodes/utils/EquirectUVNode.js @@ -59,7 +59,7 @@ export default EquirectUVNode; * * @tsl * @function - * @param {Node} [dirNode=positionWorldDirection] - A direction vector for sampling which is by default `positionWorldDirection`. + * @param {?Node} [dirNode=positionWorldDirection] - A direction vector for sampling which is by default `positionWorldDirection`. * @returns {EquirectUVNode} */ -export const equirectUV = /*@__PURE__*/ nodeProxy( EquirectUVNode ); +export const equirectUV = /*@__PURE__*/ nodeProxy( EquirectUVNode ).setParameterLength( 0, 1 ); diff --git a/src/nodes/utils/MaxMipLevelNode.js b/src/nodes/utils/MaxMipLevelNode.js index b7c5b173bec5f0..61886c5e10e0ef 100644 --- a/src/nodes/utils/MaxMipLevelNode.js +++ b/src/nodes/utils/MaxMipLevelNode.js @@ -100,4 +100,4 @@ export default MaxMipLevelNode; * @param {TextureNode} textureNode - The texture node to compute the max mip level for. * @returns {MaxMipLevelNode} */ -export const maxMipLevel = /*@__PURE__*/ nodeProxy( MaxMipLevelNode ); +export const maxMipLevel = /*@__PURE__*/ nodeProxy( MaxMipLevelNode ).setParameterLength( 1 ); diff --git a/src/nodes/utils/RemapNode.js b/src/nodes/utils/RemapNode.js index ec1e703d9f3bd8..19efdf4f25b6f0 100644 --- a/src/nodes/utils/RemapNode.js +++ b/src/nodes/utils/RemapNode.js @@ -101,11 +101,11 @@ export default RemapNode; * @param {Node} node - The node that should be remapped. * @param {Node} inLowNode - The source or current lower bound of the range. * @param {Node} inHighNode - The source or current upper bound of the range. - * @param {Node} [outLowNode=float(0)] - The target lower bound of the range. - * @param {Node} [outHighNode=float(1)] - The target upper bound of the range. + * @param {?Node} [outLowNode=float(0)] - The target lower bound of the range. + * @param {?Node} [outHighNode=float(1)] - The target upper bound of the range. * @returns {RemapNode} */ -export const remap = /*@__PURE__*/ nodeProxy( RemapNode, null, null, { doClamp: false } ); +export const remap = /*@__PURE__*/ nodeProxy( RemapNode, null, null, { doClamp: false } ).setParameterLength( 3, 5 ); /** * TSL function for creating a remap node, but with enabled clamping. @@ -115,11 +115,11 @@ export const remap = /*@__PURE__*/ nodeProxy( RemapNode, null, null, { doClamp: * @param {Node} node - The node that should be remapped. * @param {Node} inLowNode - The source or current lower bound of the range. * @param {Node} inHighNode - The source or current upper bound of the range. - * @param {Node} [outLowNode=float(0)] - The target lower bound of the range. - * @param {Node} [outHighNode=float(1)] - The target upper bound of the range. + * @param {?Node} [outLowNode=float(0)] - The target lower bound of the range. + * @param {?Node} [outHighNode=float(1)] - The target upper bound of the range. * @returns {RemapNode} */ -export const remapClamp = /*@__PURE__*/ nodeProxy( RemapNode ); +export const remapClamp = /*@__PURE__*/ nodeProxy( RemapNode ).setParameterLength( 3, 5 ); addMethodChaining( 'remap', remap ); addMethodChaining( 'remapClamp', remapClamp ); diff --git a/src/nodes/utils/RotateNode.js b/src/nodes/utils/RotateNode.js index cad6a0c941abf8..16873eb1fd7a8e 100644 --- a/src/nodes/utils/RotateNode.js +++ b/src/nodes/utils/RotateNode.js @@ -100,4 +100,4 @@ export default RotateNode; * on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. * @returns {RotateNode} */ -export const rotate = /*@__PURE__*/ nodeProxy( RotateNode ); +export const rotate = /*@__PURE__*/ nodeProxy( RotateNode ).setParameterLength( 2 ); diff --git a/src/nodes/utils/SpriteSheetUVNode.js b/src/nodes/utils/SpriteSheetUVNode.js index 114d28be3a644d..592fa420811030 100644 --- a/src/nodes/utils/SpriteSheetUVNode.js +++ b/src/nodes/utils/SpriteSheetUVNode.js @@ -83,8 +83,8 @@ export default SpriteSheetUVNode; * @tsl * @function * @param {Node} countNode - The node that defines the number of sprites in the x and y direction (e.g 6x6). - * @param {Node} [uvNode=uv()] - The uv node. - * @param {Node} [frameNode=float()] - The node that defines the current frame/sprite. + * @param {?Node} [uvNode=uv()] - The uv node. + * @param {?Node} [frameNode=float()] - The node that defines the current frame/sprite. * @returns {SpriteSheetUVNode} */ -export const spritesheetUV = /*@__PURE__*/ nodeProxy( SpriteSheetUVNode ); +export const spritesheetUV = /*@__PURE__*/ nodeProxy( SpriteSheetUVNode ).setParameterLength( 3 ); diff --git a/src/nodes/utils/StorageArrayElementNode.js b/src/nodes/utils/StorageArrayElementNode.js index 3b6cf8ed88df10..c6109c4e2b0160 100644 --- a/src/nodes/utils/StorageArrayElementNode.js +++ b/src/nodes/utils/StorageArrayElementNode.js @@ -140,4 +140,4 @@ export default StorageArrayElementNode; * @param {Node} indexNode - The index node that defines the element access. * @returns {StorageArrayElementNode} */ -export const storageElement = /*@__PURE__*/ nodeProxy( StorageArrayElementNode ); +export const storageElement = /*@__PURE__*/ nodeProxy( StorageArrayElementNode ).setParameterLength( 2 ); diff --git a/src/nodes/utils/TriplanarTexturesNode.js b/src/nodes/utils/TriplanarTexturesNode.js index d6611a8bac8807..9e7a866168328a 100644 --- a/src/nodes/utils/TriplanarTexturesNode.js +++ b/src/nodes/utils/TriplanarTexturesNode.js @@ -130,7 +130,7 @@ export default TriplanarTexturesNode; * @param {?Node} [normalNode=normalLocal] - Normals in local space. * @returns {TriplanarTexturesNode} */ -export const triplanarTextures = /*@__PURE__*/ nodeProxy( TriplanarTexturesNode ); +export const triplanarTextures = /*@__PURE__*/ nodeProxy( TriplanarTexturesNode ).setParameterLength( 1, 6 ); /** * TSL function for creating a triplanar textures node. From 24159a8425100b0fbd363a22434b22f2a8793df3 Mon Sep 17 00:00:00 2001 From: sunag Date: Sun, 23 Mar 2025 23:30:13 -0300 Subject: [PATCH 2/2] cleanup --- src/nodes/tsl/TSLCore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nodes/tsl/TSLCore.js b/src/nodes/tsl/TSLCore.js index 4a8a2f49051ba7..c4471c300bfae8 100644 --- a/src/nodes/tsl/TSLCore.js +++ b/src/nodes/tsl/TSLCore.js @@ -230,7 +230,7 @@ const ShaderNodeProxy = function ( NodeClass, scope = null, factor = null, setti } else if ( maxParams !== undefined && params.length > maxParams ) { - console.warn( `THREE.TSL: } "${ tslName }" parameter length exceeds limit.` ); + console.warn( `THREE.TSL: "${ tslName }" parameter length exceeds limit.` ); return params.slice( 0, maxParams );