FTextureSource

Texture source data management.

Choose your operating system:

Windows

macOS

Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/Texture.h

Include

#include "Engine/Texture.h"

Syntax

struct FTextureSource

Remarks

Texture source data management.

Constructors

Name Description

Public function

FTextureSource()

Default constructor.

Functions

Name Description

Public function Const

int64

 

CalcMipSize

(
    int32 BlockIndex,
    int32 LayerIndex,
    int32 MipIndex
)

Computes the size of a single mip.

Public function Const

int64

 

CalcMipSize

(
    int32 MipIndex
)

Public function

void

 

Compress()

PNG Compresses the source art if possible or tells the bulk data to zlib compress when it saves out to disk.

Public function Const

FTextureSour...

 

CopyTornOff()

Make a copy with a torn-off BulkData that has the same Guid used for DDC as this->BulkData

Public function

void

 

ExportCustomProperties

(
    FOutputDevice& Out,
    uint32 Indent
)

Support for copy/paste

Public function

void

 

ForceGenerateGuid()

Force the GUID to change even if mip data has not been modified.

Public function Const

void

 

GetBlock

(
    int32 Index,
    FTextureSourceBlock& OutBlock
)

Access the given block

Public function Static

int32

 

GetBytesPerPixel

(
    ETextureSourceFormat Format
)

Public function Const

int32

 

GetBytesPerPixel

(
    int32 LayerIndex
)

Computes the number of bytes per-pixel.

Public function Const

ETextureSour...

 

GetFormat

(
    int32 LayerIndex
)

Public function Const

FGuid

 

GetId()

Public function Const

FString

 

GetIdString()

Returns the unique ID string for this source art.

Public function Const

FIntPoint

 

GetLogicalSize()

Logical size of the texture includes all blocks

Public function

FMipData

 

GetMipData

(
    IImageWrapperModule* ImageWrap...
)

Returns a FMipData structure that wraps around the entire mip chain for read only operations.

Public function

bool

 

GetMipData

(
    TArray64< uint8 >& OutMipData,
    int32 BlockIndex,
    int32 LayerIndex,
    int32 MipIndex,
    IImageWrapperModule* ImageWrap...
)

Retrieve a copy of the data for a particular mip.

Public function

bool

 

GetMipData

(
    TArray64< uint8 >& OutMipData,
    int32 MipIndex,
    IImageWrapperModule* ImageWrap...
)

Legacy API that defaults to LayerIndex 0

Public function Const

int32

 

GetNumBlocks()

Public function Const

int32

 

GetNumLayers()

Public function Const

int32

 

GetNumMips()

Public function Const

int32

 

GetNumSlices()

Public function Const

FGuid

 

GetPersistentId()

Trivial accessors.

Public function Const

FIntPoint

 

GetSizeInBlocks()

Size of texture in blocks

Public function Const

int64

 

GetSizeOnDisk()

Public function Const

int32

 

GetSizeX()

Public function Const

int32

 

GetSizeY()

Public function Const

ETextureSour...

 

GetSourceCompression()

Returns the compression format of the source data in enum format.

Public function Const

FString

 

GetSourceCompressionAsString()

Returns the compression format of the source data in string format for use with the UI.

Public function Const

bool

 

HasHadBulkDataCleared()

Public function Const

bool

 

HasPayloadData()

Public function

void

 

ImportCustomProperties

(
    const TCHAR* SourceText,
    FFeedbackContext* Warn
)

Public function

void

 

Init

(
    int32 NewSizeX,
    int32 NewSizeY,
    int32 NewNumSlices,
    int32 NewNumMips,
    ETextureSourceFormat NewFormat,
    UE::Virtualization::FVirtualizedUnt...
)

Initialize the source data with the given size, number of mips, and format.

Public function

void

 

Init

(
    int32 NewSizeX,
    int32 NewSizeY,
    int32 NewNumSlices,
    int32 NewNumMips,
    ETextureSourceFormat NewFormat,
    const uint8* NewData
)

Initialize the source data with the given size, number of mips, and format.

Public function

void

 

Init2DWithMipChain

(
    int32 NewSizeX,
    int32 NewSizeY,
    ETextureSourceFormat NewFormat
)

