mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-07-05 16:15:12 +08:00
Add missing bmp and gif mimetypes
This commit is contained in:
parent
0d9a495fd1
commit
f8a8d9caa0
28
tiny_gltf.h
28
tiny_gltf.h
@ -449,7 +449,7 @@ struct Image {
|
||||
int component;
|
||||
std::vector<unsigned char> image;
|
||||
int bufferView; // (required if no uri)
|
||||
std::string mimeType; // (required if no uri) ["image/jpeg", "image/png"]
|
||||
std::string mimeType; // (required if no uri) ["image/jpeg", "image/png", "image/bmp", "image/gif"]
|
||||
std::string uri; // (reqiored if no mimeType)
|
||||
Value extras;
|
||||
|
||||
@ -1224,12 +1224,22 @@ static bool IsDataURI(const std::string &in) {
|
||||
return true;
|
||||
}
|
||||
|
||||
header = "data:image/jpeg;base64,";
|
||||
if (in.find(header) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
header = "data:image/png;base64,";
|
||||
if (in.find(header) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
header = "data:image/jpeg;base64,";
|
||||
header = "data:image/bmp;base64,";
|
||||
if(in.find(header) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
header = "data:image/gif;base64,";
|
||||
if(in.find(header) == 0) {
|
||||
return true;
|
||||
}
|
||||
@ -1265,6 +1275,20 @@ static bool DecodeDataURI(std::vector<unsigned char> *out,
|
||||
}
|
||||
}
|
||||
|
||||
if (data.empty()) {
|
||||
header = "data:image/bmp;base64,";
|
||||
if (in.find(header) == 0) {
|
||||
data = base64_decode(in.substr(header.size())); // cut mime string.
|
||||
}
|
||||
}
|
||||
|
||||
if (data.empty()) {
|
||||
header = "data:image/gif;base64,";
|
||||
if (in.find(header) == 0) {
|
||||
data = base64_decode(in.substr(header.size())); // cut mime string.
|
||||
}
|
||||
}
|
||||
|
||||
if (data.empty()) {
|
||||
header = "data:text/plain;base64,";
|
||||
if (in.find(header) == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user