Git Product home page Git Product logo

cl-gltf's Introduction

## How To
For the purposes of this tutorial we'll assume the package ``org.shirakumo.fraf.gltf`` has the local nickname ``gltf``. After loading the library, you can parse a glTF or GLB file as follows:

:: common lisp
(gltf:with-gltf (gltf #p"my-model.gltf")
  (describe gltf))
::

``describe`` will emit the full structure of the parsed glTF file. From there you can use the accessors from this package to traverse the structures and convert the information as you need.

Of particular importance are the ``accessor``s, which provide a convenient way to parse out the information from the raw underlying byte buffers that they index into. An ``accessor`` is a ``sequence``, so you can simply use ``length`` and ``elt`` to traverse the data.

However, note that cl-gltf makes no assumptions about a math library or anything of the sort, so by default it will parse the data out to vectors of the respective element type (usually floats). That buffer will also be shared between ``elt`` calls to avoid excessive consing. Thus, if you are just copying the data out of the buffers to another place, this should be ideal.

However, if you would like to customise the way the data is read out, such as to convert it into other structures automatically, you can do so. Either set the ``element-reader`` function on the accessor, or provide a specialised method on the ``construct-element-reader`` function. See the respective docstrings for more info.

## To Do
The following are still left to do:

- Loading from pointers or byte arrays
- Direct support of the ratified extensions
- Writing files

cl-gltf's People

Contributors

shinmera avatar vvcarvalho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.