Git Product home page Git Product logo

gltf's Introduction

glTF

A simple file loader for glTF files in Go. This package is not intended to be used for manipulation or writing glTF models to disk.

The entry point is any of FromBytes, FromFile, or FromFilename. If using FromFilename (which is recomended), the default search path for referenced files is automatically set to the same directory as the file.

Once a file is loaded, calling Resolve will:

  1. load binary data into byte slices stored in each Buffer
  2. create sub-slice references to the bytes in each BufferView
  3. replace all indexed references with a pointer to the resolved object; for example, a scene with a single node index in the source file will hold a pointer to the actual node after calling Resolve. That node will also have been resolved, so that you can walk the tree directly to the buffer data:
    resolved := myGltf.Resolve(nil)
    var meshData []byte := resovled.Scene.Nodes[0].Mesh.Primitives.Attributes[gltf.POSITION].BufferView.Data

When using either of the first two forms, you will (likely) need to provide a search URI for referenced files, such as textures or binary vertex data. Resolve accepts a slice of strings to allow searching multiple paths.

Development Status

This package is working for loading of models and has partial support for cameras. It is not currently handling textures, animations, etc. Features are being implemented in conjunction with development of a glTF model viewer written in Go.

License

MIT license. See the LICENSE file.

SPDX-License-Identifier: MIT

gltf's People

Contributors

bbredesen avatar

Stargazers

 avatar

Watchers

 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.