Skip to content

<Pcb3D /> component #115

@DrSensor

Description

@DrSensor

why?

<CadViewer /> is good, but you can't swap the renderer, lightning, and so on.
We need to extract the 3d component.

<MyCanvas>
  <CustomCamera />
  <WorldEnvironment />
  <Pcb3D></Pcb3D>
</MyCanvas>

Important

required so there is no duplicate dependencies when tscircuit/circuit-to-svg#166 merged

I'm using 👇 in that PR

bun add github:tscircuit/3d-viewer

so I can use the typescript file directly.

[trivia]
Q: why not using bun patch command?
A: patching the package doesn't work because the ./src/**.ts is missing, it only have ./dist/*.js


Change of plan

starting v0.112

  • rewrite <Pcb3D> as class Pcb3D extends Object3D
    • constructor(circuitJSON, options)
  • dispatch event on: hover/unhover and select/unselect; cad component (use raycast)
    • event dispatch can be disabled via options or .hoverComponent = false

nice to have:

  • perf: instancing multiple mesh that has same footprint/cadModel

avoid:

  • don't implement tooltip and highlight on hover
  • don't store soup/circuitJSON as property, if it's unavoidable then set them to null after doing the transformation of circuit.json->three.js.

Footnotes

  1. Major Issues with SVG Rendering #155

  2. vanilla.js version #149

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions