Skip to content

Commit 04f0d75

Browse files
authored
Add support for dumping PF_A32B32G32R32F (#11)
This seems to be used for VTX animation data. Signed-off-by: Angel Pons <th3fanbus@gmail.com>
1 parent ec350ff commit 04f0d75

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

AssetDumper/Source/AssetDumper/Private/Toolkit/AssetTypes/TextureDecompressor.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
#include "RenderUtils.h"
44
#include "detex.h"
55

6+
void ConvertABGR32FToBGRA8(const void* SourcePixelData, void* DestPixelData, int32 NumPixels) {
7+
const FLinearColor* SourceData = static_cast<const FLinearColor*>(SourcePixelData);
8+
FColor* DestData = static_cast<FColor*>(DestPixelData);
9+
10+
for (int i = 0; i < NumPixels; i++) {
11+
//Use a FLinearColor for source data but swizzle the components
12+
const FLinearColor* CurrentColorFloat = SourceData++;
13+
FColor* CurrentColor = DestData++;
14+
FLinearColor LinearColor(CurrentColorFloat->G,
15+
CurrentColorFloat->B,
16+
CurrentColorFloat->A,
17+
CurrentColorFloat->R);
18+
*CurrentColor = LinearColor.ToFColor(true);
19+
}
20+
}
21+
622
void ConvertFloatRGBAToBGRA8(const void* SourcePixelData, void* DestPixelData, int32 NumPixels) {
723
const FFloat16Color* SourceData = static_cast<const FFloat16Color*>(SourcePixelData);
824
FColor* DestData = static_cast<FColor*>(DestPixelData);
@@ -102,10 +118,14 @@ bool FTextureDecompressor::DecompressTextureData(EPixelFormat PixelFormat, const
102118
//Convert 16-bit FloatRGBA image to BGRA8 image
103119
ConvertFloatRGBAToBGRA8(SourceData, DestData, NumPixels);
104120

121+
} else if (PixelFormat == EPixelFormat::PF_A32B32G32R32F) {
122+
//Convert 32-bit FloatABGR image to BGRA8 image
123+
ConvertABGR32FToBGRA8(SourceData, DestData, NumPixels);
124+
105125
} else if (PixelFormat == EPixelFormat::PF_FloatRGB || PixelFormat == EPixelFormat::PF_FloatR11G11B10) {
106126
//Convert that weird float low-precision format that nobody is using to BGRA8 image
107127
ConvertFloatR11G11B10ToBGRA8(SourceData, DestData, NumPixels);
108-
128+
109129
} else {
110130
//Well, this format is not supported apparently
111131
if (OutErrorMessage) {

0 commit comments

Comments
 (0)