Giter VIP home page Giter VIP logo

tinygltfloader's Introduction

Tiny glTF loader, header only C++ glTF 1.x parsing library.

TinyGLTFLoader is a header only C++ glTF 1.x https://github.com/KhronosGroup/glTF parsing library.

TinyGLTFLoader is deprecated. Please go https://github.com/syoyo/tinygltf for glTF 2.0 parser/serializer

Build Status

Build status

Features

  • Portable C++. C++-03 with STL dependency only.
  • Moderate parsing time and memory consumption.
  • glTF specification v1.0.0
  • Buffers
    • Parse BASE64 encoded embedded buffer fata(DataURI).
    • Load .bin file.
  • Image(Using stb_image)
    • Parse BASE64 encoded embedded image fata(DataURI).
    • Load external image file.
    • PNG(8bit only)
    • JPEG(8bit only)
    • BMP
    • GIF

Examples

  • glview : Simple glTF geometry viewer.
  • writer : Simple glTF writer(serialize tinygltf::Scene class)
  • alembic_to_gltf : Simple Alembic to glTF converter.
  • cyhair_to_gltf : Simple CyHair(hair curves) to glTF converter.

TODOs

  • Write C++ code generator from json schema for robust parsing.
  • Support multiple scenes in .gltf
  • Parse skin
  • Compression/decompression(Open3DGC, etc)
  • Support extensions and extras property
  • HDR image?

License

TinyGLTFLoader is licensed under MIT license.

TinyGLTFLoader uses the following third party libraries.

  • picojson.h : Copyright 2009-2010 Cybozu Labs, Inc. Copyright 2011-2014 Kazuho Oku
  • base64 : Copyright (C) 2004-2008 René Nyffenegger
  • stb_image.h : v2.08 - public domain image loader - http://nothings.org/stb_image.h

Build and example

Copy stb_image.h, picojson.h and tiny_gltf_loader.h to your project.

// Define these only in *one* .cc file.
#define TINYGLTF_LOADER_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#include "tiny_gltf_loader.h"

using namespace tinygltf;

Scene scene; 
TinyGLTFLoader loader;
std::string err;
  
bool ret = loader.LoadASCIIFromFile(scene, err, argv[1]);
//bool ret = loader.LoadBinaryFromFile(scene, err, argv[1]); // for binary glTF(.glb) 
if (!err.empty()) {
  printf("Err: %s\n", err.c_str());
}

if (!ret) {
  printf("Failed to parse glTF\n");
  return -1;
}

Running tests.

Setup

Python 2.6 or 2.7 required. Git clone https://github.com/KhronosGroup/glTF-Sample-Models to your local dir.

Run test

After building loader_example, edit test_runner.py, then,

$ python test_runner.py

tinygltfloader's People

Contributors

dgough avatar lukesanantonio avatar missmah avatar r-lyeh avatar syoyo 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.