Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: tslFn rename to Fn #29090

Merged
merged 5 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/jsm/objects/SkyMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
NodeMaterial,
Vector3
} from 'three';
import { float, tslFn, vec3, acos, add, mul, clamp, cos, dot, exp, max, mix, modelViewProjection, normalize, positionWorld, pow, smoothstep, sub, varying, varyingProperty, vec4, uniform, cameraPosition } from 'three/tsl';
import { float, Fn, vec3, acos, add, mul, clamp, cos, dot, exp, max, mix, modelViewProjection, normalize, positionWorld, pow, smoothstep, sub, varying, varyingProperty, vec4, uniform, cameraPosition } from 'three/tsl';

/**
* Based on "A Practical Analytic Model for Daylight"
Expand Down Expand Up @@ -38,7 +38,7 @@ class SkyMesh extends Mesh {

this.isSky = true;

const vertexNode = /*@__PURE__*/ tslFn( () => {
const vertexNode = /*@__PURE__*/ Fn( () => {

// constants for atmospheric scattering
const e = float( 2.71828182845904523536028747135266249775724709369995957 );
Expand Down Expand Up @@ -104,7 +104,7 @@ class SkyMesh extends Mesh {

} )();

const fragmentNode = /*@__PURE__*/ tslFn( () => {
const fragmentNode = /*@__PURE__*/ Fn( () => {

const vSunDirection = varying( vec3(), 'vSunDirection' );
const vSunE = varying( float(), 'vSunE' );
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/objects/Water2Mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Vector2,
Vector3
} from 'three';
import { vec2, viewportSafeUV, viewportSharedTexture, reflector, pow, float, abs, texture, uniform, TempNode, NodeUpdateType, vec4, tslFn, cameraPosition, positionWorld, uv, mix, vec3, normalize, max, dot, viewportTopLeft } from 'three/tsl';
import { vec2, viewportSafeUV, viewportSharedTexture, reflector, pow, float, abs, texture, uniform, TempNode, NodeUpdateType, vec4, Fn, cameraPosition, positionWorld, uv, mix, vec3, normalize, max, dot, viewportTopLeft } from 'three/tsl';

/**
* References:
Expand Down Expand Up @@ -91,7 +91,7 @@ class WaterNode extends TempNode {

setup() {

const outputNode = tslFn( () => {
const outputNode = Fn( () => {

const flowMapOffset0 = this.flowConfig.x;
const flowMapOffset1 = this.flowConfig.y;
Expand Down
6 changes: 3 additions & 3 deletions examples/jsm/objects/WaterMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
NodeMaterial,
Vector3
} from 'three';
import { add, cameraPosition, div, normalize, positionWorld, sub, timerLocal, tslFn, texture, vec2, vec3, vec4, max, dot, reflect, pow, length, float, uniform, reflector, mul, mix } from 'three/tsl';
import { add, cameraPosition, div, normalize, positionWorld, sub, timerLocal, Fn, texture, vec2, vec3, vec4, max, dot, reflect, pow, length, float, uniform, reflector, mul, mix } from 'three/tsl';

/**
* Work based on :
Expand Down Expand Up @@ -39,7 +39,7 @@ class WaterMesh extends Mesh {

const timeNode = timerLocal();

const getNoise = tslFn( ( [ uv ] ) => {
const getNoise = Fn( ( [ uv ] ) => {

const uv0 = add( div( uv, 103 ), vec2( div( timeNode, 17 ), div( timeNode, 29 ) ) ).toVar();
const uv1 = div( uv, 107 ).sub( vec2( div( timeNode, - 19 ), div( timeNode, 31 ) ) ).toVar();
Expand All @@ -57,7 +57,7 @@ class WaterMesh extends Mesh {

} );

const fragmentNode = tslFn( () => {
const fragmentNode = Fn( () => {

const noise = getNoise( positionWorld.xz.mul( this.size ) );
const surfaceNormal = normalize( noise.xzy.mul( 1.5, 1.0, 1.5 ) );
Expand Down