Skip to content

Commit

Permalink
Sky: Add WebGPURenderer version. (#1161)
Browse files Browse the repository at this point in the history
* Sky: Add WebGPURenderer version.

* Update three.js

* Add examples

* Update patch and delete examples

* Fix

* upUniform

* Update
  • Loading branch information
Methuselah96 committed Aug 22, 2024
1 parent 562806b commit 0e30713
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
20 changes: 20 additions & 0 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15091,6 +15091,26 @@ index dc018c6d..6c7faf4d 100644

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
+++ b/examples-testing/examples/webgpu_sky.ts
@@ -1,12 +1,12 @@
-import * as THREE from 'three';
+import * as THREE from 'three/webgpu';

import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { Sky } from 'three/addons/objects/SkyGPU.js';

-let camera, scene, renderer;
+let camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.WebGPURenderer;

-let sky, sun;
+let sky: Sky, sun: THREE.Vector3;

init();

diff --git a/examples-testing/examples/webgpu_textures_anisotropy.ts b/examples-testing/examples/webgpu_textures_anisotropy.ts
index 21cc1197..eec04d7e 100644
--- a/examples-testing/examples/webgpu_textures_anisotropy.ts
Expand Down
17 changes: 17 additions & 0 deletions types/three/examples/jsm/objects/SkyGPU.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Node, ShaderNodeObject, UniformNode } from "three/tsl";
import { BoxGeometry, Mesh, NodeMaterial, Vector3 } from "three/webgpu";

declare class Sky extends Mesh<BoxGeometry, NodeMaterial> {
turbidity: ShaderNodeObject<UniformNode<number>>;
rayleigh: ShaderNodeObject<UniformNode<number>>;
mieCoefficient: ShaderNodeObject<UniformNode<number>>;
mieDirectionalG: ShaderNodeObject<UniformNode<number>>;
sunPosition: ShaderNodeObject<UniformNode<Vector3>>;
upUniform: ShaderNodeObject<UniformNode<Vector3>>;

readonly isSky: true;

constructor();
}

export { Sky };

0 comments on commit 0e30713

Please sign in to comment.