gltf-loader: High level GlTF loader

[ graphics, library, mit, program ] [ Propose Tags ] [ Report a vulnerability ]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
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
Revised Revision 1 made by sgillespie at 2022-11-28T03:22:13Z
Category Graphics
Home page https://github.com/sgillespie/haskell-gltf-loader#readme
Bug tracker https://github.com/sgillespie/haskell-gltf-loader/issues
Source repo head: git clone https://github.com/sgillespiep/haskell-gltf-loader
Uploaded by sgillespie at 2022-11-28T03:18:22Z
Distributions
Executables gltf-loader
Downloads 287 total (1 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-11-28 [all 1 reports]

Readme for gltf-loader-0.3.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 geometries and PBR materials are supported, but we hope to support the majority of GlTF features:

  • Animations
  • Asset
  • Cameras
  • Images
  • Materials
    • PBR Metallic Roughness
    • Textures
  • Meshes
    • Positions
    • Indices
    • Normals
    • Texture Coordinates
  • Nodes
  • Samplers
  • Skins

Authors

Sean Gillespie sean@mistersg.net

Acknowledgements

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

License

This project is licensed under the MIT License. See LICENSE