Skip to content
forked from syoyo/tinygltf

Header only C++11 tiny glTF 2.0 library

License

Notifications You must be signed in to change notification settings

kwangok/tinygltf

Repository files navigation

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

Features

  • Portable C++. C++-98 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

Limitation

Currently, TinyGLTFLoader only loads nodes and geometry(mesh/buffer) data.

Examples

  • glview : Simple glTF geometry viewer.

TODOs

  • Support multiple scenes in .gltf
  • Parse animation, program, sampler, shader, technique, texture
  • Compression/decompression(Open3DGC, etc)
  • Support extensions and extras property
  • Load .gltf from memory.
  • HDR image
  • Binary glTF.

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.LoadFromFile(scene, err, argv[1]);
if (!err.empty()) {
  printf("Err: %s\n", err.c_str());
}

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

About

Header only C++11 tiny glTF 2.0 library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 80.2%
  • C 19.5%
  • Python 0.1%
  • CMake 0.1%
  • Makefile 0.1%
  • Lua 0.0%