Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support dds files that lie about their mipmaps #351

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ObjImage/Image/DdsLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ namespace dds
m_width = header.dwWidth;
m_height = header.dwHeight;
m_depth = header.dwDepth;
m_has_mip_maps = (header.dwCaps & DDSCAPS_MIPMAP) != 0 || header.dwMipMapCount > 1;

// Best thing to do here would be to check (header.dwCaps & DDSCAPS_MIPMAP) != 0 but some tools just create bad files
// I encountered both files that have the flag without them actually having mipmaps (mipMapCount == 1)
// and also files that have mipMapCount > 1 but not the flag
m_has_mip_maps = header.dwMipMapCount > 1;

if (header.dwCaps2 & DDSCAPS2_CUBEMAP)
m_texture_type = TextureType::T_CUBE;
Expand Down
Loading