fix: harden merged map resource cleanup

This commit is contained in:
Tom Boullay
2026-05-24 23:51:28 +02:00
parent f035195b56
commit 1f6335092a
3 changed files with 47 additions and 34 deletions
+1 -2
View File
@@ -3,7 +3,6 @@ import * as THREE from "three";
import { useGLTF } from "@react-three/drei";
import { mergeGeometries } from "three/addons/utils/BufferGeometryUtils.js";
import type { VegetationInstance } from "@/world/vegetation/useVegetationData";
import { disposeInstancedMesh } from "@/utils/three/dispose";
interface InstancedVegetationProps {
modelPath: string;
@@ -143,7 +142,7 @@ export function InstancedVegetation({
return () => {
for (const mesh of instancedMeshes) {
group.remove(mesh);
disposeInstancedMesh(mesh);
mesh.dispose();
}
};
}, [instancedMeshes]);