Skip to content

Commit

Permalink
fixed grcTexturePC's DDS loading and writing
Browse files Browse the repository at this point in the history
  • Loading branch information
akifle47 committed Dec 11, 2024
1 parent 6605df8 commit a0bcdd0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/rage/grcore/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ DDS_HEADER rage::grcTexturePC::GenerateDDSHeader() const
header.Width = mWidth;
header.Height = mHeight;

header.Depth = mLayerCount + 1;
if(mLayerCount > 1 || mTextureType == eTextureType::VOLUME)
{
header.Depth = mLayerCount;
header.Depth = mLayerCount + 1;
header.Flags |= eDDSHeaderFlag::DEPTH;
header.Caps2 |= eDDSHeaderCap2::VOLUME;
}
Expand All @@ -53,8 +54,15 @@ DDS_HEADER rage::grcTexturePC::GenerateDDSHeader() const

void rage::grcTexturePC::LoadFromDDS(const DDS_HEADER& header, const void* pixelData)
{
mLayerCount = (uint8_t)header.Depth;
mMipCount = (uint8_t)header.MipMapCount;
if(header.Flags & eDDSHeaderFlag::DEPTH)
mLayerCount = (uint8_t)header.Depth - 1;
else
mLayerCount = 0;

if(header.Flags & eDDSHeaderFlag::MIPMAPCOUNT)
mMipCount = (uint8_t)header.MipMapCount;
else
mMipCount = 1;

mWidth = (uint16_t)header.Width;
mHeight = (uint16_t)header.Height;
Expand Down

0 comments on commit a0bcdd0

Please sign in to comment.