mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-07-05 23:25:13 +08:00
Support gltf-buffer
mime.
Make `min` and `max` parameters in `Accessor` optional.
This commit is contained in:
parent
57f8e7ca3b
commit
0067a9e43a
@ -1010,6 +1010,14 @@ static bool IsDataURI(const std::string &in) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE(syoyo) `gltf-buffer` is still in draft as of Jun 4, 2018,
|
||||||
|
// but some glTF sample model uses `gltf-buffer` so we deal with it.
|
||||||
|
// https://github.com/KhronosGroup/glTF/pull/1180
|
||||||
|
header = "data:application/gltf-buffer;base64,";
|
||||||
|
if (in.find(header) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
header = "data:image/png;base64,";
|
header = "data:image/png;base64,";
|
||||||
if (in.find(header) == 0) {
|
if (in.find(header) == 0) {
|
||||||
return true;
|
return true;
|
||||||
@ -1037,6 +1045,13 @@ static bool DecodeDataURI(std::vector<unsigned char> *out,
|
|||||||
data = base64_decode(in.substr(header.size())); // cut mime string.
|
data = base64_decode(in.substr(header.size())); // cut mime string.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.empty()) {
|
||||||
|
header = "data:application/gltf-buffer;base64,";
|
||||||
|
if (in.find(header) == 0) {
|
||||||
|
data = base64_decode(in.substr(header.size())); // cut mime string.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data.empty()) {
|
if (data.empty()) {
|
||||||
header = "data:image/jpeg;base64,";
|
header = "data:image/jpeg;base64,";
|
||||||
if (in.find(header) == 0) {
|
if (in.find(header) == 0) {
|
||||||
@ -1662,11 +1677,11 @@ static bool ParseAccessor(Accessor *accessor, std::string *err,
|
|||||||
|
|
||||||
accessor->minValues.clear();
|
accessor->minValues.clear();
|
||||||
accessor->maxValues.clear();
|
accessor->maxValues.clear();
|
||||||
if(!ParseNumberArrayProperty(&accessor->minValues, err, o, "min", true, "Accessor")) {
|
if(!ParseNumberArrayProperty(&accessor->minValues, err, o, "min", false, "Accessor")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ParseNumberArrayProperty(&accessor->maxValues, err, o, "max", true, "Accessor")) {
|
if(!ParseNumberArrayProperty(&accessor->maxValues, err, o, "max", false, "Accessor")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user