elm-3d-scene
elm-3d-scene copied to clipboard
Add model loading support?
This is a bit of a placeholder issue since my current thinking is that support for different file formats should live in their own packages, so (e.g.) a COLLADA package can be focused on parsing COLLADA files into nice Elm data types and elm-3d-scene
can remain focused on rendering. That said, one way or another there should definitely be an easy way to load models into elm-3d-scene
. Potential file formats to support include:
- OBJ
- COLLADA (.dae)
- FBX
- glTF
- STL
Please add a comment if there's a particular file format you'd like to see supported!
Models can also come with animations. Probably good to have in mind when deciding where to put an eventual “setAnimationFrame” function 😁
@schoening what kind of setAnimationFrame
function were you thinking of?
@ianmackenzie a quick and dirty example from babylonjs, here you see I am setting the frame manually:
https://www.babylonjs-playground.com/#4HGNW#4
Ah gotcha - I thought you were referring to the browser's animation frame, e.g. https://package.elm-lang.org/packages/elm/browser/latest/Browser-Events#onAnimationFrame.
Hi! What's the current best way / workaround to try loading STLs with elm-3d-scene
?
Currently I think the two options are:
- Write a quick and dirty parser yourself (that likely only works on your specific files)
- Pre-process the files offline to convert STL into a JSON format which you can then easily decode in Elm
I realize those are both kind of non-answers - once elm-3d-scene
1.0 is out I'll hopefully have time to start looking at implementing some proper import packages.
Hi! What's the current best way / workaround to try loading STLs with elm-3d-scene?
I am not sure if my experience is useful but I do it that way:
parse stl to jscad: https://www.npmjs.com/package/@jscad/stl-deserializer
that will return CSG object
which will have polygons
attribute
that could be sent to an Elm app from ports and can be rendered there using elm-3d-scene.
Hope that helps.