Skip to content

Commit 15b5d80

Browse files
committed
rename tslFn -> Fn
1 parent 7641f5c commit 15b5d80

File tree

85 files changed

+313
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+313
-306
lines changed

examples/webgpu_compute_audio.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<script type="module">
3030

3131
import * as THREE from 'three';
32-
import { tslFn, uniform, storage, storageObject, instanceIndex, float, texture, viewportTopLeft, color } from 'three/tsl';
32+
import { Fn, uniform, storage, storageObject, instanceIndex, float, texture, viewportTopLeft, color } from 'three/tsl';
3333

3434
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
3535

@@ -112,7 +112,7 @@
112112

113113
// compute (shader-node)
114114

115-
const computeShaderFn = tslFn( () => {
115+
const computeShaderFn = Fn( () => {
116116

117117
const index = float( instanceIndex );
118118

examples/webgpu_compute_geometry.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<script type="module">
2626

2727
import * as THREE from 'three';
28-
import { vec3, cos, sin, mat3, storage, tslFn, instanceIndex, timerLocal } from 'three/tsl';
28+
import { vec3, cos, sin, mat3, storage, Fn, instanceIndex, timerLocal } from 'three/tsl';
2929

3030
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
3131

@@ -66,7 +66,7 @@
6666

6767
// compute shader
6868

69-
const computeFn = tslFn( () => {
69+
const computeFn = Fn( () => {
7070

7171
const positionAttribute = storage( positionBaseAttribute, 'vec3', positionBaseAttribute.count ).toReadOnly();
7272
const normalAttribute = storage( normalBaseAttribute, 'vec3', normalBaseAttribute.count ).toReadOnly();

examples/webgpu_compute_particles.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<script type="module">
3838

3939
import * as THREE from 'three';
40-
import { tslFn, uniform, texture, instanceIndex, float, vec3, storage, If } from 'three/tsl';
40+
import { Fn, uniform, texture, instanceIndex, float, vec3, storage, If } from 'three/tsl';
4141

4242
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
4343
import Stats from 'three/addons/libs/stats.module.js';
@@ -85,7 +85,7 @@
8585

8686
// compute
8787

88-
const computeInit = tslFn( () => {
88+
const computeInit = Fn( () => {
8989

9090
const position = positionBuffer.element( instanceIndex );
9191
const color = colorBuffer.element( instanceIndex );
@@ -104,7 +104,7 @@
104104

105105
//
106106

107-
const computeUpdate = tslFn( () => {
107+
const computeUpdate = Fn( () => {
108108

109109
const position = positionBuffer.element( instanceIndex );
110110
const velocity = velocityBuffer.element( instanceIndex );
@@ -182,7 +182,7 @@
182182

183183
// click event
184184

185-
const computeHit = tslFn( () => {
185+
const computeHit = Fn( () => {
186186

187187
const position = positionBuffer.element( instanceIndex );
188188
const velocity = velocityBuffer.element( instanceIndex );

examples/webgpu_compute_particles_rain.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<script type="module">
2525

2626
import * as THREE from 'three';
27-
import { tslFn, texture, uv, uint, positionWorld, billboarding, timerLocal, timerDelta, vec2, instanceIndex, positionGeometry, storage, If } from 'three/tsl';
27+
import { Fn, texture, uv, uint, positionWorld, billboarding, timerLocal, timerDelta, vec2, instanceIndex, positionGeometry, storage, If } from 'three/tsl';
2828

2929
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3030

@@ -106,7 +106,7 @@
106106

107107
const randUint = () => uint( Math.random() * 0xFFFFFF );
108108

109-
const computeInit = tslFn( () => {
109+
const computeInit = Fn( () => {
110110

111111
const position = positionBuffer.element( instanceIndex );
112112
const velocity = velocityBuffer.element( instanceIndex );
@@ -128,7 +128,7 @@
128128

129129
//
130130

131-
const computeUpdate = tslFn( () => {
131+
const computeUpdate = Fn( () => {
132132

133133
const getCoord = ( pos ) => pos.add( 50 ).div( 100 );
134134

@@ -205,7 +205,7 @@
205205

206206
const rippleTime = rippleTimeBuffer.element( instanceIndex ).x;
207207

208-
const rippleEffect = tslFn( () => {
208+
const rippleEffect = Fn( () => {
209209

210210
const center = uv().add( vec2( - .5 ) ).length().mul( 7 );
211211
const distance = rippleTime.sub( center );

examples/webgpu_compute_particles_snow.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<script type="module">
2626

2727
import * as THREE from 'three';
28-
import { tslFn, texture, vec3, pass, color, uint, viewportTopLeft, positionWorld, positionLocal, timerLocal, vec2, instanceIndex, storage, If } from 'three/tsl';
28+
import { Fn, texture, vec3, pass, color, uint, viewportTopLeft, positionWorld, positionLocal, timerLocal, vec2, instanceIndex, storage, If } from 'three/tsl';
2929

3030
import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js';
3131

@@ -105,7 +105,7 @@
105105

106106
const randUint = () => uint( Math.random() * 0xFFFFFF );
107107

108-
const computeInit = tslFn( () => {
108+
const computeInit = Fn( () => {
109109

110110
const position = positionBuffer.element( instanceIndex );
111111
const scale = scaleBuffer.element( instanceIndex );
@@ -136,7 +136,7 @@
136136
const surfaceOffset = .2;
137137
const speed = .4;
138138

139-
const computeUpdate = tslFn( () => {
139+
const computeUpdate = Fn( () => {
140140

141141
const getCoord = ( pos ) => pos.add( 50 ).div( 100 );
142142

examples/webgpu_compute_points.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<script type="module">
2525

2626
import * as THREE from 'three';
27-
import { tslFn, uniform, storage, attribute, float, vec2, vec3, color, instanceIndex } from 'three/tsl';
27+
import { Fn, uniform, storage, attribute, float, vec2, vec3, color, instanceIndex } from 'three/tsl';
2828

2929
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
3030

@@ -58,7 +58,7 @@
5858

5959
// create function
6060

61-
const computeShaderFn = tslFn( () => {
61+
const computeShaderFn = Fn( () => {
6262

6363
const particle = particleBufferNode.element( instanceIndex );
6464
const velocity = velocityBufferNode.element( instanceIndex );
@@ -85,7 +85,7 @@
8585
computeNode = computeShaderFn().compute( particleNum );
8686
computeNode.onInit = ( { renderer } ) => {
8787

88-
const precomputeShaderNode = tslFn( () => {
88+
const precomputeShaderNode = Fn( () => {
8989

9090
const particleIndex = float( instanceIndex );
9191

examples/webgpu_compute_texture.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<script type="module">
2525

2626
import * as THREE from 'three';
27-
import { texture, textureStore, tslFn, instanceIndex, float, uvec2, vec4 } from 'three/tsl';
27+
import { texture, textureStore, Fn, instanceIndex, float, uvec2, vec4 } from 'three/tsl';
2828

2929
import WebGPU from 'three/addons/capabilities/WebGPU.js';
3030

@@ -58,7 +58,7 @@
5858

5959
// create function
6060

61-
const computeTexture = tslFn( ( { storageTexture } ) => {
61+
const computeTexture = Fn( ( { storageTexture } ) => {
6262

6363
const posX = instanceIndex.remainder( width );
6464
const posY = instanceIndex.div( width );

examples/webgpu_materials.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<script type="module">
2626

2727
import * as THREE from 'three';
28-
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';
28+
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';
2929

3030
import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js';
3131

@@ -135,7 +135,7 @@
135135

136136
// Custom ShaderNode ( desaturate filter )
137137

138-
const desaturateShaderNode = tslFn( ( input ) => {
138+
const desaturateShaderNode = Fn( ( input ) => {
139139

140140
return vec3( 0.299, 0.587, 0.114 ).dot( input.color.xyz );
141141

@@ -147,7 +147,7 @@
147147

148148
// Custom ShaderNode(no inputs) > Approach 2
149149

150-
const desaturateNoInputsShaderNode = tslFn( () => {
150+
const desaturateNoInputsShaderNode = Fn( () => {
151151

152152
return vec3( 0.299, 0.587, 0.114 ).dot( texture( uvTexture ).xyz );
153153

examples/webgpu_mrt.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<script type="module">
2727

2828
import * as THREE from 'three';
29-
import { output, transformedNormalWorld, pass, step, diffuseColor, emissive, viewportTopLeft, mix, mrt, tslFn } from 'three/tsl';
29+
import { output, transformedNormalWorld, pass, step, diffuseColor, emissive, viewportTopLeft, mix, mrt, Fn } from 'three/tsl';
3030

3131
import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
3232

@@ -101,7 +101,7 @@
101101

102102
postProcessing = new THREE.PostProcessing( renderer );
103103
postProcessing.outputColorTransform = false;
104-
postProcessing.outputNode = tslFn( () => {
104+
postProcessing.outputNode = Fn( () => {
105105

106106
const output = scenePass.getTextureNode( 'output' ); // output name is optional here
107107
const normal = scenePass.getTextureNode( 'normal' );

examples/webgpu_shadowmap.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<script type="module">
2525

2626
import * as THREE from 'three';
27-
import { mx_fractal_noise_vec3, positionWorld, vec4, tslFn, color, vertexIndex } from 'three/tsl';
27+
import { mx_fractal_noise_vec3, positionWorld, vec4, Fn, color, vertexIndex } from 'three/tsl';
2828

2929
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3030

@@ -95,7 +95,7 @@
9595

9696
const discardNode = vertexIndex.hash().greaterThan( 0.5 );
9797

98-
materialCustomShadow.colorNode = tslFn( () => {
98+
materialCustomShadow.colorNode = Fn( () => {
9999

100100
discardNode.discard();
101101

@@ -104,7 +104,7 @@
104104
} )();
105105

106106

107-
materialCustomShadow.shadowNode = tslFn( () => {
107+
materialCustomShadow.shadowNode = Fn( () => {
108108

109109
discardNode.discard();
110110

@@ -144,7 +144,7 @@
144144
specular: 0x111111
145145
} );
146146

147-
planeMaterial.shadowPositionNode = tslFn( () => {
147+
planeMaterial.shadowPositionNode = Fn( () => {
148148

149149
const pos = positionWorld.toVar();
150150
pos.xz.addAssign( mx_fractal_noise_vec3( positionWorld.mul( 2 ) ).saturate().xz );
@@ -153,7 +153,7 @@
153153
} )();
154154

155155

156-
planeMaterial.colorNode = tslFn( () => {
156+
planeMaterial.colorNode = Fn( () => {
157157

158158
const pos = positionWorld.toVar();
159159
pos.xz.addAssign( mx_fractal_noise_vec3( positionWorld.mul( 2 ) ).saturate().xz );

0 commit comments

Comments
 (0)