Skip to content

Commit 5eea9d7

Browse files
authored
Examples: Some revision of webgpu examples (mrdoob#28011)
* webgpu_compute_texture_pingpong: use .computeAsync() * webgpu_postprocessing_anamorphic: use .loadCubemapAsync() * webgpu_shadowmap: use `scene.backgroundNode`
1 parent 99259ff commit 5eea9d7

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

examples/webgpu_compute_texture_pingpong.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
const seed = uniform( new THREE.Vector2() );
4141

4242
init();
43-
render();
4443

4544
function init() {
4645

@@ -163,7 +162,7 @@
163162

164163
// compute init
165164

166-
renderer.compute( computeInitNode );
165+
renderer.computeAsync( computeInitNode );
167166

168167
}
169168

@@ -180,8 +179,6 @@
180179

181180
camera.updateProjectionMatrix();
182181

183-
render();
184-
185182
}
186183

187184
function render() {

examples/webgpu_postprocessing_anamorphic.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
init();
5050

51-
function init() {
51+
async function init() {
5252

5353
if ( WebGPU.isAvailable() === false && WebGL.isWebGL2Available() === false ) {
5454

@@ -67,10 +67,10 @@
6767
scene = new THREE.Scene();
6868

6969
const rgbmUrls = [ 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' ];
70-
const cube1Texture = new RGBMLoader()
70+
const cube1Texture = await new RGBMLoader()
7171
.setMaxRange( 16 )
7272
.setPath( './textures/cube/pisaRGBM16/' )
73-
.loadCubemap( rgbmUrls );
73+
.loadCubemapAsync( rgbmUrls );
7474

7575
scene.environment = cube1Texture;
7676
scene.backgroundNode = cubeTexture( cube1Texture ).mul( viewportTopLeft.distance( .5 ).oneMinus().remapClamp( .1, 4 ) ).saturation( 0 );

examples/webgpu_shadowmap.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
3232

3333
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
34-
import { vec4, tslFn, vertexIndex, MeshPhongNodeMaterial } from 'three/nodes';
34+
import { vec4, tslFn, color, vertexIndex, MeshPhongNodeMaterial } from 'three/nodes';
3535
let camera, scene, renderer, clock;
3636
let dirLight, spotLight;
3737
let torusKnot, dirGroup;
@@ -52,7 +52,7 @@
5252
camera.position.set( 0, 10, 20 );
5353

5454
scene = new THREE.Scene();
55-
scene.background = new THREE.Color( 0x222244 );
55+
scene.backgroundNode = color( 0x222244 );
5656
scene.fog = new THREE.Fog( 0x222244, 50, 100 );
5757

5858
// lights

0 commit comments

Comments
 (0)