UNFINISHED! Working on it took very long so I stopped. I'm putting it here so others can take a look at it and potentially fork.
A package for loading and working with 3D models in the GLTF format.
Link to GLTF cheat sheet here.
npm install
cd examples
npx elm reactor # compile elm code and spin up a dev server
The glTF spec is quite large, especially when also considering extensions.
The following gives a quick overview of feature that elm-gltf
aims to
support in the foreseeable future.
- Extracting scenes
- Extracting nodes
- Extracting buffers
- Extracting buffer views
- Extracting accessors
- Extracting meshes
- Extracting textures
- Extracting texture properties
- Extracting TRS properties (separate rotation, scale and translation)
- Extracting meshes with different vertex attributes (right now only position, normal, texCoords)
- Extracting different materials (PBR, Lambertian, etc)
- Extracting different mesh types (lines, etc)
- Extracting orthographic and infinite perspective projection
- Embedded glTF(all assets like buffers and images are embedded as base64, single file)
- Hyperlinked glTF(assets are referenced via URL, multiple files)
- Binary GLB (everything is bundled into a single binary container file)
- possibly extensions like DRACO
Idea: Create 3 levels
- Low-Level: Raw GLTF (normalized, looks like GLTF, Buffers unparsed)
- Mid-Level: Tree of things(denormalized, buffers parsed)
- High-Level: Just a list of Drawables, and a list of cameras.
Things that can get expensive when done a lot:
- parsing buffers
- resolving relationsships:
- accessors
- nodes -> meshes
- material -> textures
Scene
could be just something simple to draw. If something like modifying
the scene data is needed, there could be an integration with elm-3d-scene
for
that.