summaryrefslogtreecommitdiffstats
path: root/AssetLoader/src/GLTFLoader.cpp
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-05-01 16:44:42 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-05-01 16:44:42 +0000
commit05442d327b1850c105596477104c85eae419c4e4 (patch)
treeb03c371a6c22716512dd6d244225648863a401b6 /AssetLoader/src/GLTFLoader.cpp
parentUpdated TextureLoadInfo ctor (diff)
downloadDiligentTools-05442d327b1850c105596477104c85eae419c4e4.tar.gz
DiligentTools-05442d327b1850c105596477104c85eae419c4e4.zip
GLTF Loader: fixed texture format recognition
Diffstat (limited to 'AssetLoader/src/GLTFLoader.cpp')
-rw-r--r--AssetLoader/src/GLTFLoader.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/AssetLoader/src/GLTFLoader.cpp b/AssetLoader/src/GLTFLoader.cpp
index da6062e..a6363ec 100644
--- a/AssetLoader/src/GLTFLoader.cpp
+++ b/AssetLoader/src/GLTFLoader.cpp
@@ -852,20 +852,8 @@ bool LoadImageData(tinygltf::Image* gltf_image,
(void)warning;
ImageLoadInfo LoadInfo;
- if (size >= 3 && image_data[0] == 0xFF && image_data[1] == 0xD8 && image_data[2] == 0xFF)
- {
- LoadInfo.Format = EImageFileFormat::jpeg;
- VERIFY_EXPR(gltf_image->mimeType == "image/jpeg");
- }
- else if (size >= 8 &&
- image_data[0] == 137u && image_data[1] == 80u && image_data[2] == 78u && image_data[3] == 71u &&
- image_data[4] == 13u && image_data[5] == 10u && image_data[6] == 26u && image_data[7] == 10u)
- {
- // http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html
- LoadInfo.Format = EImageFileFormat::png;
- VERIFY_EXPR(gltf_image->mimeType == "image/png");
- }
- else
+ LoadInfo.Format = Image::GetFileFormat(image_data, size);
+ if (LoadInfo.Format == EImageFileFormat::unknown)
{
if (error != nullptr)
{