Skip to content

Commit

Permalink
WebGPURenderer: Improve ArrayCamera performance and fixes (#1509)
Browse files Browse the repository at this point in the history
* WebGPURenderer: Improve ArrayCamera performance and fixes

* Update three.js

* Add src

* Update patch and delete src

* Update declarations

* Add examples

* Update

* Update patch and delete examples
  • Loading branch information
Methuselah96 authored Jan 21, 2025
1 parent 18cf1ce commit 0b2946b
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 185 deletions.
22 changes: 14 additions & 8 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13336,27 +13336,33 @@ index 45619da3..97df59b3 100644
case 79 /*O*/:
activeCamera = cameraOrtho;
diff --git a/examples-testing/examples/webgpu_camera_array.ts b/examples-testing/examples/webgpu_camera_array.ts
index 2e8218be..92051ebc 100644
index 919b7422..fb696689 100644
--- a/examples-testing/examples/webgpu_camera_array.ts
+++ b/examples-testing/examples/webgpu_camera_array.ts
@@ -1,6 +1,6 @@
@@ -1,10 +1,10 @@
-import * as THREE from 'three';
+import * as THREE from 'three/webgpu';

import Stats from 'three/addons/libs/stats.module.js';

-let camera, scene, renderer;
-let mesh;
-let stats;
+let camera: THREE.ArrayCamera, scene: THREE.Scene, renderer: THREE.WebGPURenderer;
let mesh;
+let mesh: THREE.Mesh;
+let stats: Stats;

const AMOUNT = 6;

@@ -87,7 +87,7 @@ function onWindowResize() {
for (let x = 0; x < AMOUNT; x++) {
@@ -82,7 +82,7 @@ function updateCameras() {
const subcamera = camera.cameras[AMOUNT * y + x];
subcamera.copy(camera); // copy fov, aspect ratio, near, far from the root camera

- subcamera.viewport.set(Math.floor(x * WIDTH), Math.floor(y * HEIGHT), Math.ceil(WIDTH), Math.ceil(HEIGHT));
+ subcamera.viewport!.set(Math.floor(x * WIDTH), Math.floor(y * HEIGHT), Math.ceil(WIDTH), Math.ceil(HEIGHT));

subcamera.aspect = ASPECT_RATIO;
subcamera.updateProjectionMatrix();

subcamera.position.x = x / AMOUNT - 0.5;
diff --git a/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts b/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts
index 15527632..58f5cc14 100644
--- a/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts
Expand Down Expand Up @@ -16975,7 +16981,7 @@ index 45ffecc1..ce082652 100644
});

diff --git a/examples-testing/examples/webgpu_postprocessing_traa.ts b/examples-testing/examples/webgpu_postprocessing_traa.ts
index 9a5558e9..05dbf9db 100644
index 6e8509d1..7540235d 100644
--- a/examples-testing/examples/webgpu_postprocessing_traa.ts
+++ b/examples-testing/examples/webgpu_postprocessing_traa.ts
@@ -1,11 +1,14 @@
Expand Down
Loading

0 comments on commit 0b2946b

Please sign in to comment.