novo modelo 3d

This commit is contained in:
Rodrigo Bertoldo de Sousa Martins committed 2026-09-11 15:50:15 -03:00
1 parent bc7e77b007
commit 08cb8c426f
11 files changed
+301 -256

No files matched your search

+8 -14
View File
@@ -3,14 +3,15 @@ import { Canvas, useThree } from "@react-three/fiber";
import { CameraControls, Grid } from "@react-three/drei";
import * as THREE from "three";
import { useAtlasStore, type BodyRegion, type ClipAxis } from "../../store/useAtlasStore.js";
import { SystemModel, CELL_MEMBRANE_SLUG } from "./SystemModel.js";
import { SystemModel } from "./SystemModel.js";
import type { Structure } from "../../lib/api.js";
// Sistemas apresentados como diagrama 2D (fotomicrografia real com
// hotspots) em vez de malha 3D — ver SkinDiagram.tsx e
// MicroscopyDiagram.tsx. Citologia usa malha 3D real (ver
// build-manifest-cell.mjs), então não entra aqui.
const NON_3D_SYSTEMS = new Set(["tegumentar", "histologia"]);
// Sistemas sem .glb pra carregar — tegumentar/histologia são
// fotomicrografias 2D reais com hotspots (ver SkinDiagram.tsx e
// MicroscopyDiagram.tsx) e citologia é um modelo 3D ilustrativo desenhado
// à mão em Three.js (ver CellDiagram3D.tsx), não uma malha carregada de
// arquivo.
const NON_3D_SYSTEMS = new Set(["tegumentar", "histologia", "citologia"]);
// Normais de referência em anatomia: sagital separa esq./dir., coronal
// (= frontal) separa ant./post., transversal separa sup./inf.
@@ -260,14 +261,7 @@ function ClickSelector({
ndc.set(x, y);
raycaster.setFromCamera(ndc, camera);
const hits = raycaster.intersectObjects(scene.children, true);
const valid = hits.filter((h) => h.object.visible && h.object.name && bySlug.has(h.object.name));
// A membrana plasmática da célula é semitransparente de propósito
// (ver SystemModel.tsx) justamente pra deixar ver as organelas por
// dentro — clicar nela não pode "capturar" o clique antes de
// chegar na organela real por trás; só vira o resultado do clique
// se não houver mais nada na frente/atrás dela nesse raio.
const hit =
valid.find((h) => h.object.name !== CELL_MEMBRANE_SLUG) ?? valid[0];
const hit = hits.find((h) => h.object.visible && h.object.name && bySlug.has(h.object.name));
if (hit && (!best || hit.distance < best.distance)) {
best = { distance: hit.distance, slug: hit.object.name };
}