adiciona modelo real
This commit is contained in:
1 parent
71d13753c9
commit
3a659a52c7
18 files changed
+612
-176
No files matched your search
@@ -63,9 +63,27 @@ export function Scene({ bySlug }: { bySlug: Map<string, Structure> }) {
|
||||
? [...bySlug.values()].find((s) => s.id === selectedStructureId)?.slug ?? null
|
||||
: null;
|
||||
|
||||
// Um arquivo .glb pode conter estruturas de mais de um sistema (ex: o
|
||||
// "visceral-organs.glb" tem estruturas de "respiratorio" e "visceral"),
|
||||
// então carregamos qualquer arquivo que tenha ao menos uma estrutura de
|
||||
// um sistema visível — a visibilidade por malha é resolvida dentro de
|
||||
// cada SystemModel.
|
||||
const structuresByFile = useMemo(() => {
|
||||
const structuresList = [...bySlug.values()];
|
||||
const map = new Map<string, Structure[]>();
|
||||
for (const s of structuresList) {
|
||||
if (!map.has(s.modelFile)) map.set(s.modelFile, []);
|
||||
map.get(s.modelFile)!.push(s);
|
||||
}
|
||||
return map;
|
||||
}, [bySlug]);
|
||||
|
||||
const modelFiles = useMemo(
|
||||
() => [...visibleSystems].map((slug) => `${slug}.glb`),
|
||||
[visibleSystems],
|
||||
() =>
|
||||
[...structuresByFile.entries()]
|
||||
.filter(([, items]) => items.some((s) => visibleSystems.has(s.system.slug)))
|
||||
.map(([file]) => file),
|
||||
[structuresByFile, visibleSystems],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -83,6 +101,8 @@ export function Scene({ bySlug }: { bySlug: Map<string, Structure> }) {
|
||||
<SystemModel
|
||||
key={modelFile}
|
||||
modelFile={modelFile}
|
||||
structuresInFile={structuresByFile.get(modelFile) ?? []}
|
||||
visibleSystems={visibleSystems}
|
||||
selectedSlug={selectedSlug}
|
||||
clippingPlanes={clippingPlanes}
|
||||
onSelect={(slug) => {
|
||||
|
||||
Reference in new issue
Block a user