From e46b2412f64d842abe526b1e531776623ff5fe53 Mon Sep 17 00:00:00 2001 From: Siddharth Ancha Date: Mon, 3 Feb 2025 09:34:39 -0800 Subject: [PATCH 1/2] Add instanced_mesh.html example --- test/instanced_mesh.html | 167 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 test/instanced_mesh.html diff --git a/test/instanced_mesh.html b/test/instanced_mesh.html new file mode 100644 index 00000000..4b8ae9f2 --- /dev/null +++ b/test/instanced_mesh.html @@ -0,0 +1,167 @@ + + + + + + MeshCat - InstancedMesh + + + +
+
+ + + + + + + + From bebe9599a74cd82edd71bf339305ee1f7b61912b Mon Sep 17 00:00:00 2001 From: Siddharth Ancha Date: Tue, 11 Feb 2025 01:04:34 -0800 Subject: [PATCH 2/2] Fix `InstancedBufferAttribute` -> `Float32Array` Also add itemSize: 16 for instanceMatrix --- test/instanced_mesh.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/instanced_mesh.html b/test/instanced_mesh.html index 4b8ae9f2..65541665 100644 --- a/test/instanced_mesh.html +++ b/test/instanced_mesh.html @@ -45,7 +45,8 @@ geometry: "c2afd88b-ff9e-4408-9b94-b94e2079e2c8", material: "a63e3e66-c87a-4826-adee-2cf0fc04bf70", instanceMatrix: { - type: "InstancedBufferAttribute", + type: "Float32Array", + itemSize: 16, array: [ // Each line is a 4x4 transform matrix of a cube // The 4x4 matrices are flattened in column-major order @@ -85,7 +86,7 @@ ] }, instanceColor: { - type: "InstancedBufferAttribute", + type: "Float32Array", itemSize: 3, array: new Float32Array(27 * 3).fill(1) // 27 instances * 3 components (RGB) },