Merge pull request #161 from rainliang000/patch-1

if image.uri empty, should use image.bufferView
This commit is contained in:
Syoyo Fujita 2019-04-29 17:48:47 +09:00 committed by GitHub
commit 8f67121deb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4892,7 +4892,14 @@ static void SerializeGltfBufferView(BufferView &bufferView, json &o) {
}
static void SerializeGltfImage(Image &image, json &o) {
SerializeStringProperty("uri", image.uri, o);
// if uri empty, the mimeType and bufferview should be set
if (image.uri.empty()) {
SerializeStringProperty("mimeType", image.mimeType, o);
SerializeNumberProperty<int>("bufferView", image.bufferView, o);
}
else {
SerializeStringProperty("uri", image.uri, o);
}
if (image.name.size()) {
SerializeStringProperty("name", image.name, o);