urbi-exhibitions
Version:
21 lines (20 loc) • 792 B
JavaScript
import { useMemo as d, useEffect as n } from "react";
import { t as f } from "../toChunks-DRfoi4L8.js";
import { u } from "../mapContext-C4SIZcBe.js";
const c = (t, o) => d(() => !t || !o ? [] : f(t, o), [t, o]), m = (t) => {
const { models: o } = t, { map: e } = u();
n(() => {
if (e)
return e.state.floorLevelIndex === 0 && o.forEach((l) => {
e.gltfPlugin.getModelStatus(l.modelId) === 0 ? e.gltfPlugin.addModel(l).catch((s) => {
console.log("Failed to load stand models: ", s);
}) : e.gltfPlugin.showModel(l.modelId);
}), () => {
e.gltfPlugin.hideModels(o.map((l) => l.modelId));
};
}, [e == null ? void 0 : e.gltfPlugin, e == null ? void 0 : e.state.floorLevelIndex, o]);
};
export {
c as useChunks,
m as useGltfModels
};