Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

M54: tune viewport to greyscale baseline

Yuechen Lida85f468d479
diff --git a/aetheris.client/src/App.css b/aetheris.client/src/App.css
index e4f3609d..fcb33ae5 100644
--- a/aetheris.client/src/App.css
+++ b/aetheris.client/src/App.css
@@ -182,6 +182,19 @@
gap: var(--layout-space-2);
}
+
+.viewport-canvas-frame {
+ flex: 1;
+ min-height: 0;
+ border-radius: calc(var(--layout-radius) - 2px);
+ overflow: hidden;
+ background: linear-gradient(180deg, #f3f4f6 0%, #e4e7eb 100%);
+}
+
+.viewport-canvas-frame canvas {
+ display: block;
+}
+
.tool-rail {
padding: var(--layout-space-2);
overflow: auto;
diff --git a/aetheris.client/src/viewer/ViewerViewport.tsx b/aetheris.client/src/viewer/ViewerViewport.tsx
index eba70363..4a0ea6f6 100644
--- a/aetheris.client/src/viewer/ViewerViewport.tsx
+++ b/aetheris.client/src/viewer/ViewerViewport.tsx
@@ -5,6 +5,19 @@ import { useEffect, useMemo } from 'react';
import { BufferAttribute, BufferGeometry, DoubleSide, MeshStandardMaterial, Raycaster, Vector2 } from 'three';
import type { RenderSceneData } from './tessellationMapper';
+const VIEWPORT_THEME = {
+ surfaceColor: '#8f9499',
+ edgeColor: '#3a3a3a',
+ edgeWidth: 1.25,
+ gridMinorColor: '#cfd4d9',
+ gridMajorColor: '#bcc2c8',
+ ambientIntensity: 0.35,
+ directionalIntensity: 0.65,
+ selectionFaceColor: '#f59e0b',
+ selectionEdgeColor: '#f59e0b',
+ selectionEdgeWidth: 3,
+} as const;
+
interface ViewerViewportProps {
sceneData: RenderSceneData | null;
highlightedFaceId?: number | null;
@@ -23,7 +36,12 @@ function FaceMesh({ positions, normals, indices, isHighlighted }: { positions: F
}, [indices, normals, positions]);
const material = useMemo(
- () => new MeshStandardMaterial({ color: isHighlighted ? '#f59e0b' : '#8db8ff', metalness: 0.1, roughness: 0.75, side: DoubleSide }),
+ () => new MeshStandardMaterial({
+ color: isHighlighted ? VIEWPORT_THEME.selectionFaceColor : VIEWPORT_THEME.surfaceColor,
+ metalness: 0,
+ roughness: 0.95,
+ side: DoubleSide,
+ }),
[isHighlighted],
);
@@ -41,7 +59,13 @@ function EdgeLine({ points, isHighlighted }: { points: Float32Array; isHighlight
return vertices;
}, [points]);
- return <Line points={linePoints} color={isHighlighted ? '#dc2626' : '#111827'} lineWidth={isHighlighted ? 3 : 1} />;
+ return (
+ <Line
+ points={linePoints}
+ color={isHighlighted ? VIEWPORT_THEME.selectionEdgeColor : VIEWPORT_THEME.edgeColor}
+ lineWidth={isHighlighted ? VIEWPORT_THEME.selectionEdgeWidth : VIEWPORT_THEME.edgeWidth}
+ />
+ );
}
function PickRayCapture({ onPickRay }: { onPickRay?: ViewerViewportProps['onPickRay'] }) {
@@ -87,12 +111,11 @@ function PickRayCapture({ onPickRay }: { onPickRay?: ViewerViewportProps['onPick
export function ViewerViewport({ sceneData, highlightedFaceId = null, highlightedEdgeId = null, onPickRay }: ViewerViewportProps) {
return (
- <div className="viewport-shell">
- <Canvas camera={{ position: [4, 4, 4], fov: 50 }}>
- <color attach="background" args={['#f8fafc']} />
- <ambientLight intensity={0.5} />
- <directionalLight position={[4, 8, 3]} intensity={1.2} />
- <gridHelper args={[20, 20, '#cbd5e1', '#e2e8f0']} />
+ <div className="viewport-canvas-frame">
+ <Canvas camera={{ position: [4, 4, 4], fov: 50 }} gl={{ alpha: true }}>
+ <ambientLight intensity={VIEWPORT_THEME.ambientIntensity} />
+ <directionalLight position={[4, 8, 3]} intensity={VIEWPORT_THEME.directionalIntensity} />
+ <gridHelper args={[20, 20, VIEWPORT_THEME.gridMajorColor, VIEWPORT_THEME.gridMinorColor]} />
<axesHelper args={[2]} />
{sceneData?.faces.map((face) => (
<FaceMesh