gltf-loader: High level GlTF loader

[ graphics, library, mit, program ] [ Propose Tags ]
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.3.0.0
Dependencies base (>=4.11 && <10), binary, bytestring, gltf-codec, gltf-loader, linear, microlens, microlens-platform, optparse-simple, rio (>=0.1.12.0), unordered-containers [details]
License MIT
Copyright 2022 Sean Gillespie
Author Sean D Gillespie
Maintainer sean@mistersg.net
Category Graphics
Home page https://github.com/sgillespiep/haskell-gltf-loader#readme
Bug tracker https://github.com/sgillespiep/haskell-gltf-loader/issues
Source repo head: git clone https://github.com/sgillespiep/haskell-gltf-loader
Uploaded by sgillespie at 2022-09-03T03:27:53Z
Distributions
Executables gltf-loader-exe
Downloads 221 total (12 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-09-03 [all 1 reports]

Readme for gltf-loader-0.2.0.0

[back to package description]

Haskell GlTF Loader

pipeline status

A high level GlTF loader

Prerequisites

In order to build or install you will need

  • GHC (Tested on 9.0.2)
  • Stack (Tested on 2.7.5)

Building

Build the project

stack setup
stack build

Run the tests (if desired)

stack test

API Documentation

To build the documentation, run

stack haddock

API Examples

Use fromFile or fromBytestring to load a GlTF scene

import Text.GLTF.Loader (fromFile)

-- ...
-- Load a GLTF scene from a file
loadGltfFile :: IO (Either Errors Gltf)
loadGltfFile = fromFile "./cube.gltf"

Then you can, for example, get all the vertices:

getVertices :: Gltf -> [V3 Float]
getVertices gltf = concatMap getVertices' (gltf ^. _meshes)
  where getVertices' mesh = concatMap (^. _meshPrimitivePositions) (mesh ^. _meshPrimitives)

CLI

This includes a CLI utility to inspect GlTF files

gltf-loader --help

Roadmap

Currently, only retreiving indices are supported, but we hope to support the majority of GlTF features:

  • Animitions
  • Asset
  • Cameras
  • Images
  • Materials
  • Meshes
    • Positions
    • Indices
    • Normals
    • Texture Coordinates
  • Node
  • Samplers
  • Skins

Authors

Sean Gillespie sean@mistersg.net

Acknowledgements

This project is largely based on https://hackage.haskell.org/package/gltf-codec by Alexander Bondarenko

License

This project is licensed under the MIT License. See LICENSE