From bc3b9a4261200ff5202914c1bc9b31a2de023e6f Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Wed, 10 Jul 2024 02:44:57 -0600 Subject: [PATCH 1/6] Slowly testing a batching approach --- fission/src/mirabuf/MirabufInstance.ts | 98 ++++++++++++++++++----- fission/src/mirabuf/MirabufSceneObject.ts | 10 ++- 2 files changed, 85 insertions(+), 23 deletions(-) diff --git a/fission/src/mirabuf/MirabufInstance.ts b/fission/src/mirabuf/MirabufInstance.ts index 70448dcf31..52957d8bf7 100644 --- a/fission/src/mirabuf/MirabufInstance.ts +++ b/fission/src/mirabuf/MirabufInstance.ts @@ -3,6 +3,10 @@ import { mirabuf } from "../proto/mirabuf" import MirabufParser, { ParseErrorSeverity } from "./MirabufParser.ts" import World from "@/systems/World.ts" +type MirabufPartInstanceGUID = string +type MirabufPartDefinitionGUID = string +type MirabufBodyGUID = string + export enum MaterialStyle { Regular = 0, Normals = 1, @@ -81,7 +85,7 @@ const transformGeometry = (geometry: THREE.BufferGeometry, mesh: mirabuf.IMesh) class MirabufInstance { private _mirabufParser: MirabufParser private _materials: Map - private _meshes: Map> + private _meshes: Map public get parser() { return this._mirabufParser @@ -143,15 +147,25 @@ class MirabufInstance { const assembly = this._mirabufParser.assembly const instances = assembly.data!.parts!.partInstances! + interface BatchCounts { + maxInstances: number + maxVertices: number + maxIndices: number + } + + const batchMap = new Map>>() + const countMap = new Map() + + // Filter all instances by first material, then body for (const instance of Object.values(instances) /* .filter(x => x.info!.name!.startsWith('EyeBall')) */) { const definition = assembly.data!.parts!.partDefinitions![instance.partDefinitionReference!]! const bodies = definition.bodies - const meshes = new Array() + // const meshes = new Array() if (bodies) { for (const body of bodies) { if (!body) continue const mesh = body.triangleMesh - const geometry = new THREE.BufferGeometry() + // const geometry = new THREE.BufferGeometry() if ( mesh && mesh.mesh && @@ -160,7 +174,7 @@ class MirabufInstance { mesh.mesh.uv && mesh.mesh.indices ) { - transformGeometry(geometry, mesh.mesh!) + // transformGeometry(geometry, mesh.mesh!) const appearanceOverride = body.appearanceOverride const material: THREE.Material = @@ -168,20 +182,67 @@ class MirabufInstance { ? this._materials.get(appearanceOverride)! : fillerMaterials[nextFillerMaterial++ % fillerMaterials.length] - const threeMesh = new THREE.Mesh(geometry, material) - threeMesh.receiveShadow = true - threeMesh.castShadow = true + // const threeMesh = new THREE.Mesh(geometry, material) + // threeMesh.receiveShadow = true + // threeMesh.castShadow = true + + // meshes.push(threeMesh) + let materialBodyMap = batchMap.get(material) + if (!materialBodyMap) { + materialBodyMap = new Map>(); + batchMap.set(material, materialBodyMap) + } - meshes.push(threeMesh) + let bodyInstances = materialBodyMap.get(body) + if (!bodyInstances) { + bodyInstances = new Array() + materialBodyMap.set(body, bodyInstances) + } + bodyInstances.push(instance) - const mat = this._mirabufParser.globalTransforms.get(instance.info!.GUID!)! - threeMesh.position.setFromMatrixPosition(mat) - threeMesh.rotation.setFromRotationMatrix(mat) + if (countMap.has(material)) { + const count = countMap.get(material)! + count.maxInstances += 1 + count.maxVertices += mesh.mesh.verts.length / 3 + count.maxIndices += mesh.mesh.indices.length + } else { + const count: BatchCounts = { + maxInstances: 1, + maxVertices: mesh.mesh.verts.length / 3, + maxIndices: mesh.mesh.indices.length + } + countMap.set(material, count) + } + + // const mat = this._mirabufParser.globalTransforms.get(instance.info!.GUID!)! + // threeMesh.position.setFromMatrixPosition(mat) + // threeMesh.rotation.setFromRotationMatrix(mat) } } } - this._meshes.set(instance.info!.GUID!, meshes) + // this._meshes.set(instance.info!.GUID!, meshes) } + + // Construct batched meshes + batchMap.forEach((materialBodyMap, material) => { + const count = countMap.get(material)! + const batchedMesh = new THREE.BatchedMesh(count.maxInstances, count.maxVertices, count.maxIndices) + + materialBodyMap.forEach((instances, body) => { + + instances.forEach(instance => { + const mat = this._mirabufParser.globalTransforms.get(instance.info!.GUID!)! + + const geometry = new THREE.BufferGeometry() + transformGeometry(geometry, body.triangleMesh!.mesh!) + const geoId = batchedMesh.addGeometry(geometry) + + batchedMesh.setMatrixAt(geoId, mat) + + this._meshes.set(instance.info!.GUID!, [ batchedMesh, geoId ]) + }) + }) + }) } /** @@ -190,19 +251,18 @@ class MirabufInstance { * @param scene */ public AddToScene(scene: THREE.Scene) { - this._meshes.forEach(x => x.forEach(y => scene.add(y))) + this._meshes.forEach(([mesh, _]) => scene.add(mesh)) + // this._meshes.forEach(x => x.forEach(y => scene.add(y))) } /** * Disposes of all ThreeJs scenes and materials. */ public Dispose(scene: THREE.Scene) { - this._meshes.forEach(x => - x.forEach(y => { - y.geometry.dispose() - scene.remove(y) - }) - ) + this._meshes.forEach(([mesh, _]) => { + mesh.dispose() + scene.remove(mesh) + }) this._meshes.clear() this._materials.forEach(x => x.dispose()) diff --git a/fission/src/mirabuf/MirabufSceneObject.ts b/fission/src/mirabuf/MirabufSceneObject.ts index 550ca35ead..9531637318 100644 --- a/fission/src/mirabuf/MirabufSceneObject.ts +++ b/fission/src/mirabuf/MirabufSceneObject.ts @@ -78,10 +78,12 @@ class MirabufSceneObject extends SceneObject { .get(part)! .clone() .premultiply(transform) - this._mirabufInstance.meshes.get(part)!.forEach(mesh => { - mesh.position.setFromMatrixPosition(partTransform) - mesh.rotation.setFromRotationMatrix(partTransform) - }) + // this._mirabufInstance.meshes.get(part)!.forEach(mesh => { + // mesh.position.setFromMatrixPosition(partTransform) + // mesh.rotation.setFromRotationMatrix(partTransform) + // }) + const [mesh, index] = this._mirabufInstance.meshes.get(part) ?? [undefined, 0] + mesh?.setMatrixAt(index, partTransform) }) if (isNaN(body.GetPosition().GetX())) { From a026479a3fcdf5e6c6d47a5393d8a8ddd4542d29 Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Sat, 13 Jul 2024 23:51:21 -0600 Subject: [PATCH 2/6] Still have an unknown issues with very select meshes --- fission/src/mirabuf/MirabufInstance.ts | 49 ++++++++++++----------- fission/src/mirabuf/MirabufSceneObject.ts | 9 +++++ 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/fission/src/mirabuf/MirabufInstance.ts b/fission/src/mirabuf/MirabufInstance.ts index dd1898020b..4746f0d6e7 100644 --- a/fission/src/mirabuf/MirabufInstance.ts +++ b/fission/src/mirabuf/MirabufInstance.ts @@ -155,19 +155,17 @@ class MirabufInstance { maxIndices: number } - const batchMap = new Map>>() + const batchMap = new Map]>>() const countMap = new Map() // Filter all instances by first material, then body - for (const instance of Object.values(instances) /* .filter(x => x.info!.name!.startsWith('EyeBall')) */) { + for (const instance of Object.values(instances)) { const definition = assembly.data!.parts!.partDefinitions![instance.partDefinitionReference!]! const bodies = definition.bodies - // const meshes = new Array() if (bodies) { for (const body of bodies) { if (!body) continue const mesh = body.triangleMesh - // const geometry = new THREE.BufferGeometry() if ( mesh && mesh.mesh && @@ -176,8 +174,6 @@ class MirabufInstance { mesh.mesh.uv && mesh.mesh.indices ) { - // transformGeometry(geometry, mesh.mesh!) - const appearanceOverride = body.appearanceOverride const material: THREE.Material = WIREFRAME ? new THREE.MeshStandardMaterial({ wireframe: true, color: 0x000000 }) @@ -185,23 +181,19 @@ class MirabufInstance { ? this._materials.get(appearanceOverride)! : fillerMaterials[nextFillerMaterial++ % fillerMaterials.length] - // const threeMesh = new THREE.Mesh(geometry, material) - // threeMesh.receiveShadow = true - // threeMesh.castShadow = true - - // meshes.push(threeMesh) let materialBodyMap = batchMap.get(material) if (!materialBodyMap) { - materialBodyMap = new Map>(); + materialBodyMap = new Map]>(); batchMap.set(material, materialBodyMap) } - let bodyInstances = materialBodyMap.get(body) + const partBodyGuid = this.GetPartBodyGuid(definition, body) + let bodyInstances = materialBodyMap.get(partBodyGuid) if (!bodyInstances) { - bodyInstances = new Array() - materialBodyMap.set(body, bodyInstances) + bodyInstances = [body, new Array()] + materialBodyMap.set(partBodyGuid, bodyInstances) } - bodyInstances.push(instance) + bodyInstances[1].push(instance) if (countMap.has(material)) { const count = countMap.get(material)! @@ -216,24 +208,27 @@ class MirabufInstance { } countMap.set(material, count) } - - // const mat = this._mirabufParser.globalTransforms.get(instance.info!.GUID!)! - // threeMesh.position.setFromMatrixPosition(mat) - // threeMesh.rotation.setFromRotationMatrix(mat) } } } - // this._meshes.set(instance.info!.GUID!, meshes) } + console.debug(batchMap) + // Construct batched meshes batchMap.forEach((materialBodyMap, material) => { const count = countMap.get(material)! const batchedMesh = new THREE.BatchedMesh(count.maxInstances, count.maxVertices, count.maxIndices) - materialBodyMap.forEach((instances, body) => { - - instances.forEach(instance => { + console.debug(`${count.maxInstances}, ${count.maxVertices}, ${count.maxIndices}`) + + batchedMesh.material = material + batchedMesh.castShadow = true + batchedMesh.receiveShadow = true + + materialBodyMap.forEach(instances => { + const body = instances[0] + instances[1].forEach(instance => { const mat = this._mirabufParser.globalTransforms.get(instance.info!.GUID!)! const geometry = new THREE.BufferGeometry() @@ -242,12 +237,18 @@ class MirabufInstance { batchedMesh.setMatrixAt(geoId, mat) + console.debug(geoId) + this._meshes.set(instance.info!.GUID!, [ batchedMesh, geoId ]) }) }) }) } + private GetPartBodyGuid(partDef: mirabuf.IPartDefinition, body: mirabuf.IPartDefinition) { + return `${partDef.info!.GUID!}_BODY_${body.info!.GUID!}` + } + /** * Adds all the meshes to the ThreeJs scene. * diff --git a/fission/src/mirabuf/MirabufSceneObject.ts b/fission/src/mirabuf/MirabufSceneObject.ts index 92c5397d75..ad483075f3 100644 --- a/fission/src/mirabuf/MirabufSceneObject.ts +++ b/fission/src/mirabuf/MirabufSceneObject.ts @@ -99,6 +99,15 @@ class MirabufSceneObject extends SceneObject { // mesh.rotation.setFromRotationMatrix(partTransform) // }) const [mesh, index] = this._mirabufInstance.meshes.get(part) ?? [undefined, 0] + if (!mesh) { + const numBodies = this._mirabufInstance.parser.assembly.data!.parts!.partDefinitions![ + this._mirabufInstance.parser.assembly.data!.parts!.partInstances![part].partDefinitionReference! + ].bodies!.length + if (numBodies) { + console.warn(`Problem Child [Found ${numBodies} bodies]: ${part}`) + } + return + } mesh?.setMatrixAt(index, partTransform) }) From a4b16604e1a54d6befe95431c2722a7324b5e2e3 Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Sun, 14 Jul 2024 02:03:20 -0600 Subject: [PATCH 3/6] Done and gathered statistics --- fission/src/mirabuf/MirabufInstance.ts | 40 +++++++++++++------ fission/src/mirabuf/MirabufSceneObject.ts | 19 ++++----- fission/src/systems/scene/SceneRenderer.ts | 5 +++ fission/src/ui/components/TransformGizmos.tsx | 4 +- 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/fission/src/mirabuf/MirabufInstance.ts b/fission/src/mirabuf/MirabufInstance.ts index 4746f0d6e7..95ae5e7615 100644 --- a/fission/src/mirabuf/MirabufInstance.ts +++ b/fission/src/mirabuf/MirabufInstance.ts @@ -4,8 +4,6 @@ import MirabufParser, { ParseErrorSeverity } from "./MirabufParser.ts" import World from "@/systems/World.ts" type MirabufPartInstanceGUID = string -type MirabufPartDefinitionGUID = string -type MirabufBodyGUID = string const WIREFRAME = false @@ -37,15 +35,21 @@ export const miraMatToString = (mat: mirabuf.ITransform) => { let nextFillerMaterial = 0 const fillerMaterials = [ - new THREE.MeshToonMaterial({ + new THREE.MeshStandardMaterial({ color: 0xe32b50, }), - new THREE.MeshToonMaterial({ + new THREE.MeshStandardMaterial({ color: 0x4ccf57, }), - new THREE.MeshToonMaterial({ + new THREE.MeshStandardMaterial({ color: 0xcf4cca, }), + new THREE.MeshStandardMaterial({ + color: 0x585fed, + }), + new THREE.MeshStandardMaterial({ + color: 0xade04f, + }), ] const transformVerts = (mesh: mirabuf.IMesh) => { @@ -87,7 +91,8 @@ const transformGeometry = (geometry: THREE.BufferGeometry, mesh: mirabuf.IMesh) class MirabufInstance { private _mirabufParser: MirabufParser private _materials: Map - private _meshes: Map + private _meshes: Map> + private _batches: Array public get parser() { return this._mirabufParser @@ -98,6 +103,9 @@ class MirabufInstance { public get meshes() { return this._meshes } + public get batches() { + return this._batches + } public constructor(parser: MirabufParser, materialStyle?: MaterialStyle) { if (parser.errors.some(x => x[0] >= ParseErrorSeverity.Unimportable)) { @@ -107,6 +115,7 @@ class MirabufInstance { this._mirabufParser = parser this._materials = new Map() this._meshes = new Map() + this._batches = new Array() this.LoadMaterials(materialStyle ?? MaterialStyle.Regular) this.CreateMeshes() @@ -219,6 +228,7 @@ class MirabufInstance { batchMap.forEach((materialBodyMap, material) => { const count = countMap.get(material)! const batchedMesh = new THREE.BatchedMesh(count.maxInstances, count.maxVertices, count.maxIndices) + this._batches.push(batchedMesh) console.debug(`${count.maxInstances}, ${count.maxVertices}, ${count.maxIndices}`) @@ -239,7 +249,13 @@ class MirabufInstance { console.debug(geoId) - this._meshes.set(instance.info!.GUID!, [ batchedMesh, geoId ]) + let bodies = this._meshes.get(instance.info!.GUID!) + if (!bodies) { + bodies = new Array<[THREE.BatchedMesh, number]>() + this._meshes.set(instance.info!.GUID!, bodies) + } + + bodies.push([ batchedMesh, geoId ]) }) }) }) @@ -255,18 +271,18 @@ class MirabufInstance { * @param scene */ public AddToScene(scene: THREE.Scene) { - this._meshes.forEach(([mesh, _]) => scene.add(mesh)) - // this._meshes.forEach(x => x.forEach(y => scene.add(y))) + this._batches.forEach(x => scene.add(x)) } /** * Disposes of all ThreeJs scenes and materials. */ public Dispose(scene: THREE.Scene) { - this._meshes.forEach(([mesh, _]) => { - mesh.dispose() - scene.remove(mesh) + this._batches.forEach(x => { + x.dispose() + scene.remove(x) }) + this._batches = [] this._meshes.clear() this._materials.forEach(x => x.dispose()) diff --git a/fission/src/mirabuf/MirabufSceneObject.ts b/fission/src/mirabuf/MirabufSceneObject.ts index ad483075f3..6bcf848301 100644 --- a/fission/src/mirabuf/MirabufSceneObject.ts +++ b/fission/src/mirabuf/MirabufSceneObject.ts @@ -85,6 +85,7 @@ class MirabufSceneObject extends SceneObject { } public Update(): void { + this._mirabufInstance.parser.rigidNodes.forEach(rn => { if (!this._mirabufInstance.meshes.size) return // if this.dispose() has been ran then return const body = World.PhysicsSystem.GetBody(this._mechanism.GetBodyByNodeId(rn.id)!) @@ -98,17 +99,8 @@ class MirabufSceneObject extends SceneObject { // mesh.position.setFromMatrixPosition(partTransform) // mesh.rotation.setFromRotationMatrix(partTransform) // }) - const [mesh, index] = this._mirabufInstance.meshes.get(part) ?? [undefined, 0] - if (!mesh) { - const numBodies = this._mirabufInstance.parser.assembly.data!.parts!.partDefinitions![ - this._mirabufInstance.parser.assembly.data!.parts!.partInstances![part].partDefinitionReference! - ].bodies!.length - if (numBodies) { - console.warn(`Problem Child [Found ${numBodies} bodies]: ${part}`) - } - return - } - mesh?.setMatrixAt(index, partTransform) + const meshes = this._mirabufInstance.meshes.get(part) ?? [] + meshes.forEach(([batch, id]) => batch.setMatrixAt(id, partTransform)) }) /** @@ -159,6 +151,11 @@ class MirabufSceneObject extends SceneObject { comMesh.rotation.setFromRotationMatrix(comTransform) } }) + + this._mirabufInstance.batches.forEach(x => { + x.computeBoundingBox() + x.computeBoundingSphere() + }) } public Dispose(): void { diff --git a/fission/src/systems/scene/SceneRenderer.ts b/fission/src/systems/scene/SceneRenderer.ts index efc9c925e1..ce398cb544 100644 --- a/fission/src/systems/scene/SceneRenderer.ts +++ b/fission/src/systems/scene/SceneRenderer.ts @@ -125,6 +125,8 @@ class SceneRenderer extends WorldSystem { // Orbit controls this._orbitControls = new OrbitControls(this._mainCamera, this._renderer.domElement) this._orbitControls.update() + + this._renderer.info.autoReset = false } public UpdateCanvasSize() { @@ -151,6 +153,9 @@ class SceneRenderer extends WorldSystem { }) this._composer.render(deltaT) + + console.debug(`Render Stats:\nDraw Calls: ${this._renderer.info.render.calls}\nTriangles: ${this._renderer.info.render.triangles}`) + this._renderer.info.reset() } public Destroy(): void { diff --git a/fission/src/ui/components/TransformGizmos.tsx b/fission/src/ui/components/TransformGizmos.tsx index aeff21db44..e39093f502 100644 --- a/fission/src/ui/components/TransformGizmos.tsx +++ b/fission/src/ui/components/TransformGizmos.tsx @@ -78,8 +78,8 @@ class TransformGizmos { // mesh.rotation.setFromRotationMatrix(partTransform) // }) - const [mesh, index] = obj.mirabufInstance.meshes.get(part) ?? [undefined, 0] - mesh?.setMatrixAt(index, partTransform) + const meshes = obj.mirabufInstance.meshes.get(part) ?? [] + meshes.forEach(([batch, id]) => batch.setMatrixAt(id, partTransform)) }) } } From 14648395c1f6e4772c1dc08068808e0853a75b77 Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Sun, 14 Jul 2024 02:43:00 -0600 Subject: [PATCH 4/6] removed stat print outs --- fission/src/systems/scene/SceneRenderer.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fission/src/systems/scene/SceneRenderer.ts b/fission/src/systems/scene/SceneRenderer.ts index ce398cb544..efc9c925e1 100644 --- a/fission/src/systems/scene/SceneRenderer.ts +++ b/fission/src/systems/scene/SceneRenderer.ts @@ -125,8 +125,6 @@ class SceneRenderer extends WorldSystem { // Orbit controls this._orbitControls = new OrbitControls(this._mainCamera, this._renderer.domElement) this._orbitControls.update() - - this._renderer.info.autoReset = false } public UpdateCanvasSize() { @@ -153,9 +151,6 @@ class SceneRenderer extends WorldSystem { }) this._composer.render(deltaT) - - console.debug(`Render Stats:\nDraw Calls: ${this._renderer.info.render.calls}\nTriangles: ${this._renderer.info.render.triangles}`) - this._renderer.info.reset() } public Destroy(): void { From e743fdfc57e1863cf29a0cec91caebbbf17faa84 Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Sun, 14 Jul 2024 02:43:56 -0600 Subject: [PATCH 5/6] Formatter --- fission/src/mirabuf/MirabufInstance.ts | 6 +++--- fission/src/mirabuf/MirabufSceneObject.ts | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fission/src/mirabuf/MirabufInstance.ts b/fission/src/mirabuf/MirabufInstance.ts index 95ae5e7615..7b3dcb28d0 100644 --- a/fission/src/mirabuf/MirabufInstance.ts +++ b/fission/src/mirabuf/MirabufInstance.ts @@ -192,7 +192,7 @@ class MirabufInstance { let materialBodyMap = batchMap.get(material) if (!materialBodyMap) { - materialBodyMap = new Map]>(); + materialBodyMap = new Map]>() batchMap.set(material, materialBodyMap) } @@ -213,7 +213,7 @@ class MirabufInstance { const count: BatchCounts = { maxInstances: 1, maxVertices: mesh.mesh.verts.length / 3, - maxIndices: mesh.mesh.indices.length + maxIndices: mesh.mesh.indices.length, } countMap.set(material, count) } @@ -255,7 +255,7 @@ class MirabufInstance { this._meshes.set(instance.info!.GUID!, bodies) } - bodies.push([ batchedMesh, geoId ]) + bodies.push([batchedMesh, geoId]) }) }) }) diff --git a/fission/src/mirabuf/MirabufSceneObject.ts b/fission/src/mirabuf/MirabufSceneObject.ts index 6bcf848301..a5c18e591d 100644 --- a/fission/src/mirabuf/MirabufSceneObject.ts +++ b/fission/src/mirabuf/MirabufSceneObject.ts @@ -85,7 +85,6 @@ class MirabufSceneObject extends SceneObject { } public Update(): void { - this._mirabufInstance.parser.rigidNodes.forEach(rn => { if (!this._mirabufInstance.meshes.size) return // if this.dispose() has been ran then return const body = World.PhysicsSystem.GetBody(this._mechanism.GetBodyByNodeId(rn.id)!) From bd073b75221ffd7201a1a5e8146d4465c2f0713f Mon Sep 17 00:00:00 2001 From: KyroVibe Date: Mon, 15 Jul 2024 18:18:26 -0600 Subject: [PATCH 6/6] Removed comments --- fission/src/mirabuf/MirabufSceneObject.ts | 4 ---- fission/src/ui/components/TransformGizmos.tsx | 5 ----- 2 files changed, 9 deletions(-) diff --git a/fission/src/mirabuf/MirabufSceneObject.ts b/fission/src/mirabuf/MirabufSceneObject.ts index a5c18e591d..57c220e46c 100644 --- a/fission/src/mirabuf/MirabufSceneObject.ts +++ b/fission/src/mirabuf/MirabufSceneObject.ts @@ -94,10 +94,6 @@ class MirabufSceneObject extends SceneObject { .get(part)! .clone() .premultiply(transform) - // this._mirabufInstance.meshes.get(part)!.forEach(mesh => { - // mesh.position.setFromMatrixPosition(partTransform) - // mesh.rotation.setFromRotationMatrix(partTransform) - // }) const meshes = this._mirabufInstance.meshes.get(part) ?? [] meshes.forEach(([batch, id]) => batch.setMatrixAt(id, partTransform)) }) diff --git a/fission/src/ui/components/TransformGizmos.tsx b/fission/src/ui/components/TransformGizmos.tsx index e39093f502..23fc6291e3 100644 --- a/fission/src/ui/components/TransformGizmos.tsx +++ b/fission/src/ui/components/TransformGizmos.tsx @@ -72,11 +72,6 @@ class TransformGizmos { .get(part)! .clone() .premultiply(this.mesh.matrix) - // obj.mirabufInstance.meshes.get(part)!.forEach(mesh => { - // // iterating through each mesh and updating their position and rotation - // mesh.position.setFromMatrixPosition(partTransform) - // mesh.rotation.setFromRotationMatrix(partTransform) - // }) const meshes = obj.mirabufInstance.meshes.get(part) ?? [] meshes.forEach(([batch, id]) => batch.setMatrixAt(id, partTransform))