Is there a way to efficiently re-use imported object geometries in Three JS without duplicating them in memory? I've tried writing a loader but it doesn't seem to update the geometry once loaded.
var tmpGeo = geometries[ID];
if (!tmpGeo) {
tmpGeo = new THREE.BufferGeometry();
geometries[ID] = tmpGeo;
objLoader.load("/models/" + ID + ".obj", function (mesh) {
tmpGeo = mesh.children[0].geometry;
});
}
obj.add(new THREE.Mesh(tmpGeo, tmpMat));
I want to be able to import an object only once and then re-use its geometry across multiple objects. Any suggestions on how to achieve this?