Skip to content

Commit 023bd77

Browse files
committed
added .toArray()
1 parent 009a3e4 commit 023bd77

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/nodes/TSL.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
export * from './core/constants.js';
33

44
// core
5-
export * from './core/ArrayNode.js';
65
export * from './core/AssignNode.js';
76
export * from './core/AttributeNode.js';
87
export * from './core/BypassNode.js';

src/nodes/core/ArrayNode.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import TempNode from './TempNode.js';
2-
import { nodeObject } from '../tsl/TSLCore.js';
2+
import { addMethodChaining, nodeObject } from '../tsl/TSLCore.js';
33

44
/** @module ArrayNode **/
55

@@ -121,3 +121,5 @@ export const array = ( ...params ) => {
121121
return nodeObject( node );
122122

123123
};
124+
125+
addMethodChaining( 'toArray', ( node, count ) => array( Array( count ).fill( node ) ) );

src/nodes/tsl/TSLBase.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// TSL Base Syntax
33

44
export * from './TSLCore.js'; // float(), vec2(), vec3(), vec4(), mat3(), mat4(), Fn(), If(), element(), nodeObject(), nodeProxy(), ...
5+
export * from '../core/ArrayNode.js'; // array(), .toArray()
56
export * from '../core/UniformNode.js'; // uniform()
67
export * from '../core/PropertyNode.js'; // property() <-> TODO: Separate Material Properties in other file
78
export * from '../core/AssignNode.js'; // .assign()

0 commit comments

Comments
 (0)