diff --git a/include/fastgltf/types.hpp b/include/fastgltf/types.hpp index 4879057d7..cd08df70f 100644 --- a/include/fastgltf/types.hpp +++ b/include/fastgltf/types.hpp @@ -210,6 +210,7 @@ namespace fastgltf { DDS = 4, GltfBuffer = 5, OctetStream = 6, + WEBP = 7, }; FASTGLTF_EXPORT enum class AnimationInterpolation : std::uint8_t { @@ -458,6 +459,7 @@ namespace fastgltf { constexpr std::string_view mimeTypeDds = "image/vnd-ms.dds"; constexpr std::string_view mimeTypeGltfBuffer = "application/gltf-buffer"; constexpr std::string_view mimeTypeOctetStream = "application/octet-stream"; + constexpr std::string_view mimeTypeWebp = "image/webp"; constexpr std::string_view getMimeTypeString(MimeType mimeType) noexcept { switch (mimeType) { @@ -473,6 +475,8 @@ namespace fastgltf { return mimeTypeGltfBuffer; case MimeType::OctetStream: return mimeTypeOctetStream; + case MimeType::WEBP: + return mimeTypeWebp; default: return ""; } @@ -1925,7 +1929,7 @@ namespace fastgltf { Optional clearcoatTexture; num clearcoatRoughnessFactor = 0.0f; Optional clearcoatRoughnessTexture; - Optional clearcoatNormalTexture; + Optional clearcoatNormalTexture; }; FASTGLTF_EXPORT struct MaterialSheen { diff --git a/src/fastgltf.cpp b/src/fastgltf.cpp index 179336562..d8971611a 100644 --- a/src/fastgltf.cpp +++ b/src/fastgltf.cpp @@ -799,6 +799,9 @@ fg::MimeType fg::Parser::getMimeTypeFromString(std::string_view mime) { case force_consteval: { return MimeType::OctetStream; } + case force_consteval: { + return MimeType::WEBP; + } default: { return MimeType::None; } @@ -2634,9 +2637,9 @@ fg::Error fg::Parser::parseMaterialExtensions(simdjson::dom::object &object, fas return error; } - TextureInfo clearcoatNormalTexture; + NormalTextureInfo clearcoatNormalTexture; if (auto error = parseTextureInfo(clearcoatObject, "clearcoatNormalTexture", - &clearcoatNormalTexture, config.extensions); error == + &clearcoatNormalTexture, config.extensions, TextureInfoType::NormalTexture); error == Error::None) { clearcoat->clearcoatNormalTexture = std::move(clearcoatNormalTexture); } else if (error != Error::MissingField) { @@ -4735,7 +4738,7 @@ void fg::Exporter::writeMaterials(const Asset& asset, std::string& json) { if (it->clearcoat->clearcoatNormalTexture.has_value()) { if (json.back() != '{') json += ','; json += "\"clearcoatNormalTexture\":"; - writeTextureInfo(json, &it->clearcoat->clearcoatNormalTexture.value()); + writeTextureInfo(json, &it->clearcoat->clearcoatNormalTexture.value(), TextureInfoType::NormalTexture); } json += '}'; }