Initializes the source data for a 2D texture with a full mip chain.

Public function

void

 

InitBlocked

(
    const ETextureSourceFormat* In...,
    const FTextureSourceBlock* InB...,
    int32 InNumLayers,
    int32 InNumBlocks,
    UE::Virtualization::FVirtualizedUnt...
)

Public function

void

 

InitBlocked

(
    const ETextureSourceFormat* In...,
    const FTextureSourceBlock* InB...,
    int32 InNumLayers,
    int32 InNumBlocks,
    const uint8** InDataPerBlo...
)

Public function

void

 

InitCubeWithMipChain

(
    int32 NewSizeX,
    int32 NewSizeY,
    ETextureSourceFormat NewFormat
)

Initializes the source data for a cubemap with a full mip chain.

Public function

void

 

InitLayered

(
    int32 NewSizeX,
    int32 NewSizeY,
    int32 NewNumSlices,
    int32 NewNumLayers,
    int32 NewNumMips,
    const ETextureSourceFormat* Ne...,
    UE::Virtualization::FVirtualizedUnt...
)

Public function

void

 

InitLayered

(
    int32 NewSizeX,
    int32 NewSizeY,
    int32 NewNumSlices,
    int32 NewNumLayers,
    int32 NewNumMips,
    const ETextureSourceFormat* Ne...,
    const uint8* NewData
)

Public function

void

 

InitLayered2DWithMipChain

(
    int32 NewSizeX,
    int32 NewSizeY,
    int32 NewNumLayers,
    const ETextureSourceFormat* Ne...
)

Public function

void

 

InitWithCompressedSourceData

(
    int32 NewSizeX,
    int32 NewSizeY,
    int32 NewNumMips,
    ETextureSourceFormat NewFormat,
    const TArrayView64< uint8 > NewSour...,
    ETextureSourceCompressionFormat New...
)

Initialize the source data with the given size, number of mips, and format.

Public function Const

bool

 

IsBulkDataLoaded()

Returns true if the texture's bulkdata payload is either already in memory or if the payload is 0 bytes in length.

Public function Static

bool

 

IsHDR

(
    ETextureSourceFormat Format
)

Public function Const

bool

 

IsLongLatCubemap()

Public function Const

bool

 

IsPNGCompressed()

Public function Const

bool

 

IsPowerOfTwo

(
    int32 BlockIndex
)

Return true if the source data is power-of-2.

Public function Const

bool

 

IsValid()

Returns true if source art is available.

Public function

uint8 *

 

LockMip

(
    int32 MipIndex
)

Lock a mip for editing.

Public function

uint8 *

 

LockMip

(
    int32 BlockIndex,
    int32 LayerIndex,
    int32 MipIndex
)

Lock a mip for editing.

Public function

const uint8 ...

 

LockMipReadOnly

(
    int32 MipIndex
)

Lock a mip for reading.

Public function

const uint8 ...

 

LockMipReadOnly

(
    int32 BlockIndex,
    int32 LayerIndex,
    int32 MipIndex
)

Lock a mip for reading.

Public function

void

 

OperateOnLoadedBulkData

(
    TFunctionRef< void...
)

Public function

void

 

ReleaseSourceMemory()

Public function

void

 

RemoveBulkData()

Public function

void

 

SetId

(
    const FGuid& InId,
    bool bInGuidIsHash
)

Sets the GUID to use, and whether that GUID is actually a hash of some data.

Public function

void

 

UnlockMip

(
    int32 MipIndex
)

Public function

void

 

UnlockMip

(
    int32 BlockIndex,
    int32 LayerIndex,
    int32 MipIndex
)

Unlock a mip.

Public function

void

 

UseHashAsGuid()

Uses a hash as the GUID, useful to prevent creating new GUIDs on load for legacy assets.

Classes

Name

Description

Public struct

FMipAllocation

Public struct

FMipData

Structure that encapsulates the decompressed texture data and can be accessed per mip

Enums

Name

Description

Private enum

ELockState

Deprecated Functions

Name Description

Public function

bool

 

LoadBulkDataWithFileReader()

There is no longer a need to call LoadBulkDataWithFileReader, FTextureSource::BulkData can now load the data on demand without it.