mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-10 07:19:02 +08:00
Parse extensions
property of Image.
This commit is contained in:
parent
9ec7109089
commit
3e53feb046
@ -1,3 +1,6 @@
|
||||
//
|
||||
// TODO(syoyo): Print extensions and extras for each glTF object.
|
||||
//
|
||||
#define TINYGLTF_IMPLEMENTATION
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
@ -514,6 +517,7 @@ static void Dump(const tinygltf::Model &model) {
|
||||
std::cout << Indent(2) << "width : " << image.width << std::endl;
|
||||
std::cout << Indent(2) << "height : " << image.height << std::endl;
|
||||
std::cout << Indent(2) << "component : " << image.component << std::endl;
|
||||
DumpExtensions(image.extensions, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,6 +529,7 @@ static void Dump(const tinygltf::Model &model) {
|
||||
<< std::endl;
|
||||
std::cout << Indent(1) << "source : " << texture.source
|
||||
<< std::endl;
|
||||
DumpExtensions(texture.extensions, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -456,6 +456,7 @@ struct Image {
|
||||
// "image/bmp", "image/gif"]
|
||||
std::string uri; // (required if no mimeType)
|
||||
Value extras;
|
||||
ExtensionMap extensions;
|
||||
|
||||
Image() { bufferView = -1; }
|
||||
};
|
||||
@ -2126,6 +2127,7 @@ static bool ParseImage(Image *image, std::string *err, std::string *warn,
|
||||
}
|
||||
|
||||
ParseStringProperty(&image->name, err, o, "name", false);
|
||||
ParseExtensionsProperty(&image->extensions, err, o);
|
||||
|
||||
if (hasBufferView) {
|
||||
double bufferView = -1;
|
||||
@ -4014,6 +4016,8 @@ static void SerializeGltfImage(Image &image, json &o) {
|
||||
if (image.extras.Type() != NULL_TYPE) {
|
||||
SerializeValue("extras", image.extras, o);
|
||||
}
|
||||
|
||||
SerializeExtensionMap(image.extensions, o);
|
||||
}
|
||||
|
||||
static void SerializeGltfMaterial(Material &material, json &o) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user