我使用NVidia 的 Texture Exporter Tool创建了一个 Texture Cube,但我无法使用IWICDdsDecoder
.
它失败了0x88982f61 : The image header is unrecognized.
。
另一方面,Dimension = WICDdsTexture2D
使用 NVTET 创建的普通 2D 纹理 ( ) 可以正确加载并且运行良好。
是否IWICDdsLoader
支持 Cube Maps,如果不支持,为什么要WICDdsDimension.WICDdsTextureCube
指定?
WICDdsTexture2D
适用于NVTET 编写的普通纹理的部分加载程序代码。
HRESULT lResult;
WICStream lStream;
lResult = gFactory->CreateStream(&lStream);
if (FAILED(lResult)) return lResult;
lResult = lStream->InitializeFromFilename(aPath, GENERIC_READ);
if (FAILED(lResult)) return lResult;
WICBitmapDecoder lBitmapDecoder;
lResult = gFactory->CreateDecoder(GUID_ContainerFormatDds, nullptr, &lBitmapDecoder);
if (FAILED(lResult)) return lResult;
lResult = lBitmapDecoder->Initialize(lStream, WICDecodeMetadataCacheOnDemand);
if (FAILED(lResult)) return lResult; // <-- it fails here!
// 0x88982f61 : The image header is unrecognized.
WICDdsDecoder lDecoder(lBitmapDecoder);
if (!lDecoder) return E_NOINTERFACE;
WICDdsParameters lParameters{};
lResult = lDecoder->GetParameters(&lParameters);
if (FAILED(lResult)) return lResult;
if (lParameters.Dimension != WICDdsTextureCube) return E_FAIL;
// etc.