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

TSL: Flow control function names revision (#29064)

* rename `loop` to `Loop`

* rename `tslFn` -> `Fn`

* TSLEncoder: rename `tslFn` -> `Fn`

* rename `if` -> `If`, `else` -> `Else`, `elseif` -> `ElseIf`

* rename `cond` -> `select`

* StackNode: deprecated alerts

* Update UniformArrayNode.js

* rename `cond` -> `select` (2)

* cleanup

* cleanup
sunag 1 год назад
Родитель
Сommit
05e32cd471
93 измененных файлов с 513 добавлено и 471 удалено
  1. 8 8
      examples/jsm/transpiler/TSLEncoder.js
  2. 4 4
      examples/webgpu_backdrop_water.html
  3. 2 2
      examples/webgpu_compute_audio.html
  4. 2 2
      examples/webgpu_compute_geometry.html
  5. 4 4
      examples/webgpu_compute_particles.html
  6. 4 4
      examples/webgpu_compute_particles_rain.html
  7. 4 4
      examples/webgpu_compute_particles_snow.html
  8. 6 6
      examples/webgpu_compute_points.html
  9. 2 2
      examples/webgpu_compute_texture.html
  10. 4 4
      examples/webgpu_materials.html
  11. 2 2
      examples/webgpu_mrt.html
  12. 5 5
      examples/webgpu_shadowmap.html
  13. 2 2
      examples/webgpu_shadowmap_opacity.html
  14. 4 4
      examples/webgpu_storage_buffer.html
  15. 2 2
      examples/webgpu_texturegrad.html
  16. 4 4
      examples/webgpu_tsl_angular_slicing.html
  17. 3 3
      examples/webgpu_tsl_coffee_smoke.html
  18. 6 6
      examples/webgpu_tsl_compute_attractors_particles.html
  19. 3 3
      examples/webgpu_tsl_halftone.html
  20. 3 3
      examples/webgpu_tsl_interoperability.html
  21. 5 5
      examples/webgpu_tsl_procedural_terrain.html
  22. 3 3
      examples/webgpu_tsl_raging_sea.html
  23. 3 3
      examples/webgpu_tsl_vfx_flames.html
  24. 7 7
      examples/webgpu_tsl_vfx_tornado.html
  25. 2 2
      examples/webgpu_volume_cloud.html
  26. 2 2
      examples/webgpu_volume_perlin.html
  27. 2 2
      src/nodes/Nodes.js
  28. 2 2
      src/nodes/accessors/BatchNode.js
  29. 8 8
      src/nodes/accessors/ClippingNode.js
  30. 4 4
      src/nodes/accessors/MorphNode.js
  31. 2 2
      src/nodes/accessors/TangentNode.js
  32. 8 8
      src/nodes/accessors/Texture3DNode.js
  33. 5 3
      src/nodes/accessors/UniformArrayNode.js
  34. 22 6
      src/nodes/core/StackNode.js
  35. 3 3
      src/nodes/display/AfterImageNode.js
  36. 4 4
      src/nodes/display/AnamorphicNode.js
  37. 2 2
      src/nodes/display/BleachBypassNode.js
  38. 8 8
      src/nodes/display/BlendModeNode.js
  39. 7 7
      src/nodes/display/BloomNode.js
  40. 3 3
      src/nodes/display/BumpMapNode.js
  41. 4 4
      src/nodes/display/ColorAdjustmentNode.js
  42. 3 3
      src/nodes/display/ColorSpaceNode.js
  43. 7 7
      src/nodes/display/DenoiseNode.js
  44. 2 2
      src/nodes/display/DepthOfFieldNode.js
  45. 3 3
      src/nodes/display/DotScreenNode.js
  46. 9 9
      src/nodes/display/FXAANode.js
  47. 2 2
      src/nodes/display/FilmNode.js
  48. 8 8
      src/nodes/display/GTAONode.js
  49. 2 2
      src/nodes/display/GaussianBlurNode.js
  50. 2 2
      src/nodes/display/Lut3DNode.js
  51. 2 2
      src/nodes/display/NormalMapNode.js
  52. 3 3
      src/nodes/display/PixelationPassNode.js
  53. 2 2
      src/nodes/display/RGBShiftNode.js
  54. 2 2
      src/nodes/display/SepiaNode.js
  55. 2 2
      src/nodes/display/SobelOperatorNode.js
  56. 11 11
      src/nodes/display/ToneMappingNode.js
  57. 3 3
      src/nodes/display/TransitionNode.js
  58. 2 2
      src/nodes/functions/BSDF/BRDF_GGX.js
  59. 2 2
      src/nodes/functions/BSDF/BRDF_Lambert.js
  60. 4 4
      src/nodes/functions/BSDF/BRDF_Sheen.js
  61. 2 2
      src/nodes/functions/BSDF/DFGApprox.js
  62. 2 2
      src/nodes/functions/BSDF/D_GGX.js
  63. 2 2
      src/nodes/functions/BSDF/D_GGX_Anisotropic.js
  64. 2 2
      src/nodes/functions/BSDF/EnvironmentBRDF.js
  65. 2 2
      src/nodes/functions/BSDF/F_Schlick.js
  66. 6 6
      src/nodes/functions/BSDF/LTC.js
  67. 2 2
      src/nodes/functions/BSDF/Schlick_to_F0.js
  68. 2 2
      src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js
  69. 2 2
      src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js
  70. 3 3
      src/nodes/functions/PhongLightingModel.js
  71. 18 18
      src/nodes/functions/PhysicalLightingModel.js
  72. 2 2
      src/nodes/functions/ToonLightingModel.js
  73. 2 2
      src/nodes/functions/material/getGeometryRoughness.js
  74. 2 2
      src/nodes/functions/material/getRoughness.js
  75. 5 5
      src/nodes/lighting/AnalyticLightNode.js
  76. 3 3
      src/nodes/lighting/LightUtils.js
  77. 3 3
      src/nodes/materials/InstancedPointsNodeMaterial.js
  78. 17 17
      src/nodes/materials/Line2NodeMaterial.js
  79. 1 1
      src/nodes/materials/MeshPhysicalNodeMaterial.js
  80. 5 5
      src/nodes/materials/VolumeNodeMaterial.js
  81. 12 12
      src/nodes/materialx/lib/mx_hsv.js
  82. 80 80
      src/nodes/materialx/lib/mx_noise.js
  83. 2 2
      src/nodes/materialx/lib/mx_transform_color.js
  84. 13 2
      src/nodes/math/CondNode.js
  85. 2 2
      src/nodes/math/MathNode.js
  86. 6 6
      src/nodes/math/TriNoise3D.js
  87. 34 34
      src/nodes/pmrem/PMREMUtils.js
  88. 2 2
      src/nodes/procedural/CheckerNode.js
  89. 10 3
      src/nodes/shadernode/ShaderNode.js
  90. 10 4
      src/nodes/utils/LoopNode.js
  91. 2 2
      src/nodes/utils/SpriteUtils.js
  92. 3 3
      src/nodes/utils/UVUtils.js
  93. 3 3
      src/nodes/utils/ViewportUtils.js

+ 8 - 8
examples/jsm/transpiler/TSLEncoder.js

@@ -322,9 +322,9 @@ class TSLEncoder {
 		const leftStr = this.emitExpression( node.left );
 		const leftStr = this.emitExpression( node.left );
 		const rightStr = this.emitExpression( node.right );
 		const rightStr = this.emitExpression( node.right );
 
 
-		this.addImport( 'cond' );
+		this.addImport( 'select' );
 
 
-		return `cond( ${ condStr }, ${ leftStr }, ${ rightStr } )`;
+		return `select( ${ condStr }, ${ leftStr }, ${ rightStr } )`;
 
 
 	}
 	}
 
 
