This commit is contained in:
gpt-engineer-app[bot]
2026-02-27 02:04:21 +00:00
parent 9dd45c96de
commit c0f153df1c
3 changed files with 120 additions and 16 deletions
+29 -13
View File
@@ -25,6 +25,8 @@ function GLBModel({ url }: { url: string }) {
const ref = useRef<THREE.Group>(null);
const opacity = useModelStore((s) => s.opacity);
const renderMode = useModelStore((s) => s.renderMode);
const wireframeColor = useModelStore((s) => s.wireframeColor);
const wireframeThickness = useModelStore((s) => s.wireframeThickness);
const checklist = useModelStore((s) => s.checklist);
const fineTuning = useModelStore((s) => s.fineTuning);
@@ -54,8 +56,14 @@ function GLBModel({ url }: { url: string }) {
mat.transparent = opacity < 1;
mat.opacity = opacity;
mat.wireframe = renderMode === 'wireframe';
if (renderMode === 'wireframe') {
mat.wireframeLinewidth = wireframeThickness;
}
mat.needsUpdate = true;
if (hasRejected) {
mat.needsUpdate = true;
if (renderMode === 'wireframe') {
mat.color.set(wireframeColor);
} else if (hasRejected) {
mat.color.setHSL(0, 0.7, 0.5);
} else if (allApproved) {
mat.color.setHSL(0.38, 0.7, 0.45);
@@ -66,7 +74,7 @@ function GLBModel({ url }: { url: string }) {
});
}
});
}, [scene, opacity, renderMode, checklist]);
}, [scene, opacity, renderMode, checklist, wireframeColor, wireframeThickness]);
const rotYRad = (fineTuning.rotY * Math.PI) / 180;
@@ -188,6 +196,24 @@ function MeasureClickHandler() {
return null;
}
function GridLayer() {
const showGrid = useModelStore((s) => s.showGrid);
if (!showGrid) return null;
return (
<Grid
infiniteGrid
cellSize={0.01}
sectionSize={0.1}
cellThickness={0.5}
sectionThickness={1}
cellColor="#334155"
sectionColor="#475569"
fadeDistance={5}
fadeStrength={1}
/>
);
}
export function ModelViewerCanvas({ url }: ModelViewerProps) {
return (
<Canvas
@@ -212,17 +238,7 @@ export function ModelViewerCanvas({ url }: ModelViewerProps) {
<MeasurementOverlay />
<MeasureClickHandler />
<Grid
infiniteGrid
cellSize={0.01}
sectionSize={0.1}
cellThickness={0.5}
sectionThickness={1}
cellColor="#334155"
sectionColor="#475569"
fadeDistance={5}
fadeStrength={1}
/>
<GridLayer />
<OrbitControls
makeDefault