Просмотр исходного кода

TSL: Fix `instance()` optional parameter (#30848)

sunag 10 месяцев назад
Родитель
Сommit
b4ca470e69
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      src/nodes/accessors/InstanceNode.js

+ 5 - 4
src/nodes/accessors/InstanceNode.js

@@ -33,9 +33,9 @@ class InstanceNode extends Node {
 	 *
 	 * @param {number} count - The number of instances.
 	 * @param {InstancedBufferAttribute} instanceMatrix - Instanced buffer attribute representing the instance transformations.
-	 * @param {InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors.
+	 * @param {?InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors.
 	 */
-	constructor( count, instanceMatrix, instanceColor ) {
+	constructor( count, instanceMatrix, instanceColor = null ) {
 
 		super( 'void' );
 
@@ -71,6 +71,7 @@ class InstanceNode extends Node {
 		 * The node that represents the instance color data.
 		 *
 		 * @type {?Node}
+		 * @default null
 		 */
 		this.instanceColorNode = null;
 
@@ -220,7 +221,7 @@ export default InstanceNode;
  * @function
  * @param {number} count - The number of instances.
  * @param {InstancedBufferAttribute} instanceMatrix - Instanced buffer attribute representing the instance transformations.
- * @param {InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors.
+ * @param {?InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors.
  * @returns {InstanceNode}
  */
-export const instance = /*@__PURE__*/ nodeProxy( InstanceNode ).setParameterLength( 3 );
+export const instance = /*@__PURE__*/ nodeProxy( InstanceNode ).setParameterLength( 2, 3 );

粤ICP备19079148号