Open r-bt opened 1 month ago
I like the idea of exposing props for basic customization, but I would recommend we create a component called <JscadMesh>
or <JscadThreeMesh>
that neatly integrates into ThreeJS, it's not too hard to do this but it does require some knowledge of how fiber works. I can try to give some pointers in a moment
So the basic idea of the implementation is this, @r-bt lmk if you're interested in implementing otherwise I can probably implement ~tomorrow
import { createRoot } from "../somewhere-in-jscad-fiber"
export const JscadThreeMesh = ({ children }) => {
const threeMesh = useMemo(() => {
const jscadElms = []
createRoot(children, jscadElms)
const mesh = convertCsgToThree(jscadElms)
}, [])
return <primitive mesh={mesh} />
}
Usage would be like:
<Scene>
<Light {/* ... */} />
<JscadThreeMesh>
<Cube size={1} />
</JscadThreeMesh>
</Scene>
Awesome, I can give it a shot
I'd like to be able to custom JSCadFixture. Specifically the size, background colour, and positioning of the ThreeJS camera.
I was wondering are there any thoughts about the best way to do this. My initial ideas are either:
Other thoughts?