mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-15 15:35:53 +08:00
- Parse image extras property
- Optionally serialize texture.source (it is not required in the current spec)
This commit is contained in:
parent
fa0a998a8b
commit
8eb3904de2
@ -487,7 +487,7 @@ struct Texture {
|
|||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
int sampler;
|
int sampler;
|
||||||
int source; // Required (not specified in the spec ?)
|
int source;
|
||||||
Value extras;
|
Value extras;
|
||||||
ExtensionMap extensions;
|
ExtensionMap extensions;
|
||||||
|
|
||||||
@ -2475,6 +2475,7 @@ static bool ParseImage(Image *image, std::string *err, std::string *warn,
|
|||||||
|
|
||||||
ParseStringProperty(&image->name, err, o, "name", false);
|
ParseStringProperty(&image->name, err, o, "name", false);
|
||||||
ParseExtensionsProperty(&image->extensions, err, o);
|
ParseExtensionsProperty(&image->extensions, err, o);
|
||||||
|
ParseExtrasProperty(&image->extras, o);
|
||||||
|
|
||||||
if (hasBufferView) {
|
if (hasBufferView) {
|
||||||
double bufferView = -1;
|
double bufferView = -1;
|
||||||
@ -4578,8 +4579,9 @@ static void SerializeGltfTexture(Texture &texture, json &o) {
|
|||||||
if (texture.sampler > -1) {
|
if (texture.sampler > -1) {
|
||||||
SerializeNumberProperty("sampler", texture.sampler, o);
|
SerializeNumberProperty("sampler", texture.sampler, o);
|
||||||
}
|
}
|
||||||
SerializeNumberProperty("source", texture.source, o);
|
if (texture.source > -1) {
|
||||||
|
SerializeNumberProperty("source", texture.source, o);
|
||||||
|
}
|
||||||
if (texture.extras.Type() != NULL_TYPE) {
|
if (texture.extras.Type() != NULL_TYPE) {
|
||||||
SerializeValue("extras", texture.extras, o);
|
SerializeValue("extras", texture.extras, o);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user