Skip to content

Commit

Permalink
TSL: Introduce viewportSafeUV() (#1163)
Browse files Browse the repository at this point in the history
* TSL: Introduce viewportSafeUV()

* Update three.js

* Add examples

* Update

* Update patch and delete examples

* Format
  • Loading branch information
Methuselah96 authored Aug 22, 2024
1 parent fdf82ad commit 798097a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
13 changes: 2 additions & 11 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15125,13 +15125,13 @@ index d4228f90..191b58f2 100644
init();
render();
diff --git a/examples-testing/examples/webgpu_refraction.ts b/examples-testing/examples/webgpu_refraction.ts
index dc018c6d..6c7faf4d 100644
index bf36d911..0e77df7c 100644
--- a/examples-testing/examples/webgpu_refraction.ts
+++ b/examples-testing/examples/webgpu_refraction.ts
@@ -1,13 +1,13 @@
-import * as THREE from 'three';
+import * as THREE from 'three/webgpu';
import { viewportSharedTexture, texture, uv } from 'three/tsl';
import { viewportSafeUV, viewportSharedTexture, viewportTopLeft, texture, uv } from 'three/tsl';

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

Expand All @@ -15146,15 +15146,6 @@ index dc018c6d..6c7faf4d 100644

init();

@@ -40,7 +40,7 @@ function init() {

const verticalNormalScale = 0.1;
const verticalUVOffset = texture(floorNormal, uv().mul(5)).xy.mul(2).sub(1).mul(verticalNormalScale);
- verticalRefractor.uvNode = verticalRefractor.uvNode.add(verticalUVOffset);
+ verticalRefractor.uvNode = verticalRefractor.uvNode!.add(verticalUVOffset);

const planeGeo = new THREE.PlaneGeometry(100.1, 100.1);

diff --git a/examples-testing/examples/webgpu_sky.ts b/examples-testing/examples/webgpu_sky.ts
index 60af1c2d..1b7a8906 100644
--- a/examples-testing/examples/webgpu_sky.ts
Expand Down
1 change: 1 addition & 0 deletions examples-testing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const exceptionList = [
'webgpu_tsl_procedural_terrain',
'webgpu_tsl_raging_sea',
'webgpu_tsl_transpiler',
'webgpu_tsl_vfx_tornado',
'webgpu_volume_cloud',
'webgpu_volume_perlin',
'webxr_vr_handinput_cubes',
Expand Down
1 change: 1 addition & 0 deletions types/three/src/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export {
triplanarTextures,
} from "./utils/TriplanarTexturesNode.js";
export * from "./utils/UVUtils.js";
export * from "./utils/ViewportUtils.js";

// shader node
export * from "./shadernode/ShaderNode.js";
Expand Down
4 changes: 4 additions & 0 deletions types/three/src/nodes/utils/ViewportUtils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Node from "../core/Node.js";
import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";

export const viewportSafeUV: (uv?: NodeRepresentation | null) => ShaderNodeObject<Node>;

0 comments on commit 798097a

Please sign in to comment.