fix membrana
This commit is contained in:
1 parent
369638bf98
commit
bc7e77b007
2 files changed
+23
-2
No files matched your search
@@ -3,7 +3,7 @@ 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 } from "./SystemModel.js";
|
||||
import { SystemModel, CELL_MEMBRANE_SLUG } from "./SystemModel.js";
|
||||
import type { Structure } from "../../lib/api.js";
|
||||
|
||||
// Sistemas apresentados como diagrama 2D (fotomicrografia real com
|
||||
@@ -260,7 +260,14 @@ function ClickSelector({
|
||||
ndc.set(x, y);
|
||||
raycaster.setFromCamera(ndc, camera);
|
||||
const hits = raycaster.intersectObjects(scene.children, true);
|
||||
const hit = hits.find((h) => h.object.visible && h.object.name && bySlug.has(h.object.name));
|
||||
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];
|
||||
if (hit && (!best || hit.distance < best.distance)) {
|
||||
best = { distance: hit.distance, slug: hit.object.name };
|
||||
}
|
||||
|
||||
@@ -17,6 +17,13 @@ interface Props {
|
||||
const HIGHLIGHT = new THREE.Color("#22d3ee");
|
||||
const BLACK = new THREE.Color(0x000000);
|
||||
|
||||
// A membrana plasmática é a malha REAL (FIB-SEM) de fora de uma célula
|
||||
// HeLa cultivada — achatada e irregular (célula aderente em cultura, não
|
||||
// uma bolinha lisa), não um erro. Mas sólida e opaca ela cobria e escondia
|
||||
// as organelas de dentro (núcleo, mitocôndrias etc.), que é o oposto do
|
||||
// que se quer pra estudar a célula — por isso ela é semitransparente.
|
||||
export const CELL_MEMBRANE_SLUG = "celula-membrana-plasmatica";
|
||||
|
||||
export function SystemModel({
|
||||
modelFile,
|
||||
structuresInFile,
|
||||
@@ -120,6 +127,13 @@ export function SystemModel({
|
||||
const isSelected = structure.slug === selectedSlug;
|
||||
mat.emissive = isSelected ? HIGHLIGHT : BLACK;
|
||||
mat.emissiveIntensity = isSelected ? 0.6 : 0;
|
||||
|
||||
if (structure.slug === CELL_MEMBRANE_SLUG) {
|
||||
mat.transparent = true;
|
||||
mat.opacity = 0.18;
|
||||
mat.depthWrite = false;
|
||||
mat.side = THREE.DoubleSide;
|
||||
}
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [root, bySlugInFile, byMeshNameInFile, visibleSystems, selectedSlug, clippingPlanes]);
|
||||
|
||||
Reference in new issue
Block a user