mirror of
https://github.com/syoyo/tinygltf.git
synced 2026-06-11 12:43:49 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2026e03fab |
@@ -40,5 +40,5 @@ script:
|
|||||||
- export CC="${CC}-${COMPILER_VERSION}"
|
- export CC="${CC}-${COMPILER_VERSION}"
|
||||||
- export CXX="${CXX}-${COMPILER_VERSION}"
|
- export CXX="${CXX}-${COMPILER_VERSION}"
|
||||||
- ${CC} -v
|
- ${CC} -v
|
||||||
- ${CXX} ${EXTRA_CXXFLAGS} -std=c++11 -Wall -g -o loader_example loader_example.cc
|
- ${CXX} ${EXTRA_CXXFLAGS} -Wall -g -o loader_example loader_example.cc
|
||||||
- ./loader_example ./models/Cube/Cube.gltf
|
- ./loader_example ./models/Cube/Cube.gltf
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -3,7 +3,7 @@
|
|||||||
#EXTRA_CXXFLAGS := -fsanitize=address -Wall -Werror -Weverything -Wno-c++11-long-long -DTINYGLTF_APPLY_CLANG_WEVERYTHING
|
#EXTRA_CXXFLAGS := -fsanitize=address -Wall -Werror -Weverything -Wno-c++11-long-long -DTINYGLTF_APPLY_CLANG_WEVERYTHING
|
||||||
|
|
||||||
all:
|
all:
|
||||||
clang++ $(EXTRA_CXXFLAGS) -std=c++11 -g -O0 -o loader_example loader_example.cc
|
clang++ $(EXTRA_CXXFLAGS) -g -O0 -o loader_example loader_example.cc
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
./cpplint.py tiny_gltf_loader.h
|
./cpplint.py tiny_gltf_loader.h
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -1,6 +1,6 @@
|
|||||||
# Header only C++ tiny glTF library(loader/saver).
|
# Header only C++ tiny glTF library(loader/saver).
|
||||||
|
|
||||||
`TinyGLTF` is a header only C++11 glTF 2.0 https://github.com/KhronosGroup/glTF library.
|
`TinyGLTF` is a header only C++ glTF 2.0 https://github.com/KhronosGroup/glTF library.
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ Work in process(`devel` branch). Very near to release, but need more tests and e
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Written in portable C++. C++-11 with STL dependency only.
|
* Written in portable C++. C++-03 with STL dependency only.
|
||||||
* [x] macOS + clang(LLVM)
|
* [x] macOS + clang(LLVM)
|
||||||
* [x] iOS + clang
|
* [x] iOS + clang
|
||||||
* [x] Linux + gcc/clang
|
* [x] Linux + gcc/clang
|
||||||
@@ -40,12 +40,11 @@ Work in process(`devel` branch). Very near to release, but need more tests and e
|
|||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
* [glview](examples/glview) : Simple glTF geometry viewer.
|
* [glview](examples/glview) : Simple glTF geometry viewer.
|
||||||
* [validator](examples/validator) : Simple glTF validator with JSON schema.
|
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
* [ ] Write C++ code generator from json schema for robust parsing.
|
* [ ] Write C++ code generator from json schema for robust parsing.
|
||||||
* [x] Serialization
|
* [ ] Serialization
|
||||||
* [ ] Compression/decompression(Open3DGC, etc)
|
* [ ] Compression/decompression(Open3DGC, etc)
|
||||||
* [ ] Support `extensions` and `extras` property
|
* [ ] Support `extensions` and `extras` property
|
||||||
* [ ] HDR image?
|
* [ ] HDR image?
|
||||||
@@ -57,14 +56,14 @@ TinyGLTF is licensed under MIT license.
|
|||||||
|
|
||||||
TinyGLTF uses the following third party libraries.
|
TinyGLTF uses the following third party libraries.
|
||||||
|
|
||||||
* json.hpp : Copyright (c) 2013-2017 Niels Lohmann. MIT license.
|
* picojson.h : Copyright 2009-2010 Cybozu Labs, Inc. Copyright 2011-2014 Kazuho Oku
|
||||||
* base64 : Copyright (C) 2004-2008 René Nyffenegger
|
* base64 : Copyright (C) 2004-2008 René Nyffenegger
|
||||||
* stb_image.h : v2.08 - public domain image loader - http://nothings.org/stb_image.h
|
* stb_image.h : v2.08 - public domain image loader - http://nothings.org/stb_image.h
|
||||||
|
|
||||||
|
|
||||||
## Build and example
|
## Build and example
|
||||||
|
|
||||||
Copy `stb_image.h`, `json.hpp` and `tiny_gltf.h` to your project.
|
Copy `stb_image.h`, `picojson.h` and `tiny_gltf.h` to your project.
|
||||||
|
|
||||||
### Loading glTF 2.0 model
|
### Loading glTF 2.0 model
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ solution "glview"
|
|||||||
files { "glview.cc", "trackball.cc" }
|
files { "glview.cc", "trackball.cc" }
|
||||||
includedirs { "./" }
|
includedirs { "./" }
|
||||||
includedirs { "../../" }
|
includedirs { "../../" }
|
||||||
flags "c++11"
|
|
||||||
|
|
||||||
configuration { "linux" }
|
configuration { "linux" }
|
||||||
linkoptions { "`pkg-config --libs glfw3`" }
|
linkoptions { "`pkg-config --libs glfw3`" }
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#include "gltf-loader.h"
|
#include "gltf-loader.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#define TINYGLTF_IMPLEMENTATION
|
#define TINYGLTF_IMPLEMENTATION
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#include "tiny_gltf.h"
|
#include "tiny_gltf.h"
|
||||||
|
|||||||
@@ -9,6 +9,32 @@ Experimental. W.I.P.
|
|||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
* C++11 compiler
|
* C++11 compiler
|
||||||
|
* CMake 3.2 or later
|
||||||
|
|
||||||
|
## How to build
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mkdir build
|
||||||
|
$ cd build
|
||||||
|
$ cmake ..
|
||||||
|
$ make
|
||||||
|
```
|
||||||
|
|
||||||
|
## How to run
|
||||||
|
|
||||||
|
First clone glTF repo somewhere to get glTF schema JSON files.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cd ~/work # Choose your favorite dir.
|
||||||
|
$ git clone https://github.com/KhronosGroup/glTF
|
||||||
|
$ export GLTF_DIR=~/work/glTF
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, specify the directory of glTF 2.0 schema JSONs and a glTF file.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./tinygltf-validator $GLTF_DIR/specification/2.0/schema/ ../../models/Cube/Cube.gltf
|
||||||
|
```
|
||||||
|
|
||||||
## Third party licenses
|
## Third party licenses
|
||||||
|
|
||||||
|
|||||||
1163
picojson.h
Normal file
1163
picojson.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,6 @@ solution "TinyGLTFSolution"
|
|||||||
kind "ConsoleApp"
|
kind "ConsoleApp"
|
||||||
language "C++"
|
language "C++"
|
||||||
files { sources }
|
files { sources }
|
||||||
flags { "c++11" }
|
|
||||||
|
|
||||||
configuration "Debug"
|
configuration "Debug"
|
||||||
defines { "DEBUG" } -- -DDEBUG
|
defines { "DEBUG" } -- -DDEBUG
|
||||||
|
|||||||
1454
tiny_gltf.h
1454
tiny_gltf.h
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user