Improve windows build.
Don't report error when `in_normal` is not used in the shader.
3 files changed
tree: 5365d1cc2d059565851d8bb7d9abc6ee30f6ea03
  1. deps/
  2. examples/
  3. images/
  4. tools/
  5. .clang-format
  6. .travis.yml
  7. appveyor.yml
  8. box.gltf
  9. loader_example.cc
  10. Makefile
  11. picojson.h
  12. premake4.lua
  13. README.md
  14. stb_image.h
  15. test_runner.py
  16. tiny_gltf_loader.h
  17. vcsetup.bat
README.md

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

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

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
    • [x] Parse BASE64 encoded embedded buffer fata(DataURI).
    • [x] Load .bin file.
  • Image(Using stb_image)
    • [x] Parse BASE64 encoded embedded image fata(DataURI).
    • [x] Load external image file.
    • [x] PNG(8bit only)
    • [x] JPEG(8bit only)
    • [x] BMP
    • [x] GIF

Examples

  • glview : Simple glTF geometry viewer.

TODOs

  • [ ] Support multiple scenes in .gltf
  • [ ] Parse animation, program, sampler, shader, technique
  • [ ] Compression/decompression(Open3DGC, etc)
  • [ ] Support extensions and extras property
  • [ ] HDR image?

License

TinyGLTFLoader is licensed under 2-clause BSD.

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 to your local dir.

Run test

After building loader_test, edit test_runner.py, then,

$ python test_runner.py