mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-11 21:09:07 +08:00
Update Readme.md
This commit is contained in:
parent
168d0595ef
commit
9ec8137dd0
14
README.md
14
README.md
@ -51,24 +51,24 @@ TinyGLTF uses the following third party libraries.
|
|||||||
|
|
||||||
## Build and example
|
## Build and example
|
||||||
|
|
||||||
Copy `stb_image.h`, `picojson.h` and `tiny_gltf_loader.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
|
||||||
|
|
||||||
```
|
```
|
||||||
// Define these only in *one* .cc file.
|
// Define these only in *one* .cc file.
|
||||||
#define TINYGLTF_LOADER_IMPLEMENTATION
|
#define TINYGLTF_IMPLEMENTATION
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#include "tiny_gltf_loader.h"
|
#include "tiny_gltf.h"
|
||||||
|
|
||||||
using namespace tinygltf;
|
using namespace tinygltf;
|
||||||
|
|
||||||
Scene scene;
|
Model model;
|
||||||
TinyGLTFLoader loader;
|
TinyGLTF loader;
|
||||||
std::string err;
|
std::string err;
|
||||||
|
|
||||||
bool ret = loader.LoadASCIIFromFile(scene, err, argv[1]);
|
bool ret = loader.LoadASCIIFromFile(&model, &err, argv[1]);
|
||||||
//bool ret = loader.LoadBinaryFromFile(scene, err, argv[1]); // for binary glTF(.glb)
|
//bool ret = loader.LoadBinaryFromFile(&model, &err, argv[1]); // for binary glTF(.glb)
|
||||||
if (!err.empty()) {
|
if (!err.empty()) {
|
||||||
printf("Err: %s\n", err.c_str());
|
printf("Err: %s\n", err.c_str());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user