Navigation
API > API/Runtime > API/Runtime/ImageCore
References
| Module | ImageCore |
| Header | /Engine/Source/Runtime/ImageCore/Public/DDSFile.h |
| Include | #include "DDSFile.h" |
Syntax
struct FDDSFile
Remarks
Metadata structure for a DDS file, with access pointers for the raw texture data (i.e. unconverted from the DXGI format).
Can be used for loading or saving a dds file.
For saving, general structure is: { dds = FDDSFile::CreateEmpty2D copy data for each mip/array: for (mips) memcpy(dds->mips[idx].data, mip_data, mip_size);
Ar = IFileManager::Get().CreateFileWriter(filename);
dds->Serialize(Ar); delete dds;
Ar->Close() delete Ar; }
Variables
| Type | Name | Description | |
|---|---|---|---|
| uint32 | ArraySize | Array size here uses the conventions as in the D3D runtime, which means an array of N cubemaps has an array size of 6N (one element per face). | |
| uint32 | CreateFlags | ||
| uint32 | Depth | ||
| int32 | Dimension | ||
| EDXGIFormat | DXGIFormat | ||
| uint32 | Height | ||
| uint32 | MipCount | ||
| TArray64< uint8 > | MipRawData | When we allocate the mips ourselves, we keep all storage together in a single allocation, namely this one, and the mips point into it. | |
| TArray< FDDSMip > | Mips | Mips are ordered starting from mip 0 (full-size texture) decreasing in size; for arrays, we store the full mip chain for one array element before advancing to the next array element, and have (ArraySize * MipCount) mips total. | |
| uint32 | Width |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | ConvertChannelOrder
(
EChannelOrder InTargetOrder |
For 8-bit UNorm formats, both RGBA and BGRA channel order variants exist and are popular. | |
| void | Convert X alpha to A and fill 255 | ||
| FDDSFile * | CreateEmpty
(
int32 InDimension, |
Create an empty DDS structure (for writing DDS files typically) | |
| FDDSFile * | CreateEmpty2D
(
uint32 InWidth, |
Convenience version of the above to create a basic 2D texture with mip chain. | |
| FDDSFile * | CreateFromDDSInMemory
(
const uint8* InDDS, |
Used for loading from a DDS file image in memory. | |
| void | FillMip
(
const FImageView& FromImage, |
Fill DDS mip from ImageImage must be of format DXGIFormatFromRawFormat | |
| bool | GetMipImage
(
const FImageView& ToImage, |
Blit pixels from DDS mip to Image return false if no pixel format conversion is supported ToImage is not allocated, must be pre-allocated and sized correctly | |
| bool | IsADDS
(
const uint8* InDDS, |
Is this buffer a DDS ? | |
| bool | Check if this DDS is usable in Unreal Texture types: | ||
| bool | |||
| bool | |||
| bool | |||
| EDDSError | Validate () |
Sanity-check that all members make sense and return an error code. | |
| EDDSError | WriteDDS
(
TArray64< uint8 >& OutDDS, |
Write DDS-format data to memory. |
Constants
| Name | Description |
|---|---|
| CREATE_FLAG_CUBEMAP | |
| CREATE_FLAG_NO_MIP_STORAGE_ALLOC | |
| CREATE_FLAG_NONE | Bit flags. |
| CREATE_FLAG_WAS_D3D9 | |
| MAX_MIPS_SUPPORTED | 20 mips means 512k x 512k pixels max, should be sufficient for now. |