Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 88 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"plotly.js-basic-dist": "^2.15.1",
"solid-js": "^1.9.9",
"solid-record": "^0.2.1",
"solid-three": "^0.3.0-next.11",
"three": "^0.149.0",
"vinxi": "^0.5.8",
"vite": "^6.1.1"
Expand Down
53 changes: 53 additions & 0 deletions src/components/Isometric.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// SPDX-License-Identifier: Apache-2.0

import { For } from 'solid-js';
import { Canvas, Entity } from 'solid-three';
import * as THREE from 'three';
import { layout, rectLayer, rectViaLayer } from '../model/layout';

export default function Isometric() {
const rects = () => layout.rects;

return (
<Canvas
defaultCamera={{ position: [0, 0, 900] }}
shadows
style={{ width: '400px', height: '600px' }}
>
<Entity
from={THREE.Group}
position={[-275, 100, 0]}
rotation={[(7 * Math.PI) / 4, 0, Math.PI / 4]}
>
<For each={rects()}>
{(rect) => {
const layer = rectLayer(rect);
const viaLayer = rectViaLayer(layout, rect);
if (!viaLayer || !layer) {
return <Entity from={THREE.Mesh} />;
}

return (
<Entity
from={THREE.Mesh}
position={[
rect.x + rect.width / 2,
-(rect.y + rect.height / 2),
-viaLayer.crossY - viaLayer.crossHeight / 2,
]}
>
<Entity
from={THREE.BoxGeometry}
args={[rect.width, rect.height, viaLayer.crossHeight]}
/>
<Entity from={THREE.MeshStandardMaterial} color={layer.color} />
</Entity>
);
}}
</For>
</Entity>
<Entity from={THREE.AmbientLight} intensity={0.1} />
<Entity from={THREE.PointLight} position={[0, 600, -250]} />
</Canvas>
);
}
12 changes: 11 additions & 1 deletion src/components/MainView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import CrossSection from './CrossSection';
import DRCList from './DRCList';
import Editor from './Editor';
import Layers from './Layers';
import Isometric from './Isometric';
import SimulationParams from './SimulationParams';

type ITabName = 'xsection' | 'simulation';
type ITabName = 'xsection' | 'simulation' | '3d';

export default function MainView() {
const [drc, setDRC] = createSignal<IDRCItem[] | undefined>();
Expand Down Expand Up @@ -43,6 +44,12 @@ export default function MainView() {
</Paper>
<Paper sx={{ padding: 1 }}>
<ButtonGroup>
<Button
onClick={() => setActiveTab('3d')}
variant={activeTab() === '3d' ? 'contained' : 'outlined'}
>
3D
</Button>
<Button
onClick={() => setActiveTab('xsection')}
endIcon={hasDRCErrors() ? <Error /> : <Check />}
Expand Down Expand Up @@ -74,6 +81,9 @@ export default function MainView() {
</Show>
<DRCList drc={drc()} />
</Show>
<Show when={activeTab() === '3d'}>
<Isometric />
</Show>
</Paper>
</Box>
);
Expand Down