@@ -349,7 +349,7 @@ ${ this.tab }} )`;
 
 
 				const elseCondStr = this.emitExpression( current.elseConditional.cond );
 				const elseCondStr = this.emitExpression( current.elseConditional.cond );
 
 
-				ifStr += `.elseif( ${ elseCondStr }, () => {
+				ifStr += `.ElseIf( ${ elseCondStr }, () => {
 
 
 ${ elseBodyStr }
 ${ elseBodyStr }
 
 
@@ -357,7 +357,7 @@ ${ this.tab }} )`;
 
 
 			} else {
 			} else {
 
 
-				ifStr += `.else( () => {
+				ifStr += `.Else( () => {
 
 
 ${ elseBodyStr }
 ${ elseBodyStr }
 
 
@@ -391,13 +391,13 @@ ${ this.tab }} )`;
 		const conditionParam = condition !== '<' ? `, condition: '${ condition }'` : '';
 		const conditionParam = condition !== '<' ? `, condition: '${ condition }'` : '';
 		const updateParam = update !== '++' ? `, update: '${ update }'` : '';
 		const updateParam = update !== '++' ? `, update: '${ update }'` : '';
 
 
-		let loopStr = `loop( { start: ${ start }, end: ${ end + nameParam + typeParam + conditionParam + updateParam } }, ( { ${ name } } ) => {\n\n`;
+		let loopStr = `Loop( { start: ${ start }, end: ${ end + nameParam + typeParam + conditionParam + updateParam } }, ( { ${ name } } ) => {\n\n`;
 
 
 		loopStr += this.emitBody( node.body ) + '\n\n';
 		loopStr += this.emitBody( node.body ) + '\n\n';
 
 
 		loopStr += this.tab + '} )';
 		loopStr += this.tab + '} )';
 
 
-		this.imports.add( 'loop' );
+		this.imports.add( 'Loop' );
 
 
 		return loopStr;
 		return loopStr;
 
 
@@ -586,7 +586,7 @@ ${ this.tab }} )`;
 
 
 		const prefix = this.iife === false ? 'export ' : '';
 		const prefix = this.iife === false ? 'export ' : '';
 
 
-		let funcStr = `${ prefix }const ${ fnName } = /*#__PURE__*/ tslFn( (${ paramsStr }) => {
+		let funcStr = `${ prefix }const ${ fnName } = /*#__PURE__*/ Fn( (${ paramsStr }) => {
 
 
 ${ bodyStr }
 ${ bodyStr }
 
 
@@ -608,7 +608,7 @@ ${ this.tab }} )`;
 
 
 		funcStr += ';\n';
 		funcStr += ';\n';
 
 
-		this.imports.add( 'tslFn' );
+		this.imports.add( 'Fn' );
 
 
 		this.global.add( node.name );
 		this.global.add( node.name );
 
 

+ 4 - 4
examples/webgpu_backdrop_water.html

@@ -155,7 +155,7 @@
 
 
 				const depthRefraction = depthTestForRefraction.remapClamp( 0, .1 );
 				const depthRefraction = depthTestForRefraction.remapClamp( 0, .1 );
 
 
-				const finalUV = depthTestForRefraction.lessThan( 0 ).cond( viewportTopLeft, refractionUV );
+				const finalUV = depthTestForRefraction.lessThan( 0 ).select( viewportTopLeft, refractionUV );
 
 
 				const viewportTexture = viewportSharedTexture( finalUV );
 				const viewportTexture = viewportSharedTexture( finalUV );
 
 
@@ -180,7 +180,7 @@
 				const waterPosY = positionWorld.y.sub( water.position.y );
 				const waterPosY = positionWorld.y.sub( water.position.y );
 
 
 				let transition = waterPosY.add( .1 ).saturate().oneMinus();
 				let transition = waterPosY.add( .1 ).saturate().oneMinus();
-				transition = waterPosY.lessThan( 0 ).cond( transition, normalWorld.y.mix( transition, 0 ) ).toVar();
+				transition = waterPosY.lessThan( 0 ).select( transition, normalWorld.y.mix( transition, 0 ) ).toVar();
 
 
 				const colorNode = transition.mix( material.colorNode, material.colorNode.add( waterLayer0 ) );
 				const colorNode = transition.mix( material.colorNode, material.colorNode.add( waterLayer0 ) );
 
 
@@ -224,12 +224,12 @@
 				const waterMask = objectPosition( camera ).y.greaterThan( 0 );
 				const waterMask = objectPosition( camera ).y.greaterThan( 0 );
 
 
 				const scenePassColorBlurred = scenePassColor.gaussianBlur();
 				const scenePassColorBlurred = scenePassColor.gaussianBlur();
-				scenePassColorBlurred.directionNode = waterMask.cond( scenePassDepth, scenePass.getLinearDepthNode().mul( 5 ) );
+				scenePassColorBlurred.directionNode = waterMask.select( scenePassDepth, scenePass.getLinearDepthNode().mul( 5 ) );
 
 
 				const vignet = viewportTopLeft.distance( .5 ).mul( 1.35 ).clamp().oneMinus();
 				const vignet = viewportTopLeft.distance( .5 ).mul( 1.35 ).clamp().oneMinus();
 
 
 				postProcessing = new THREE.PostProcessing( renderer );
 				postProcessing = new THREE.PostProcessing( renderer );
-				postProcessing.outputNode = waterMask.cond( scenePassColorBlurred, scenePassColorBlurred.mul( color( 0x74ccf4 ) ).mul( vignet ) );
+				postProcessing.outputNode = waterMask.select( scenePassColorBlurred, scenePassColorBlurred.mul( color( 0x74ccf4 ) ).mul( vignet ) );
 
 
 				//
 				//
 
 

+ 2 - 2
examples/webgpu_compute_audio.html

@@ -29,7 +29,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { tslFn, uniform, storage, storageObject, instanceIndex, float, texture, viewportTopLeft, color } from 'three/tsl';
+			import { Fn, uniform, storage, storageObject, instanceIndex, float, texture, viewportTopLeft, color } from 'three/tsl';
 
 
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 
 
@@ -112,7 +112,7 @@
 
 
 				// compute (shader-node)
 				// compute (shader-node)
 
 
-				const computeShaderFn = tslFn( () => {
+				const computeShaderFn = Fn( () => {
 
 
 					const index = float( instanceIndex );
 					const index = float( instanceIndex );
 
 

+ 2 - 2
examples/webgpu_compute_geometry.html

@@ -25,7 +25,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { vec3, cos, sin, mat3, storage, tslFn, instanceIndex, timerLocal } from 'three/tsl';
+			import { vec3, cos, sin, mat3, storage, Fn, instanceIndex, timerLocal } from 'three/tsl';
 
 
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 
 
@@ -66,7 +66,7 @@
 
 
 					// compute shader
 					// compute shader
 
 
-					const computeFn = tslFn( () => {
+					const computeFn = Fn( () => {
 
 
 						const positionAttribute = storage( positionBaseAttribute, 'vec3', positionBaseAttribute.count ).toReadOnly();
 						const positionAttribute = storage( positionBaseAttribute, 'vec3', positionBaseAttribute.count ).toReadOnly();
 						const normalAttribute = storage( normalBaseAttribute, 'vec3', normalBaseAttribute.count ).toReadOnly();
 						const normalAttribute = storage( normalBaseAttribute, 'vec3', normalBaseAttribute.count ).toReadOnly();

+ 4 - 4
examples/webgpu_compute_particles.html

@@ -37,7 +37,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { tslFn, uniform, texture, instanceIndex, float, vec3, storage, If } from 'three/tsl';
+			import { Fn, uniform, texture, instanceIndex, float, vec3, storage, If } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import Stats from 'three/addons/libs/stats.module.js';
 			import Stats from 'three/addons/libs/stats.module.js';
@@ -85,7 +85,7 @@
 
 
 				// compute
 				// compute
 
 
-				const computeInit = tslFn( () => {
+				const computeInit = Fn( () => {
 
 
 					const position = positionBuffer.element( instanceIndex );
 					const position = positionBuffer.element( instanceIndex );
 					const color = colorBuffer.element( instanceIndex );
 					const color = colorBuffer.element( instanceIndex );
@@ -104,7 +104,7 @@
 
 
 				//
 				//
 
 
-				const computeUpdate = tslFn( () => {
+				const computeUpdate = Fn( () => {
 
 
 					const position = positionBuffer.element( instanceIndex );
 					const position = positionBuffer.element( instanceIndex );
 					const velocity = velocityBuffer.element( instanceIndex );
 					const velocity = velocityBuffer.element( instanceIndex );
@@ -182,7 +182,7 @@
 
 
 				// click event
 				// click event
 
 
-				const computeHit = tslFn( () => {
+				const computeHit = Fn( () => {
 
 
 					const position = positionBuffer.element( instanceIndex );
 					const position = positionBuffer.element( instanceIndex );
 					const velocity = velocityBuffer.element( instanceIndex );
 					const velocity = velocityBuffer.element( instanceIndex );

+ 4 - 4
examples/webgpu_compute_particles_rain.html

@@ -24,7 +24,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { tslFn, texture, uv, uint, positionWorld, billboarding, timerLocal, timerDelta, vec2, instanceIndex, positionGeometry, storage, If } from 'three/tsl';
+			import { Fn, texture, uv, uint, positionWorld, billboarding, timerLocal, timerDelta, vec2, instanceIndex, positionGeometry, storage, If } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 
 
@@ -106,7 +106,7 @@
 
 
 				const randUint = () => uint( Math.random() * 0xFFFFFF );
 				const randUint = () => uint( Math.random() * 0xFFFFFF );
 
 
-				const computeInit = tslFn( () => {
+				const computeInit = Fn( () => {
 
 
 					const position = positionBuffer.element( instanceIndex );
 					const position = positionBuffer.element( instanceIndex );
 					const velocity = velocityBuffer.element( instanceIndex );
 					const velocity = velocityBuffer.element( instanceIndex );
@@ -128,7 +128,7 @@
 
 
 				//
 				//
 
 
-				const computeUpdate = tslFn( () => {
+				const computeUpdate = Fn( () => {
 
 
 					const getCoord = ( pos ) => pos.add( 50 ).div( 100 );
 					const getCoord = ( pos ) => pos.add( 50 ).div( 100 );
 
 
@@ -205,7 +205,7 @@
 
 
 				const rippleTime = rippleTimeBuffer.element( instanceIndex ).x;
 				const rippleTime = rippleTimeBuffer.element( instanceIndex ).x;
 
 
-				const rippleEffect = tslFn( () => {
+				const rippleEffect = Fn( () => {
 
 
 					const center = uv().add( vec2( - .5 ) ).length().mul( 7 );
 					const center = uv().add( vec2( - .5 ) ).length().mul( 7 );
 					const distance = rippleTime.sub( center );
 					const distance = rippleTime.sub( center );

+ 4 - 4
examples/webgpu_compute_particles_snow.html

@@ -25,7 +25,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { tslFn, texture, vec3, pass, color, uint, viewportTopLeft, positionWorld, positionLocal, timerLocal, vec2, instanceIndex, storage, If } from 'three/tsl';
+			import { Fn, texture, vec3, pass, color, uint, viewportTopLeft, positionWorld, positionLocal, timerLocal, vec2, instanceIndex, storage, If } from 'three/tsl';
 
 
 			import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js';
 			import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js';
 
 
@@ -105,7 +105,7 @@
 
 
 				const randUint = () => uint( Math.random() * 0xFFFFFF );
 				const randUint = () => uint( Math.random() * 0xFFFFFF );
 
 
-				const computeInit = tslFn( () => {
+				const computeInit = Fn( () => {
 
 
 					const position = positionBuffer.element( instanceIndex );
 					const position = positionBuffer.element( instanceIndex );
 					const scale = scaleBuffer.element( instanceIndex );
 					const scale = scaleBuffer.element( instanceIndex );
@@ -136,7 +136,7 @@
 				const surfaceOffset = .2;
 				const surfaceOffset = .2;
 				const speed = .4;
 				const speed = .4;
 
 
-				const computeUpdate = tslFn( () => {
+				const computeUpdate = Fn( () => {
 
 
 					const getCoord = ( pos ) => pos.add( 50 ).div( 100 );
 					const getCoord = ( pos ) => pos.add( 50 ).div( 100 );
 
 
@@ -157,7 +157,7 @@
 
 
 						position.y = position.y.add( velocity );
 						position.y = position.y.add( velocity );
 
 
-					} ).else( () => {
+					} ).Else( () => {
 
 
 						staticPositionBuffer.element( instanceIndex ).assign( position );
 						staticPositionBuffer.element( instanceIndex ).assign( position );
 
 

+ 6 - 6
examples/webgpu_compute_points.html

@@ -24,7 +24,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { tslFn, uniform, storage, attribute, float, vec2, vec3, color, instanceIndex } from 'three/tsl';
+			import { Fn, uniform, storage, attribute, float, vec2, vec3, color, instanceIndex } from 'three/tsl';
 
 
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 
 
@@ -58,7 +58,7 @@
 
 
 				// create function
 				// create function
 
 
-				const computeShaderFn = tslFn( () => {
+				const computeShaderFn = Fn( () => {
 
 
 					const particle = particleBufferNode.element( instanceIndex );
 					const particle = particleBufferNode.element( instanceIndex );
 					const velocity = velocityBufferNode.element( instanceIndex );
 					const velocity = velocityBufferNode.element( instanceIndex );
@@ -68,15 +68,15 @@
 
 
 					const position = particle.add( velocity ).temp();
 					const position = particle.add( velocity ).temp();
 
 
-					velocity.x = position.x.abs().greaterThanEqual( limit.x ).cond( velocity.x.negate(), velocity.x );
-					velocity.y = position.y.abs().greaterThanEqual( limit.y ).cond( velocity.y.negate(), velocity.y );
+					velocity.x = position.x.abs().greaterThanEqual( limit.x ).select( velocity.x.negate(), velocity.x );
+					velocity.y = position.y.abs().greaterThanEqual( limit.y ).select( velocity.y.negate(), velocity.y );
 
 
 					position.assign( position.min( limit ).max( limit.negate() ) );
 					position.assign( position.min( limit ).max( limit.negate() ) );
 
 
 					const pointerSize = 0.1;
 					const pointerSize = 0.1;
 					const distanceFromPointer = pointer.sub( position ).length();
 					const distanceFromPointer = pointer.sub( position ).length();
 
 
-					particle.assign( distanceFromPointer.lessThanEqual( pointerSize ).cond( vec3(), position ) );
+					particle.assign( distanceFromPointer.lessThanEqual( pointerSize ).select( vec3(), position ) );
 
 
 				} );
 				} );
 
 
@@ -85,7 +85,7 @@
 				computeNode = computeShaderFn().compute( particleNum );
 				computeNode = computeShaderFn().compute( particleNum );
 				computeNode.onInit = ( { renderer } ) => {
 				computeNode.onInit = ( { renderer } ) => {
 
 
-					const precomputeShaderNode = tslFn( () => {
+					const precomputeShaderNode = Fn( () => {
 
 
 						const particleIndex = float( instanceIndex );
 						const particleIndex = float( instanceIndex );
 
 

+ 2 - 2
examples/webgpu_compute_texture.html

@@ -24,7 +24,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { texture, textureStore, tslFn, instanceIndex, float, uvec2, vec4 } from 'three/tsl';
+			import { texture, textureStore, Fn, instanceIndex, float, uvec2, vec4 } from 'three/tsl';
 
 
 			import WebGPU from 'three/addons/capabilities/WebGPU.js';
 			import WebGPU from 'three/addons/capabilities/WebGPU.js';
 
 
@@ -58,7 +58,7 @@
 
 
 				// create function
 				// create function
 
 
-				const computeTexture = tslFn( ( { storageTexture } ) => {
+				const computeTexture = Fn( ( { storageTexture } ) => {
 
 
 					const posX = instanceIndex.remainder( width );
 					const posX = instanceIndex.remainder( width );
 					const posY = instanceIndex.div( width );
 					const posY = instanceIndex.div( width );

+ 4 - 4
examples/webgpu_materials.html

@@ -25,7 +25,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { tslFn, wgslFn, positionLocal, positionWorld, normalLocal, normalWorld, normalView, color, texture, uv, float, vec2, vec3, vec4, oscSine, triplanarTexture, viewportBottomLeft, js, string, global, loop, cameraProjectionMatrix } from 'three/tsl';
+			import { Fn, wgslFn, positionLocal, positionWorld, normalLocal, normalWorld, normalView, color, texture, uv, float, vec2, vec3, vec4, oscSine, triplanarTexture, viewportBottomLeft, js, string, global, Loop, cameraProjectionMatrix } from 'three/tsl';
 
 
 			import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js';
 			import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js';
 
 
@@ -135,7 +135,7 @@
 
 
 				// Custom ShaderNode ( desaturate filter )
 				// Custom ShaderNode ( desaturate filter )
 
 
-				const desaturateShaderNode = tslFn( ( input ) => {
+				const desaturateShaderNode = Fn( ( input ) => {
 
 
 					return vec3( 0.299, 0.587, 0.114 ).dot( input.color.xyz );
 					return vec3( 0.299, 0.587, 0.114 ).dot( input.color.xyz );
 
 
@@ -147,7 +147,7 @@
 
 
 				// Custom ShaderNode(no inputs) > Approach 2
 				// Custom ShaderNode(no inputs) > Approach 2
 
 
-				const desaturateNoInputsShaderNode = tslFn( () => {
+				const desaturateNoInputsShaderNode = Fn( () => {
 
 
 					return vec3( 0.299, 0.587, 0.114 ).dot( texture( uvTexture ).xyz );
 					return vec3( 0.299, 0.587, 0.114 ).dot( texture( uvTexture ).xyz );
 
 
@@ -215,7 +215,7 @@
 				materials.push( material );
 				materials.push( material );
 
 
 				const loopCount = 10;
 				const loopCount = 10;
-				material.colorNode = loop( loopCount, ( { i } ) => {
+				material.colorNode = Loop( loopCount, ( { i } ) => {
 
 
 					const output = vec4().temp();
 					const output = vec4().temp();
 					const scale = oscSine().mul( .09 ); // just a value to test
 					const scale = oscSine().mul( .09 ); // just a value to test

+ 2 - 2
examples/webgpu_mrt.html

@@ -26,7 +26,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { output, transformedNormalWorld, pass, step, diffuseColor, emissive, viewportTopLeft, mix, mrt, tslFn } from 'three/tsl';
+			import { output, transformedNormalWorld, pass, step, diffuseColor, emissive, viewportTopLeft, mix, mrt, Fn } from 'three/tsl';
 
 
 			import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
 			import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
 
 
@@ -101,7 +101,7 @@
 
 
 				postProcessing = new THREE.PostProcessing( renderer );
 				postProcessing = new THREE.PostProcessing( renderer );
 				postProcessing.outputColorTransform = false;
 				postProcessing.outputColorTransform = false;
-				postProcessing.outputNode = tslFn( () => {
+				postProcessing.outputNode = Fn( () => {
 
 
 					const output = scenePass.getTextureNode( 'output' ); // output name is optional here
 					const output = scenePass.getTextureNode( 'output' ); // output name is optional here
 					const normal = scenePass.getTextureNode( 'normal' );
 					const normal = scenePass.getTextureNode( 'normal' );

+ 5 - 5
examples/webgpu_shadowmap.html

@@ -24,7 +24,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { mx_fractal_noise_vec3, positionWorld, vec4, tslFn, color, vertexIndex } from 'three/tsl';
+			import { mx_fractal_noise_vec3, positionWorld, vec4, Fn, color, vertexIndex } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 
 
@@ -95,7 +95,7 @@
 			
 			
 				const discardNode = vertexIndex.hash().greaterThan( 0.5 );
 				const discardNode = vertexIndex.hash().greaterThan( 0.5 );
 
 
-				materialCustomShadow.colorNode = tslFn( () => {
+				materialCustomShadow.colorNode = Fn( () => {
 
 
 					discardNode.discard();
 					discardNode.discard();
 
 
@@ -104,7 +104,7 @@
 				} )();
 				} )();
 
 
 
 
-				materialCustomShadow.shadowNode = tslFn( () => {
+				materialCustomShadow.shadowNode = Fn( () => {
 
 
 					discardNode.discard();
 					discardNode.discard();
 
 
@@ -144,7 +144,7 @@
 					specular: 0x111111
 					specular: 0x111111
 				} );
 				} );
 
 
-				planeMaterial.shadowPositionNode = tslFn( () => {
+				planeMaterial.shadowPositionNode = Fn( () => {
 
 
 					const pos = positionWorld.toVar();
 					const pos = positionWorld.toVar();
 					pos.xz.addAssign( mx_fractal_noise_vec3( positionWorld.mul( 2 ) ).saturate().xz );
 					pos.xz.addAssign( mx_fractal_noise_vec3( positionWorld.mul( 2 ) ).saturate().xz );
@@ -153,7 +153,7 @@
 				} )();
 				} )();
 
 
 
 
-				planeMaterial.colorNode = tslFn( () => {
+				planeMaterial.colorNode = Fn( () => {
 
 
 					const pos = positionWorld.toVar();
 					const pos = positionWorld.toVar();
 					pos.xz.addAssign( mx_fractal_noise_vec3( positionWorld.mul( 2 ) ).saturate().xz );
 					pos.xz.addAssign( mx_fractal_noise_vec3( positionWorld.mul( 2 ) ).saturate().xz );

+ 2 - 2
examples/webgpu_shadowmap_opacity.html

@@ -25,7 +25,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { tslFn, vec4 } from 'three/tsl';
+			import { Fn, vec4 } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
@@ -94,7 +94,7 @@
 
 
 				// shadow node
 				// shadow node
 
 
-				const customShadow = tslFn( ( [ color, opacity = .8 ] ) => {
+				const customShadow = Fn( ( [ color, opacity = .8 ] ) => {
 
 
 					return vec4( color, opacity );
 					return vec4( color, opacity );
 
 

+ 4 - 4
examples/webgpu_storage_buffer.html

@@ -52,7 +52,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { storageObject, If, vec3, uv, uint, float, tslFn, instanceIndex } from 'three/tsl';
+			import { storageObject, If, vec3, uv, uint, float, Fn, instanceIndex } from 'three/tsl';
 
 
 			const timestamps = {
 			const timestamps = {
 				webgpu: document.getElementById( 'timestamps' ),
 				webgpu: document.getElementById( 'timestamps' ),
@@ -93,7 +93,7 @@
 
 
 				}
 				}
 
 
-				const computeInitOrder = tslFn( () => {
+				const computeInitOrder = Fn( () => {
 
 
 					for ( let i = 0; i < type.length; i ++ ) {
 					for ( let i = 0; i < type.length; i ++ ) {
 
 
@@ -103,7 +103,7 @@
 
 
 				} );
 				} );
 
 
-				const computeInvertOrder = tslFn( () => {
+				const computeInvertOrder = Fn( () => {
 
 
 					for ( let i = 0; i < type.length; i ++ ) {
 					for ( let i = 0; i < type.length; i ++ ) {
 
 
@@ -122,7 +122,7 @@
 
 
 				const material = new THREE.MeshBasicNodeMaterial( { color: 0x00ff00 } );
 				const material = new THREE.MeshBasicNodeMaterial( { color: 0x00ff00 } );
 
 
-				material.colorNode = tslFn( () => {
+				material.colorNode = Fn( () => {
 
 
 					const index = uint( uv().x.mul( size ).floor() ).toVar();
 					const index = uint( uv().x.mul( size ).floor() ).toVar();
 
 

+ 2 - 2
examples/webgpu_texturegrad.html

@@ -27,7 +27,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { If, vec4, float, timerLocal, cos, pow, vec2, uv, texture, tslFn } from 'three/tsl';
+			import { If, vec4, float, timerLocal, cos, pow, vec2, uv, texture, Fn } from 'three/tsl';
 
 
 			// WebGPU Backend
 			// WebGPU Backend
 			init();
 			init();
@@ -51,7 +51,7 @@
 				const map = await new THREE.TextureLoader().loadAsync( 'textures/uv_grid_opengl.jpg' );
 				const map = await new THREE.TextureLoader().loadAsync( 'textures/uv_grid_opengl.jpg' );
 
 
 				const elapsedTime = timerLocal();
 				const elapsedTime = timerLocal();
-				material.colorNode = tslFn( () => {
+				material.colorNode = Fn( () => {
 
 
 					const color = vec4( 1. ).toVar();
 					const color = vec4( 1. ).toVar();
 
 

+ 4 - 4
examples/webgpu_tsl_angular_slicing.html

@@ -27,7 +27,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { If, PI2, atan2, color, frontFacing, output, positionLocal, tslFn, uniform, vec4 } from 'three/tsl';
+			import { If, PI2, atan2, color, frontFacing, output, positionLocal, Fn, uniform, vec4 } from 'three/tsl';
 
 
 			import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
 			import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
@@ -77,7 +77,7 @@
 
 
 				// TSL functions
 				// TSL functions
 			
 			
-				const inAngle = tslFn( ( [ position, angleStart, angleArc ] ) => {
+				const inAngle = Fn( ( [ position, angleStart, angleArc ] ) => {
 
 
 					const angle = atan2( position.y, position.x ).sub( angleStart ).mod( PI2 ).toVar();
 					const angle = atan2( position.y, position.x ).sub( angleStart ).mod( PI2 ).toVar();
 					return angle.greaterThan( 0 ).and( angle.lessThan( angleArc ) );
 					return angle.greaterThan( 0 ).and( angle.lessThan( angleArc ) );
@@ -115,7 +115,7 @@
 
 
 				// output
 				// output
 
 
-				slicedMaterial.outputNode = tslFn( () => {
+				slicedMaterial.outputNode = Fn( () => {
 
 
 					// discard
 					// discard
 
 
@@ -136,7 +136,7 @@
 
 
 				// shadow
 				// shadow
 
 
-				slicedMaterial.shadowNode = tslFn( () => {
+				slicedMaterial.shadowNode = Fn( () => {
 
 
 					// discard
 					// discard
 
 

+ 3 - 3
examples/webgpu_tsl_coffee_smoke.html

@@ -29,7 +29,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { mix, mul, positionLocal, smoothstep, texture, timerLocal, tslFn, uv, vec2, vec3, vec4 } from 'three/tsl';
+			import { mix, mul, positionLocal, smoothstep, texture, timerLocal, Fn, uv, vec2, vec3, vec4 } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
@@ -81,7 +81,7 @@
 
 
 				// position
 				// position
 
 
-				smokeMaterial.positionNode = tslFn( () => {
+				smokeMaterial.positionNode = Fn( () => {
 
 
 					// twist
 					// twist
 
 
@@ -103,7 +103,7 @@
 
 
 				// color
 				// color
 
 
-				smokeMaterial.colorNode = tslFn( () => {
+				smokeMaterial.colorNode = Fn( () => {
 
 
 					// alpha
 					// alpha
 
 

+ 6 - 6
examples/webgpu_tsl_compute_attractors_particles.html

@@ -25,7 +25,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { float, If, PI, color, cos, instanceIndex, loop, mix, mod, sin, storage, tslFn, uint, uniform, uniformArray, vec3, vec4 } from 'three/tsl';
+			import { float, If, PI, color, cos, instanceIndex, Loop, mix, mod, sin, storage, Fn, uint, uniform, uniformArray, vec3, vec4 } from 'three/tsl';
 
 
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
@@ -157,7 +157,7 @@
 				const positionBuffer = storage( new THREE.StorageInstancedBufferAttribute( count, 3 ), 'vec3', count );
 				const positionBuffer = storage( new THREE.StorageInstancedBufferAttribute( count, 3 ), 'vec3', count );
 				const velocityBuffer = storage( new THREE.StorageInstancedBufferAttribute( count, 3 ), 'vec3', count );
 				const velocityBuffer = storage( new THREE.StorageInstancedBufferAttribute( count, 3 ), 'vec3', count );
 
 
-				const sphericalToVec3 = tslFn( ( [ phi, theta ] ) => {
+				const sphericalToVec3 = Fn( ( [ phi, theta ] ) => {
 
 
 					const sinPhiRadius = sin( phi );
 					const sinPhiRadius = sin( phi );
 
 
@@ -171,7 +171,7 @@
 
 
 				// init compute
 				// init compute
 
 
-				const init = tslFn( () => {
+				const init = Fn( () => {
 
 
 					const position = positionBuffer.element( instanceIndex );
 					const position = positionBuffer.element( instanceIndex );
 					const velocity = velocityBuffer.element( instanceIndex );
 					const velocity = velocityBuffer.element( instanceIndex );
@@ -205,7 +205,7 @@
 				const particleMassMultiplier = instanceIndex.add( uint( Math.random() * 0xffffff ) ).hash().remap( 0.25, 1 ).toVar();
 				const particleMassMultiplier = instanceIndex.add( uint( Math.random() * 0xffffff ) ).hash().remap( 0.25, 1 ).toVar();
 				const particleMass = particleMassMultiplier.mul( particleGlobalMass ).toVar();
 				const particleMass = particleMassMultiplier.mul( particleGlobalMass ).toVar();
 
 
-				const update = tslFn( () => {
+				const update = Fn( () => {
 
 
 					// const delta = timerDelta().mul( timeScale ).min( 1 / 30 ).toVar();
 					// const delta = timerDelta().mul( timeScale ).min( 1 / 30 ).toVar();
 					const delta = float( 1 / 60 ).mul( timeScale ).toVar(); // uses fixed delta to consistant result
 					const delta = float( 1 / 60 ).mul( timeScale ).toVar(); // uses fixed delta to consistant result
@@ -216,7 +216,7 @@
 
 
 					const force = vec3( 0 ).toVar();
 					const force = vec3( 0 ).toVar();
 
 
-					loop( attractorsLength, ( { i } ) => {
+					Loop( attractorsLength, ( { i } ) => {
 
 
 						const attractorPosition = attractorsPositions.element( i );
 						const attractorPosition = attractorsPositions.element( i );
 						const attractorRotationAxis = attractorsRotationAxes.element( i );
 						const attractorRotationAxis = attractorsRotationAxes.element( i );
@@ -263,7 +263,7 @@
 
 
 				material.positionNode = positionBuffer.toAttribute();
 				material.positionNode = positionBuffer.toAttribute();
 
 
-				material.colorNode = tslFn( () => {
+				material.colorNode = Fn( () => {
 
 
 					const velocity = velocityBuffer.toAttribute();
 					const velocity = velocityBuffer.toAttribute();
 					const speed = velocity.length();
 					const speed = velocity.length();

+ 3 - 3
examples/webgpu_tsl_halftone.html

@@ -25,7 +25,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { color, mix, normalWorld, output, tslFn, uniform, vec4, viewportCoordinate, viewportResolution } from 'three/tsl';
+			import { color, mix, normalWorld, output, Fn, uniform, vec4, viewportCoordinate, viewportResolution } from 'three/tsl';
 
 
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
@@ -129,7 +129,7 @@
 
 
 				// halftone functions
 				// halftone functions
 
 
-				const halftone = tslFn( ( [ count, color, direction, start, end, radius, mixLow, mixHigh ] ) => {
+				const halftone = Fn( ( [ count, color, direction, start, end, radius, mixLow, mixHigh ] ) => {
 
 
 					// grid pattern
 					// grid pattern
 
 
@@ -157,7 +157,7 @@
 			
 			
 				} );
 				} );
 
 
-				const halftones = tslFn( ( [ input ] ) => {
+				const halftones = Fn( ( [ input ] ) => {
 
 
 					const halftonesOutput = input;
 					const halftonesOutput = input;
 
 

+ 3 - 3
examples/webgpu_tsl_interoperability.html

@@ -28,7 +28,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { tslFn, attribute, varyingProperty, timerLocal, uniform, wgslFn, texture, sampler, uv, clamp, float, vec2, vec3, fract, floor, positionGeometry, sin } from 'three/tsl';
+			import { Fn, attribute, varyingProperty, timerLocal, uniform, wgslFn, texture, sampler, uv, clamp, float, vec2, vec3, fract, floor, positionGeometry, sin } from 'three/tsl';
 
 
 			import WebGPU from 'three/addons/capabilities/WebGPU.js';
 			import WebGPU from 'three/addons/capabilities/WebGPU.js';
 
 
@@ -191,14 +191,14 @@
 
 
 				//
 				//
 
 
-				const tslVertexShader = tslFn( () => {
+				const tslVertexShader = Fn( () => {
 
 
 					vUv.assign( uv() );
 					vUv.assign( uv() );
 					return positionGeometry;
 					return positionGeometry;
 
 
 				} );
 				} );
 
 
-				const tslFragmentShader = tslFn( () => {
+				const tslFragmentShader = Fn( () => {
 
 
 					const dimensions = vec2( crtWidthUniform, crtHeightUniform );
 					const dimensions = vec2( crtWidthUniform, crtHeightUniform );
 					const translatedUV = vUv.mul( 0.5 ).add( 0.5 );
 					const translatedUV = vUv.mul( 0.5 ).add( 0.5 );

+ 5 - 5
examples/webgpu_tsl_procedural_terrain.html

@@ -27,7 +27,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { mx_noise_float, color, cross, dot, float, modelNormalMatrix, positionLocal, sign, step, tslFn, uniform, varying, vec2, vec3, loop } from 'three/tsl';
+			import { mx_noise_float, color, cross, dot, float, modelNormalMatrix, positionLocal, sign, step, Fn, uniform, varying, vec2, vec3, Loop } from 'three/tsl';
 
 
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
@@ -99,13 +99,13 @@
 				const vNormal = varying( vec3() );
 				const vNormal = varying( vec3() );
 				const vPosition = varying( vec3() );
 				const vPosition = varying( vec3() );
 
 
-				const terrainElevation = tslFn( ( [ position ] ) => {
+				const terrainElevation = Fn( ( [ position ] ) => {
 
 
 					const warpedPosition = position.add( offset ).toVar();
 					const warpedPosition = position.add( offset ).toVar();
 					warpedPosition.addAssign( mx_noise_float( warpedPosition.mul( positionFrequency ).mul( warpFrequency ), 1, 0 ).mul( warpStrength ) );
 					warpedPosition.addAssign( mx_noise_float( warpedPosition.mul( positionFrequency ).mul( warpFrequency ), 1, 0 ).mul( warpStrength ) );
 			
 			
 					const elevation = float( 0 ).toVar();
 					const elevation = float( 0 ).toVar();
-					loop( { type: 'float', start: float( 1 ), end: noiseIterations.toFloat(), condition: '<=' }, ( { i } ) => {
+					Loop( { type: 'float', start: float( 1 ), end: noiseIterations.toFloat(), condition: '<=' }, ( { i } ) => {
 
 
 						const noiseInput = warpedPosition.mul( positionFrequency ).mul( i.mul( 2 ) ).add( i.mul( 987 ) );
 						const noiseInput = warpedPosition.mul( positionFrequency ).mul( i.mul( 2 ) ).add( i.mul( 987 ) );
 						const noise = mx_noise_float( noiseInput, 1, 0 ).div( i.add( 1 ).mul( 2 ) );
 						const noise = mx_noise_float( noiseInput, 1, 0 ).div( i.add( 1 ).mul( 2 ) );
@@ -120,7 +120,7 @@
 			
 			
 				} );
 				} );
 
 
-				material.positionNode = tslFn( () => {
+				material.positionNode = Fn( () => {
 
 
 					// neighbours positions
 					// neighbours positions
 
 
@@ -152,7 +152,7 @@
 
 
 				material.normalNode = modelNormalMatrix.mul( vNormal );
 				material.normalNode = modelNormalMatrix.mul( vNormal );
 
 
-				material.colorNode = tslFn( () => {
+				material.colorNode = Fn( () => {
 
 
 					const finalColor = colorSand.toVar();
 					const finalColor = colorSand.toVar();
 
 

+ 3 - 3
examples/webgpu_tsl_raging_sea.html

@@ -27,7 +27,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { float, mx_noise_float, loop, color, positionLocal, sin, vec2, vec3, mul, timerLocal, uniform, tslFn, modelNormalMatrix } from 'three/tsl';
+			import { float, mx_noise_float, Loop, color, positionLocal, sin, vec2, vec3, mul, timerLocal, uniform, Fn, modelNormalMatrix } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
@@ -68,7 +68,7 @@
 
 
 				// TSL functions
 				// TSL functions
 
 
-				const wavesElevation = tslFn( ( [ position ] ) => {
+				const wavesElevation = Fn( ( [ position ] ) => {
 
 
 					const time = timerLocal();
 					const time = timerLocal();
 
 
@@ -80,7 +80,7 @@
 						largeWavesMultiplier
 						largeWavesMultiplier
 					).toVar();
 					).toVar();
 
 
-					loop( { start: float( 1 ), end: smallWavesIterations.add( 1 ) }, ( { i } ) => {
+					Loop( { start: float( 1 ), end: smallWavesIterations.add( 1 ) }, ( { i } ) => {
 
 
 						const noiseInput = vec3(
 						const noiseInput = vec3(
 							position.xz
 							position.xz

+ 3 - 3
examples/webgpu_tsl_vfx_flames.html

@@ -27,7 +27,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { PI2, spherizeUV, sin, step, texture, timerLocal, tslFn, uv, vec2, vec3, vec4, mix, billboarding } from 'three/tsl';
+			import { PI2, spherizeUV, sin, step, texture, timerLocal, Fn, uv, vec2, vec3, vec4, mix, billboarding } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 
 
@@ -94,7 +94,7 @@
 
 
 				const flame1Material = new THREE.SpriteNodeMaterial( { transparent: true, side: THREE.DoubleSide } );
 				const flame1Material = new THREE.SpriteNodeMaterial( { transparent: true, side: THREE.DoubleSide } );
 
 
-				flame1Material.colorNode = tslFn( () => {
+				flame1Material.colorNode = Fn( () => {
 
 
 					const time = timerLocal();
 					const time = timerLocal();
 
 
@@ -132,7 +132,7 @@
 
 
 				const flame2Material = new THREE.SpriteNodeMaterial( { transparent: true, side: THREE.DoubleSide } );
 				const flame2Material = new THREE.SpriteNodeMaterial( { transparent: true, side: THREE.DoubleSide } );
 
 
-				flame2Material.colorNode = tslFn( () => {
+				flame2Material.colorNode = Fn( () => {
 
 
 					const time = timerLocal();
 					const time = timerLocal();
 
 

+ 7 - 7
examples/webgpu_tsl_vfx_tornado.html

@@ -27,7 +27,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { luminance, cos, float, min, timerLocal, atan2, uniform, pass, bloom, PI, PI2, color, positionLocal, sin, texture, tslFn, uv, vec2, vec3, vec4 } from 'three/tsl';
+			import { luminance, cos, float, min, timerLocal, atan2, uniform, pass, bloom, PI, PI2, color, positionLocal, sin, texture, Fn, uv, vec2, vec3, vec4 } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
@@ -52,7 +52,7 @@
 
 
 				// TSL functions
 				// TSL functions
 
 
-				const toRadialUv = tslFn( ( [ uv, multiplier, rotation, offset ] ) => {
+				const toRadialUv = Fn( ( [ uv, multiplier, rotation, offset ] ) => {
 
 
 					const centeredUv = uv.sub( 0.5 ).toVar();
 					const centeredUv = uv.sub( 0.5 ).toVar();
 					const distanceToCenter = centeredUv.length();
 					const distanceToCenter = centeredUv.length();
@@ -66,7 +66,7 @@
 
 
 				} );
 				} );
 
 
-				const toSkewedUv = tslFn( ( [ uv, skew ] ) => {
+				const toSkewedUv = Fn( ( [ uv, skew ] ) => {
 
 
 					return vec2(
 					return vec2(
 						uv.x.add( uv.y.mul( skew.x ) ),
 						uv.x.add( uv.y.mul( skew.x ) ),
@@ -75,7 +75,7 @@
 
 
 				} );
 				} );
 
 
-				const twistedCylinder = tslFn( ( [ position, parabolStrength, parabolOffset, parabolAmplitude, time ] ) => {
+				const twistedCylinder = Fn( ( [ position, parabolStrength, parabolOffset, parabolAmplitude, time ] ) => {
 
 
 					const angle = atan2( position.z, position.x ).toVar();
 					const angle = atan2( position.z, position.x ).toVar();
 					const elevation = position.y;
 					const elevation = position.y;
@@ -108,7 +108,7 @@
 
 
 				const floorMaterial = new THREE.MeshBasicNodeMaterial( { transparent: true, wireframe: false } );
 				const floorMaterial = new THREE.MeshBasicNodeMaterial( { transparent: true, wireframe: false } );
 
 
-				floorMaterial.outputNode = tslFn( () => {
+				floorMaterial.outputNode = Fn( () => {
 
 
 					const time = timerLocal().mul( timeScale );
 					const time = timerLocal().mul( timeScale );
 
 
@@ -173,7 +173,7 @@
 
 
 				emissiveMaterial.positionNode = twistedCylinder( positionLocal, parabolStrength, parabolOffset, parabolAmplitude.sub( 0.05 ), timerLocal().mul( timeScale ) );
 				emissiveMaterial.positionNode = twistedCylinder( positionLocal, parabolStrength, parabolOffset, parabolAmplitude.sub( 0.05 ), timerLocal().mul( timeScale ) );
 
 
-				emissiveMaterial.outputNode = tslFn( () => {
+				emissiveMaterial.outputNode = Fn( () => {
 
 
 					const time = timerLocal().mul( timeScale );
 					const time = timerLocal().mul( timeScale );
 
 
@@ -224,7 +224,7 @@
 
 
 				darkMaterial.positionNode = twistedCylinder( positionLocal, parabolStrength, parabolOffset, parabolAmplitude, timerLocal().mul( timeScale ) );
 				darkMaterial.positionNode = twistedCylinder( positionLocal, parabolStrength, parabolOffset, parabolAmplitude, timerLocal().mul( timeScale ) );
 
 
-				darkMaterial.outputNode = tslFn( () => {
+				darkMaterial.outputNode = Fn( () => {
 
 
 					const time = timerLocal().mul( timeScale ).add( 123.4 );
 					const time = timerLocal().mul( timeScale ).add( 123.4 );
 
 

+ 2 - 2
examples/webgpu_volume_cloud.html

@@ -25,7 +25,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { vec3, materialReference, smoothstep, If, Break, tslFn } from 'three/tsl';
+			import { vec3, materialReference, smoothstep, If, Break, Fn } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js';
 			import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js';
@@ -127,7 +127,7 @@
 				const threshold = materialReference( 'threshold', 'float' );
 				const threshold = materialReference( 'threshold', 'float' );
 				const opacity = materialReference( 'opacity', 'float' );
 				const opacity = materialReference( 'opacity', 'float' );
 
 
-				material.testNode = tslFn( ( { map, mapValue, probe, finalColor } ) => {
+				material.testNode = Fn( ( { map, mapValue, probe, finalColor } ) => {
 
 
 					mapValue.assign( smoothstep( threshold.sub( range ), threshold.add( range ), mapValue ).mul( opacity ) );
 					mapValue.assign( smoothstep( threshold.sub( range ), threshold.add( range ), mapValue ).mul( opacity ) );
 
 

+ 2 - 2
examples/webgpu_volume_perlin.html

@@ -24,7 +24,7 @@
 
 
 		<script type="module">
 		<script type="module">
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { Break, If, vec3, materialReference, tslFn } from 'three/tsl';
+			import { Break, If, vec3, materialReference, Fn } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js';
 			import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js';
@@ -99,7 +99,7 @@
 
 
 				const threshold = materialReference( 'threshold', 'float' );
 				const threshold = materialReference( 'threshold', 'float' );
 
 
-				material.testNode = tslFn( ( { map, mapValue, probe, finalColor } ) => {
+				material.testNode = Fn( ( { map, mapValue, probe, finalColor } ) => {
 
 
 					If( mapValue.greaterThan( threshold ), () => {
 					If( mapValue.greaterThan( threshold ), () => {
 
 

+ 2 - 2
src/nodes/Nodes.js

@@ -42,7 +42,7 @@ export { NodeUtils };
 export { default as MathNode, PI, PI2, EPSILON, INFINITY, radians, degrees, exp, exp2, log, log2, sqrt, inverseSqrt, floor, ceil, normalize, fract, sin, cos, tan, asin, acos, atan, abs, sign, length, lengthSq, negate, oneMinus, dFdx, dFdy, round, reciprocal, trunc, fwidth, bitcast, atan2, min, max, mod, step, reflect, distance, difference, dot, cross, pow, pow2, pow3, pow4, transformDirection, mix, clamp, saturate, refract, smoothstep, faceForward, cbrt, transpose, all, any, equals, rand } from './math/MathNode.js';
 export { default as MathNode, PI, PI2, EPSILON, INFINITY, radians, degrees, exp, exp2, log, log2, sqrt, inverseSqrt, floor, ceil, normalize, fract, sin, cos, tan, asin, acos, atan, abs, sign, length, lengthSq, negate, oneMinus, dFdx, dFdy, round, reciprocal, trunc, fwidth, bitcast, atan2, min, max, mod, step, reflect, distance, difference, dot, cross, pow, pow2, pow3, pow4, transformDirection, mix, clamp, saturate, refract, smoothstep, faceForward, cbrt, transpose, all, any, equals, rand } from './math/MathNode.js';
 
 
 export { default as OperatorNode, add, sub, mul, div, remainder, equal, lessThan, greaterThan, lessThanEqual, greaterThanEqual, and, or, not, xor, bitAnd, bitNot, bitOr, bitXor, shiftLeft, shiftRight } from './math/OperatorNode.js';
 export { default as OperatorNode, add, sub, mul, div, remainder, equal, lessThan, greaterThan, lessThanEqual, greaterThanEqual, and, or, not, xor, bitAnd, bitNot, bitOr, bitXor, shiftLeft, shiftRight } from './math/OperatorNode.js';
-export { default as CondNode, cond } from './math/CondNode.js';
+export { default as CondNode, select, cond } from './math/CondNode.js';
 export { default as HashNode, hash } from './math/HashNode.js';
 export { default as HashNode, hash } from './math/HashNode.js';
 
 
 // math utils
 // math utils
@@ -56,7 +56,7 @@ export { default as DiscardNode, discard, Return } from './utils/DiscardNode.js'
 export { default as EquirectUVNode, equirectUV } from './utils/EquirectUVNode.js';
 export { default as EquirectUVNode, equirectUV } from './utils/EquirectUVNode.js';
 export { default as FunctionOverloadingNode, overloadingFn } from './utils/FunctionOverloadingNode.js';
 export { default as FunctionOverloadingNode, overloadingFn } from './utils/FunctionOverloadingNode.js';
 export { default as JoinNode } from './utils/JoinNode.js';
 export { default as JoinNode } from './utils/JoinNode.js';
-export { default as LoopNode, loop, Continue, Break } from './utils/LoopNode.js';
+export { default as LoopNode, Loop, Continue, Break } from './utils/LoopNode.js';
 export { default as MatcapUVNode, matcapUV } from './utils/MatcapUVNode.js';
 export { default as MatcapUVNode, matcapUV } from './utils/MatcapUVNode.js';
 export { default as MaxMipLevelNode, maxMipLevel } from './utils/MaxMipLevelNode.js';
 export { default as MaxMipLevelNode, maxMipLevel } from './utils/MaxMipLevelNode.js';
 export { default as OscNode, oscSine, oscSquare, oscTriangle, oscSawtooth } from './utils/OscNode.js';
 export { default as OscNode, oscSine, oscSquare, oscTriangle, oscSawtooth } from './utils/OscNode.js';

+ 2 - 2
src/nodes/accessors/BatchNode.js

@@ -1,7 +1,7 @@
 import Node, { addNodeClass } from '../core/Node.js';
 import Node, { addNodeClass } from '../core/Node.js';
 import { normalLocal } from './NormalNode.js';
 import { normalLocal } from './NormalNode.js';
 import { positionLocal } from './PositionNode.js';
 import { positionLocal } from './PositionNode.js';
-import { nodeProxy, vec3, mat3, mat4, int, ivec2, float, tslFn } from '../shadernode/ShaderNode.js';
+import { nodeProxy, vec3, mat3, mat4, int, ivec2, float, Fn } from '../shadernode/ShaderNode.js';
 import { textureLoad } from './TextureNode.js';
 import { textureLoad } from './TextureNode.js';
 import { textureSize } from './TextureSizeNode.js';
 import { textureSize } from './TextureSizeNode.js';
 import { tangentLocal } from './TangentNode.js';
 import { tangentLocal } from './TangentNode.js';
@@ -40,7 +40,7 @@ class BatchNode extends Node {
 
 
 		}
 		}
 
 
-		const getIndirectIndex = tslFn( ( [ id ] ) => {
+		const getIndirectIndex = Fn( ( [ id ] ) => {
 
 
 			const size = textureSize( textureLoad( this.batchMesh._indirectTexture ), 0 );
 			const size = textureSize( textureLoad( this.batchMesh._indirectTexture ), 0 );
 			const x = int( id ).remainder( int( size ) );
 			const x = int( id ).remainder( int( size ) );

+ 8 - 8
src/nodes/accessors/ClippingNode.js

@@ -3,8 +3,8 @@ import Node from '../core/Node.js';
 import { nodeObject } from '../shadernode/ShaderNode.js';
 import { nodeObject } from '../shadernode/ShaderNode.js';
 import { positionView } from './PositionNode.js';
 import { positionView } from './PositionNode.js';
 import { diffuseColor, property } from '../core/PropertyNode.js';
 import { diffuseColor, property } from '../core/PropertyNode.js';
-import { tslFn } from '../shadernode/ShaderNode.js';
-import { loop } from '../utils/LoopNode.js';
+import { Fn } from '../shadernode/ShaderNode.js';
+import { Loop } from '../utils/LoopNode.js';
 import { smoothstep } from '../math/MathNode.js';
 import { smoothstep } from '../math/MathNode.js';
 import { uniformArray } from './UniformArrayNode.js';
 import { uniformArray } from './UniformArrayNode.js';
 
 
@@ -42,7 +42,7 @@ class ClippingNode extends Node {
 
 
 	setupAlphaToCoverage( planes, numClippingPlanes, numUnionClippingPlanes ) {
 	setupAlphaToCoverage( planes, numClippingPlanes, numUnionClippingPlanes ) {
 
 
-		return tslFn( () => {
+		return Fn( () => {
 
 
 			const clippingPlanes = uniformArray( planes );
 			const clippingPlanes = uniformArray( planes );
 
 
@@ -55,7 +55,7 @@ class ClippingNode extends Node {
 
 
 			let plane;
 			let plane;
 
 
-			loop( numUnionClippingPlanes, ( { i } ) => {
+			Loop( numUnionClippingPlanes, ( { i } ) => {
 
 
 				plane = clippingPlanes.element( i );
 				plane = clippingPlanes.element( i );
 
 
@@ -74,7 +74,7 @@ class ClippingNode extends Node {
 
 
 				unionClipOpacity.assign( 1 );
 				unionClipOpacity.assign( 1 );
 
 
-				loop( { start: numUnionClippingPlanes, end: numClippingPlanes }, ( { i } ) => {
+				Loop( { start: numUnionClippingPlanes, end: numClippingPlanes }, ( { i } ) => {
 
 
 					plane = clippingPlanes.element( i );
 					plane = clippingPlanes.element( i );
 
 
@@ -99,13 +99,13 @@ class ClippingNode extends Node {
 
 
 	setupDefault( planes, numClippingPlanes, numUnionClippingPlanes ) {
 	setupDefault( planes, numClippingPlanes, numUnionClippingPlanes ) {
 
 
-		return tslFn( () => {
+		return Fn( () => {
 
 
 			const clippingPlanes = uniformArray( planes );
 			const clippingPlanes = uniformArray( planes );
 
 
 			let plane;
 			let plane;
 
 
-			loop( numUnionClippingPlanes, ( { i } ) => {
+			Loop( numUnionClippingPlanes, ( { i } ) => {
 
 
 				plane = clippingPlanes.element( i );
 				plane = clippingPlanes.element( i );
 				positionView.dot( plane.xyz ).greaterThan( plane.w ).discard();
 				positionView.dot( plane.xyz ).greaterThan( plane.w ).discard();
@@ -118,7 +118,7 @@ class ClippingNode extends Node {
 
 
 				clipped.assign( true );
 				clipped.assign( true );
 
 
-				loop( { start: numUnionClippingPlanes, end: numClippingPlanes }, ( { i } ) => {
+				Loop( { start: numUnionClippingPlanes, end: numClippingPlanes }, ( { i } ) => {
 
 
 					plane = clippingPlanes.element( i );
 					plane = clippingPlanes.element( i );
 					clipped.assign( positionView.dot( plane.xyz ).greaterThan( plane.w ).and( clipped ) );
 					clipped.assign( positionView.dot( plane.xyz ).greaterThan( plane.w ).and( clipped ) );

+ 4 - 4
src/nodes/accessors/MorphNode.js

@@ -1,6 +1,6 @@
 import Node, { addNodeClass } from '../core/Node.js';
 import Node, { addNodeClass } from '../core/Node.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
-import { float, nodeProxy, tslFn } from '../shadernode/ShaderNode.js';
+import { float, nodeProxy, Fn } from '../shadernode/ShaderNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { reference } from './ReferenceNode.js';
 import { reference } from './ReferenceNode.js';
 import { positionLocal } from './PositionNode.js';
 import { positionLocal } from './PositionNode.js';
@@ -8,7 +8,7 @@ import { normalLocal } from './NormalNode.js';
 import { textureLoad } from './TextureNode.js';
 import { textureLoad } from './TextureNode.js';
 import { instanceIndex, vertexIndex } from '../core/IndexNode.js';
 import { instanceIndex, vertexIndex } from '../core/IndexNode.js';
 import { ivec2, int } from '../shadernode/ShaderNode.js';
 import { ivec2, int } from '../shadernode/ShaderNode.js';
-import { loop } from '../utils/LoopNode.js';
+import { Loop } from '../utils/LoopNode.js';
 
 
 import { DataArrayTexture } from '../../textures/DataArrayTexture.js';
 import { DataArrayTexture } from '../../textures/DataArrayTexture.js';
 import { Vector2 } from '../../math/Vector2.js';
 import { Vector2 } from '../../math/Vector2.js';
@@ -18,7 +18,7 @@ import { FloatType } from '../../constants.js';
 const _morphTextures = new WeakMap();
 const _morphTextures = new WeakMap();
 const _morphVec4 = /*@__PURE__*/ new Vector4();
 const _morphVec4 = /*@__PURE__*/ new Vector4();
 
 
-const getMorph = tslFn( ( { bufferMap, influence, stride, width, depth, offset } ) => {
+const getMorph = Fn( ( { bufferMap, influence, stride, width, depth, offset } ) => {
 
 
 	const texelIndex = int( vertexIndex ).mul( stride ).add( offset );
 	const texelIndex = int( vertexIndex ).mul( stride ).add( offset );
 
 
@@ -190,7 +190,7 @@ class MorphNode extends Node {
 
 
 		const width = int( size.width );
 		const width = int( size.width );
 
 
-		loop( morphTargetsCount, ( { i } ) => {
+		Loop( morphTargetsCount, ( { i } ) => {
 
 
 			const influence = float( 0 ).toVar();
 			const influence = float( 0 ).toVar();
 
 

+ 2 - 2
src/nodes/accessors/TangentNode.js

@@ -2,9 +2,9 @@ import { attribute } from '../core/AttributeNode.js';
 import { varying } from '../core/VaryingNode.js';
 import { varying } from '../core/VaryingNode.js';
 import { cameraViewMatrix } from './CameraNode.js';
 import { cameraViewMatrix } from './CameraNode.js';
 import { modelViewMatrix } from './ModelNode.js';
 import { modelViewMatrix } from './ModelNode.js';
-import { tslFn, vec4 } from '../shadernode/ShaderNode.js';
+import { Fn, vec4 } from '../shadernode/ShaderNode.js';
 
 
-export const tangentGeometry = /*#__PURE__*/ tslFn( ( stack, builder ) => {
+export const tangentGeometry = /*#__PURE__*/ Fn( ( stack, builder ) => {
 
 
 	if ( builder.geometry.hasAttribute( 'tangent' ) === false ) {
 	if ( builder.geometry.hasAttribute( 'tangent' ) === false ) {
 
 

+ 8 - 8
src/nodes/accessors/Texture3DNode.js

@@ -1,8 +1,8 @@
 import TextureNode from './TextureNode.js';
 import TextureNode from './TextureNode.js';
 import { addNodeClass } from '../core/Node.js';
 import { addNodeClass } from '../core/Node.js';
-import { nodeProxy, vec3, tslFn, If } from '../shadernode/ShaderNode.js';
+import { nodeProxy, vec3, Fn, If } from '../shadernode/ShaderNode.js';
 
 
-const normal = tslFn( ( { texture, uv } ) => {
+const normal = Fn( ( { texture, uv } ) => {
 
 
 	const epsilon = 0.0001;
 	const epsilon = 0.0001;
 
 
@@ -12,27 +12,27 @@ const normal = tslFn( ( { texture, uv } ) => {
 
 
 		ret.assign( vec3( 1, 0, 0 ) );
 		ret.assign( vec3( 1, 0, 0 ) );
 
 
-	} ).elseif( uv.y.lessThan( epsilon ), () => {
+	} ).ElseIf( uv.y.lessThan( epsilon ), () => {
 
 
 		ret.assign( vec3( 0, 1, 0 ) );
 		ret.assign( vec3( 0, 1, 0 ) );
 
 
-	} ).elseif( uv.z.lessThan( epsilon ), () => {
+	} ).ElseIf( uv.z.lessThan( epsilon ), () => {
 
 
 		ret.assign( vec3( 0, 0, 1 ) );
 		ret.assign( vec3( 0, 0, 1 ) );
 
 
-	} ).elseif( uv.x.greaterThan( 1 - epsilon ), () => {
+	} ).ElseIf( uv.x.greaterThan( 1 - epsilon ), () => {
 
 
 		ret.assign( vec3( - 1, 0, 0 ) );
 		ret.assign( vec3( - 1, 0, 0 ) );
 
 
-	} ).elseif( uv.y.greaterThan( 1 - epsilon ), () => {
+	} ).ElseIf( uv.y.greaterThan( 1 - epsilon ), () => {
 
 
 		ret.assign( vec3( 0, - 1, 0 ) );
 		ret.assign( vec3( 0, - 1, 0 ) );
 
 
-	} ).elseif( uv.z.greaterThan( 1 - epsilon ), () => {
+	} ).ElseIf( uv.z.greaterThan( 1 - epsilon ), () => {
 
 
 		ret.assign( vec3( 0, 0, - 1 ) );
 		ret.assign( vec3( 0, 0, - 1 ) );
 
 
-	} ).else( () => {
+	} ).Else( () => {
 
 
 		const step = 0.01;
 		const step = 0.01;
 
 

+ 5 - 3
src/nodes/accessors/UniformArrayNode.js

@@ -143,11 +143,13 @@ export default UniformArrayNode;
 
 
 export const uniformArray = ( values, nodeType ) => nodeObject( new UniformArrayNode( values, nodeType ) );
 export const uniformArray = ( values, nodeType ) => nodeObject( new UniformArrayNode( values, nodeType ) );
 
 
+addNodeClass( 'UniformArrayNode', UniformArrayNode );
+
+//
+
 export const uniforms = ( values, nodeType ) => { // @deprecated, r168
 export const uniforms = ( values, nodeType ) => { // @deprecated, r168
 
 
-	console.warn( 'THREE.UniformArrayNode: uniforms() has been renamed to uniformArray().' );
+	console.warn( 'TSL.UniformArrayNode: uniforms() has been renamed to uniformArray().' );
 	return nodeObject( new UniformArrayNode( values, nodeType ) );
 	return nodeObject( new UniformArrayNode( values, nodeType ) );
 
 
 };
 };
-
-addNodeClass( 'UniformArrayNode', UniformArrayNode );

+ 22 - 6
src/nodes/core/StackNode.js

@@ -1,5 +1,5 @@
 import Node, { addNodeClass } from './Node.js';
 import Node, { addNodeClass } from './Node.js';
-import { cond } from '../math/CondNode.js';
+import { select } from '../math/CondNode.js';
 import { ShaderNode, nodeProxy, getCurrentStack, setCurrentStack } from '../shadernode/ShaderNode.js';
 import { ShaderNode, nodeProxy, getCurrentStack, setCurrentStack } from '../shadernode/ShaderNode.js';
 
 
 class StackNode extends Node {
 class StackNode extends Node {
@@ -33,19 +33,19 @@ class StackNode extends Node {
 
 
 	}
 	}
 
 
-	if( boolNode, method ) {
+	If( boolNode, method ) {
 
 
 		const methodNode = new ShaderNode( method );
 		const methodNode = new ShaderNode( method );
-		this._currentCond = cond( boolNode, methodNode );
+		this._currentCond = select( boolNode, methodNode );
 
 
 		return this.add( this._currentCond );
 		return this.add( this._currentCond );
 
 
 	}
 	}
 
 
-	elseif( boolNode, method ) {
+	ElseIf( boolNode, method ) {
 
 
 		const methodNode = new ShaderNode( method );
 		const methodNode = new ShaderNode( method );
-		const ifNode = cond( boolNode, methodNode );
+		const ifNode = select( boolNode, methodNode );
 
 
 		this._currentCond.elseNode = ifNode;
 		this._currentCond.elseNode = ifNode;
 		this._currentCond = ifNode;
 		this._currentCond = ifNode;
@@ -54,7 +54,7 @@ class StackNode extends Node {
 
 
 	}
 	}
 
 
-	else( method ) {
+	Else( method ) {
 
 
 		this._currentCond.elseNode = new ShaderNode( method );
 		this._currentCond.elseNode = new ShaderNode( method );
 
 
@@ -80,6 +80,22 @@ class StackNode extends Node {
 
 
 	}
 	}
 
 
+	//
+
+	else( ...params ) { // @deprecated, r168
+
+		console.warn( 'TSL.StackNode: .else() has been renamed to .Else().' );
+		return this.Else( ...params );
+
+	}
+
+	elseif( ...params ) { // @deprecated, r168
+
+		console.warn( 'TSL.StackNode: .elseif() has been renamed to .ElseIf().' );
+		return this.ElseIf( ...params );
+
+	}
+
 }
 }
 
 
 export default StackNode;
 export default StackNode;

+ 3 - 3
src/nodes/display/AfterImageNode.js

@@ -1,5 +1,5 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
-import { nodeObject, addNodeElement, tslFn, float, vec4 } from '../shadernode/ShaderNode.js';
+import { nodeObject, addNodeElement, Fn, float, vec4 } from '../shadernode/ShaderNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { texture } from '../accessors/TextureNode.js';
 import { texture } from '../accessors/TextureNode.js';
@@ -98,7 +98,7 @@ class AfterImageNode extends TempNode {
 
 
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 
 
-		const when_gt = tslFn( ( [ x_immutable, y_immutable ] ) => {
+		const when_gt = Fn( ( [ x_immutable, y_immutable ] ) => {
 
 
 			const y = float( y_immutable ).toVar();
 			const y = float( y_immutable ).toVar();
 			const x = vec4( x_immutable ).toVar();
 			const x = vec4( x_immutable ).toVar();
@@ -107,7 +107,7 @@ class AfterImageNode extends TempNode {
 
 
 		} );
 		} );
 
 
-		const afterImg = tslFn( () => {
+		const afterImg = Fn( () => {
 
 
 			const texelOld = vec4( textureNodeOld );
 			const texelOld = vec4( textureNodeOld );
 			const texelNew = vec4( sampleTexture( uvNode ) );
 			const texelNew = vec4( sampleTexture( uvNode ) );

+ 4 - 4
src/nodes/display/AnamorphicNode.js

@@ -1,6 +1,6 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
-import { nodeObject, addNodeElement, tslFn, float, vec2, vec3 } from '../shadernode/ShaderNode.js';
-import { loop } from '../utils/LoopNode.js';
+import { nodeObject, addNodeElement, Fn, float, vec2, vec3 } from '../shadernode/ShaderNode.js';
+import { Loop } from '../utils/LoopNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { threshold } from './ColorAdjustmentNode.js';
 import { threshold } from './ColorAdjustmentNode.js';
@@ -90,14 +90,14 @@ class AnamorphicNode extends TempNode {
 
 
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 
 
-		const anamorph = tslFn( () => {
+		const anamorph = Fn( () => {
 
 
 			const samples = this.samples;
 			const samples = this.samples;
 			const halfSamples = Math.floor( samples / 2 );
 			const halfSamples = Math.floor( samples / 2 );
 
 
 			const total = vec3( 0 ).toVar();
 			const total = vec3( 0 ).toVar();
 
 
-			loop( { start: - halfSamples, end: halfSamples }, ( { i } ) => {
+			Loop( { start: - halfSamples, end: halfSamples }, ( { i } ) => {
 
 
 				const softness = float( i ).abs().div( halfSamples ).oneMinus();
 				const softness = float( i ).abs().div( halfSamples ).oneMinus();
 
 

+ 2 - 2
src/nodes/display/BleachBypassNode.js

@@ -1,8 +1,8 @@
-import { addNodeElement, float, tslFn, vec3, vec4 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, float, Fn, vec3, vec4 } from '../shadernode/ShaderNode.js';
 import { min, max, mix } from '../math/MathNode.js';
 import { min, max, mix } from '../math/MathNode.js';
 import { luminance } from './ColorAdjustmentNode.js';
 import { luminance } from './ColorAdjustmentNode.js';
 
 
-export const bleach = /*@__PURE__*/ tslFn( ( [ color, opacity = 1 ] ) => {
+export const bleach = /*@__PURE__*/ Fn( ( [ color, opacity = 1 ] ) => {
 
 
 	const base = color;
 	const base = color;
 	const lum = luminance( base.rgb );
 	const lum = luminance( base.rgb );

+ 8 - 8
src/nodes/display/BlendModeNode.js

@@ -1,11 +1,11 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { /*mix, step,*/ EPSILON } from '../math/MathNode.js';
 import { /*mix, step,*/ EPSILON } from '../math/MathNode.js';
 import { addNodeClass } from '../core/Node.js';
 import { addNodeClass } from '../core/Node.js';
-import { addNodeElement, tslFn, nodeProxy, vec3 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeProxy, vec3 } from '../shadernode/ShaderNode.js';
 
 
-export const BurnNode = tslFn( ( { base, blend } ) => {
+export const BurnNode = Fn( ( { base, blend } ) => {
 
 
-	const fn = ( c ) => blend[ c ].lessThan( EPSILON ).cond( blend[ c ], base[ c ].oneMinus().div( blend[ c ] ).oneMinus().max( 0 ) );
+	const fn = ( c ) => blend[ c ].lessThan( EPSILON ).select( blend[ c ], base[ c ].oneMinus().div( blend[ c ] ).oneMinus().max( 0 ) );
 
 
 	return vec3( fn( 'x' ), fn( 'y' ), fn( 'z' ) );
 	return vec3( fn( 'x' ), fn( 'y' ), fn( 'z' ) );
 
 
@@ -18,9 +18,9 @@ export const BurnNode = tslFn( ( { base, blend } ) => {
 	]
 	]
 } );
 } );
 
 
-export const DodgeNode = tslFn( ( { base, blend } ) => {
+export const DodgeNode = Fn( ( { base, blend } ) => {
 
 
-	const fn = ( c ) => blend[ c ].equal( 1.0 ).cond( blend[ c ], base[ c ].div( blend[ c ].oneMinus() ).max( 0 ) );
+	const fn = ( c ) => blend[ c ].equal( 1.0 ).select( blend[ c ], base[ c ].div( blend[ c ].oneMinus() ).max( 0 ) );
 
 
 	return vec3( fn( 'x' ), fn( 'y' ), fn( 'z' ) );
 	return vec3( fn( 'x' ), fn( 'y' ), fn( 'z' ) );
 
 
@@ -33,7 +33,7 @@ export const DodgeNode = tslFn( ( { base, blend } ) => {
 	]
 	]
 } );
 } );
 
 
-export const ScreenNode = tslFn( ( { base, blend } ) => {
+export const ScreenNode = Fn( ( { base, blend } ) => {
 
 
 	const fn = ( c ) => base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus();
 	const fn = ( c ) => base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus();
 
 
@@ -48,9 +48,9 @@ export const ScreenNode = tslFn( ( { base, blend } ) => {
 	]
 	]
 } );
 } );
 
 
-export const OverlayNode = tslFn( ( { base, blend } ) => {
+export const OverlayNode = Fn( ( { base, blend } ) => {
 
 
-	const fn = ( c ) => base[ c ].lessThan( 0.5 ).cond( base[ c ].mul( blend[ c ], 2.0 ), base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus() );
+	const fn = ( c ) => base[ c ].lessThan( 0.5 ).select( base[ c ].mul( blend[ c ], 2.0 ), base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus() );
 	//const fn = ( c ) => mix( base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus(), base[ c ].mul( blend[ c ], 2.0 ), step( base[ c ], 0.5 ) );
 	//const fn = ( c ) => mix( base[ c ].oneMinus().mul( blend[ c ].oneMinus() ).oneMinus(), base[ c ].mul( blend[ c ], 2.0 ), step( base[ c ], 0.5 ) );
 
 
 	return vec3( fn( 'x' ), fn( 'y' ), fn( 'z' ) );
 	return vec3( fn( 'x' ), fn( 'y' ), fn( 'z' ) );

+ 7 - 7
src/nodes/display/BloomNode.js

@@ -1,5 +1,5 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
-import { addNodeElement, tslFn, nodeObject, float, vec4, int } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, float, vec4, int } from '../shadernode/ShaderNode.js';
 import { mix, smoothstep } from '../math/MathNode.js';
 import { mix, smoothstep } from '../math/MathNode.js';
 import { luminance } from './ColorAdjustmentNode.js';
 import { luminance } from './ColorAdjustmentNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
@@ -11,7 +11,7 @@ import { RenderTarget } from '../../core/RenderTarget.js';
 import { HalfFloatType } from '../../constants.js';
 import { HalfFloatType } from '../../constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { Vector2 } from '../../math/Vector2.js';
 import { Vector2 } from '../../math/Vector2.js';
-import { loop } from '../utils/LoopNode.js';
+import { Loop } from '../utils/LoopNode.js';
 import { add } from '../math/OperatorNode.js';
 import { add } from '../math/OperatorNode.js';
 import QuadMesh from '../../renderers/common/QuadMesh.js';
 import QuadMesh from '../../renderers/common/QuadMesh.js';
 import { texture } from '../accessors/TextureNode.js';
 import { texture } from '../accessors/TextureNode.js';
@@ -183,7 +183,7 @@ class BloomNode extends TempNode {
 
 
 		// luminosity high pass material
 		// luminosity high pass material
 
 
-		const luminosityHighPass = tslFn( () => {
+		const luminosityHighPass = Fn( () => {
 
 
 			const texel = this.inputNode;
 			const texel = this.inputNode;
 			const v = luminance( texel.rgb );
 			const v = luminance( texel.rgb );
@@ -213,7 +213,7 @@ class BloomNode extends TempNode {
 		const bloomFactors = uniformArray( [ 1.0, 0.8, 0.6, 0.4, 0.2 ] );
 		const bloomFactors = uniformArray( [ 1.0, 0.8, 0.6, 0.4, 0.2 ] );
 		const bloomTintColors = uniformArray( [ new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ) ] );
 		const bloomTintColors = uniformArray( [ new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ) ] );
 
 
-		const lerpBloomFactor = tslFn( ( [ factor, radius ] ) => {
+		const lerpBloomFactor = Fn( ( [ factor, radius ] ) => {
 
 
 			const mirrorFactor = float( 1.2 ).sub( factor );
 			const mirrorFactor = float( 1.2 ).sub( factor );
 			return mix( factor, mirrorFactor, radius );
 			return mix( factor, mirrorFactor, radius );
@@ -228,7 +228,7 @@ class BloomNode extends TempNode {
 		} );
 		} );
 
 
 
 
-		const compositePass = tslFn( () => {
+		const compositePass = Fn( () => {
 
 
 			const color0 = lerpBloomFactor( bloomFactors.element( 0 ), this.radius ).mul( vec4( bloomTintColors.element( 0 ), 1.0 ) ).mul( this._textureNodeBlur0 );
 			const color0 = lerpBloomFactor( bloomFactors.element( 0 ), this.radius ).mul( vec4( bloomTintColors.element( 0 ), 1.0 ) ).mul( this._textureNodeBlur0 );
 			const color1 = lerpBloomFactor( bloomFactors.element( 1 ), this.radius ).mul( vec4( bloomTintColors.element( 1 ), 1.0 ) ).mul( this._textureNodeBlur1 );
 			const color1 = lerpBloomFactor( bloomFactors.element( 1 ), this.radius ).mul( vec4( bloomTintColors.element( 1 ), 1.0 ) ).mul( this._textureNodeBlur1 );
@@ -290,12 +290,12 @@ class BloomNode extends TempNode {
 		const uvNode = uv();
 		const uvNode = uv();
 		const sampleTexel = ( uv ) => colorTexture.uv( uv );
 		const sampleTexel = ( uv ) => colorTexture.uv( uv );
 
 
-		const seperableBlurPass = tslFn( () => {
+		const seperableBlurPass = Fn( () => {
 
 
 			const weightSum = gaussianCoefficients.element( 0 ).toVar();
 			const weightSum = gaussianCoefficients.element( 0 ).toVar();
 			const diffuseSum = sampleTexel( uvNode ).rgb.mul( weightSum ).toVar();
 			const diffuseSum = sampleTexel( uvNode ).rgb.mul( weightSum ).toVar();
 
 
-			loop( { start: int( 1 ), end: int( kernelRadius ), type: 'int', condition: '<' }, ( { i } ) => {
+			Loop( { start: int( 1 ), end: int( kernelRadius ), type: 'int', condition: '<' }, ( { i } ) => {
 
 
 				const x = float( i );
 				const x = float( i );
 				const w = gaussianCoefficients.element( i );
 				const w = gaussianCoefficients.element( i );

+ 3 - 3
src/nodes/display/BumpMapNode.js

@@ -4,12 +4,12 @@ import { uv } from '../accessors/UVNode.js';
 import { normalView } from '../accessors/NormalNode.js';
 import { normalView } from '../accessors/NormalNode.js';
 import { positionView } from '../accessors/PositionNode.js';
 import { positionView } from '../accessors/PositionNode.js';
 import { faceDirection } from './FrontFacingNode.js';
 import { faceDirection } from './FrontFacingNode.js';
-import { addNodeElement, tslFn, nodeProxy, float, vec2 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeProxy, float, vec2 } from '../shadernode/ShaderNode.js';
 
 
 // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen
 // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen
 // https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf
 // https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf
 
 
-const dHdxy_fwd = tslFn( ( { textureNode, bumpScale } ) => {
+const dHdxy_fwd = Fn( ( { textureNode, bumpScale } ) => {
 
 
 	// It's used to preserve the same TextureNode instance
 	// It's used to preserve the same TextureNode instance
 	const sampleTexture = ( callback ) => textureNode.cache().context( { getUV: ( texNode ) => callback( texNode.uvNode || uv() ), forceUVContext: true } );
 	const sampleTexture = ( callback ) => textureNode.cache().context( { getUV: ( texNode ) => callback( texNode.uvNode || uv() ), forceUVContext: true } );
@@ -25,7 +25,7 @@ const dHdxy_fwd = tslFn( ( { textureNode, bumpScale } ) => {
 
 
 // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)
 // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)
 
 
-const perturbNormalArb = tslFn( ( inputs ) => {
+const perturbNormalArb = Fn( ( inputs ) => {
 
 
 	const { surf_pos, surf_norm, dHdxy } = inputs;
 	const { surf_pos, surf_norm, dHdxy } = inputs;
 
 

+ 4 - 4
src/nodes/display/ColorAdjustmentNode.js

@@ -2,17 +2,17 @@ import TempNode from '../core/TempNode.js';
 import { dot, mix } from '../math/MathNode.js';
 import { dot, mix } from '../math/MathNode.js';
 import { add } from '../math/OperatorNode.js';
 import { add } from '../math/OperatorNode.js';
 import { addNodeClass } from '../core/Node.js';
 import { addNodeClass } from '../core/Node.js';
-import { addNodeElement, tslFn, nodeProxy, float, vec3 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeProxy, float, vec3 } from '../shadernode/ShaderNode.js';
 import { ColorManagement } from '../../math/ColorManagement.js';
 import { ColorManagement } from '../../math/ColorManagement.js';
 import { Vector3 } from '../../math/Vector3.js';
 import { Vector3 } from '../../math/Vector3.js';
 
 
-const saturationNode = tslFn( ( { color, adjustment } ) => {
+const saturationNode = Fn( ( { color, adjustment } ) => {
 
 
 	return adjustment.mix( luminance( color.rgb ), color.rgb );
 	return adjustment.mix( luminance( color.rgb ), color.rgb );
 
 
 } );
 } );
 
 
-const vibranceNode = tslFn( ( { color, adjustment } ) => {
+const vibranceNode = Fn( ( { color, adjustment } ) => {
 
 
 	const average = add( color.r, color.g, color.b ).div( 3.0 );
 	const average = add( color.r, color.g, color.b ).div( 3.0 );
 
 
@@ -23,7 +23,7 @@ const vibranceNode = tslFn( ( { color, adjustment } ) => {
 
 
 } );
 } );
 
 
-const hueNode = tslFn( ( { color, adjustment } ) => {
+const hueNode = Fn( ( { color, adjustment } ) => {
 
 
 	const k = vec3( 0.57735, 0.57735, 0.57735 );
 	const k = vec3( 0.57735, 0.57735, 0.57735 );
 
 

+ 3 - 3
src/nodes/display/ColorSpaceNode.js

@@ -1,11 +1,11 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { mix } from '../math/MathNode.js';
 import { mix } from '../math/MathNode.js';
 import { addNodeClass } from '../core/Node.js';
 import { addNodeClass } from '../core/Node.js';
-import { addNodeElement, tslFn, nodeObject, nodeProxy, vec4 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, nodeProxy, vec4 } from '../shadernode/ShaderNode.js';
 
 
 import { LinearSRGBColorSpace, SRGBColorSpace } from '../../constants.js';
 import { LinearSRGBColorSpace, SRGBColorSpace } from '../../constants.js';
 
 
-const sRGBToLinearShader = tslFn( ( inputs ) => {
+const sRGBToLinearShader = Fn( ( inputs ) => {
 
 
 	const { value } = inputs;
 	const { value } = inputs;
 	const { rgb } = value;
 	const { rgb } = value;
@@ -20,7 +20,7 @@ const sRGBToLinearShader = tslFn( ( inputs ) => {
 
 
 } );
 } );
 
 
-const LinearTosRGBShader = tslFn( ( inputs ) => {
+const LinearTosRGBShader = Fn( ( inputs ) => {
 
 
 	const { value } = inputs;
 	const { value } = inputs;
 	const { rgb } = value;
 	const { rgb } = value;

+ 7 - 7
src/nodes/display/DenoiseNode.js

@@ -1,11 +1,11 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
-import { addNodeElement, tslFn, nodeObject, float, int, vec2, vec3, vec4, mat2, If } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, float, int, vec2, vec3, vec4, mat2, If } from '../shadernode/ShaderNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniformArray } from '../accessors/UniformArrayNode.js';
 import { uniformArray } from '../accessors/UniformArrayNode.js';
 import { abs, dot, sin, cos, PI, pow, max } from '../math/MathNode.js';
 import { abs, dot, sin, cos, PI, pow, max } from '../math/MathNode.js';
-import { loop } from '../utils/LoopNode.js';
+import { Loop } from '../utils/LoopNode.js';
 import { luminance } from './ColorAdjustmentNode.js';
 import { luminance } from './ColorAdjustmentNode.js';
 import { textureSize } from '../accessors/TextureSizeNode.js';
 import { textureSize } from '../accessors/TextureSizeNode.js';
 import { Vector2 } from '../../math/Vector2.js';
 import { Vector2 } from '../../math/Vector2.js';
@@ -53,7 +53,7 @@ class DenoiseNode extends TempNode {
 		const sampleNormal = ( uv ) => this.normalNode.uv( uv );
 		const sampleNormal = ( uv ) => this.normalNode.uv( uv );
 		const sampleNoise = ( uv ) => this.noiseNode.uv( uv );
 		const sampleNoise = ( uv ) => this.noiseNode.uv( uv );
 
 
-		const getViewPosition = tslFn( ( [ screenPosition, depth ] ) => {
+		const getViewPosition = Fn( ( [ screenPosition, depth ] ) => {
 
 
 			screenPosition = vec2( screenPosition.x, screenPosition.y.oneMinus() ).mul( 2.0 ).sub( 1.0 );
 			screenPosition = vec2( screenPosition.x, screenPosition.y.oneMinus() ).mul( 2.0 ).sub( 1.0 );
 
 
@@ -64,7 +64,7 @@ class DenoiseNode extends TempNode {
 
 
 		} );
 		} );
 
 
-		const denoiseSample = tslFn( ( [ center, viewNormal, viewPosition, sampleUv ] ) => {
+		const denoiseSample = Fn( ( [ center, viewNormal, viewPosition, sampleUv ] ) => {
 
 
 			const texel = sampleTexture( sampleUv );
 			const texel = sampleTexture( sampleUv );
 			const depth = sampleDepth( sampleUv );
 			const depth = sampleDepth( sampleUv );
@@ -84,7 +84,7 @@ class DenoiseNode extends TempNode {
 
 
 		} );
 		} );
 
 
-		const denoise = tslFn( ( [ uvNode ] ) => {
+		const denoise = Fn( ( [ uvNode ] ) => {
 
 
 			const depth = sampleDepth( uvNode );
 			const depth = sampleDepth( uvNode );
 			const viewNormal = sampleNormal( uvNode ).rgb.normalize();
 			const viewNormal = sampleNormal( uvNode ).rgb.normalize();
@@ -115,7 +115,7 @@ class DenoiseNode extends TempNode {
 			const totalWeight = float( 1.0 ).toVar();
 			const totalWeight = float( 1.0 ).toVar();
 			const denoised = vec3( texel.rgb ).toVar();
 			const denoised = vec3( texel.rgb ).toVar();
 
 
-			loop( { start: int( 0 ), end: int( 16 ), type: 'int', condition: '<' }, ( { i } ) => {
+			Loop( { start: int( 0 ), end: int( 16 ), type: 'int', condition: '<' }, ( { i } ) => {
 
 
 				const sampleDir = this._sampleVectors.element( i ).toVar();
 				const sampleDir = this._sampleVectors.element( i ).toVar();
 				const offset = rotationMatrix.mul( sampleDir.xy.mul( float( 1.0 ).add( sampleDir.z.mul( this.radius.sub( 1 ) ) ) ) ).div( this._resolution ).toVar();
 				const offset = rotationMatrix.mul( sampleDir.xy.mul( float( 1.0 ).add( sampleDir.z.mul( this.radius.sub( 1 ) ) ) ) ).div( this._resolution ).toVar();
@@ -144,7 +144,7 @@ class DenoiseNode extends TempNode {
 			]
 			]
 		} );
 		} );
 
 
-		const output = tslFn( () => {
+		const output = Fn( () => {
 
 
 			return denoise( uvNode );
 			return denoise( uvNode );
 
 

+ 2 - 2
src/nodes/display/DepthOfFieldNode.js

@@ -1,6 +1,6 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
-import { addNodeElement, tslFn, nodeObject, vec2, vec4 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, vec2, vec4 } from '../shadernode/ShaderNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { clamp } from '../math/MathNode.js';
 import { clamp } from '../math/MathNode.js';
@@ -39,7 +39,7 @@ class DepthOfFieldNode extends TempNode {
 
 
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 
 
-		const dof = tslFn( () => {
+		const dof = Fn( () => {
 
 
 			const aspectcorrect = vec2( 1.0, this._aspect );
 			const aspectcorrect = vec2( 1.0, this._aspect );
 
 

+ 3 - 3
src/nodes/display/DotScreenNode.js

@@ -1,5 +1,5 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
-import { nodeObject, addNodeElement, tslFn, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
+import { nodeObject, addNodeElement, Fn, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
@@ -37,7 +37,7 @@ class DotScreenNode extends TempNode {
 
 
 		const inputNode = this.inputNode;
 		const inputNode = this.inputNode;
 
 
-		const pattern = tslFn( () => {
+		const pattern = Fn( () => {
 
 
 			const s = sin( this.angle );
 			const s = sin( this.angle );
 			const c = cos( this.angle );
 			const c = cos( this.angle );
@@ -49,7 +49,7 @@ class DotScreenNode extends TempNode {
 
 
 		} );
 		} );
 
 
-		const dotScreen = tslFn( () => {
+		const dotScreen = Fn( () => {
 
 
 			const color = inputNode;
 			const color = inputNode;
 
 

+ 9 - 9
src/nodes/display/FXAANode.js

@@ -1,11 +1,11 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
-import { addNodeElement, tslFn, nodeObject, float, vec2, vec4, int, If } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, float, vec2, vec4, int, If } from '../shadernode/ShaderNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { abs, max, min, mix, pow } from '../math/MathNode.js';
 import { abs, max, min, mix, pow } from '../math/MathNode.js';
 import { sub } from '../math/OperatorNode.js';
 import { sub } from '../math/OperatorNode.js';
-import { loop, Break } from '../utils/LoopNode.js';
+import { Loop, Break } from '../utils/LoopNode.js';
 
 
 import { Vector2 } from '../../math/Vector2.js';
 import { Vector2 } from '../../math/Vector2.js';
 
 
@@ -77,7 +77,7 @@ class FXAANode extends TempNode {
 
 
 		const NUM_SAMPLES = int( 5 );
 		const NUM_SAMPLES = int( 5 );
 
 
-		const contrast = tslFn( ( [ a_immutable, b_immutable ] ) => {
+		const contrast = Fn( ( [ a_immutable, b_immutable ] ) => {
 
 
 			// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha
 			// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha
 
 
@@ -91,7 +91,7 @@ class FXAANode extends TempNode {
 
 
 		// FXAA3 QUALITY - PC
 		// FXAA3 QUALITY - PC
 
 
-		const FxaaPixelShader = tslFn( ( [ uv, fxaaQualityRcpFrame, fxaaQualityEdgeThreshold, fxaaQualityinvEdgeThreshold ] ) => {
+		const FxaaPixelShader = Fn( ( [ uv, fxaaQualityRcpFrame, fxaaQualityEdgeThreshold, fxaaQualityinvEdgeThreshold ] ) => {
 
 
 			const rgbaM = FxaaTexTop( uv ).toVar();
 			const rgbaM = FxaaTexTop( uv ).toVar();
 			const rgbaS = FxaaTexOff( uv, vec2( 0.0, - 1.0 ), fxaaQualityRcpFrame.xy ).toVar();
 			const rgbaS = FxaaTexOff( uv, vec2( 0.0, - 1.0 ), fxaaQualityRcpFrame.xy ).toVar();
@@ -130,8 +130,8 @@ class FXAANode extends TempNode {
 
 
 				// locate the edge
 				// locate the edge
 
 
-				const x = contrastE.greaterThan( contrastW ).cond( 1, - 1 ).toVar();
-				const y = contrastS.greaterThan( contrastN ).cond( 1, - 1 ).toVar();
+				const x = contrastE.greaterThan( contrastW ).select( 1, - 1 ).toVar();
+				const y = contrastS.greaterThan( contrastN ).select( 1, - 1 ).toVar();
 
 
 				const dirToEdge = vec2( x, y ).toVar();
 				const dirToEdge = vec2( x, y ).toVar();
 				// . 2 .      . 1 .
 				// . 2 .      . 1 .
@@ -184,7 +184,7 @@ class FXAANode extends TempNode {
 				offNP.x.assign( 0 );
 				offNP.x.assign( 0 );
 				offNP.y.assign( fxaaQualityRcpFrame.y );
 				offNP.y.assign( fxaaQualityRcpFrame.y );
 
 
-			 } ).else( () => {
+			 } ).Else( () => {
 
 
 				offNP.x.assign( fxaaQualityRcpFrame.x );
 				offNP.x.assign( fxaaQualityRcpFrame.x );
 				offNP.y.assign( 0 );
 				offNP.y.assign( 0 );
@@ -212,7 +212,7 @@ class FXAANode extends TempNode {
 			const iterationsUsedN = int( 0 ).toVar();
 			const iterationsUsedN = int( 0 ).toVar();
 			const iterationsUsedP = int( 0 ).toVar();
 			const iterationsUsedP = int( 0 ).toVar();
 
 
-			loop( NUM_SAMPLES, ( { i } ) => {
+			Loop( NUM_SAMPLES, ( { i } ) => {
 
 
 				const increment = i.add( 1 ).toVar();
 				const increment = i.add( 1 ).toVar();
 
 
@@ -303,7 +303,7 @@ class FXAANode extends TempNode {
 			]
 			]
 		} );
 		} );
 
 
-		const fxaa = tslFn( () => {
+		const fxaa = Fn( () => {
 
 
 			const edgeDetectionQuality = float( 0.2 );
 			const edgeDetectionQuality = float( 0.2 );
 			const invEdgeDetectionQuality = float( 1 ).div( edgeDetectionQuality );
 			const invEdgeDetectionQuality = float( 1 ).div( edgeDetectionQuality );

+ 2 - 2
src/nodes/display/FilmNode.js

@@ -1,6 +1,6 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
-import { addNodeElement, tslFn, nodeProxy, vec4 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeProxy, vec4 } from '../shadernode/ShaderNode.js';
 import { mix, fract, clamp, rand } from '../math/MathNode.js';
 import { mix, fract, clamp, rand } from '../math/MathNode.js';
 import { timerLocal } from '../utils/TimerNode.js';
 import { timerLocal } from '../utils/TimerNode.js';
 
 
@@ -20,7 +20,7 @@ class FilmNode extends TempNode {
 
 
 		const uvNode = this.uvNode || uv();
 		const uvNode = this.uvNode || uv();
 
 
-		const film = tslFn( () => {
+		const film = Fn( () => {
 
 
 			const base = this.inputNode.rgb;
 			const base = this.inputNode.rgb;
 			const noise = rand( fract( uvNode.add( timerLocal() ) ) );
 			const noise = rand( fract( uvNode.add( timerLocal() ) ) );

+ 8 - 8
src/nodes/display/GTAONode.js

@@ -2,7 +2,7 @@ import TempNode from '../core/TempNode.js';
 import { texture } from '../accessors/TextureNode.js';
 import { texture } from '../accessors/TextureNode.js';
 import { textureSize } from '../accessors/TextureSizeNode.js';
 import { textureSize } from '../accessors/TextureSizeNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
-import { addNodeElement, nodeObject, tslFn, mat3, vec2, vec3, vec4, float, int, If } from '../shadernode/ShaderNode.js';
+import { addNodeElement, nodeObject, Fn, mat3, vec2, vec3, vec4, float, int, If } from '../shadernode/ShaderNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { DataTexture } from '../../textures/DataTexture.js';
 import { DataTexture } from '../../textures/DataTexture.js';
@@ -10,7 +10,7 @@ import { Vector2 } from '../../math/Vector2.js';
 import { Vector3 } from '../../math/Vector3.js';
 import { Vector3 } from '../../math/Vector3.js';
 import { PI, cos, sin, pow, clamp, abs, max, mix, sqrt, acos, dot, normalize, cross } from '../math/MathNode.js';
 import { PI, cos, sin, pow, clamp, abs, max, mix, sqrt, acos, dot, normalize, cross } from '../math/MathNode.js';
 import { div, mul, add, sub } from '../math/OperatorNode.js';
 import { div, mul, add, sub } from '../math/OperatorNode.js';
-import { loop } from '../utils/LoopNode.js';
+import { Loop } from '../utils/LoopNode.js';
 import { passTexture } from './PassNode.js';
 import { passTexture } from './PassNode.js';
 import { RepeatWrapping } from '../../constants.js';
 import { RepeatWrapping } from '../../constants.js';
 import QuadMesh from '../../renderers/common/QuadMesh.js';
 import QuadMesh from '../../renderers/common/QuadMesh.js';
@@ -106,7 +106,7 @@ class GTAONode extends TempNode {
 		const sampleDepth = ( uv ) => this.depthNode.uv( uv ).x;
 		const sampleDepth = ( uv ) => this.depthNode.uv( uv ).x;
 		const sampleNoise = ( uv ) => this.noiseNode.uv( uv );
 		const sampleNoise = ( uv ) => this.noiseNode.uv( uv );
 
 
-		const getSceneUvAndDepth = tslFn( ( [ sampleViewPos ] )=> {
+		const getSceneUvAndDepth = Fn( ( [ sampleViewPos ] )=> {
 
 
 			const sampleClipPos = this.cameraProjectionMatrix.mul( vec4( sampleViewPos, 1.0 ) );
 			const sampleClipPos = this.cameraProjectionMatrix.mul( vec4( sampleViewPos, 1.0 ) );
 			let sampleUv = sampleClipPos.xy.div( sampleClipPos.w ).mul( 0.5 ).add( 0.5 ).toVar();
 			let sampleUv = sampleClipPos.xy.div( sampleClipPos.w ).mul( 0.5 ).add( 0.5 ).toVar();
@@ -116,7 +116,7 @@ class GTAONode extends TempNode {
 
 
 		} );
 		} );
 
 
-		const getViewPosition = tslFn( ( [ screenPosition, depth ] ) => {
+		const getViewPosition = Fn( ( [ screenPosition, depth ] ) => {
 
 
 			screenPosition = vec2( screenPosition.x, screenPosition.y.oneMinus() ).mul( 2.0 ).sub( 1.0 );
 			screenPosition = vec2( screenPosition.x, screenPosition.y.oneMinus() ).mul( 2.0 ).sub( 1.0 );
 
 
@@ -127,7 +127,7 @@ class GTAONode extends TempNode {
 
 
 		} );
 		} );
 
 
-		const ao = tslFn( () => {
+		const ao = Fn( () => {
 
 
 			const depth = sampleDepth( uvNode );
 			const depth = sampleDepth( uvNode );
 
 
@@ -147,12 +147,12 @@ class GTAONode extends TempNode {
 			const bitangent = vec3( tangent.y.mul( - 1.0 ), tangent.x, 0.0 );
 			const bitangent = vec3( tangent.y.mul( - 1.0 ), tangent.x, 0.0 );
 			const kernelMatrix = mat3( tangent, bitangent, vec3( 0.0, 0.0, 1.0 ) );
 			const kernelMatrix = mat3( tangent, bitangent, vec3( 0.0, 0.0, 1.0 ) );
 
 
-			const DIRECTIONS = this.SAMPLES.lessThan( 30 ).cond( 3, 5 );
+			const DIRECTIONS = this.SAMPLES.lessThan( 30 ).select( 3, 5 );
 			const STEPS = add( this.SAMPLES, DIRECTIONS.sub( 1 ) ).div( DIRECTIONS );
 			const STEPS = add( this.SAMPLES, DIRECTIONS.sub( 1 ) ).div( DIRECTIONS );
 
 
 			const ao = float( 0 ).toVar();
 			const ao = float( 0 ).toVar();
 
 
-			loop( { start: int( 0 ), end: DIRECTIONS, type: 'int', condition: '<' }, ( { i } ) => {
+			Loop( { start: int( 0 ), end: DIRECTIONS, type: 'int', condition: '<' }, ( { i } ) => {
 
 
 				const angle = float( i ).div( float( DIRECTIONS ) ).mul( PI );
 				const angle = float( i ).div( float( DIRECTIONS ) ).mul( PI );
 				const sampleDir = vec4( cos( angle ), sin( angle ), 0., add( 0.5, mul( 0.5, noiseTexel.w ) ) );
 				const sampleDir = vec4( cos( angle ), sin( angle ), 0., add( 0.5, mul( 0.5, noiseTexel.w ) ) );
@@ -166,7 +166,7 @@ class GTAONode extends TempNode {
 				const tangentToNormalInSlice = cross( normalInSlice, sliceBitangent );
 				const tangentToNormalInSlice = cross( normalInSlice, sliceBitangent );
 				const cosHorizons = vec2( dot( viewDir, tangentToNormalInSlice ), dot( viewDir, tangentToNormalInSlice.negate() ) ).toVar();
 				const cosHorizons = vec2( dot( viewDir, tangentToNormalInSlice ), dot( viewDir, tangentToNormalInSlice.negate() ) ).toVar();
 
 
-				loop( { end: STEPS, type: 'int', name: 'j', condition: '<' }, ( { j } ) => {
+				Loop( { end: STEPS, type: 'int', name: 'j', condition: '<' }, ( { j } ) => {
 
 
 					const sampleViewOffset = sampleDir.xyz.mul( radiusToUse ).mul( sampleDir.w ).mul( pow( div( float( j ).add( 1.0 ), float( STEPS ) ), this.distanceExponent ) );
 					const sampleViewOffset = sampleDir.xyz.mul( radiusToUse ).mul( sampleDir.w ).mul( pow( div( float( j ).add( 1.0 ), float( STEPS ) ), this.distanceExponent ) );
 
 

+ 2 - 2
src/nodes/display/GaussianBlurNode.js

@@ -1,5 +1,5 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
-import { nodeObject, addNodeElement, tslFn, float, vec2, vec4 } from '../shadernode/ShaderNode.js';
+import { nodeObject, addNodeElement, Fn, float, vec2, vec4 } from '../shadernode/ShaderNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { mul } from '../math/OperatorNode.js';
 import { mul } from '../math/OperatorNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
@@ -129,7 +129,7 @@ class GaussianBlurNode extends TempNode {
 
 
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 
 
-		const blur = tslFn( () => {
+		const blur = Fn( () => {
 
 
 			const kernelSize = 3 + ( 2 * this.sigma );
 			const kernelSize = 3 + ( 2 * this.sigma );
 			const gaussianCoefficients = this._getCoefficients( kernelSize );
 			const gaussianCoefficients = this._getCoefficients( kernelSize );

+ 2 - 2
src/nodes/display/Lut3DNode.js

@@ -1,5 +1,5 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
-import { addNodeElement, tslFn, nodeObject, vec3, vec4, float } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, vec3, vec4, float } from '../shadernode/ShaderNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { mix } from '../math/MathNode.js';
 import { mix } from '../math/MathNode.js';
 
 
@@ -22,7 +22,7 @@ class Lut3DNode extends TempNode {
 
 
 		const sampleLut = ( uv ) => lutNode.uv( uv );
 		const sampleLut = ( uv ) => lutNode.uv( uv );
 
 
-		const lut3D = tslFn( () => {
+		const lut3D = Fn( () => {
 
 
 			const base = inputNode;
 			const base = inputNode;
 
 

+ 2 - 2
src/nodes/display/NormalMapNode.js

@@ -8,14 +8,14 @@ import { TBNViewMatrix } from '../accessors/AccessorsUtils.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { faceDirection } from './FrontFacingNode.js';
 import { faceDirection } from './FrontFacingNode.js';
 import { addNodeClass } from '../core/Node.js';
 import { addNodeClass } from '../core/Node.js';
-import { addNodeElement, tslFn, nodeProxy, vec3 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeProxy, vec3 } from '../shadernode/ShaderNode.js';
 
 
 import { TangentSpaceNormalMap, ObjectSpaceNormalMap } from '../../constants.js';
 import { TangentSpaceNormalMap, ObjectSpaceNormalMap } from '../../constants.js';
 
 
 // Normal Mapping Without Precomputed Tangents
 // Normal Mapping Without Precomputed Tangents
 // http://www.thetenthplanet.de/archives/1180
 // http://www.thetenthplanet.de/archives/1180
 
 
-const perturbNormal2Arb = tslFn( ( inputs ) => {
+const perturbNormal2Arb = Fn( ( inputs ) => {
 
 
 	const { eye_pos, surf_norm, mapN, uv } = inputs;
 	const { eye_pos, surf_norm, mapN, uv } = inputs;
 
 

+ 3 - 3
src/nodes/display/PixelationPassNode.js

@@ -1,6 +1,6 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
-import { addNodeElement, tslFn, nodeObject, vec2, vec3, float, If } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, vec2, vec3, float, If } from '../shadernode/ShaderNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { dot, clamp, smoothstep, sign, step, floor } from '../math/MathNode.js';
 import { dot, clamp, smoothstep, sign, step, floor } from '../math/MathNode.js';
@@ -106,7 +106,7 @@ class PixelationNode extends TempNode {
 
 
 		};
 		};
 
 
-		const pixelation = tslFn( () => {
+		const pixelation = Fn( () => {
 
 
 			const texel = sampleTexture();
 			const texel = sampleTexture();
 
 
@@ -136,7 +136,7 @@ class PixelationNode extends TempNode {
 
 
 			} );
 			} );
 
 
-			const strength = dei.greaterThan( 0 ).cond( float( 1.0 ).sub( dei.mul( this.depthEdgeStrength ) ), nei.mul( this.normalEdgeStrength ).add( 1 ) );
+			const strength = dei.greaterThan( 0 ).select( float( 1.0 ).sub( dei.mul( this.depthEdgeStrength ) ), nei.mul( this.normalEdgeStrength ).add( 1 ) );
 
 
 			return texel.mul( strength );
 			return texel.mul( strength );
 
 

+ 2 - 2
src/nodes/display/RGBShiftNode.js

@@ -1,5 +1,5 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
-import { nodeObject, addNodeElement, tslFn, vec2, vec4 } from '../shadernode/ShaderNode.js';
+import { nodeObject, addNodeElement, Fn, vec2, vec4 } from '../shadernode/ShaderNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { sin, cos } from '../math/MathNode.js';
 import { sin, cos } from '../math/MathNode.js';
@@ -24,7 +24,7 @@ class RGBShiftNode extends TempNode {
 
 
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 
 
-		const rgbShift = tslFn( () => {
+		const rgbShift = Fn( () => {
 
 
 			const offset = vec2( cos( this.angle ), sin( this.angle ) ).mul( this.amount );
 			const offset = vec2( cos( this.angle ), sin( this.angle ) ).mul( this.amount );
 			const cr = sampleTexture( uvNode.add( offset ) );
 			const cr = sampleTexture( uvNode.add( offset ) );

+ 2 - 2
src/nodes/display/SepiaNode.js

@@ -1,7 +1,7 @@
-import { addNodeElement, tslFn, vec3 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, vec3 } from '../shadernode/ShaderNode.js';
 import { dot } from '../math/MathNode.js';
 import { dot } from '../math/MathNode.js';
 
 
-export const sepia = /*@__PURE__*/ tslFn( ( [ color ] ) => {
+export const sepia = /*@__PURE__*/ Fn( ( [ color ] ) => {
 
 
 	const c = vec3( color );
 	const c = vec3( color );
 
 

+ 2 - 2
src/nodes/display/SobelOperatorNode.js

@@ -1,7 +1,7 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { luminance } from './ColorAdjustmentNode.js';
 import { luminance } from './ColorAdjustmentNode.js';
-import { addNodeElement, tslFn, nodeObject, vec2, vec3, vec4, mat3 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, vec2, vec3, vec4, mat3 } from '../shadernode/ShaderNode.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { NodeUpdateType } from '../core/constants.js';
 import { uniform } from '../core/UniformNode.js';
 import { uniform } from '../core/UniformNode.js';
 import { add } from '../math/OperatorNode.js';
 import { add } from '../math/OperatorNode.js';
@@ -38,7 +38,7 @@ class SobelOperatorNode extends TempNode {
 
 
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 		const sampleTexture = ( uv ) => textureNode.uv( uv );
 
 
-		const sobel = tslFn( () => {
+		const sobel = Fn( () => {
 
 
 			// Sobel Edge Detection (see https://youtu.be/uihBwtPIBxM)
 			// Sobel Edge Detection (see https://youtu.be/uihBwtPIBxM)
 
 

+ 11 - 11
src/nodes/display/ToneMappingNode.js

@@ -1,22 +1,22 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { addNodeClass } from '../core/Node.js';
 import { addNodeClass } from '../core/Node.js';
-import { addNodeElement, tslFn, nodeObject, float, mat3, vec3, If } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, float, mat3, vec3, If } from '../shadernode/ShaderNode.js';
 import { rendererReference } from '../accessors/RendererReferenceNode.js';
 import { rendererReference } from '../accessors/RendererReferenceNode.js';
-import { cond } from '../math/CondNode.js';
+import { select } from '../math/CondNode.js';
 import { clamp, log2, max, min, pow, mix } from '../math/MathNode.js';
 import { clamp, log2, max, min, pow, mix } from '../math/MathNode.js';
 import { mul, sub, div } from '../math/OperatorNode.js';
 import { mul, sub, div } from '../math/OperatorNode.js';
 
 
 import { NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping } from '../../constants.js';
 import { NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping } from '../../constants.js';
 
 
 // exposure only
 // exposure only
-const LinearToneMappingNode = tslFn( ( { color, exposure } ) => {
+const LinearToneMappingNode = Fn( ( { color, exposure } ) => {
 
 
 	return color.mul( exposure ).clamp();
 	return color.mul( exposure ).clamp();
 
 
 } );
 } );
 
 
 // source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf
 // source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf
-const ReinhardToneMappingNode = tslFn( ( { color, exposure } ) => {
+const ReinhardToneMappingNode = Fn( ( { color, exposure } ) => {
 
 
 	color = color.mul( exposure );
 	color = color.mul( exposure );
 
 
@@ -25,7 +25,7 @@ const ReinhardToneMappingNode = tslFn( ( { color, exposure } ) => {
 } );
 } );
 
 
 // source: http://filmicworlds.com/blog/filmic-tonemapping-operators/
 // source: http://filmicworlds.com/blog/filmic-tonemapping-operators/
-const OptimizedCineonToneMappingNode = tslFn( ( { color, exposure } ) => {
+const OptimizedCineonToneMappingNode = Fn( ( { color, exposure } ) => {
 
 
 	// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson
 	// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson
 	color = color.mul( exposure );
 	color = color.mul( exposure );
@@ -39,7 +39,7 @@ const OptimizedCineonToneMappingNode = tslFn( ( { color, exposure } ) => {
 } );
 } );
 
 
 // source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
 // source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
-const RRTAndODTFit = tslFn( ( { color } ) => {
+const RRTAndODTFit = Fn( ( { color } ) => {
 
 
 	const a = color.mul( color.add( 0.0245786 ) ).sub( 0.000090537 );
 	const a = color.mul( color.add( 0.0245786 ) ).sub( 0.000090537 );
 	const b = color.mul( color.add( 0.4329510 ).mul( 0.983729 ) ).add( 0.238081 );
 	const b = color.mul( color.add( 0.4329510 ).mul( 0.983729 ) ).add( 0.238081 );
@@ -49,7 +49,7 @@ const RRTAndODTFit = tslFn( ( { color } ) => {
 } );
 } );
 
 
 // source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
 // source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs
-const ACESFilmicToneMappingNode = tslFn( ( { color, exposure } ) => {
+const ACESFilmicToneMappingNode = Fn( ( { color, exposure } ) => {
 
 
 	// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
 	// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
 	const ACESInputMat = mat3(
 	const ACESInputMat = mat3(
@@ -84,7 +84,7 @@ const ACESFilmicToneMappingNode = tslFn( ( { color, exposure } ) => {
 const LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) );
 const LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) );
 const LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) );
 const LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) );
 
 
-const agxDefaultContrastApprox = tslFn( ( [ x_immutable ] ) => {
+const agxDefaultContrastApprox = Fn( ( [ x_immutable ] ) => {
 
 
 	const x = vec3( x_immutable ).toVar();
 	const x = vec3( x_immutable ).toVar();
 	const x2 = vec3( x.mul( x ) ).toVar();
 	const x2 = vec3( x.mul( x ) ).toVar();
@@ -94,7 +94,7 @@ const agxDefaultContrastApprox = tslFn( ( [ x_immutable ] ) => {
 
 
 } );
 } );
 
 
-const AGXToneMappingNode = tslFn( ( { color, exposure } ) => {
+const AGXToneMappingNode = Fn( ( { color, exposure } ) => {
 
 
 	const colortone = vec3( color ).toVar();
 	const colortone = vec3( color ).toVar();
 	const AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) );
 	const AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) );
@@ -120,7 +120,7 @@ const AGXToneMappingNode = tslFn( ( { color, exposure } ) => {
 
 
 // https://modelviewer.dev/examples/tone-mapping
 // https://modelviewer.dev/examples/tone-mapping
 
 
-const NeutralToneMappingNode = tslFn( ( { color, exposure } ) => {
+const NeutralToneMappingNode = Fn( ( { color, exposure } ) => {
 
 
 	const StartCompression = float( 0.8 - 0.04 );
 	const StartCompression = float( 0.8 - 0.04 );
 	const Desaturation = float( 0.15 );
 	const Desaturation = float( 0.15 );
@@ -128,7 +128,7 @@ const NeutralToneMappingNode = tslFn( ( { color, exposure } ) => {
 	color = color.mul( exposure );
 	color = color.mul( exposure );
 
 
 	const x = min( color.r, min( color.g, color.b ) );
 	const x = min( color.r, min( color.g, color.b ) );
-	const offset = cond( x.lessThan( 0.08 ), x.sub( mul( 6.25, x.mul( x ) ) ), 0.04 );
+	const offset = select( x.lessThan( 0.08 ), x.sub( mul( 6.25, x.mul( x ) ) ), 0.04 );
 
 
 	color.subAssign( offset );
 	color.subAssign( offset );
 
 

+ 3 - 3
src/nodes/display/TransitionNode.js

@@ -1,6 +1,6 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
-import { addNodeElement, tslFn, nodeObject, float, int, vec4, If } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeObject, float, int, vec4, If } from '../shadernode/ShaderNode.js';
 import { clamp, mix } from '../math/MathNode.js';
 import { clamp, mix } from '../math/MathNode.js';
 import { sub } from '../math/OperatorNode.js';
 import { sub } from '../math/OperatorNode.js';
 
 
@@ -35,7 +35,7 @@ class TransitionNode extends TempNode {
 
 
 		};
 		};
 
 
-		const transition = tslFn( () => {
+		const transition = Fn( () => {
 
 
 			const texelOne = sampleTexture( textureNodeA );
 			const texelOne = sampleTexture( textureNodeA );
 			const texelTwo = sampleTexture( textureNodeB );
 			const texelTwo = sampleTexture( textureNodeB );
@@ -50,7 +50,7 @@ class TransitionNode extends TempNode {
 
 
 				color.assign( mix( texelOne, texelTwo, mixf ) );
 				color.assign( mix( texelOne, texelTwo, mixf ) );
 
 
-			} ).else( () => {
+			} ).Else( () => {
 
 
 				color.assign( mix( texelTwo, texelOne, mixRatioNode ) );
 				color.assign( mix( texelTwo, texelOne, mixRatioNode ) );
 
 

+ 2 - 2
src/nodes/functions/BSDF/BRDF_GGX.js

@@ -6,10 +6,10 @@ import D_GGX_Anisotropic from './D_GGX_Anisotropic.js';
 import { transformedNormalView } from '../../accessors/NormalNode.js';
 import { transformedNormalView } from '../../accessors/NormalNode.js';
 import { positionViewDirection } from '../../accessors/PositionNode.js';
 import { positionViewDirection } from '../../accessors/PositionNode.js';
 import { iridescence, alphaT, anisotropyT, anisotropyB } from '../../core/PropertyNode.js';
 import { iridescence, alphaT, anisotropyT, anisotropyB } from '../../core/PropertyNode.js';
-import { tslFn, defined } from '../../shadernode/ShaderNode.js';
+import { Fn, defined } from '../../shadernode/ShaderNode.js';
 
 
 // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
 // GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility
-const BRDF_GGX = tslFn( ( inputs ) => {
+const BRDF_GGX = Fn( ( inputs ) => {
 
 
 	const { lightDirection, f0, f90, roughness, f, USE_IRIDESCENCE, USE_ANISOTROPY } = inputs;
 	const { lightDirection, f0, f90, roughness, f, USE_IRIDESCENCE, USE_ANISOTROPY } = inputs;
 
 

+ 2 - 2
src/nodes/functions/BSDF/BRDF_Lambert.js

@@ -1,6 +1,6 @@
-import { tslFn } from '../../shadernode/ShaderNode.js';
+import { Fn } from '../../shadernode/ShaderNode.js';
 
 
-const BRDF_Lambert = tslFn( ( inputs ) => {
+const BRDF_Lambert = Fn( ( inputs ) => {
 
 
 	return inputs.diffuseColor.mul( 1 / Math.PI ); // punctual light
 	return inputs.diffuseColor.mul( 1 / Math.PI ); // punctual light
 
 

+ 4 - 4
src/nodes/functions/BSDF/BRDF_Sheen.js

@@ -1,10 +1,10 @@
 import { transformedNormalView } from '../../accessors/NormalNode.js';
 import { transformedNormalView } from '../../accessors/NormalNode.js';
 import { positionViewDirection } from '../../accessors/PositionNode.js';
 import { positionViewDirection } from '../../accessors/PositionNode.js';
 import { sheen, sheenRoughness } from '../../core/PropertyNode.js';
 import { sheen, sheenRoughness } from '../../core/PropertyNode.js';
-import { tslFn, float } from '../../shadernode/ShaderNode.js';
+import { Fn, float } from '../../shadernode/ShaderNode.js';
 
 
 // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
 // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
-const D_Charlie = tslFn( ( { roughness, dotNH } ) => {
+const D_Charlie = Fn( ( { roughness, dotNH } ) => {
 
 
 	const alpha = roughness.pow2();
 	const alpha = roughness.pow2();
 
 
@@ -25,7 +25,7 @@ const D_Charlie = tslFn( ( { roughness, dotNH } ) => {
 } );
 } );
 
 
 // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
 // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
-const V_Neubelt = tslFn( ( { dotNV, dotNL } ) => {
+const V_Neubelt = Fn( ( { dotNV, dotNL } ) => {
 
 
 	// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"
 	// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"
 	return float( 1.0 ).div( float( 4.0 ).mul( dotNL.add( dotNV ).sub( dotNL.mul( dotNV ) ) ) );
 	return float( 1.0 ).div( float( 4.0 ).mul( dotNL.add( dotNV ).sub( dotNL.mul( dotNV ) ) ) );
@@ -39,7 +39,7 @@ const V_Neubelt = tslFn( ( { dotNV, dotNL } ) => {
 	]
 	]
 } );
 } );
 
 
-const BRDF_Sheen = tslFn( ( { lightDirection } ) => {
+const BRDF_Sheen = Fn( ( { lightDirection } ) => {
 
 
 	const halfDir = lightDirection.add( positionViewDirection ).normalize();
 	const halfDir = lightDirection.add( positionViewDirection ).normalize();
 
 

+ 2 - 2
src/nodes/functions/BSDF/DFGApprox.js

@@ -1,10 +1,10 @@
-import { tslFn, vec2, vec4 } from '../../shadernode/ShaderNode.js';
+import { Fn, vec2, vec4 } from '../../shadernode/ShaderNode.js';
 
 
 // Analytical approximation of the DFG LUT, one half of the
 // Analytical approximation of the DFG LUT, one half of the
 // split-sum approximation used in indirect specular lighting.
 // split-sum approximation used in indirect specular lighting.
 // via 'environmentBRDF' from "Physically Based Shading on Mobile"
 // via 'environmentBRDF' from "Physically Based Shading on Mobile"
 // https://www.unrealengine.com/blog/physically-based-shading-on-mobile
 // https://www.unrealengine.com/blog/physically-based-shading-on-mobile
-const DFGApprox = tslFn( ( { roughness, dotNV } ) => {
+const DFGApprox = Fn( ( { roughness, dotNV } ) => {
 
 
 	const c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
 	const c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
 
 

+ 2 - 2
src/nodes/functions/BSDF/D_GGX.js

@@ -1,9 +1,9 @@
-import { tslFn } from '../../shadernode/ShaderNode.js';
+import { Fn } from '../../shadernode/ShaderNode.js';
 
 
 // Microfacet Models for Refraction through Rough Surfaces - equation (33)
 // Microfacet Models for Refraction through Rough Surfaces - equation (33)
 // http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
 // http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
 // alpha is "roughness squared" in Disney’s reparameterization
 // alpha is "roughness squared" in Disney’s reparameterization
-const D_GGX = tslFn( ( { alpha, dotNH } ) => {
+const D_GGX = Fn( ( { alpha, dotNH } ) => {
 
 
 	const a2 = alpha.pow2();
 	const a2 = alpha.pow2();
 
 

+ 2 - 2
src/nodes/functions/BSDF/D_GGX_Anisotropic.js

@@ -1,10 +1,10 @@
-import { tslFn, float, vec3 } from '../../shadernode/ShaderNode.js';
+import { Fn, float, vec3 } from '../../shadernode/ShaderNode.js';
 
 
 const RECIPROCAL_PI = float( 1 / Math.PI );
 const RECIPROCAL_PI = float( 1 / Math.PI );
 
 
 // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
 // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
 
 
-const D_GGX_Anisotropic = tslFn( ( { alphaT, alphaB, dotNH, dotTH, dotBH } ) => {
+const D_GGX_Anisotropic = Fn( ( { alphaT, alphaB, dotNH, dotTH, dotBH } ) => {
 
 
 	const a2 = alphaT.mul( alphaB );
 	const a2 = alphaT.mul( alphaB );
 	const v = vec3( alphaB.mul( dotTH ), alphaT.mul( dotBH ), a2.mul( dotNH ) );
 	const v = vec3( alphaB.mul( dotTH ), alphaT.mul( dotBH ), a2.mul( dotNH ) );

+ 2 - 2
src/nodes/functions/BSDF/EnvironmentBRDF.js

@@ -1,7 +1,7 @@
 import DFGApprox from './DFGApprox.js';
 import DFGApprox from './DFGApprox.js';
-import { tslFn } from '../../shadernode/ShaderNode.js';
+import { Fn } from '../../shadernode/ShaderNode.js';
 
 
-const EnvironmentBRDF = tslFn( ( inputs ) => {
+const EnvironmentBRDF = Fn( ( inputs ) => {
 
 
 	const { dotNV, specularColor, specularF90, roughness } = inputs;
 	const { dotNV, specularColor, specularF90, roughness } = inputs;
 
 

+ 2 - 2
src/nodes/functions/BSDF/F_Schlick.js

@@ -1,6 +1,6 @@
-import { tslFn } from '../../shadernode/ShaderNode.js';
+import { Fn } from '../../shadernode/ShaderNode.js';
 
 
-const F_Schlick = tslFn( ( { f0, f90, dotVH } ) => {
+const F_Schlick = Fn( ( { f0, f90, dotVH } ) => {
 
 
 	// Original approximation by Christophe Schlick '94
 	// Original approximation by Christophe Schlick '94
 	// float fresnel = pow( 1.0 - dotVH, 5.0 );
 	// float fresnel = pow( 1.0 - dotVH, 5.0 );

+ 6 - 6
src/nodes/functions/BSDF/LTC.js

@@ -1,4 +1,4 @@
-import { tslFn, If, mat3, vec2, vec3 } from '../../shadernode/ShaderNode.js';
+import { Fn, If, mat3, vec2, vec3 } from '../../shadernode/ShaderNode.js';
 import { max } from '../../math/MathNode.js';
 import { max } from '../../math/MathNode.js';
 
 
 // Rect Area Light
 // Rect Area Light
@@ -7,7 +7,7 @@ import { max } from '../../math/MathNode.js';
 // by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt
 // by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt
 // code: https://github.com/selfshadow/ltc_code/
 // code: https://github.com/selfshadow/ltc_code/
 
 
-const LTC_Uv = tslFn( ( { N, V, roughness } ) => {
+const LTC_Uv = Fn( ( { N, V, roughness } ) => {
 
 
 	const LUT_SIZE = 64.0;
 	const LUT_SIZE = 64.0;
 	const LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
 	const LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
@@ -32,7 +32,7 @@ const LTC_Uv = tslFn( ( { N, V, roughness } ) => {
 	]
 	]
 } );
 } );
 
 
-const LTC_ClippedSphereFormFactor = tslFn( ( { f } ) => {
+const LTC_ClippedSphereFormFactor = Fn( ( { f } ) => {
 
 
 	// Real-Time Area Lighting: a Journey from Research to Production (p.102)
 	// Real-Time Area Lighting: a Journey from Research to Production (p.102)
 	// An approximation of the form factor of a horizon-clipped rectangle.
 	// An approximation of the form factor of a horizon-clipped rectangle.
@@ -49,7 +49,7 @@ const LTC_ClippedSphereFormFactor = tslFn( ( { f } ) => {
 	]
 	]
 } );
 } );
 
 
-const LTC_EdgeVectorFormFactor = tslFn( ( { v1, v2 } ) => {
+const LTC_EdgeVectorFormFactor = Fn( ( { v1, v2 } ) => {
 
 
 	const x = v1.dot( v2 );
 	const x = v1.dot( v2 );
 	const y = x.abs().toVar();
 	const y = x.abs().toVar();
@@ -59,7 +59,7 @@ const LTC_EdgeVectorFormFactor = tslFn( ( { v1, v2 } ) => {
 	const b = y.add( 4.1616724 ).mul( y ).add( 3.4175940 ).toVar();
 	const b = y.add( 4.1616724 ).mul( y ).add( 3.4175940 ).toVar();
 	const v = a.div( b );
 	const v = a.div( b );
 
 
-	const theta_sintheta = x.greaterThan( 0.0 ).cond( v, max( x.mul( x ).oneMinus(), 1e-7 ).inverseSqrt().mul( 0.5 ).sub( v ) );
+	const theta_sintheta = x.greaterThan( 0.0 ).select( v, max( x.mul( x ).oneMinus(), 1e-7 ).inverseSqrt().mul( 0.5 ).sub( v ) );
 
 
 	return v1.cross( v2 ).mul( theta_sintheta );
 	return v1.cross( v2 ).mul( theta_sintheta );
 
 
@@ -72,7 +72,7 @@ const LTC_EdgeVectorFormFactor = tslFn( ( { v1, v2 } ) => {
 	]
 	]
 } );
 } );
 
 
-const LTC_Evaluate = tslFn( ( { N, V, P, mInv, p0, p1, p2, p3 } ) => {
+const LTC_Evaluate = Fn( ( { N, V, P, mInv, p0, p1, p2, p3 } ) => {
 
 
 	// bail if point is on back side of plane of light
 	// bail if point is on back side of plane of light
 	// assumes ccw winding order of light vertices
 	// assumes ccw winding order of light vertices

+ 2 - 2
src/nodes/functions/BSDF/Schlick_to_F0.js

@@ -1,6 +1,6 @@
-import { tslFn, vec3 } from '../../shadernode/ShaderNode.js';
+import { Fn, vec3 } from '../../shadernode/ShaderNode.js';
 
 
-const Schlick_to_F0 = tslFn( ( { f, f90, dotVH } ) => {
+const Schlick_to_F0 = Fn( ( { f, f90, dotVH } ) => {
 
 
 	const x = dotVH.oneMinus().saturate();
 	const x = dotVH.oneMinus().saturate();
 	const x2 = x.mul( x );
 	const x2 = x.mul( x );

+ 2 - 2
src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js

@@ -1,10 +1,10 @@
 import { div } from '../../math/OperatorNode.js';
 import { div } from '../../math/OperatorNode.js';
 import { EPSILON } from '../../math/MathNode.js';
 import { EPSILON } from '../../math/MathNode.js';
-import { tslFn } from '../../shadernode/ShaderNode.js';
+import { Fn } from '../../shadernode/ShaderNode.js';
 
 
 // Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2
 // Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2
 // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
-const V_GGX_SmithCorrelated = tslFn( ( { alpha, dotNL, dotNV } ) => {
+const V_GGX_SmithCorrelated = Fn( ( { alpha, dotNL, dotNV } ) => {
 
 
 	const a2 = alpha.pow2();
 	const a2 = alpha.pow2();
 
 

+ 2 - 2
src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js

@@ -1,9 +1,9 @@
 import { div } from '../../math/OperatorNode.js';
 import { div } from '../../math/OperatorNode.js';
-import { tslFn, vec3 } from '../../shadernode/ShaderNode.js';
+import { Fn, vec3 } from '../../shadernode/ShaderNode.js';
 
 
 // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
 // https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf
 
 
-const V_GGX_SmithCorrelated_Anisotropic = tslFn( ( { alphaT, alphaB, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL } ) => {
+const V_GGX_SmithCorrelated_Anisotropic = Fn( ( { alphaT, alphaB, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL } ) => {
 
 
 	const gv = dotNL.mul( vec3( alphaT.mul( dotTV ), alphaB.mul( dotBV ), dotNV ).length() );
 	const gv = dotNL.mul( vec3( alphaT.mul( dotTV ), alphaB.mul( dotBV ), dotNV ).length() );
 	const gl = dotNV.mul( vec3( alphaT.mul( dotTL ), alphaB.mul( dotBL ), dotNL ).length() );
 	const gl = dotNV.mul( vec3( alphaT.mul( dotTL ), alphaB.mul( dotBL ), dotNL ).length() );

+ 3 - 3
src/nodes/functions/PhongLightingModel.js

@@ -6,17 +6,17 @@ import { transformedNormalView } from '../accessors/NormalNode.js';
 import { materialSpecularStrength } from '../accessors/MaterialNode.js';
 import { materialSpecularStrength } from '../accessors/MaterialNode.js';
 import { shininess, specularColor } from '../core/PropertyNode.js';
 import { shininess, specularColor } from '../core/PropertyNode.js';
 import { positionViewDirection } from '../accessors/PositionNode.js';
 import { positionViewDirection } from '../accessors/PositionNode.js';
-import { tslFn, float } from '../shadernode/ShaderNode.js';
+import { Fn, float } from '../shadernode/ShaderNode.js';
 
 
 const G_BlinnPhong_Implicit = () => float( 0.25 );
 const G_BlinnPhong_Implicit = () => float( 0.25 );
 
 
-const D_BlinnPhong = tslFn( ( { dotNH } ) => {
+const D_BlinnPhong = Fn( ( { dotNH } ) => {
 
 
 	return shininess.mul( float( 0.5 ) ).add( 1.0 ).mul( float( 1 / Math.PI ) ).mul( dotNH.pow( shininess ) );
 	return shininess.mul( float( 0.5 ) ).add( 1.0 ).mul( float( 1 / Math.PI ) ).mul( dotNH.pow( shininess ) );
 
 
 } );
 } );
 
 
-const BRDF_BlinnPhong = tslFn( ( { lightDirection } ) => {
+const BRDF_BlinnPhong = Fn( ( { lightDirection } ) => {
 
 
 	const halfDir = lightDirection.add( positionViewDirection ).normalize();
 	const halfDir = lightDirection.add( positionViewDirection ).normalize();
 
 

+ 18 - 18
src/nodes/functions/PhysicalLightingModel.js

@@ -10,21 +10,21 @@ import LightingModel from '../core/LightingModel.js';
 import { diffuseColor, specularColor, specularF90, roughness, clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, ior, thickness, transmission, attenuationDistance, attenuationColor, dispersion } from '../core/PropertyNode.js';
 import { diffuseColor, specularColor, specularF90, roughness, clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, ior, thickness, transmission, attenuationDistance, attenuationColor, dispersion } from '../core/PropertyNode.js';
 import { transformedNormalView, transformedClearcoatNormalView, transformedNormalWorld } from '../accessors/NormalNode.js';
 import { transformedNormalView, transformedClearcoatNormalView, transformedNormalWorld } from '../accessors/NormalNode.js';
 import { positionViewDirection, positionView, positionWorld } from '../accessors/PositionNode.js';
 import { positionViewDirection, positionView, positionWorld } from '../accessors/PositionNode.js';
-import { tslFn, float, vec2, vec3, vec4, mat3, If } from '../shadernode/ShaderNode.js';
-import { cond } from '../math/CondNode.js';
+import { Fn, float, vec2, vec3, vec4, mat3, If } from '../shadernode/ShaderNode.js';
+import { select } from '../math/CondNode.js';
 import { mix, normalize, refract, length, clamp, log2, log, exp, smoothstep } from '../math/MathNode.js';
 import { mix, normalize, refract, length, clamp, log2, log, exp, smoothstep } from '../math/MathNode.js';
 import { div } from '../math/OperatorNode.js';
 import { div } from '../math/OperatorNode.js';
 import { cameraPosition, cameraProjectionMatrix, cameraViewMatrix } from '../accessors/CameraNode.js';
 import { cameraPosition, cameraProjectionMatrix, cameraViewMatrix } from '../accessors/CameraNode.js';
 import { modelWorldMatrix } from '../accessors/ModelNode.js';
 import { modelWorldMatrix } from '../accessors/ModelNode.js';
 import { viewportResolution } from '../display/ViewportNode.js';
 import { viewportResolution } from '../display/ViewportNode.js';
 import { viewportMipTexture } from '../display/ViewportTextureNode.js';
 import { viewportMipTexture } from '../display/ViewportTextureNode.js';
-import { loop } from '../utils/LoopNode.js';
+import { Loop } from '../utils/LoopNode.js';
 
 
 //
 //
 // Transmission
 // Transmission
 //
 //
 
 
-const getVolumeTransmissionRay = tslFn( ( [ n, v, thickness, ior, modelMatrix ] ) => {
+const getVolumeTransmissionRay = Fn( ( [ n, v, thickness, ior, modelMatrix ] ) => {
 
 
 	// Direction of refracted light.
 	// Direction of refracted light.
 	const refractionVector = vec3( refract( v.negate(), normalize( n ), div( 1.0, ior ) ) );
 	const refractionVector = vec3( refract( v.negate(), normalize( n ), div( 1.0, ior ) ) );
@@ -51,7 +51,7 @@ const getVolumeTransmissionRay = tslFn( ( [ n, v, thickness, ior, modelMatrix ]
 	]
 	]
 } );
 } );
 
 
-const applyIorToRoughness = tslFn( ( [ roughness, ior ] ) => {
+const applyIorToRoughness = Fn( ( [ roughness, ior ] ) => {
 
 
 	// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
 	// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
 	// an IOR of 1.5 results in the default amount of microfacet refraction.
 	// an IOR of 1.5 results in the default amount of microfacet refraction.
@@ -68,7 +68,7 @@ const applyIorToRoughness = tslFn( ( [ roughness, ior ] ) => {
 
 
 const singleViewportMipTexture = viewportMipTexture();
 const singleViewportMipTexture = viewportMipTexture();
 
 
-const getTransmissionSample = tslFn( ( [ fragCoord, roughness, ior ] ) => {
+const getTransmissionSample = Fn( ( [ fragCoord, roughness, ior ] ) => {
 
 
 	const transmissionSample = singleViewportMipTexture.uv( fragCoord );
 	const transmissionSample = singleViewportMipTexture.uv( fragCoord );
 	//const transmissionSample = viewportMipTexture( fragCoord );
 	//const transmissionSample = viewportMipTexture( fragCoord );
@@ -79,7 +79,7 @@ const getTransmissionSample = tslFn( ( [ fragCoord, roughness, ior ] ) => {
 
 
 } );
 } );
 
 
-const volumeAttenuation = tslFn( ( [ transmissionDistance, attenuationColor, attenuationDistance ] ) => {
+const volumeAttenuation = Fn( ( [ transmissionDistance, attenuationColor, attenuationDistance ] ) => {
 
 
 	If( attenuationDistance.notEqual( 0 ), () => {
 	If( attenuationDistance.notEqual( 0 ), () => {
 
 
@@ -104,7 +104,7 @@ const volumeAttenuation = tslFn( ( [ transmissionDistance, attenuationColor, att
 	]
 	]
 } );
 } );
 
 
-const getIBLVolumeRefraction = tslFn( ( [ n, v, roughness, diffuseColor, specularColor, specularF90, position, modelMatrix, viewMatrix, projMatrix, ior, thickness, attenuationColor, attenuationDistance, dispersion ] ) => {
+const getIBLVolumeRefraction = Fn( ( [ n, v, roughness, diffuseColor, specularColor, specularF90, position, modelMatrix, viewMatrix, projMatrix, ior, thickness, attenuationColor, attenuationDistance, dispersion ] ) => {
 
 
 	let transmittedLight, transmittance;
 	let transmittedLight, transmittance;
 
 
@@ -116,7 +116,7 @@ const getIBLVolumeRefraction = tslFn( ( [ n, v, roughness, diffuseColor, specula
 		const halfSpread = ior.sub( 1.0 ).mul( dispersion.mul( 0.025 ) );
 		const halfSpread = ior.sub( 1.0 ).mul( dispersion.mul( 0.025 ) );
 		const iors = vec3( ior.sub( halfSpread ), ior, ior.add( halfSpread ) );
 		const iors = vec3( ior.sub( halfSpread ), ior, ior.add( halfSpread ) );
 
 
-		loop( { start: 0, end: 3 }, ( { i } ) => {
+		Loop( { start: 0, end: 3 }, ( { i } ) => {
 
 
 			const ior = iors.element( i );
 			const ior = iors.element( i );
 
 
@@ -227,7 +227,7 @@ const evalSensitivity = ( OPD, shift ) => {
 
 
 };
 };
 
 
-const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThickness, baseF0 } ) => {
+const evalIridescence = Fn( ( { outsideIOR, eta2, cosTheta1, thinFilmThickness, baseF0 } ) => {
 
 
 	// Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0
 	// Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0
 	const iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
 	const iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
@@ -249,7 +249,7 @@ const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThicknes
 	const R12 = F_Schlick( { f0: R0, f90: 1.0, dotVH: cosTheta1 } );
 	const R12 = F_Schlick( { f0: R0, f90: 1.0, dotVH: cosTheta1 } );
 	//const R21 = R12;
 	//const R21 = R12;
 	const T121 = R12.oneMinus();
 	const T121 = R12.oneMinus();
-	const phi12 = iridescenceIOR.lessThan( outsideIOR ).cond( Math.PI, 0.0 );
+	const phi12 = iridescenceIOR.lessThan( outsideIOR ).select( Math.PI, 0.0 );
 	const phi21 = float( Math.PI ).sub( phi12 );
 	const phi21 = float( Math.PI ).sub( phi12 );
 
 
 	// Second interface
 	// Second interface
@@ -257,9 +257,9 @@ const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThicknes
 	const R1 = IorToFresnel0( baseIOR, iridescenceIOR.toVec3() );
 	const R1 = IorToFresnel0( baseIOR, iridescenceIOR.toVec3() );
 	const R23 = F_Schlick( { f0: R1, f90: 1.0, dotVH: cosTheta2 } );
 	const R23 = F_Schlick( { f0: R1, f90: 1.0, dotVH: cosTheta2 } );
 	const phi23 = vec3(
 	const phi23 = vec3(
-		baseIOR.x.lessThan( iridescenceIOR ).cond( Math.PI, 0.0 ),
-		baseIOR.y.lessThan( iridescenceIOR ).cond( Math.PI, 0.0 ),
-		baseIOR.z.lessThan( iridescenceIOR ).cond( Math.PI, 0.0 )
+		baseIOR.x.lessThan( iridescenceIOR ).select( Math.PI, 0.0 ),
+		baseIOR.y.lessThan( iridescenceIOR ).select( Math.PI, 0.0 ),
+		baseIOR.z.lessThan( iridescenceIOR ).select( Math.PI, 0.0 )
 	);
 	);
 
 
 	// Phase shift
 	// Phase shift
@@ -307,25 +307,25 @@ const evalIridescence = tslFn( ( { outsideIOR, eta2, cosTheta1, thinFilmThicknes
 // This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from
 // This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from
 // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found
 // Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found
 // in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
 // in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
-const IBLSheenBRDF = tslFn( ( { normal, viewDir, roughness } ) => {
+const IBLSheenBRDF = Fn( ( { normal, viewDir, roughness } ) => {
 
 
 	const dotNV = normal.dot( viewDir ).saturate();
 	const dotNV = normal.dot( viewDir ).saturate();
 
 
 	const r2 = roughness.pow2();
 	const r2 = roughness.pow2();
 
 
-	const a = cond(
+	const a = select(
 		roughness.lessThan( 0.25 ),
 		roughness.lessThan( 0.25 ),
 		float( - 339.2 ).mul( r2 ).add( float( 161.4 ).mul( roughness ) ).sub( 25.9 ),
 		float( - 339.2 ).mul( r2 ).add( float( 161.4 ).mul( roughness ) ).sub( 25.9 ),
 		float( - 8.48 ).mul( r2 ).add( float( 14.3 ).mul( roughness ) ).sub( 9.95 )
 		float( - 8.48 ).mul( r2 ).add( float( 14.3 ).mul( roughness ) ).sub( 9.95 )
 	);
 	);
 
 
-	const b = cond(
+	const b = select(
 		roughness.lessThan( 0.25 ),
 		roughness.lessThan( 0.25 ),
 		float( 44.0 ).mul( r2 ).sub( float( 23.7 ).mul( roughness ) ).add( 3.26 ),
 		float( 44.0 ).mul( r2 ).sub( float( 23.7 ).mul( roughness ) ).add( 3.26 ),
 		float( 1.97 ).mul( r2 ).sub( float( 3.27 ).mul( roughness ) ).add( 0.72 )
 		float( 1.97 ).mul( r2 ).sub( float( 3.27 ).mul( roughness ) ).add( 0.72 )
 	);
 	);
 
 
-	const DG = cond( roughness.lessThan( 0.25 ), 0.0, float( 0.1 ).mul( roughness ).sub( 0.025 ) ).add( a.mul( dotNV ).add( b ).exp() );
+	const DG = select( roughness.lessThan( 0.25 ), 0.0, float( 0.1 ).mul( roughness ).sub( 0.025 ) ).add( a.mul( dotNV ).add( b ).exp() );
 
 
 	return DG.mul( 1.0 / Math.PI ).saturate();
 	return DG.mul( 1.0 / Math.PI ).saturate();
 
 

+ 2 - 2
src/nodes/functions/ToonLightingModel.js

@@ -2,11 +2,11 @@ import LightingModel from '../core/LightingModel.js';
 import BRDF_Lambert from './BSDF/BRDF_Lambert.js';
 import BRDF_Lambert from './BSDF/BRDF_Lambert.js';
 import { diffuseColor } from '../core/PropertyNode.js';
 import { diffuseColor } from '../core/PropertyNode.js';
 import { normalGeometry } from '../accessors/NormalNode.js';
 import { normalGeometry } from '../accessors/NormalNode.js';
-import { tslFn, float, vec2, vec3 } from '../shadernode/ShaderNode.js';
+import { Fn, float, vec2, vec3 } from '../shadernode/ShaderNode.js';
 import { mix, smoothstep } from '../math/MathNode.js';
 import { mix, smoothstep } from '../math/MathNode.js';
 import { materialReference } from '../accessors/MaterialReferenceNode.js';
 import { materialReference } from '../accessors/MaterialReferenceNode.js';
 
 
-const getGradientIrradiance = tslFn( ( { normal, lightDirection, builder } ) => {
+const getGradientIrradiance = Fn( ( { normal, lightDirection, builder } ) => {
 
 
 	// dotNL will be from -1.0 to 1.0
 	// dotNL will be from -1.0 to 1.0
 	const dotNL = normal.dot( lightDirection );
 	const dotNL = normal.dot( lightDirection );

+ 2 - 2
src/nodes/functions/material/getGeometryRoughness.js

@@ -1,7 +1,7 @@
 import { normalGeometry } from '../../accessors/NormalNode.js';
 import { normalGeometry } from '../../accessors/NormalNode.js';
-import { tslFn } from '../../shadernode/ShaderNode.js';
+import { Fn } from '../../shadernode/ShaderNode.js';
 
 
-const getGeometryRoughness = tslFn( () => {
+const getGeometryRoughness = Fn( () => {
 
 
 	const dxy = normalGeometry.dFdx().abs().max( normalGeometry.dFdy().abs() );
 	const dxy = normalGeometry.dFdx().abs().max( normalGeometry.dFdy().abs() );
 	const geometryRoughness = dxy.x.max( dxy.y ).max( dxy.z );
 	const geometryRoughness = dxy.x.max( dxy.y ).max( dxy.z );

+ 2 - 2
src/nodes/functions/material/getRoughness.js

@@ -1,7 +1,7 @@
 import getGeometryRoughness from './getGeometryRoughness.js';
 import getGeometryRoughness from './getGeometryRoughness.js';
-import { tslFn } from '../../shadernode/ShaderNode.js';
+import { Fn } from '../../shadernode/ShaderNode.js';
 
 
-const getRoughness = tslFn( ( inputs ) => {
+const getRoughness = Fn( ( inputs ) => {
 
 
 	const { roughness } = inputs;
 	const { roughness } = inputs;
 
 

+ 5 - 5
src/nodes/lighting/AnalyticLightNode.js

@@ -11,16 +11,16 @@ import { mix, fract } from '../math/MathNode.js';
 import { add } from '../math/OperatorNode.js';
 import { add } from '../math/OperatorNode.js';
 import { Color } from '../../math/Color.js';
 import { Color } from '../../math/Color.js';
 import { DepthTexture } from '../../textures/DepthTexture.js';
 import { DepthTexture } from '../../textures/DepthTexture.js';
-import { tslFn } from '../shadernode/ShaderNode.js';
+import { Fn } from '../shadernode/ShaderNode.js';
 import { LessCompare, WebGPUCoordinateSystem } from '../../constants.js';
 import { LessCompare, WebGPUCoordinateSystem } from '../../constants.js';
 
 
-const BasicShadowMap = tslFn( ( { depthTexture, shadowCoord } ) => {
+const BasicShadowMap = Fn( ( { depthTexture, shadowCoord } ) => {
 
 
 	return texture( depthTexture, shadowCoord.xy ).compare( shadowCoord.z );
 	return texture( depthTexture, shadowCoord.xy ).compare( shadowCoord.z );
 
 
 } );
 } );
 
 
-const PCFShadowMap = tslFn( ( { depthTexture, shadowCoord, shadow } ) => {
+const PCFShadowMap = Fn( ( { depthTexture, shadowCoord, shadow } ) => {
 
 
 	const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare );
 	const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare );
 
 
@@ -59,7 +59,7 @@ const PCFShadowMap = tslFn( ( { depthTexture, shadowCoord, shadow } ) => {
 
 
 } );
 } );
 
 
-const PCFSoftShadowMap = tslFn( ( { depthTexture, shadowCoord, shadow } ) => {
+const PCFSoftShadowMap = Fn( ( { depthTexture, shadowCoord, shadow } ) => {
 
 
 	const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare );
 	const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare );
 
 
@@ -223,7 +223,7 @@ class AnalyticLightNode extends LightingNode {
 			}
 			}
 
 
 			const shadowColor = texture( shadowMap.texture, shadowCoord );
 			const shadowColor = texture( shadowMap.texture, shadowCoord );
-			const shadowNode = frustumTest.cond( filterFn( { depthTexture, shadowCoord, shadow } ), float( 1 ) );
+			const shadowNode = frustumTest.select( filterFn( { depthTexture, shadowCoord, shadow } ), float( 1 ) );
 
 
 			this.shadowMap = shadowMap;
 			this.shadowMap = shadowMap;
 
 

+ 3 - 3
src/nodes/lighting/LightUtils.js

@@ -1,6 +1,6 @@
-import { tslFn } from '../shadernode/ShaderNode.js';
+import { Fn } from '../shadernode/ShaderNode.js';
 
 
-export const getDistanceAttenuation = tslFn( ( inputs ) => {
+export const getDistanceAttenuation = Fn( ( inputs ) => {
 
 
 	const { lightDistance, cutoffDistance, decayExponent } = inputs;
 	const { lightDistance, cutoffDistance, decayExponent } = inputs;
 
 
@@ -9,7 +9,7 @@ export const getDistanceAttenuation = tslFn( ( inputs ) => {
 	// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 	// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
 	const distanceFalloff = lightDistance.pow( decayExponent ).max( 0.01 ).reciprocal();
 	const distanceFalloff = lightDistance.pow( decayExponent ).max( 0.01 ).reciprocal();
 
 
-	return cutoffDistance.greaterThan( 0 ).cond(
+	return cutoffDistance.greaterThan( 0 ).select(
 		distanceFalloff.mul( lightDistance.div( cutoffDistance ).pow4().oneMinus().clamp().pow2() ),
 		distanceFalloff.mul( lightDistance.div( cutoffDistance ).pow4().oneMinus().clamp().pow2() ),
 		distanceFalloff
 		distanceFalloff
 	);
 	);

+ 3 - 3
src/nodes/materials/InstancedPointsNodeMaterial.js

@@ -7,7 +7,7 @@ import { materialColor, materialPointWidth } from '../accessors/MaterialNode.js'
 import { modelViewMatrix } from '../accessors/ModelNode.js';
 import { modelViewMatrix } from '../accessors/ModelNode.js';
 import { positionGeometry } from '../accessors/PositionNode.js';
 import { positionGeometry } from '../accessors/PositionNode.js';
 import { smoothstep } from '../math/MathNode.js';
 import { smoothstep } from '../math/MathNode.js';
-import { tslFn, vec2, vec4 } from '../shadernode/ShaderNode.js';
+import { Fn, vec2, vec4 } from '../shadernode/ShaderNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { viewport } from '../display/ViewportNode.js';
 import { viewport } from '../display/ViewportNode.js';
 
 
@@ -46,7 +46,7 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
 		const useAlphaToCoverage = this.alphaToCoverage;
 		const useAlphaToCoverage = this.alphaToCoverage;
 		const useColor = this.useColor;
 		const useColor = this.useColor;
 
 
-		this.vertexNode = tslFn( () => {
+		this.vertexNode = Fn( () => {
 
 
 			//vUv = uv;
 			//vUv = uv;
 			varying( vec2(), 'vUv' ).assign( uv() ); // @TODO: Analyze other way to do this
 			varying( vec2(), 'vUv' ).assign( uv() ); // @TODO: Analyze other way to do this
@@ -81,7 +81,7 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
 
 
 		} )();
 		} )();
 
 
-		this.fragmentNode = tslFn( () => {
+		this.fragmentNode = Fn( () => {
 
 
 			const vUv = varying( vec2(), 'vUv' );
 			const vUv = varying( vec2(), 'vUv' );
 
 

+ 17 - 17
src/nodes/materials/Line2NodeMaterial.js

@@ -8,7 +8,7 @@ import { materialColor, materialLineScale, materialLineDashSize, materialLineGap
 import { modelViewMatrix } from '../accessors/ModelNode.js';
 import { modelViewMatrix } from '../accessors/ModelNode.js';
 import { positionGeometry } from '../accessors/PositionNode.js';
 import { positionGeometry } from '../accessors/PositionNode.js';
 import { mix, smoothstep } from '../math/MathNode.js';
 import { mix, smoothstep } from '../math/MathNode.js';
-import { tslFn, float, vec2, vec3, vec4, If } from '../shadernode/ShaderNode.js';
+import { Fn, float, vec2, vec3, vec4, If } from '../shadernode/ShaderNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { viewport } from '../display/ViewportNode.js';
 import { viewport } from '../display/ViewportNode.js';
 import { dashSize, gapSize } from '../core/PropertyNode.js';
 import { dashSize, gapSize } from '../core/PropertyNode.js';
@@ -62,7 +62,7 @@ class Line2NodeMaterial extends NodeMaterial {
 		const useDash = this.dashed;
 		const useDash = this.dashed;
 		const useWorldUnits = this.worldUnits;
 		const useWorldUnits = this.worldUnits;
 
 
-		const trimSegment = tslFn( ( { start, end } ) => {
+		const trimSegment = Fn( ( { start, end } ) => {
 
 
 			const a = cameraProjectionMatrix.element( 2 ).element( 2 ); // 3nd entry in 3th column
 			const a = cameraProjectionMatrix.element( 2 ).element( 2 ); // 3nd entry in 3th column
 			const b = cameraProjectionMatrix.element( 3 ).element( 2 ); // 3nd entry in 4th column
 			const b = cameraProjectionMatrix.element( 3 ).element( 2 ); // 3nd entry in 4th column
@@ -74,7 +74,7 @@ class Line2NodeMaterial extends NodeMaterial {
 
 
 		} );
 		} );
 
 
-		this.vertexNode = tslFn( () => {
+		this.vertexNode = Fn( () => {
 
 
 			varyingProperty( 'vec2', 'vUv' ).assign( uv() );
 			varyingProperty( 'vec2', 'vUv' ).assign( uv() );
 
 
@@ -111,7 +111,7 @@ class Line2NodeMaterial extends NodeMaterial {
 
 
 					end.assign( trimSegment( { start: start, end: end } ) );
 					end.assign( trimSegment( { start: start, end: end } ) );
 
 
-				} ).elseif( end.z.lessThan( 0.0 ).and( start.z.greaterThanEqual( 0.0 ) ), () => {
+				} ).ElseIf( end.z.lessThan( 0.0 ).and( start.z.greaterThanEqual( 0.0 ) ), () => {
 
 
 					start.assign( trimSegment( { start: end, end: start } ) );
 					start.assign( trimSegment( { start: end, end: start } ) );
 
 
@@ -147,18 +147,18 @@ class Line2NodeMaterial extends NodeMaterial {
 
 
 				const worldPos = varyingProperty( 'vec4', 'worldPos' );
 				const worldPos = varyingProperty( 'vec4', 'worldPos' );
 
 
-				worldPos.assign( positionGeometry.y.lessThan( 0.5 ).cond( start, end ) );
+				worldPos.assign( positionGeometry.y.lessThan( 0.5 ).select( start, end ) );
 
 
 				// height offset
 				// height offset
 				const hw = materialLineWidth.mul( 0.5 );
 				const hw = materialLineWidth.mul( 0.5 );
-				worldPos.addAssign( vec4( positionGeometry.x.lessThan( 0.0 ).cond( worldUp.mul( hw ), worldUp.mul( hw ).negate() ), 0 ) );
+				worldPos.addAssign( vec4( positionGeometry.x.lessThan( 0.0 ).select( worldUp.mul( hw ), worldUp.mul( hw ).negate() ), 0 ) );
 
 
 				// don't extend the line if we're rendering dashes because we
 				// don't extend the line if we're rendering dashes because we
 				// won't be rendering the endcaps
 				// won't be rendering the endcaps
 				if ( ! useDash ) {
 				if ( ! useDash ) {
 
 
 					// cap extension
 					// cap extension
-					worldPos.addAssign( vec4( positionGeometry.y.lessThan( 0.5 ).cond( worldDir.mul( hw ).negate(), worldDir.mul( hw ) ), 0 ) );
+					worldPos.addAssign( vec4( positionGeometry.y.lessThan( 0.5 ).select( worldDir.mul( hw ).negate(), worldDir.mul( hw ) ), 0 ) );
 
 
 					// add width to the box
 					// add width to the box
 					worldPos.addAssign( vec4( worldFwd.mul( hw ), 0 ) );
 					worldPos.addAssign( vec4( worldFwd.mul( hw ), 0 ) );
@@ -179,7 +179,7 @@ class Line2NodeMaterial extends NodeMaterial {
 				// segments overlap neatly
 				// segments overlap neatly
 				const clipPose = temp( vec3() );
 				const clipPose = temp( vec3() );
 
 
-				clipPose.assign( positionGeometry.y.lessThan( 0.5 ).cond( ndcStart, ndcEnd ) );
+				clipPose.assign( positionGeometry.y.lessThan( 0.5 ).select( ndcStart, ndcEnd ) );
 				clip.z.assign( clipPose.z.mul( clip.w ) );
 				clip.z.assign( clipPose.z.mul( clip.w ) );
 
 
 			} else {
 			} else {
@@ -193,14 +193,14 @@ class Line2NodeMaterial extends NodeMaterial {
 				offset.x.assign( offset.x.div( aspect ) );
 				offset.x.assign( offset.x.div( aspect ) );
 
 
 				// sign flip
 				// sign flip
-				offset.assign( positionGeometry.x.lessThan( 0.0 ).cond( offset.negate(), offset ) );
+				offset.assign( positionGeometry.x.lessThan( 0.0 ).select( offset.negate(), offset ) );
 
 
 				// endcaps
 				// endcaps
 				If( positionGeometry.y.lessThan( 0.0 ), () => {
 				If( positionGeometry.y.lessThan( 0.0 ), () => {
 
 
 					offset.assign( offset.sub( dir ) );
 					offset.assign( offset.sub( dir ) );
 
 
-				} ).elseif( positionGeometry.y.greaterThan( 1.0 ), () => {
+				} ).ElseIf( positionGeometry.y.greaterThan( 1.0 ), () => {
 
 
 					offset.assign( offset.add( dir ) );
 					offset.assign( offset.add( dir ) );
 
 
@@ -213,7 +213,7 @@ class Line2NodeMaterial extends NodeMaterial {
 				offset.assign( offset.div( viewport.w ) );
 				offset.assign( offset.div( viewport.w ) );
 
 
 				// select end
 				// select end
-				clip.assign( positionGeometry.y.lessThan( 0.5 ).cond( clipStart, clipEnd ) );
+				clip.assign( positionGeometry.y.lessThan( 0.5 ).select( clipStart, clipEnd ) );
 
 
 				// back to clip space
 				// back to clip space
 				offset.assign( offset.mul( clip.w ) );
 				offset.assign( offset.mul( clip.w ) );
@@ -226,7 +226,7 @@ class Line2NodeMaterial extends NodeMaterial {
 
 
 		} )();
 		} )();
 
 
-		const closestLineToLine = tslFn( ( { p1, p2, p3, p4 } ) => {
+		const closestLineToLine = Fn( ( { p1, p2, p3, p4 } ) => {
 
 
 			const p13 = p1.sub( p3 );
 			const p13 = p1.sub( p3 );
 			const p43 = p4.sub( p3 );
 			const p43 = p4.sub( p3 );
@@ -249,7 +249,7 @@ class Line2NodeMaterial extends NodeMaterial {
 
 
 		} );
 		} );
 
 
-		this.fragmentNode = tslFn( () => {
+		this.fragmentNode = Fn( () => {
 
 
 			const vUv = varyingProperty( 'vec2', 'vUv' );
 			const vUv = varyingProperty( 'vec2', 'vUv' );
 
 
@@ -266,7 +266,7 @@ class Line2NodeMaterial extends NodeMaterial {
 				const instanceDistanceStart = attribute( 'instanceDistanceStart' );
 				const instanceDistanceStart = attribute( 'instanceDistanceStart' );
 				const instanceDistanceEnd = attribute( 'instanceDistanceEnd' );
 				const instanceDistanceEnd = attribute( 'instanceDistanceEnd' );
 
 
-				const lineDistance = positionGeometry.y.lessThan( 0.5 ).cond( dashScaleNode.mul( instanceDistanceStart ), materialLineScale.mul( instanceDistanceEnd ) );
+				const lineDistance = positionGeometry.y.lessThan( 0.5 ).select( dashScaleNode.mul( instanceDistanceStart ), materialLineScale.mul( instanceDistanceEnd ) );
 
 
 				const vLineDistance = varying( lineDistance.add( materialLineDashOffset ) );
 				const vLineDistance = varying( lineDistance.add( materialLineDashOffset ) );
 				const vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;
 				const vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;
@@ -318,7 +318,7 @@ class Line2NodeMaterial extends NodeMaterial {
 				if ( useAlphaToCoverage ) {
 				if ( useAlphaToCoverage ) {
 
 
 					const a = vUv.x;
 					const a = vUv.x;
-					const b = vUv.y.greaterThan( 0.0 ).cond( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
+					const b = vUv.y.greaterThan( 0.0 ).select( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
 
 
 					const len2 = a.mul( a ).add( b.mul( b ) );
 					const len2 = a.mul( a ).add( b.mul( b ) );
 
 
@@ -337,7 +337,7 @@ class Line2NodeMaterial extends NodeMaterial {
 					If( vUv.y.abs().greaterThan( 1.0 ), () => {
 					If( vUv.y.abs().greaterThan( 1.0 ), () => {
 
 
 						const a = vUv.x;
 						const a = vUv.x;
-						const b = vUv.y.greaterThan( 0.0 ).cond( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
+						const b = vUv.y.greaterThan( 0.0 ).select( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
 						const len2 = a.mul( a ).add( b.mul( b ) );
 						const len2 = a.mul( a ).add( b.mul( b ) );
 
 
 						len2.greaterThan( 1.0 ).discard();
 						len2.greaterThan( 1.0 ).discard();
@@ -361,7 +361,7 @@ class Line2NodeMaterial extends NodeMaterial {
 					const instanceColorStart = attribute( 'instanceColorStart' );
 					const instanceColorStart = attribute( 'instanceColorStart' );
 					const instanceColorEnd = attribute( 'instanceColorEnd' );
 					const instanceColorEnd = attribute( 'instanceColorEnd' );
 
 
-					const instanceColor = positionGeometry.y.lessThan( 0.5 ).cond( instanceColorStart, instanceColorEnd );
+					const instanceColor = positionGeometry.y.lessThan( 0.5 ).select( instanceColorStart, instanceColorEnd );
 
 
 					lineColorNode = instanceColor.mul( materialColor );
 					lineColorNode = instanceColor.mul( materialColor );
 
 

+ 1 - 1
src/nodes/materials/MeshPhysicalNodeMaterial.js

@@ -156,7 +156,7 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
 
 
 				anisotropyV.assign( vec2( 1.0, 0.0 ) );
 				anisotropyV.assign( vec2( 1.0, 0.0 ) );
 
 
-			} ).else( () => {
+			} ).Else( () => {
 
 
 				anisotropyV.divAssign( vec2( anisotropy ) );
 				anisotropyV.divAssign( vec2( anisotropy ) );
 				anisotropy.assign( anisotropy.saturate() );
 				anisotropy.assign( anisotropy.saturate() );

+ 5 - 5
src/nodes/materials/VolumeNodeMaterial.js

@@ -5,9 +5,9 @@ import { materialReference } from '../accessors/MaterialReferenceNode.js';
 import { modelWorldMatrixInverse } from '../accessors/ModelNode.js';
 import { modelWorldMatrixInverse } from '../accessors/ModelNode.js';
 import { cameraPosition } from '../accessors/CameraNode.js';
 import { cameraPosition } from '../accessors/CameraNode.js';
 import { positionGeometry } from '../accessors/PositionNode.js';
 import { positionGeometry } from '../accessors/PositionNode.js';
-import { tslFn, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
+import { Fn, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
 import { min, max } from '../math/MathNode.js';
 import { min, max } from '../math/MathNode.js';
-import { loop, Break } from '../utils/LoopNode.js';
+import { Loop, Break } from '../utils/LoopNode.js';
 import { texture3D } from '../accessors/Texture3DNode.js';
 import { texture3D } from '../accessors/Texture3DNode.js';
 
 
 class VolumeNodeMaterial extends NodeMaterial {
 class VolumeNodeMaterial extends NodeMaterial {
@@ -29,7 +29,7 @@ class VolumeNodeMaterial extends NodeMaterial {
 
 
 		const map = texture3D( this.map, null, 0 );
 		const map = texture3D( this.map, null, 0 );
 
 
-		const hitBox = tslFn( ( { orig, dir } ) => {
+		const hitBox = Fn( ( { orig, dir } ) => {
 
 
 			const box_min = vec3( - 0.5 );
 			const box_min = vec3( - 0.5 );
 			const box_max = vec3( 0.5 );
 			const box_max = vec3( 0.5 );
@@ -49,7 +49,7 @@ class VolumeNodeMaterial extends NodeMaterial {
 
 
 		} );
 		} );
 
 
-		this.fragmentNode = tslFn( () => {
+		this.fragmentNode = Fn( () => {
 
 
 			const vOrigin = varying( vec3( modelWorldMatrixInverse.mul( vec4( cameraPosition, 1.0 ) ) ) );
 			const vOrigin = varying( vec3( modelWorldMatrixInverse.mul( vec4( cameraPosition, 1.0 ) ) ) );
 			const vDirection = varying( positionGeometry.sub( vOrigin ) );
 			const vDirection = varying( positionGeometry.sub( vOrigin ) );
@@ -69,7 +69,7 @@ class VolumeNodeMaterial extends NodeMaterial {
 
 
 			const ac = property( 'vec4', 'ac' ).assign( vec4( materialReference( 'base', 'color' ), 0.0 ) );
 			const ac = property( 'vec4', 'ac' ).assign( vec4( materialReference( 'base', 'color' ), 0.0 ) );
 
 
-			loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= delta' }, () => {
+			Loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= delta' }, () => {
 
 
 				const d = property( 'float', 'd' ).assign( map.uv( p.add( 0.5 ) ).r );
 				const d = property( 'float', 'd' ).assign( map.uv( p.add( 0.5 ) ).r );
 
 

+ 12 - 12
src/nodes/materialx/lib/mx_hsv.js

@@ -1,11 +1,11 @@
 // Three.js Transpiler
 // Three.js Transpiler
 // https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genglsl/lib/mx_hsv.glsl
 // https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genglsl/lib/mx_hsv.glsl
 
 
-import { int, float, vec3, If, tslFn } from '../../shadernode/ShaderNode.js';
+import { int, float, vec3, If, Fn } from '../../shadernode/ShaderNode.js';
 import { add, sub, mul } from '../../math/OperatorNode.js';
 import { add, sub, mul } from '../../math/OperatorNode.js';
 import { floor, trunc, max, min } from '../../math/MathNode.js';
 import { floor, trunc, max, min } from '../../math/MathNode.js';
 
 
-export const mx_hsvtorgb = /*#__PURE__*/ tslFn( ( [ hsv_immutable ] ) => {
+export const mx_hsvtorgb = /*#__PURE__*/ Fn( ( [ hsv_immutable ] ) => {
 
 
 	const hsv = vec3( hsv_immutable ).toVar();
 	const hsv = vec3( hsv_immutable ).toVar();
 	const h = float( hsv.x ).toVar();
 	const h = float( hsv.x ).toVar();
@@ -16,7 +16,7 @@ export const mx_hsvtorgb = /*#__PURE__*/ tslFn( ( [ hsv_immutable ] ) => {
 
 
 		return vec3( v, v, v );
 		return vec3( v, v, v );
 
 
-	} ).else( () => {
+	} ).Else( () => {
 
 
 		h.assign( mul( 6.0, h.sub( floor( h ) ) ) );
 		h.assign( mul( 6.0, h.sub( floor( h ) ) ) );
 		const hi = int( trunc( h ) ).toVar();
 		const hi = int( trunc( h ) ).toVar();
@@ -29,19 +29,19 @@ export const mx_hsvtorgb = /*#__PURE__*/ tslFn( ( [ hsv_immutable ] ) => {
 
 
 			return vec3( v, t, p );
 			return vec3( v, t, p );
 
 
-		} ).elseif( hi.equal( int( 1 ) ), () => {
+		} ).ElseIf( hi.equal( int( 1 ) ), () => {
 
 
 			return vec3( q, v, p );
 			return vec3( q, v, p );
 
 
-		} ).elseif( hi.equal( int( 2 ) ), () => {
+		} ).ElseIf( hi.equal( int( 2 ) ), () => {
 
 
 			return vec3( p, v, t );
 			return vec3( p, v, t );
 
 
-		} ).elseif( hi.equal( int( 3 ) ), () => {
+		} ).ElseIf( hi.equal( int( 3 ) ), () => {
 
 
 			return vec3( p, q, v );
 			return vec3( p, q, v );
 
 
-		} ).elseif( hi.equal( int( 4 ) ), () => {
+		} ).ElseIf( hi.equal( int( 4 ) ), () => {
 
 
 			return vec3( t, p, v );
 			return vec3( t, p, v );
 
 
@@ -59,7 +59,7 @@ export const mx_hsvtorgb = /*#__PURE__*/ tslFn( ( [ hsv_immutable ] ) => {
 	]
 	]
 } );
 } );
 
 
-export const mx_rgbtohsv = /*#__PURE__*/ tslFn( ( [ c_immutable ] ) => {
+export const mx_rgbtohsv = /*#__PURE__*/ Fn( ( [ c_immutable ] ) => {
 
 
 	const c = vec3( c_immutable ).toVar();
 	const c = vec3( c_immutable ).toVar();
 	const r = float( c.x ).toVar();
 	const r = float( c.x ).toVar();
@@ -75,7 +75,7 @@ export const mx_rgbtohsv = /*#__PURE__*/ tslFn( ( [ c_immutable ] ) => {
 
 
 		s.assign( delta.div( maxcomp ) );
 		s.assign( delta.div( maxcomp ) );
 
 
-	} ).else( () => {
+	} ).Else( () => {
 
 
 		s.assign( 0.0 );
 		s.assign( 0.0 );
 
 
@@ -85,17 +85,17 @@ export const mx_rgbtohsv = /*#__PURE__*/ tslFn( ( [ c_immutable ] ) => {
 
 
 		h.assign( 0.0 );
 		h.assign( 0.0 );
 
 
-	} ).else( () => {
+	} ).Else( () => {
 
 
 		If( r.greaterThanEqual( maxcomp ), () => {
 		If( r.greaterThanEqual( maxcomp ), () => {
 
 
 			h.assign( g.sub( b ).div( delta ) );
 			h.assign( g.sub( b ).div( delta ) );
 
 
-		} ).elseif( g.greaterThanEqual( maxcomp ), () => {
+		} ).ElseIf( g.greaterThanEqual( maxcomp ), () => {
 
 
 			h.assign( add( 2.0, b.sub( r ).div( delta ) ) );
 			h.assign( add( 2.0, b.sub( r ).div( delta ) ) );
 
 
-		} ).else( () => {
+		} ).Else( () => {
 
 
 			h.assign( add( 4.0, r.sub( g ).div( delta ) ) );
 			h.assign( add( 4.0, r.sub( g ).div( delta ) ) );
 
 

+ 80 - 80
src/nodes/materialx/lib/mx_noise.js

@@ -1,21 +1,21 @@
 // Three.js Transpiler
 // Three.js Transpiler
 // https://raw.githubusercontent.com/AcademySoftwareFoundation/MaterialX/main/libraries/stdlib/genglsl/lib/mx_noise.glsl
 // https://raw.githubusercontent.com/AcademySoftwareFoundation/MaterialX/main/libraries/stdlib/genglsl/lib/mx_noise.glsl
 
 
-import { int, uint, float, vec3, bool, uvec3, vec2, vec4, If, tslFn } from '../../shadernode/ShaderNode.js';
-import { cond } from '../../math/CondNode.js';
+import { int, uint, float, vec3, bool, uvec3, vec2, vec4, If, Fn } from '../../shadernode/ShaderNode.js';
+import { select } from '../../math/CondNode.js';
 import { sub, mul } from '../../math/OperatorNode.js';
 import { sub, mul } from '../../math/OperatorNode.js';
 import { floor, abs, max, dot, min, sqrt } from '../../math/MathNode.js';
 import { floor, abs, max, dot, min, sqrt } from '../../math/MathNode.js';
 import { overloadingFn } from '../../utils/FunctionOverloadingNode.js';
 import { overloadingFn } from '../../utils/FunctionOverloadingNode.js';
-import { loop } from '../../utils/LoopNode.js';
+import { Loop } from '../../utils/LoopNode.js';
 
 
 
 
-export const mx_select = /*#__PURE__*/ tslFn( ( [ b_immutable, t_immutable, f_immutable ] ) => {
+export const mx_select = /*#__PURE__*/ Fn( ( [ b_immutable, t_immutable, f_immutable ] ) => {
 
 
 	const f = float( f_immutable ).toVar();
 	const f = float( f_immutable ).toVar();
 	const t = float( t_immutable ).toVar();
 	const t = float( t_immutable ).toVar();
 	const b = bool( b_immutable ).toVar();
 	const b = bool( b_immutable ).toVar();
 
 
-	return cond( b, t, f );
+	return select( b, t, f );
 
 
 } ).setLayout( {
 } ).setLayout( {
 	name: 'mx_select',
 	name: 'mx_select',
@@ -27,12 +27,12 @@ export const mx_select = /*#__PURE__*/ tslFn( ( [ b_immutable, t_immutable, f_im
 	]
 	]
 } );
 } );
 
 
-export const mx_negate_if = /*#__PURE__*/ tslFn( ( [ val_immutable, b_immutable ] ) => {
+export const mx_negate_if = /*#__PURE__*/ Fn( ( [ val_immutable, b_immutable ] ) => {
 
 
 	const b = bool( b_immutable ).toVar();
 	const b = bool( b_immutable ).toVar();
 	const val = float( val_immutable ).toVar();
 	const val = float( val_immutable ).toVar();
 
 
-	return cond( b, val.negate(), val );
+	return select( b, val.negate(), val );
 
 
 } ).setLayout( {
 } ).setLayout( {
 	name: 'mx_negate_if',
 	name: 'mx_negate_if',
@@ -43,7 +43,7 @@ export const mx_negate_if = /*#__PURE__*/ tslFn( ( [ val_immutable, b_immutable
 	]
 	]
 } );
 } );
 
 
-export const mx_floor = /*#__PURE__*/ tslFn( ( [ x_immutable ] ) => {
+export const mx_floor = /*#__PURE__*/ Fn( ( [ x_immutable ] ) => {
 
 
 	const x = float( x_immutable ).toVar();
 	const x = float( x_immutable ).toVar();
 
 
@@ -57,7 +57,7 @@ export const mx_floor = /*#__PURE__*/ tslFn( ( [ x_immutable ] ) => {
 	]
 	]
 } );
 } );
 
 
-export const mx_floorfrac = /*#__PURE__*/ tslFn( ( [ x_immutable, i ] ) => {
+export const mx_floorfrac = /*#__PURE__*/ Fn( ( [ x_immutable, i ] ) => {
 
 
 	const x = float( x_immutable ).toVar();
 	const x = float( x_immutable ).toVar();
 	i.assign( mx_floor( x ) );
 	i.assign( mx_floor( x ) );
@@ -66,7 +66,7 @@ export const mx_floorfrac = /*#__PURE__*/ tslFn( ( [ x_immutable, i ] ) => {
 
 
 } );
 } );
 
 
-export const mx_bilerp_0 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {
+export const mx_bilerp_0 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {
 
 
 	const t = float( t_immutable ).toVar();
 	const t = float( t_immutable ).toVar();
 	const s = float( s_immutable ).toVar();
 	const s = float( s_immutable ).toVar();
@@ -91,7 +91,7 @@ export const mx_bilerp_0 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable,
 	]
 	]
 } );
 } );
 
 
-export const mx_bilerp_1 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {
+export const mx_bilerp_1 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, s_immutable, t_immutable ] ) => {
 
 
 	const t = float( t_immutable ).toVar();
 	const t = float( t_immutable ).toVar();
 	const s = float( s_immutable ).toVar();
 	const s = float( s_immutable ).toVar();
@@ -118,7 +118,7 @@ export const mx_bilerp_1 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable,
 
 
 export const mx_bilerp = /*#__PURE__*/ overloadingFn( [ mx_bilerp_0, mx_bilerp_1 ] );
 export const mx_bilerp = /*#__PURE__*/ overloadingFn( [ mx_bilerp_0, mx_bilerp_1 ] );
 
 
-export const mx_trilerp_0 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {
+export const mx_trilerp_0 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {
 
 
 	const r = float( r_immutable ).toVar();
 	const r = float( r_immutable ).toVar();
 	const t = float( t_immutable ).toVar();
 	const t = float( t_immutable ).toVar();
@@ -155,7 +155,7 @@ export const mx_trilerp_0 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable,
 	]
 	]
 } );
 } );
 
 
-export const mx_trilerp_1 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {
+export const mx_trilerp_1 = /*#__PURE__*/ Fn( ( [ v0_immutable, v1_immutable, v2_immutable, v3_immutable, v4_immutable, v5_immutable, v6_immutable, v7_immutable, s_immutable, t_immutable, r_immutable ] ) => {
 
 
 	const r = float( r_immutable ).toVar();
 	const r = float( r_immutable ).toVar();
 	const t = float( t_immutable ).toVar();
 	const t = float( t_immutable ).toVar();
@@ -194,7 +194,7 @@ export const mx_trilerp_1 = /*#__PURE__*/ tslFn( ( [ v0_immutable, v1_immutable,
 
 
 export const mx_trilerp = /*#__PURE__*/ overloadingFn( [ mx_trilerp_0, mx_trilerp_1 ] );
 export const mx_trilerp = /*#__PURE__*/ overloadingFn( [ mx_trilerp_0, mx_trilerp_1 ] );
 
 
-export const mx_gradient_float_0 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_immutable, y_immutable ] ) => {
+export const mx_gradient_float_0 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable ] ) => {
 
 
 	const y = float( y_immutable ).toVar();
 	const y = float( y_immutable ).toVar();
 	const x = float( x_immutable ).toVar();
 	const x = float( x_immutable ).toVar();
@@ -215,7 +215,7 @@ export const mx_gradient_float_0 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_im
 	]
 	]
 } );
 } );
 
 
-export const mx_gradient_float_1 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {
+export const mx_gradient_float_1 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {
 
 
 	const z = float( z_immutable ).toVar();
 	const z = float( z_immutable ).toVar();
 	const y = float( y_immutable ).toVar();
 	const y = float( y_immutable ).toVar();
@@ -240,7 +240,7 @@ export const mx_gradient_float_1 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_im
 
 
 export const mx_gradient_float = /*#__PURE__*/ overloadingFn( [ mx_gradient_float_0, mx_gradient_float_1 ] );
 export const mx_gradient_float = /*#__PURE__*/ overloadingFn( [ mx_gradient_float_0, mx_gradient_float_1 ] );
 
 
-export const mx_gradient_vec3_0 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_immutable, y_immutable ] ) => {
+export const mx_gradient_vec3_0 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable ] ) => {
 
 
 	const y = float( y_immutable ).toVar();
 	const y = float( y_immutable ).toVar();
 	const x = float( x_immutable ).toVar();
 	const x = float( x_immutable ).toVar();
@@ -258,7 +258,7 @@ export const mx_gradient_vec3_0 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_imm
 	]
 	]
 } );
 } );
 
 
-export const mx_gradient_vec3_1 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {
+export const mx_gradient_vec3_1 = /*#__PURE__*/ Fn( ( [ hash_immutable, x_immutable, y_immutable, z_immutable ] ) => {
 
 
 	const z = float( z_immutable ).toVar();
 	const z = float( z_immutable ).toVar();
 	const y = float( y_immutable ).toVar();
 	const y = float( y_immutable ).toVar();
@@ -280,7 +280,7 @@ export const mx_gradient_vec3_1 = /*#__PURE__*/ tslFn( ( [ hash_immutable, x_imm
 
 
 export const mx_gradient_vec3 = /*#__PURE__*/ overloadingFn( [ mx_gradient_vec3_0, mx_gradient_vec3_1 ] );
 export const mx_gradient_vec3 = /*#__PURE__*/ overloadingFn( [ mx_gradient_vec3_0, mx_gradient_vec3_1 ] );
 
 
-export const mx_gradient_scale2d_0 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) => {
+export const mx_gradient_scale2d_0 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => {
 
 
 	const v = float( v_immutable ).toVar();
 	const v = float( v_immutable ).toVar();
 
 
@@ -294,7 +294,7 @@ export const mx_gradient_scale2d_0 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) =>
 	]
 	]
 } );
 } );
 
 
-export const mx_gradient_scale3d_0 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) => {
+export const mx_gradient_scale3d_0 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => {
 
 
 	const v = float( v_immutable ).toVar();
 	const v = float( v_immutable ).toVar();
 
 
@@ -308,7 +308,7 @@ export const mx_gradient_scale3d_0 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) =>
 	]
 	]
 } );
 } );
 
 
-export const mx_gradient_scale2d_1 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) => {
+export const mx_gradient_scale2d_1 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => {
 
 
 	const v = vec3( v_immutable ).toVar();
 	const v = vec3( v_immutable ).toVar();
 
 
@@ -324,7 +324,7 @@ export const mx_gradient_scale2d_1 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) =>
 
 
 export const mx_gradient_scale2d = /*#__PURE__*/ overloadingFn( [ mx_gradient_scale2d_0, mx_gradient_scale2d_1 ] );
 export const mx_gradient_scale2d = /*#__PURE__*/ overloadingFn( [ mx_gradient_scale2d_0, mx_gradient_scale2d_1 ] );
 
 
-export const mx_gradient_scale3d_1 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) => {
+export const mx_gradient_scale3d_1 = /*#__PURE__*/ Fn( ( [ v_immutable ] ) => {
 
 
 	const v = vec3( v_immutable ).toVar();
 	const v = vec3( v_immutable ).toVar();
 
 
@@ -340,7 +340,7 @@ export const mx_gradient_scale3d_1 = /*#__PURE__*/ tslFn( ( [ v_immutable ] ) =>
 
 
 export const mx_gradient_scale3d = /*#__PURE__*/ overloadingFn( [ mx_gradient_scale3d_0, mx_gradient_scale3d_1 ] );
 export const mx_gradient_scale3d = /*#__PURE__*/ overloadingFn( [ mx_gradient_scale3d_0, mx_gradient_scale3d_1 ] );
 
 
-export const mx_rotl32 = /*#__PURE__*/ tslFn( ( [ x_immutable, k_immutable ] ) => {
+export const mx_rotl32 = /*#__PURE__*/ Fn( ( [ x_immutable, k_immutable ] ) => {
 
 
 	const k = int( k_immutable ).toVar();
 	const k = int( k_immutable ).toVar();
 	const x = uint( x_immutable ).toVar();
 	const x = uint( x_immutable ).toVar();
@@ -356,7 +356,7 @@ export const mx_rotl32 = /*#__PURE__*/ tslFn( ( [ x_immutable, k_immutable ] ) =
 	]
 	]
 } );
 } );
 
 
-export const mx_bjmix = /*#__PURE__*/ tslFn( ( [ a, b, c ] ) => {
+export const mx_bjmix = /*#__PURE__*/ Fn( ( [ a, b, c ] ) => {
 
 
 	a.subAssign( c );
 	a.subAssign( c );
 	a.bitXorAssign( mx_rotl32( c, int( 4 ) ) );
 	a.bitXorAssign( mx_rotl32( c, int( 4 ) ) );
@@ -379,7 +379,7 @@ export const mx_bjmix = /*#__PURE__*/ tslFn( ( [ a, b, c ] ) => {
 
 
 } );
 } );
 
 
-export const mx_bjfinal = /*#__PURE__*/ tslFn( ( [ a_immutable, b_immutable, c_immutable ] ) => {
+export const mx_bjfinal = /*#__PURE__*/ Fn( ( [ a_immutable, b_immutable, c_immutable ] ) => {
 
 
 	const c = uint( c_immutable ).toVar();
 	const c = uint( c_immutable ).toVar();
 	const b = uint( b_immutable ).toVar();
 	const b = uint( b_immutable ).toVar();
@@ -411,7 +411,7 @@ export const mx_bjfinal = /*#__PURE__*/ tslFn( ( [ a_immutable, b_immutable, c_i
 	]
 	]
 } );
 } );
 
 
-export const mx_bits_to_01 = /*#__PURE__*/ tslFn( ( [ bits_immutable ] ) => {
+export const mx_bits_to_01 = /*#__PURE__*/ Fn( ( [ bits_immutable ] ) => {
 
 
 	const bits = uint( bits_immutable ).toVar();
 	const bits = uint( bits_immutable ).toVar();
 
 
@@ -425,7 +425,7 @@ export const mx_bits_to_01 = /*#__PURE__*/ tslFn( ( [ bits_immutable ] ) => {
 	]
 	]
 } );
 } );
 
 
-export const mx_fade = /*#__PURE__*/ tslFn( ( [ t_immutable ] ) => {
+export const mx_fade = /*#__PURE__*/ Fn( ( [ t_immutable ] ) => {
 
 
 	const t = float( t_immutable ).toVar();
 	const t = float( t_immutable ).toVar();
 
 
@@ -439,7 +439,7 @@ export const mx_fade = /*#__PURE__*/ tslFn( ( [ t_immutable ] ) => {
 	]
 	]
 } );
 } );
 
 
-export const mx_hash_int_0 = /*#__PURE__*/ tslFn( ( [ x_immutable ] ) => {
+export const mx_hash_int_0 = /*#__PURE__*/ Fn( ( [ x_immutable ] ) => {
 
 
 	const x = int( x_immutable ).toVar();
 	const x = int( x_immutable ).toVar();
 	const len = uint( uint( 1 ) ).toVar();
 	const len = uint( uint( 1 ) ).toVar();
@@ -455,7 +455,7 @@ export const mx_hash_int_0 = /*#__PURE__*/ tslFn( ( [ x_immutable ] ) => {
 	]
 	]
 } );
 } );
 
 
-export const mx_hash_int_1 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable ] ) => {
+export const mx_hash_int_1 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) => {
 
 
 	const y = int( y_immutable ).toVar();
 	const y = int( y_immutable ).toVar();
 	const x = int( x_immutable ).toVar();
 	const x = int( x_immutable ).toVar();
@@ -476,7 +476,7 @@ export const mx_hash_int_1 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable ]
 	]
 	]
 } );
 } );
 
 
-export const mx_hash_int_2 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable, z_immutable ] ) => {
+export const mx_hash_int_2 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable ] ) => {
 
 
 	const z = int( z_immutable ).toVar();
 	const z = int( z_immutable ).toVar();
 	const y = int( y_immutable ).toVar();
 	const y = int( y_immutable ).toVar();
@@ -500,7 +500,7 @@ export const mx_hash_int_2 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable,
 	]
 	]
 } );
 } );
 
 
-export const mx_hash_int_3 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable ] ) => {
+export const mx_hash_int_3 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable ] ) => {
 
 
 	const xx = int( xx_immutable ).toVar();
 	const xx = int( xx_immutable ).toVar();
 	const z = int( z_immutable ).toVar();
 	const z = int( z_immutable ).toVar();
@@ -528,7 +528,7 @@ export const mx_hash_int_3 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable,
 	]
 	]
 } );
 } );
 
 
-export const mx_hash_int_4 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable, yy_immutable ] ) => {
+export const mx_hash_int_4 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable, xx_immutable, yy_immutable ] ) => {
 
 
 	const yy = int( yy_immutable ).toVar();
 	const yy = int( yy_immutable ).toVar();
 	const xx = int( xx_immutable ).toVar();
 	const xx = int( xx_immutable ).toVar();
@@ -561,7 +561,7 @@ export const mx_hash_int_4 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable,
 
 
 export const mx_hash_int = /*#__PURE__*/ overloadingFn( [ mx_hash_int_0, mx_hash_int_1, mx_hash_int_2, mx_hash_int_3, mx_hash_int_4 ] );
 export const mx_hash_int = /*#__PURE__*/ overloadingFn( [ mx_hash_int_0, mx_hash_int_1, mx_hash_int_2, mx_hash_int_3, mx_hash_int_4 ] );
 
 
-export const mx_hash_vec3_0 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable ] ) => {
+export const mx_hash_vec3_0 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable ] ) => {
 
 
 	const y = int( y_immutable ).toVar();
 	const y = int( y_immutable ).toVar();
 	const x = int( x_immutable ).toVar();
 	const x = int( x_immutable ).toVar();
@@ -582,7 +582,7 @@ export const mx_hash_vec3_0 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable
 	]
 	]
 } );
 } );
 
 
-export const mx_hash_vec3_1 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable, z_immutable ] ) => {
+export const mx_hash_vec3_1 = /*#__PURE__*/ Fn( ( [ x_immutable, y_immutable, z_immutable ] ) => {
 
 
 	const z = int( z_immutable ).toVar();
 	const z = int( z_immutable ).toVar();
 	const y = int( y_immutable ).toVar();
 	const y = int( y_immutable ).toVar();
@@ -607,7 +607,7 @@ export const mx_hash_vec3_1 = /*#__PURE__*/ tslFn( ( [ x_immutable, y_immutable,
 
 
 export const mx_hash_vec3 = /*#__PURE__*/ overloadingFn( [ mx_hash_vec3_0, mx_hash_vec3_1 ] );
 export const mx_hash_vec3 = /*#__PURE__*/ overloadingFn( [ mx_hash_vec3_0, mx_hash_vec3_1 ] );
 
 
-export const mx_perlin_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_perlin_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec2( p_immutable ).toVar();
 	const p = vec2( p_immutable ).toVar();
 	const X = int().toVar(), Y = int().toVar();
 	const X = int().toVar(), Y = int().toVar();
@@ -627,7 +627,7 @@ export const mx_perlin_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] )
 	]
 	]
 } );
 } );
 
 
-export const mx_perlin_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_perlin_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec3( p_immutable ).toVar();
 	const p = vec3( p_immutable ).toVar();
 	const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
 	const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
@@ -651,7 +651,7 @@ export const mx_perlin_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] )
 
 
 export const mx_perlin_noise_float = /*#__PURE__*/ overloadingFn( [ mx_perlin_noise_float_0, mx_perlin_noise_float_1 ] );
 export const mx_perlin_noise_float = /*#__PURE__*/ overloadingFn( [ mx_perlin_noise_float_0, mx_perlin_noise_float_1 ] );
 
 
-export const mx_perlin_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_perlin_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec2( p_immutable ).toVar();
 	const p = vec2( p_immutable ).toVar();
 	const X = int().toVar(), Y = int().toVar();
 	const X = int().toVar(), Y = int().toVar();
@@ -671,7 +671,7 @@ export const mx_perlin_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =
 	]
 	]
 } );
 } );
 
 
-export const mx_perlin_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_perlin_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec3( p_immutable ).toVar();
 	const p = vec3( p_immutable ).toVar();
 	const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
 	const X = int().toVar(), Y = int().toVar(), Z = int().toVar();
@@ -695,7 +695,7 @@ export const mx_perlin_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =
 
 
 export const mx_perlin_noise_vec3 = /*#__PURE__*/ overloadingFn( [ mx_perlin_noise_vec3_0, mx_perlin_noise_vec3_1 ] );
 export const mx_perlin_noise_vec3 = /*#__PURE__*/ overloadingFn( [ mx_perlin_noise_vec3_0, mx_perlin_noise_vec3_1 ] );
 
 
-export const mx_cell_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_cell_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = float( p_immutable ).toVar();
 	const p = float( p_immutable ).toVar();
 	const ix = int( mx_floor( p ) ).toVar();
 	const ix = int( mx_floor( p ) ).toVar();
@@ -710,7 +710,7 @@ export const mx_cell_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
 	]
 	]
 } );
 } );
 
 
-export const mx_cell_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_cell_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec2( p_immutable ).toVar();
 	const p = vec2( p_immutable ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
@@ -726,7 +726,7 @@ export const mx_cell_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
 	]
 	]
 } );
 } );
 
 
-export const mx_cell_noise_float_2 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_cell_noise_float_2 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec3( p_immutable ).toVar();
 	const p = vec3( p_immutable ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
@@ -743,7 +743,7 @@ export const mx_cell_noise_float_2 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
 	]
 	]
 } );
 } );
 
 
-export const mx_cell_noise_float_3 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_cell_noise_float_3 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec4( p_immutable ).toVar();
 	const p = vec4( p_immutable ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
@@ -763,7 +763,7 @@ export const mx_cell_noise_float_3 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
 
 
 export const mx_cell_noise_float = /*#__PURE__*/ overloadingFn( [ mx_cell_noise_float_0, mx_cell_noise_float_1, mx_cell_noise_float_2, mx_cell_noise_float_3 ] );
 export const mx_cell_noise_float = /*#__PURE__*/ overloadingFn( [ mx_cell_noise_float_0, mx_cell_noise_float_1, mx_cell_noise_float_2, mx_cell_noise_float_3 ] );
 
 
-export const mx_cell_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_cell_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = float( p_immutable ).toVar();
 	const p = float( p_immutable ).toVar();
 	const ix = int( mx_floor( p ) ).toVar();
 	const ix = int( mx_floor( p ) ).toVar();
@@ -778,7 +778,7 @@ export const mx_cell_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
 	]
 	]
 } );
 } );
 
 
-export const mx_cell_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_cell_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec2( p_immutable ).toVar();
 	const p = vec2( p_immutable ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
@@ -794,7 +794,7 @@ export const mx_cell_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
 	]
 	]
 } );
 } );
 
 
-export const mx_cell_noise_vec3_2 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_cell_noise_vec3_2 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec3( p_immutable ).toVar();
 	const p = vec3( p_immutable ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
@@ -811,7 +811,7 @@ export const mx_cell_noise_vec3_2 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
 	]
 	]
 } );
 } );
 
 
-export const mx_cell_noise_vec3_3 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) => {
+export const mx_cell_noise_vec3_3 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
 
 
 	const p = vec4( p_immutable ).toVar();
 	const p = vec4( p_immutable ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
 	const ix = int( mx_floor( p.x ) ).toVar();
@@ -831,7 +831,7 @@ export const mx_cell_noise_vec3_3 = /*#__PURE__*/ tslFn( ( [ p_immutable ] ) =>
 
 
 export const mx_cell_noise_vec3 = /*#__PURE__*/ overloadingFn( [ mx_cell_noise_vec3_0, mx_cell_noise_vec3_1, mx_cell_noise_vec3_2, mx_cell_noise_vec3_3 ] );
 export const mx_cell_noise_vec3 = /*#__PURE__*/ overloadingFn( [ mx_cell_noise_vec3_0, mx_cell_noise_vec3_1, mx_cell_noise_vec3_2, mx_cell_noise_vec3_3 ] );
 
 
-export const mx_fractal_noise_float = /*#__PURE__*/ tslFn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
+export const mx_fractal_noise_float = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
 
 
 	const diminish = float( diminish_immutable ).toVar();
 	const diminish = float( diminish_immutable ).toVar();
 	const lacunarity = float( lacunarity_immutable ).toVar();
 	const lacunarity = float( lacunarity_immutable ).toVar();
@@ -840,7 +840,7 @@ export const mx_fractal_noise_float = /*#__PURE__*/ tslFn( ( [ p_immutable, octa
 	const result = float( 0.0 ).toVar();
 	const result = float( 0.0 ).toVar();
 	const amplitude = float( 1.0 ).toVar();
 	const amplitude = float( 1.0 ).toVar();
 
 
-	loop( octaves, () => {
+	Loop( octaves, () => {
 
 
 		result.addAssign( amplitude.mul( mx_perlin_noise_float( p ) ) );
 		result.addAssign( amplitude.mul( mx_perlin_noise_float( p ) ) );
 		amplitude.mulAssign( diminish );
 		amplitude.mulAssign( diminish );
@@ -861,7 +861,7 @@ export const mx_fractal_noise_float = /*#__PURE__*/ tslFn( ( [ p_immutable, octa
 	]
 	]
 } );
 } );
 
 
-export const mx_fractal_noise_vec3 = /*#__PURE__*/ tslFn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
+export const mx_fractal_noise_vec3 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
 
 
 	const diminish = float( diminish_immutable ).toVar();
 	const diminish = float( diminish_immutable ).toVar();
 	const lacunarity = float( lacunarity_immutable ).toVar();
 	const lacunarity = float( lacunarity_immutable ).toVar();
@@ -870,7 +870,7 @@ export const mx_fractal_noise_vec3 = /*#__PURE__*/ tslFn( ( [ p_immutable, octav
 	const result = vec3( 0.0 ).toVar();
 	const result = vec3( 0.0 ).toVar();
 	const amplitude = float( 1.0 ).toVar();
 	const amplitude = float( 1.0 ).toVar();
 
 
-	loop( octaves, () => {
+	Loop( octaves, () => {
 
 
 		result.addAssign( amplitude.mul( mx_perlin_noise_vec3( p ) ) );
 		result.addAssign( amplitude.mul( mx_perlin_noise_vec3( p ) ) );
 		amplitude.mulAssign( diminish );
 		amplitude.mulAssign( diminish );
@@ -891,7 +891,7 @@ export const mx_fractal_noise_vec3 = /*#__PURE__*/ tslFn( ( [ p_immutable, octav
 	]
 	]
 } );
 } );
 
 
-export const mx_fractal_noise_vec2 = /*#__PURE__*/ tslFn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
+export const mx_fractal_noise_vec2 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
 
 
 	const diminish = float( diminish_immutable ).toVar();
 	const diminish = float( diminish_immutable ).toVar();
 	const lacunarity = float( lacunarity_immutable ).toVar();
 	const lacunarity = float( lacunarity_immutable ).toVar();
@@ -911,7 +911,7 @@ export const mx_fractal_noise_vec2 = /*#__PURE__*/ tslFn( ( [ p_immutable, octav
 	]
 	]
 } );
 } );
 
 
-export const mx_fractal_noise_vec4 = /*#__PURE__*/ tslFn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
+export const mx_fractal_noise_vec4 = /*#__PURE__*/ Fn( ( [ p_immutable, octaves_immutable, lacunarity_immutable, diminish_immutable ] ) => {
 
 
 	const diminish = float( diminish_immutable ).toVar();
 	const diminish = float( diminish_immutable ).toVar();
 	const lacunarity = float( lacunarity_immutable ).toVar();
 	const lacunarity = float( lacunarity_immutable ).toVar();
@@ -933,7 +933,7 @@ export const mx_fractal_noise_vec4 = /*#__PURE__*/ tslFn( ( [ p_immutable, octav
 	]
 	]
 } );
 } );
 
 
-export const mx_worley_distance_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, x_immutable, y_immutable, xoff_immutable, yoff_immutable, jitter_immutable, metric_immutable ] ) => {
+export const mx_worley_distance_0 = /*#__PURE__*/ Fn( ( [ p_immutable, x_immutable, y_immutable, xoff_immutable, yoff_immutable, jitter_immutable, metric_immutable ] ) => {
 
 
 	const metric = int( metric_immutable ).toVar();
 	const metric = int( metric_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
@@ -978,7 +978,7 @@ export const mx_worley_distance_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, x_immu
 	]
 	]
 } );
 } );
 
 
-export const mx_worley_distance_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, x_immutable, y_immutable, z_immutable, xoff_immutable, yoff_immutable, zoff_immutable, jitter_immutable, metric_immutable ] ) => {
+export const mx_worley_distance_1 = /*#__PURE__*/ Fn( ( [ p_immutable, x_immutable, y_immutable, z_immutable, xoff_immutable, yoff_immutable, zoff_immutable, jitter_immutable, metric_immutable ] ) => {
 
 
 	const metric = int( metric_immutable ).toVar();
 	const metric = int( metric_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
@@ -1028,7 +1028,7 @@ export const mx_worley_distance_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, x_immu
 
 
 export const mx_worley_distance = /*#__PURE__*/ overloadingFn( [ mx_worley_distance_0, mx_worley_distance_1 ] );
 export const mx_worley_distance = /*#__PURE__*/ overloadingFn( [ mx_worley_distance_0, mx_worley_distance_1 ] );
 
 
-export const mx_worley_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
+export const mx_worley_noise_float_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
 
 
 	const metric = int( metric_immutable ).toVar();
 	const metric = int( metric_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
@@ -1037,9 +1037,9 @@ export const mx_worley_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jit
 	const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
 	const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
 	const sqdist = float( 1e6 ).toVar();
 	const sqdist = float( 1e6 ).toVar();
 
 
-	loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
+	Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
 
 
-		loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
+		Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
 
 
 			const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
 			const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
 			sqdist.assign( min( sqdist, dist ) );
 			sqdist.assign( min( sqdist, dist ) );
@@ -1066,7 +1066,7 @@ export const mx_worley_noise_float_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jit
 	]
 	]
 } );
 } );
 
 
-export const mx_worley_noise_vec2_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
+export const mx_worley_noise_vec2_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
 
 
 	const metric = int( metric_immutable ).toVar();
 	const metric = int( metric_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
@@ -1075,9 +1075,9 @@ export const mx_worley_noise_vec2_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 	const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
 	const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
 	const sqdist = vec2( 1e6, 1e6 ).toVar();
 	const sqdist = vec2( 1e6, 1e6 ).toVar();
 
 
-	loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
+	Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
 
 
-		loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
+		Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
 
 
 			const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
 			const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
 
 
@@ -1086,7 +1086,7 @@ export const mx_worley_noise_vec2_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 				sqdist.y.assign( sqdist.x );
 				sqdist.y.assign( sqdist.x );
 				sqdist.x.assign( dist );
 				sqdist.x.assign( dist );
 
 
-			} ).elseif( dist.lessThan( sqdist.y ), () => {
+			} ).ElseIf( dist.lessThan( sqdist.y ), () => {
 
 
 				sqdist.y.assign( dist );
 				sqdist.y.assign( dist );
 
 
@@ -1114,7 +1114,7 @@ export const mx_worley_noise_vec2_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 	]
 	]
 } );
 } );
 
 
-export const mx_worley_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
+export const mx_worley_noise_vec3_0 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
 
 
 	const metric = int( metric_immutable ).toVar();
 	const metric = int( metric_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
@@ -1123,9 +1123,9 @@ export const mx_worley_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 	const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
 	const localpos = vec2( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ) ).toVar();
 	const sqdist = vec3( 1e6, 1e6, 1e6 ).toVar();
 	const sqdist = vec3( 1e6, 1e6, 1e6 ).toVar();
 
 
-	loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
+	Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
 
 
-		loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
+		Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
 
 
 			const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
 			const dist = float( mx_worley_distance( localpos, x, y, X, Y, jitter, metric ) ).toVar();
 
 
@@ -1135,12 +1135,12 @@ export const mx_worley_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 				sqdist.y.assign( sqdist.x );
 				sqdist.y.assign( sqdist.x );
 				sqdist.x.assign( dist );
 				sqdist.x.assign( dist );
 
 
-			} ).elseif( dist.lessThan( sqdist.y ), () => {
+			} ).ElseIf( dist.lessThan( sqdist.y ), () => {
 
 
 				sqdist.z.assign( sqdist.y );
 				sqdist.z.assign( sqdist.y );
 				sqdist.y.assign( dist );
 				sqdist.y.assign( dist );
 
 
-			} ).elseif( dist.lessThan( sqdist.z ), () => {
+			} ).ElseIf( dist.lessThan( sqdist.z ), () => {
 
 
 				sqdist.z.assign( dist );
 				sqdist.z.assign( dist );
 
 
@@ -1168,7 +1168,7 @@ export const mx_worley_noise_vec3_0 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 	]
 	]
 } );
 } );
 
 
-export const mx_worley_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
+export const mx_worley_noise_float_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
 
 
 	const metric = int( metric_immutable ).toVar();
 	const metric = int( metric_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
@@ -1177,11 +1177,11 @@ export const mx_worley_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jit
 	const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
 	const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
 	const sqdist = float( 1e6 ).toVar();
 	const sqdist = float( 1e6 ).toVar();
 
 
-	loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
+	Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
 
 
-		loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
+		Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
 
 
-			loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
+			Loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
 
 
 				const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
 				const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
 				sqdist.assign( min( sqdist, dist ) );
 				sqdist.assign( min( sqdist, dist ) );
@@ -1212,7 +1212,7 @@ export const mx_worley_noise_float_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jit
 
 
 export const mx_worley_noise_float = /*#__PURE__*/ overloadingFn( [ mx_worley_noise_float_0, mx_worley_noise_float_1 ] );
 export const mx_worley_noise_float = /*#__PURE__*/ overloadingFn( [ mx_worley_noise_float_0, mx_worley_noise_float_1 ] );
 
 
-export const mx_worley_noise_vec2_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
+export const mx_worley_noise_vec2_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
 
 
 	const metric = int( metric_immutable ).toVar();
 	const metric = int( metric_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
@@ -1221,11 +1221,11 @@ export const mx_worley_noise_vec2_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 	const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
 	const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
 	const sqdist = vec2( 1e6, 1e6 ).toVar();
 	const sqdist = vec2( 1e6, 1e6 ).toVar();
 
 
-	loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
+	Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
 
 
-		loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
+		Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
 
 
-			loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
+			Loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
 
 
 				const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
 				const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
 
 
@@ -1234,7 +1234,7 @@ export const mx_worley_noise_vec2_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 					sqdist.y.assign( sqdist.x );
 					sqdist.y.assign( sqdist.x );
 					sqdist.x.assign( dist );
 					sqdist.x.assign( dist );
 
 
-				} ).elseif( dist.lessThan( sqdist.y ), () => {
+				} ).ElseIf( dist.lessThan( sqdist.y ), () => {
 
 
 					sqdist.y.assign( dist );
 					sqdist.y.assign( dist );
 
 
@@ -1266,7 +1266,7 @@ export const mx_worley_noise_vec2_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 
 
 export const mx_worley_noise_vec2 = /*#__PURE__*/ overloadingFn( [ mx_worley_noise_vec2_0, mx_worley_noise_vec2_1 ] );
 export const mx_worley_noise_vec2 = /*#__PURE__*/ overloadingFn( [ mx_worley_noise_vec2_0, mx_worley_noise_vec2_1 ] );
 
 
-export const mx_worley_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
+export const mx_worley_noise_vec3_1 = /*#__PURE__*/ Fn( ( [ p_immutable, jitter_immutable, metric_immutable ] ) => {
 
 
 	const metric = int( metric_immutable ).toVar();
 	const metric = int( metric_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
 	const jitter = float( jitter_immutable ).toVar();
@@ -1275,11 +1275,11 @@ export const mx_worley_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 	const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
 	const localpos = vec3( mx_floorfrac( p.x, X ), mx_floorfrac( p.y, Y ), mx_floorfrac( p.z, Z ) ).toVar();
 	const sqdist = vec3( 1e6, 1e6, 1e6 ).toVar();
 	const sqdist = vec3( 1e6, 1e6, 1e6 ).toVar();
 
 
-	loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
+	Loop( { start: - 1, end: int( 1 ), name: 'x', condition: '<=' }, ( { x } ) => {
 
 
-		loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
+		Loop( { start: - 1, end: int( 1 ), name: 'y', condition: '<=' }, ( { y } ) => {
 
 
-			loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
+			Loop( { start: - 1, end: int( 1 ), name: 'z', condition: '<=' }, ( { z } ) => {
 
 
 				const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
 				const dist = float( mx_worley_distance( localpos, x, y, z, X, Y, Z, jitter, metric ) ).toVar();
 
 
@@ -1289,12 +1289,12 @@ export const mx_worley_noise_vec3_1 = /*#__PURE__*/ tslFn( ( [ p_immutable, jitt
 					sqdist.y.assign( sqdist.x );
 					sqdist.y.assign( sqdist.x );
 					sqdist.x.assign( dist );
 					sqdist.x.assign( dist );
 
 
-				} ).elseif( dist.lessThan( sqdist.y ), () => {
+				} ).ElseIf( dist.lessThan( sqdist.y ), () => {
 
 
 					sqdist.z.assign( sqdist.y );
 					sqdist.z.assign( sqdist.y );
 					sqdist.y.assign( dist );
 					sqdist.y.assign( dist );
 
 
-				} ).elseif( dist.lessThan( sqdist.z ), () => {
+				} ).ElseIf( dist.lessThan( sqdist.z ), () => {
 
 
 					sqdist.z.assign( dist );
 					sqdist.z.assign( dist );
 
 

+ 2 - 2
src/nodes/materialx/lib/mx_transform_color.js

@@ -1,11 +1,11 @@
 // Three.js Transpiler
 // Three.js Transpiler
 // https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genglsl/lib/mx_transform_color.glsl
 // https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genglsl/lib/mx_transform_color.glsl
 
 
-import { bvec3, vec3, tslFn } from '../../shadernode/ShaderNode.js';
+import { bvec3, vec3, Fn } from '../../shadernode/ShaderNode.js';
 import { greaterThan } from '../../math/OperatorNode.js';
 import { greaterThan } from '../../math/OperatorNode.js';
 import { max, pow, mix } from '../../math/MathNode.js';
 import { max, pow, mix } from '../../math/MathNode.js';
 
 
-export const mx_srgb_texture_to_lin_rec709 = /*#__PURE__*/ tslFn( ( [ color_immutable ] ) => {
+export const mx_srgb_texture_to_lin_rec709 = /*#__PURE__*/ Fn( ( [ color_immutable ] ) => {
 
 
 	const color = vec3( color_immutable ).toVar();
 	const color = vec3( color_immutable ).toVar();
 	const isAbove = bvec3( greaterThan( color, vec3( 0.04045 ) ) ).toVar();
 	const isAbove = bvec3( greaterThan( color, vec3( 0.04045 ) ) ).toVar();

+ 13 - 2
src/nodes/math/CondNode.js

@@ -121,8 +121,19 @@ class CondNode extends Node {
 
 
 export default CondNode;
 export default CondNode;
 
 
-export const cond = nodeProxy( CondNode );
+export const select = nodeProxy( CondNode );
 
 
-addNodeElement( 'cond', cond );
+addNodeElement( 'select', select );
 
 
 addNodeClass( 'CondNode', CondNode );
 addNodeClass( 'CondNode', CondNode );
+
+//
+
+export const cond = ( ...params ) => { // @deprecated, r168
+
+	console.warn( 'TSL.CondNode: cond() has been renamed to select().' );
+	return select( ...params );
+
+};
+
+addNodeElement( 'cond', cond );

+ 2 - 2
src/nodes/math/MathNode.js

@@ -1,7 +1,7 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { sub, mul, div } from './OperatorNode.js';
 import { sub, mul, div } from './OperatorNode.js';
 import { addNodeClass } from '../core/Node.js';
 import { addNodeClass } from '../core/Node.js';
-import { addNodeElement, nodeObject, nodeProxy, float, vec2, vec3, vec4, tslFn } from '../shadernode/ShaderNode.js';
+import { addNodeElement, nodeObject, nodeProxy, float, vec2, vec3, vec4, Fn } from '../shadernode/ShaderNode.js';
 
 
 class MathNode extends TempNode {
 class MathNode extends TempNode {
 
 
@@ -330,7 +330,7 @@ export const refract = nodeProxy( MathNode, MathNode.REFRACT );
 export const smoothstep = nodeProxy( MathNode, MathNode.SMOOTHSTEP );
 export const smoothstep = nodeProxy( MathNode, MathNode.SMOOTHSTEP );
 export const faceForward = nodeProxy( MathNode, MathNode.FACEFORWARD );
 export const faceForward = nodeProxy( MathNode, MathNode.FACEFORWARD );
 
 
-export const rand = tslFn( ( [ uv ] ) => {
+export const rand = Fn( ( [ uv ] ) => {
 
 
 	const a = 12.9898, b = 78.233, c = 43758.5453;
 	const a = 12.9898, b = 78.233, c = 43758.5453;
 	const dt = dot( uv.xy, vec2( a, b ) ), sn = mod( dt, PI );
 	const dt = dot( uv.xy, vec2( a, b ) ), sn = mod( dt, PI );

+ 6 - 6
src/nodes/math/TriNoise3D.js

@@ -1,28 +1,28 @@
 // https://github.com/cabbibo/glsl-tri-noise-3d
 // https://github.com/cabbibo/glsl-tri-noise-3d
 
 
-import { loop } from '../utils/LoopNode.js';
-import { float, vec3, tslFn } from '../shadernode/ShaderNode.js';
+import { Loop } from '../utils/LoopNode.js';
+import { float, vec3, Fn } from '../shadernode/ShaderNode.js';
 
 
-const tri = tslFn( ( [ x ] ) => {
+const tri = Fn( ( [ x ] ) => {
 
 
 	return x.fract().sub( .5 ).abs();
 	return x.fract().sub( .5 ).abs();
 
 
 } );
 } );
 
 
-const tri3 = tslFn( ( [ p ] ) => {
+const tri3 = Fn( ( [ p ] ) => {
 
 
 	return vec3( tri( p.z.add( tri( p.y.mul( 1. ) ) ) ), tri( p.z.add( tri( p.x.mul( 1. ) ) ) ), tri( p.y.add( tri( p.x.mul( 1. ) ) ) ) );
 	return vec3( tri( p.z.add( tri( p.y.mul( 1. ) ) ) ), tri( p.z.add( tri( p.x.mul( 1. ) ) ) ), tri( p.y.add( tri( p.x.mul( 1. ) ) ) ) );
 
 
 } );
 } );
 
 
-const triNoise3D = tslFn( ( [ p_immutable, spd, time ] ) => {
+const triNoise3D = Fn( ( [ p_immutable, spd, time ] ) => {
 
 
 	const p = vec3( p_immutable ).toVar();
 	const p = vec3( p_immutable ).toVar();
 	const z = float( 1.4 ).toVar();
 	const z = float( 1.4 ).toVar();
 	const rz = float( 0.0 ).toVar();
 	const rz = float( 0.0 ).toVar();
 	const bp = vec3( p ).toVar();
 	const bp = vec3( p ).toVar();
 
 
-	loop( { start: float( 0.0 ), end: float( 3.0 ), type: 'float', condition: '<=' }, () => {
+	Loop( { start: float( 0.0 ), end: float( 3.0 ), type: 'float', condition: '<=' }, () => {
 
 
 		const dg = vec3( tri3( bp.mul( 2.0 ) ) ).toVar();
 		const dg = vec3( tri3( bp.mul( 2.0 ) ) ).toVar();
 		p.addAssign( dg.add( time.mul( float( 0.1 ).mul( spd ) ) ) );
 		p.addAssign( dg.add( time.mul( float( 0.1 ).mul( spd ) ) ) );

+ 34 - 34
src/nodes/pmrem/PMREMUtils.js

@@ -1,8 +1,8 @@
-import { tslFn, int, float, vec2, vec3, vec4, If } from '../shadernode/ShaderNode.js';
+import { Fn, int, float, vec2, vec3, vec4, If } from '../shadernode/ShaderNode.js';
 import { cos, sin, abs, max, exp2, log2, clamp, fract, mix, floor, normalize, cross, all } from '../math/MathNode.js';
 import { cos, sin, abs, max, exp2, log2, clamp, fract, mix, floor, normalize, cross, all } from '../math/MathNode.js';
 import { mul } from '../math/OperatorNode.js';
 import { mul } from '../math/OperatorNode.js';
-import { cond } from '../math/CondNode.js';
-import { loop, Break } from '../utils/LoopNode.js';
+import { select } from '../math/CondNode.js';
+import { Loop, Break } from '../utils/LoopNode.js';
 
 
 // These defines must match with PMREMGenerator
 // These defines must match with PMREMGenerator
 
 
@@ -24,7 +24,7 @@ const cubeUV_minTileSize = float( 16.0 );
 // a cubemap, the 0-5 integer index of a cube face, and the direction vector for
 // a cubemap, the 0-5 integer index of a cube face, and the direction vector for
 // sampling a textureCube (not generally normalized ).
 // sampling a textureCube (not generally normalized ).
 
 
-const getFace = tslFn( ( [ direction ] ) => {
+const getFace = Fn( ( [ direction ] ) => {
 
 
 	const absDirection = vec3( abs( direction ) ).toVar();
 	const absDirection = vec3( abs( direction ) ).toVar();
 	const face = float( - 1.0 ).toVar();
 	const face = float( - 1.0 ).toVar();
@@ -33,23 +33,23 @@ const getFace = tslFn( ( [ direction ] ) => {
 
 
 		If( absDirection.x.greaterThan( absDirection.y ), () => {
 		If( absDirection.x.greaterThan( absDirection.y ), () => {
 
 
-			face.assign( cond( direction.x.greaterThan( 0.0 ), 0.0, 3.0 ) );
+			face.assign( select( direction.x.greaterThan( 0.0 ), 0.0, 3.0 ) );
 
 
-		} ).else( () => {
+		} ).Else( () => {
 
 
-			face.assign( cond( direction.y.greaterThan( 0.0 ), 1.0, 4.0 ) );
+			face.assign( select( direction.y.greaterThan( 0.0 ), 1.0, 4.0 ) );
 
 
 		} );
 		} );
 
 
-	} ).else( () => {
+	} ).Else( () => {
 
 
 		If( absDirection.z.greaterThan( absDirection.y ), () => {
 		If( absDirection.z.greaterThan( absDirection.y ), () => {
 
 
-			face.assign( cond( direction.z.greaterThan( 0.0 ), 2.0, 5.0 ) );
+			face.assign( select( direction.z.greaterThan( 0.0 ), 2.0, 5.0 ) );
 
 
-		} ).else( () => {
+		} ).Else( () => {
 
 
-			face.assign( cond( direction.y.greaterThan( 0.0 ), 1.0, 4.0 ) );
+			face.assign( select( direction.y.greaterThan( 0.0 ), 1.0, 4.0 ) );
 
 
 		} );
 		} );
 
 
@@ -66,7 +66,7 @@ const getFace = tslFn( ( [ direction ] ) => {
 } );
 } );
 
 
 // RH coordinate system; PMREM face-indexing convention
 // RH coordinate system; PMREM face-indexing convention
-const getUV = tslFn( ( [ direction, face ] ) => {
+const getUV = Fn( ( [ direction, face ] ) => {
 
 
 	const uv = vec2().toVar();
 	const uv = vec2().toVar();
 
 
@@ -74,23 +74,23 @@ const getUV = tslFn( ( [ direction, face ] ) => {
 
 
 		uv.assign( vec2( direction.z, direction.y ).div( abs( direction.x ) ) ); // pos x
 		uv.assign( vec2( direction.z, direction.y ).div( abs( direction.x ) ) ); // pos x
 
 
-	} ).elseif( face.equal( 1.0 ), () => {
+	} ).ElseIf( face.equal( 1.0 ), () => {
 
 
 		uv.assign( vec2( direction.x.negate(), direction.z.negate() ).div( abs( direction.y ) ) ); // pos y
 		uv.assign( vec2( direction.x.negate(), direction.z.negate() ).div( abs( direction.y ) ) ); // pos y
 
 
-	} ).elseif( face.equal( 2.0 ), () => {
+	} ).ElseIf( face.equal( 2.0 ), () => {
 
 
 		uv.assign( vec2( direction.x.negate(), direction.y ).div( abs( direction.z ) ) ); // pos z
 		uv.assign( vec2( direction.x.negate(), direction.y ).div( abs( direction.z ) ) ); // pos z
 
 
-	} ).elseif( face.equal( 3.0 ), () => {
+	} ).ElseIf( face.equal( 3.0 ), () => {
 
 
 		uv.assign( vec2( direction.z.negate(), direction.y ).div( abs( direction.x ) ) ); // neg x
 		uv.assign( vec2( direction.z.negate(), direction.y ).div( abs( direction.x ) ) ); // neg x
 
 
-	} ).elseif( face.equal( 4.0 ), () => {
+	} ).ElseIf( face.equal( 4.0 ), () => {
 
 
 		uv.assign( vec2( direction.x.negate(), direction.z ).div( abs( direction.y ) ) ); // neg y
 		uv.assign( vec2( direction.x.negate(), direction.z ).div( abs( direction.y ) ) ); // neg y
 
 
-	} ).else( () => {
+	} ).Else( () => {
 
 
 		uv.assign( vec2( direction.x, direction.y ).div( abs( direction.z ) ) ); // neg z
 		uv.assign( vec2( direction.x, direction.y ).div( abs( direction.z ) ) ); // neg z
 
 
@@ -107,7 +107,7 @@ const getUV = tslFn( ( [ direction, face ] ) => {
 	]
 	]
 } );
 } );
 
 
-const roughnessToMip = tslFn( ( [ roughness ] ) => {
+const roughnessToMip = Fn( ( [ roughness ] ) => {
 
 
 	const mip = float( 0.0 ).toVar();
 	const mip = float( 0.0 ).toVar();
 
 
@@ -115,19 +115,19 @@ const roughnessToMip = tslFn( ( [ roughness ] ) => {
 
 
 		mip.assign( cubeUV_r0.sub( roughness ).mul( cubeUV_m1.sub( cubeUV_m0 ) ).div( cubeUV_r0.sub( cubeUV_r1 ) ).add( cubeUV_m0 ) );
 		mip.assign( cubeUV_r0.sub( roughness ).mul( cubeUV_m1.sub( cubeUV_m0 ) ).div( cubeUV_r0.sub( cubeUV_r1 ) ).add( cubeUV_m0 ) );
 
 
-	} ).elseif( roughness.greaterThanEqual( cubeUV_r4 ), () => {
+	} ).ElseIf( roughness.greaterThanEqual( cubeUV_r4 ), () => {
 
 
 		mip.assign( cubeUV_r1.sub( roughness ).mul( cubeUV_m4.sub( cubeUV_m1 ) ).div( cubeUV_r1.sub( cubeUV_r4 ) ).add( cubeUV_m1 ) );
 		mip.assign( cubeUV_r1.sub( roughness ).mul( cubeUV_m4.sub( cubeUV_m1 ) ).div( cubeUV_r1.sub( cubeUV_r4 ) ).add( cubeUV_m1 ) );
 
 
-	} ).elseif( roughness.greaterThanEqual( cubeUV_r5 ), () => {
+	} ).ElseIf( roughness.greaterThanEqual( cubeUV_r5 ), () => {
 
 
 		mip.assign( cubeUV_r4.sub( roughness ).mul( cubeUV_m5.sub( cubeUV_m4 ) ).div( cubeUV_r4.sub( cubeUV_r5 ) ).add( cubeUV_m4 ) );
 		mip.assign( cubeUV_r4.sub( roughness ).mul( cubeUV_m5.sub( cubeUV_m4 ) ).div( cubeUV_r4.sub( cubeUV_r5 ) ).add( cubeUV_m4 ) );
 
 
-	} ).elseif( roughness.greaterThanEqual( cubeUV_r6 ), () => {
+	} ).ElseIf( roughness.greaterThanEqual( cubeUV_r6 ), () => {
 
 
 		mip.assign( cubeUV_r5.sub( roughness ).mul( cubeUV_m6.sub( cubeUV_m5 ) ).div( cubeUV_r5.sub( cubeUV_r6 ) ).add( cubeUV_m5 ) );
 		mip.assign( cubeUV_r5.sub( roughness ).mul( cubeUV_m6.sub( cubeUV_m5 ) ).div( cubeUV_r5.sub( cubeUV_r6 ) ).add( cubeUV_m5 ) );
 
 
-	} ).else( () => {
+	} ).Else( () => {
 
 
 		mip.assign( float( - 2.0 ).mul( log2( mul( 1.16, roughness ) ) ) ); // 1.16 = 1.79^0.25
 		mip.assign( float( - 2.0 ).mul( log2( mul( 1.16, roughness ) ) ) ); // 1.16 = 1.79^0.25
 
 
@@ -144,7 +144,7 @@ const roughnessToMip = tslFn( ( [ roughness ] ) => {
 } );
 } );
 
 
 // RH coordinate system; PMREM face-indexing convention
 // RH coordinate system; PMREM face-indexing convention
-export const getDirection = tslFn( ( [ uv_immutable, face ] ) => {
+export const getDirection = Fn( ( [ uv_immutable, face ] ) => {
 
 
 	const uv = uv_immutable.toVar();
 	const uv = uv_immutable.toVar();
 	uv.assign( mul( 2.0, uv ).sub( 1.0 ) );
 	uv.assign( mul( 2.0, uv ).sub( 1.0 ) );
@@ -154,26 +154,26 @@ export const getDirection = tslFn( ( [ uv_immutable, face ] ) => {
 
 
 		direction.assign( direction.zyx ); // ( 1, v, u ) pos x
 		direction.assign( direction.zyx ); // ( 1, v, u ) pos x
 
 
-	} ).elseif( face.equal( 1.0 ), () => {
+	} ).ElseIf( face.equal( 1.0 ), () => {
 
 
 		direction.assign( direction.xzy );
 		direction.assign( direction.xzy );
 		direction.xz.mulAssign( - 1.0 ); // ( -u, 1, -v ) pos y
 		direction.xz.mulAssign( - 1.0 ); // ( -u, 1, -v ) pos y
 
 
-	} ).elseif( face.equal( 2.0 ), () => {
+	} ).ElseIf( face.equal( 2.0 ), () => {
 
 
 		direction.x.mulAssign( - 1.0 ); // ( -u, v, 1 ) pos z
 		direction.x.mulAssign( - 1.0 ); // ( -u, v, 1 ) pos z
 
 
-	} ).elseif( face.equal( 3.0 ), () => {
+	} ).ElseIf( face.equal( 3.0 ), () => {
 
 
 		direction.assign( direction.zyx );
 		direction.assign( direction.zyx );
 		direction.xz.mulAssign( - 1.0 ); // ( -1, v, -u ) neg x
 		direction.xz.mulAssign( - 1.0 ); // ( -1, v, -u ) neg x
 
 
-	} ).elseif( face.equal( 4.0 ), () => {
+	} ).ElseIf( face.equal( 4.0 ), () => {
 
 
 		direction.assign( direction.xzy );
 		direction.assign( direction.xzy );
 		direction.xy.mulAssign( - 1.0 ); // ( -u, -1, v ) neg y
 		direction.xy.mulAssign( - 1.0 ); // ( -u, -1, v ) neg y
 
 
-	} ).elseif( face.equal( 5.0 ), () => {
+	} ).ElseIf( face.equal( 5.0 ), () => {
 
 
 		direction.z.mulAssign( - 1.0 ); // ( u, v, -1 ) neg zS
 		direction.z.mulAssign( - 1.0 ); // ( u, v, -1 ) neg zS
 
 
@@ -192,7 +192,7 @@ export const getDirection = tslFn( ( [ uv_immutable, face ] ) => {
 
 
 //
 //
 
 
-export const textureCubeUV = tslFn( ( [ envMap, sampleDir_immutable, roughness_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => {
+export const textureCubeUV = Fn( ( [ envMap, sampleDir_immutable, roughness_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => {
 
 
 	const roughness = float( roughness_immutable );
 	const roughness = float( roughness_immutable );
 	const sampleDir = vec3( sampleDir_immutable );
 	const sampleDir = vec3( sampleDir_immutable );
@@ -214,7 +214,7 @@ export const textureCubeUV = tslFn( ( [ envMap, sampleDir_immutable, roughness_i
 
 
 } );
 } );
 
 
-const bilinearCubeUV = tslFn( ( [ envMap, direction_immutable, mipInt_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => {
+const bilinearCubeUV = Fn( ( [ envMap, direction_immutable, mipInt_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP ] ) => {
 
 
 	const mipInt = float( mipInt_immutable ).toVar();
 	const mipInt = float( mipInt_immutable ).toVar();
 	const direction = vec3( direction_immutable );
 	const direction = vec3( direction_immutable );
@@ -241,7 +241,7 @@ const bilinearCubeUV = tslFn( ( [ envMap, direction_immutable, mipInt_immutable,
 
 
 } );
 } );
 
 
-const getSample = tslFn( ( { envMap, mipInt, outputDirection, theta, axis, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => {
+const getSample = Fn( ( { envMap, mipInt, outputDirection, theta, axis, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => {
 
 
 	const cosTheta = cos( theta );
 	const cosTheta = cos( theta );
 
 
@@ -254,9 +254,9 @@ const getSample = tslFn( ( { envMap, mipInt, outputDirection, theta, axis, CUBEU
 
 
 } );
 } );
 
 
-export const blur = tslFn( ( { n, latitudinal, poleAxis, outputDirection, weights, samples, dTheta, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => {
+export const blur = Fn( ( { n, latitudinal, poleAxis, outputDirection, weights, samples, dTheta, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) => {
 
 
-	const axis = vec3( cond( latitudinal, poleAxis, cross( poleAxis, outputDirection ) ) ).toVar();
+	const axis = vec3( select( latitudinal, poleAxis, cross( poleAxis, outputDirection ) ) ).toVar();
 
 
 	If( all( axis.equals( vec3( 0.0 ) ) ), () => {
 	If( all( axis.equals( vec3( 0.0 ) ) ), () => {
 
 
@@ -269,7 +269,7 @@ export const blur = tslFn( ( { n, latitudinal, poleAxis, outputDirection, weight
 	const gl_FragColor = vec3().toVar();
 	const gl_FragColor = vec3().toVar();
 	gl_FragColor.addAssign( weights.element( int( 0 ) ).mul( getSample( { theta: 0.0, axis, outputDirection, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) ) );
 	gl_FragColor.addAssign( weights.element( int( 0 ) ).mul( getSample( { theta: 0.0, axis, outputDirection, mipInt, envMap, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP } ) ) );
 
 
-	loop( { start: int( 1 ), end: n }, ( { i } ) => {
+	Loop( { start: int( 1 ), end: n }, ( { i } ) => {
 
 
 		If( i.greaterThanEqual( samples ), () => {
 		If( i.greaterThanEqual( samples ), () => {
 
 

+ 2 - 2
src/nodes/procedural/CheckerNode.js

@@ -1,9 +1,9 @@
 import TempNode from '../core/TempNode.js';
 import TempNode from '../core/TempNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { uv } from '../accessors/UVNode.js';
 import { addNodeClass } from '../core/Node.js';
 import { addNodeClass } from '../core/Node.js';
-import { addNodeElement, tslFn, nodeProxy } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, nodeProxy } from '../shadernode/ShaderNode.js';
 
 
-const checkerShaderNode = tslFn( ( inputs ) => {
+const checkerShaderNode = Fn( ( inputs ) => {
 
 
 	const uv = inputs.uv.mul( 2.0 );
 	const uv = inputs.uv.mul( 2.0 );
 
 

+ 10 - 3
src/nodes/shadernode/ShaderNode.js

@@ -164,7 +164,7 @@ const ShaderNodeObject = function ( obj, altType = null ) {
 
 
 	} else if ( type === 'shader' ) {
 	} else if ( type === 'shader' ) {
 
 
-		return tslFn( obj );
+		return Fn( obj );
 
 
 	}
 	}
 
 
@@ -492,7 +492,7 @@ export const nodeArray = ( val, altType = null ) => new ShaderNodeArray( val, al
 export const nodeProxy = ( ...params ) => new ShaderNodeProxy( ...params );
 export const nodeProxy = ( ...params ) => new ShaderNodeProxy( ...params );
 export const nodeImmutable = ( ...params ) => new ShaderNodeImmutable( ...params );
 export const nodeImmutable = ( ...params ) => new ShaderNodeImmutable( ...params );
 
 
-export const tslFn = ( jsFunc ) => {
+export const Fn = ( jsFunc ) => {
 
 
 	const shaderNode = new ShaderNode( jsFunc );
 	const shaderNode = new ShaderNode( jsFunc );
 
 
@@ -529,6 +529,13 @@ export const tslFn = ( jsFunc ) => {
 
 
 };
 };
 
 
+export const tslFn = ( ...params ) => { // @deprecated, r168
+
+	console.warn( 'TSL.tslFn: tslFn() has been renamed to Fn().' );
+	return Fn( ...params );
+
+};
+
 addNodeClass( 'ShaderNode', ShaderNode );
 addNodeClass( 'ShaderNode', ShaderNode );
 
 
 //
 //
@@ -557,7 +564,7 @@ export const setCurrentStack = ( stack ) => {
 
 
 export const getCurrentStack = () => currentStack;
 export const getCurrentStack = () => currentStack;
 
 
-export const If = ( ...params ) => currentStack.if( ...params );
+export const If = ( ...params ) => currentStack.If( ...params );
 
 
 export function append( node ) {
 export function append( node ) {
 
 

+ 10 - 4
src/nodes/utils/LoopNode.js

@@ -1,7 +1,6 @@
 import Node, { addNodeClass } from '../core/Node.js';
 import Node, { addNodeClass } from '../core/Node.js';
 import { expression } from '../code/ExpressionNode.js';
 import { expression } from '../code/ExpressionNode.js';
-import { bypass } from '../core/BypassNode.js';
-import { addNodeElement, nodeObject, nodeArray } from '../shadernode/ShaderNode.js';
+import { nodeObject, nodeArray } from '../shadernode/ShaderNode.js';
 
 
 class LoopNode extends Node {
 class LoopNode extends Node {
 
 
@@ -192,10 +191,17 @@ class LoopNode extends Node {
 
 
 export default LoopNode;
 export default LoopNode;
 
 
-export const loop = ( ...params ) => nodeObject( new LoopNode( nodeArray( params, 'int' ) ) ).append();
+export const Loop = ( ...params ) => nodeObject( new LoopNode( nodeArray( params, 'int' ) ) ).append();
 export const Continue = () => expression( 'continue' ).append();
 export const Continue = () => expression( 'continue' ).append();
 export const Break = () => expression( 'break' ).append();
 export const Break = () => expression( 'break' ).append();
 
 
-addNodeElement( 'loop', ( returns, ...params ) => bypass( returns, loop( ...params ) ) );
+//
+
+export const loop = ( ...params ) => { // @deprecated, r168
+
+	console.warn( 'TSL.LoopNode: loop() has been renamed to Loop().' );
+	return Loop( ...params );
+
+};
 
 
 addNodeClass( 'LoopNode', LoopNode );
 addNodeClass( 'LoopNode', LoopNode );

+ 2 - 2
src/nodes/utils/SpriteUtils.js

@@ -1,9 +1,9 @@
 import { modelWorldMatrix } from '../accessors/ModelNode.js';
 import { modelWorldMatrix } from '../accessors/ModelNode.js';
 import { cameraViewMatrix, cameraProjectionMatrix } from '../accessors/CameraNode.js';
 import { cameraViewMatrix, cameraProjectionMatrix } from '../accessors/CameraNode.js';
 import { positionLocal } from '../accessors/PositionNode.js';
 import { positionLocal } from '../accessors/PositionNode.js';
-import { tslFn, defined } from '../shadernode/ShaderNode.js';
+import { Fn, defined } from '../shadernode/ShaderNode.js';
 
 
-export const billboarding = tslFn( ( { position = null, horizontal = true, vertical = false } ) => {
+export const billboarding = Fn( ( { position = null, horizontal = true, vertical = false } ) => {
 
 
 	let worldMatrix;
 	let worldMatrix;
 
 

+ 3 - 3
src/nodes/utils/UVUtils.js

@@ -1,12 +1,12 @@
-import { addNodeElement, tslFn, vec2 } from '../shadernode/ShaderNode.js';
+import { addNodeElement, Fn, vec2 } from '../shadernode/ShaderNode.js';
 
 
-export const rotateUV = tslFn( ( [ uv, rotation, center = vec2( 0.5 ) ] ) => {
+export const rotateUV = Fn( ( [ uv, rotation, center = vec2( 0.5 ) ] ) => {
 
 
 	return uv.sub( center ).rotate( rotation ).add( center );
 	return uv.sub( center ).rotate( rotation ).add( center );
 
 
 } );
 } );
 
 
-export const spherizeUV = tslFn( ( [ uv, strength, center = vec2( 0.5 ) ] ) => {
+export const spherizeUV = Fn( ( [ uv, strength, center = vec2( 0.5 ) ] ) => {
 
 
 	const delta = uv.sub( center );
 	const delta = uv.sub( center );
 	const delta2 = delta.dot( delta );
 	const delta2 = delta.dot( delta );

+ 3 - 3
src/nodes/utils/ViewportUtils.js

@@ -1,13 +1,13 @@
-import { tslFn } from '../shadernode/ShaderNode.js';
+import { Fn } from '../shadernode/ShaderNode.js';
 import { viewportTopLeft } from '../display/ViewportNode.js';
 import { viewportTopLeft } from '../display/ViewportNode.js';
 import { viewportDepthTexture } from '../display/ViewportDepthTextureNode.js';
 import { viewportDepthTexture } from '../display/ViewportDepthTextureNode.js';
 import { linearDepth } from '../display/ViewportDepthNode.js';
 import { linearDepth } from '../display/ViewportDepthNode.js';
 
 
-export const viewportSafeUV = tslFn( ( [ uv = null ] ) => {
+export const viewportSafeUV = Fn( ( [ uv = null ] ) => {
 
 
 	const depth = linearDepth();
 	const depth = linearDepth();
 	const depthDiff = linearDepth( viewportDepthTexture( uv ) ).sub( depth );
 	const depthDiff = linearDepth( viewportDepthTexture( uv ) ).sub( depth );
-	const finalUV = depthDiff.lessThan( 0 ).cond( viewportTopLeft, uv );
+	const finalUV = depthDiff.lessThan( 0 ).select( viewportTopLeft, uv );
 
 
 	return finalUV;
 	return finalUV;
 
 

粤ICP备19079148号