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

WebGPURenderer: BatchedMesh colors support #1201

Merged
merged 4 commits into from
Aug 25, 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
18 changes: 10 additions & 8 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14189,10 +14189,10 @@ index bd84aba0..f9d188c3 100644
}

diff --git a/examples-testing/examples/webgpu_mesh_batch.ts b/examples-testing/examples/webgpu_mesh_batch.ts
index a619f430..46473e46 100644
index 48c6fad6..52624f42 100644
--- a/examples-testing/examples/webgpu_mesh_batch.ts
+++ b/examples-testing/examples/webgpu_mesh_batch.ts
@@ -1,17 +1,17 @@
@@ -1,19 +1,19 @@
-import * as THREE from 'three';
+import * as THREE from 'three/webgpu';

Expand All @@ -14202,7 +14202,9 @@ index a619f430..46473e46 100644

import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
-import { radixSort } from 'three/addons/utils/SortUtils.js';
+import { RadixSortOptions, radixSort } from 'three/addons/utils/SortUtils.js';
+import { radixSort, RadixSortOptions } from 'three/addons/utils/SortUtils.js';

import { transformedNormalView, directionToColor, diffuseColor } from 'three/tsl';

-let camera, scene, renderer;
-let controls, stats;
Expand All @@ -14212,12 +14214,12 @@ index a619f430..46473e46 100644
+let camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.WebGPURenderer;
+let controls: OrbitControls, stats: Stats;
+let gui: GUI;
+let geometries: THREE.BufferGeometry[], mesh: THREE.BatchedMesh, material: THREE.MeshNormalNodeMaterial;
+let geometries: THREE.BufferGeometry[], mesh: THREE.BatchedMesh, material: THREE.MeshBasicNodeMaterial;
+const ids: number[] = [];

const matrix = new THREE.Matrix4();

@@ -41,7 +41,7 @@ init();
@@ -43,7 +43,7 @@ init();

//

Expand All @@ -14226,7 +14228,7 @@ index a619f430..46473e46 100644
position.x = Math.random() * 40 - 20;
position.y = Math.random() * 40 - 20;
position.z = Math.random() * 40 - 20;
@@ -57,7 +57,7 @@ function randomizeMatrix(matrix) {
@@ -59,7 +59,7 @@ function randomizeMatrix(matrix) {
return matrix.compose(position, quaternion, scale);
}

Expand All @@ -14235,7 +14237,7 @@ index a619f430..46473e46 100644
rotation.x = Math.random() * 0.01;
rotation.y = Math.random() * 0.01;
rotation.z = Math.random() * 0.01;
@@ -82,7 +82,7 @@ function createMaterial() {
@@ -85,7 +85,7 @@ function createMaterial() {

function cleanup() {
if (mesh) {
Expand All @@ -14244,7 +14246,7 @@ index a619f430..46473e46 100644

if (mesh.dispose) {
mesh.dispose();
@@ -250,18 +250,26 @@ function init(forceWebGL = false) {
@@ -248,18 +248,26 @@ function init(forceWebGL = false) {

//

Expand Down
1 change: 0 additions & 1 deletion types/three/src/nodes/accessors/BatchNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ShaderNodeObject } from "../shadernode/ShaderNode.js";
export default class BatchNode extends Node {
batchMesh: BatchedMesh;

instanceColorNode: Node | null;
batchingIdNode: Node | null;

constructor(batchMesh: BatchedMesh);
Expand Down
Loading