Skip to content

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Jul 25, 2025

Description

Adds support for using arrays in named parameter functions for TSL functions that do not have a layout.

const col = Fn( ( { r = 0, g = 0, b = 0 } ) => {

	return vec3( r, g, b );

} );


// Any of the options below will return a green color.

material.colorNode = col( 0, 1, 0 ); // option 1
material.colorNode = col( { r: 0, g: 1, b: 0 } ); // option 2
material.colorNode = col( { g: 1 } ); // option 3

@sunag sunag changed the title TSL: Sequential parameters in objects for Fn( { .. } ) TSL: Sequential object as parameters for Fn( { .. } ) Jul 25, 2025
@sunag sunag added this to the r179 milestone Jul 25, 2025
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.22
78.88
338.22
78.88
+0 B
+0 B
WebGPU 560.72
155.17
560.82
155.22
+107 B
+49 B
WebGPU Nodes 559.64
154.96
559.75
155.01
+107 B
+50 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 469.49
113.56
469.49
113.56
+0 B
+0 B
WebGPU 635.72
172.04
635.83
172.09
+107 B
+44 B
WebGPU Nodes 590.37
161.29
590.48
161.33
+107 B
+42 B

@sunag sunag marked this pull request as ready for review July 25, 2025 14:27
@sunag sunag merged commit b8f39e4 into mrdoob:dev Jul 25, 2025
9 checks passed
@sunag sunag deleted the dev-tsl-fn branch July 25, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant