| commit | 6ac97adf6b002773a90366f4e855d78fcb901224 | [log] [tgz] |
|---|---|---|
| author | Syoyo Fujita <syoyo@lighttransport.com> | Wed May 29 20:09:47 2019 +0900 |
| committer | Syoyo Fujita <syoyo@lighttransport.com> | Wed May 29 20:09:47 2019 +0900 |
| tree | c2fd7031f94881e281288733a2d44c474170d245 | |
| parent | 06f93c859d57cb1e4a8eb27f890eb65c14f8d01e [diff] |
Add valijson. Currently it seg faults due to stack overflow when validating with `glTF.schema.json`
TinyGLTF is a header only C++11 glTF 2.0 https://github.com/KhronosGroup/glTF library.
TinyGLTF uses dropbox/json11 JSON library(https://github.com/dropbox/json11), so now it requires C++11 compiler. If you are looking for old, C++03 version, please use devel-picojson branch.
v2.2.0 Use dropbox/json11 instead of nlohmann's json.hpp v2.0.0 release(22 Aug, 2018)!
.bin file.extensions and extras propertyanimation and skinTinyGLTF is licensed under MIT license.
TinyGLTF uses the following third party libraries.
Copy stb_image.h, stb_image_write.h, and tiny_gltf.h to your project. json11 code is embeded into tiny_gltf.h
// Define these only in *one* .cc file. #define TINYGLTF_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_WRITE_IMPLEMENTATION // Optional. Uncomment these if you want external json11.cpp instead of embedded json11.cpp code //#define TINYGLTF_USE_EXTERNAL_JSON11_CPP //#include "json11.hpp" #include "tiny_gltf.h" using namespace tinygltf; Model model; TinyGLTF loader; std::string err; std::string warn; bool ret = loader.LoadASCIIFromFile(&model, &err, &warn, argv[1]); //bool ret = loader.LoadBinaryFromFile(&model, &err, &warn, argv[1]); // for binary glTF(.glb) if (!warn.empty()) { printf("Warn: %s\n", warn.c_str()); } if (!err.empty()) { printf("Err: %s\n", err.c_str()); } if (!ret) { printf("Failed to parse glTF\n"); return -1; }
TINYGLTF_NO_STB_IMAGE : Do not load images with stb_image. Instead use TinyGLTF::SetImageLoader(LoadimageDataFunction LoadImageData, void *user_data) to set a callback for loading images.TINYGLTF_NO_STB_IMAGE_WRITE : Do not write images with stb_image_write. Instead use TinyGLTF::SetImageWriter(WriteimageDataFunction WriteImageData, void *user_data) to set a callback for writing images.TINYGLTF_NO_EXTERNAL_IMAGE : Do not try to load external image file. This option woulde be helpful if you do not want load image file during glTF parsing.TINYGLTF_ANDROID_LOAD_FROM_ASSETS: Load all files from packaged app assets instead of the regular file system. Note: You must pass a valid asset manager from your android app to tinygltf::asset_manager beforehand.TINYGLTF_ENABLE_DRACO: Enable Draco compression. User must provide include path and link correspnding libraries in your project file.TINYGLTF_USE_EXTERNAL_JSON11_CPP : Use externally supplied json11.cpp/json11.hpp. This option may be helpful if you use json11.cpp in other source codes of your project.Python 2.6 or 2.7 required. Git clone https://github.com/KhronosGroup/glTF-Sample-Models to your local dir.
After building loader_example, edit test_runner.py, then,
$ python test_runner.py
$ cd tests $ make $ ./tester $ ./tester_noexcept