Navigation
API > API/Runtime > API/Runtime/Engine
Texture source data management.
| Name | FTextureSource |
| Type | struct |
| Header File | /Engine/Source/Runtime/Engine/Classes/Engine/Texture.h |
| Include Path | #include "Engine/Texture.h" |
Syntax
USTRUCT ()
struct FTextureSource
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FTextureSource() |
Default constructor. | Engine/Texture.h |
Structs
| Name | Remarks |
|---|---|
| FMipAllocation | |
| FMipData | Structure that encapsulates the decompressed texture data and can be accessed per mip |
| FMipLock | FMipLock to encapsulate a locked mip - acquires the lock in construct and unlocks in destruct. |
Enums
Public
| Name | Remarks |
|---|---|
| ELockState |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| BaseBlockX | int32 | Position of texture block0, only relevant if source has multiple blocks | Engine/Texture.h |
|
| BaseBlockY | int32 | Engine/Texture.h |
|
|
| bGuidIsHash | bool | Uses hash instead of guid to identify content to improve DDC cache hit. | Engine/Texture.h |
|
| BlockDataOffsets | TArray< int64 > | Offsets of each block (including Block0) in the bulk data. | Engine/Texture.h | |
| Blocks | TArray< FTextureSourceBlock > | All sources have 1 implicit block defined by BaseBlockXY/SizeXY members. | Engine/Texture.h |
|
| bLongLatCubemap | bool | Source represents a cubemap in long/lat format, will have only 1 slice per cube, rather than 6 slices. | Engine/Texture.h |
|
| BulkData | UE::Serialization::FEditorBulkData | The bulk source data. | Engine/Texture.h | |
| BulkDataLock | TDontCopy< FCriticalSection > | BulkDataLock protects simultaneous access to BulkData ; BulkDataLock protects the BulkData, also LockState, NumLockedMips, LockedMipData. | Engine/Texture.h | |
| CompressionFormat | TEnumAsByte< enum ETextureSourceCompressionFormat > | Compression format that source data is stored as. | Engine/Texture.h |
|
| Format | TEnumAsByte< enum ETextureSourceFormat > | Format in which the source data is stored. | Engine/Texture.h |
|
| Id | FGuid | GUID used to track changes to the source data. | Engine/Texture.h |
|
| LayerColorInfo_LockProtected | TArray< FTextureSourceLayerColorInfo > | Per layer color info. | Engine/Texture.h |
|
| LayerFormat | TArray< TEnumAsByte< enum ETextureSourceFormat > > | For multi-layered sources, each layer may have a different format (in this case LayerFormat[0] == Format) . | Engine/Texture.h |
|
| LockedMipData | FMipAllocation | Pointer to locked mip data, if any. | Engine/Texture.h | |
| LockState | ELockState | The state of any lock being held on the mip data | Engine/Texture.h | |
| NumLayers | int32 | Number of layers (for multi-layered virtual textures) provided as source data for the texture. | Engine/Texture.h |
|
| NumLockedMips | uint32 | Number of mips that are locked. | Engine/Texture.h | |
| NumMips | int32 | Number of mips provided as source data for the texture. | Engine/Texture.h |
|
| NumSlices | int32 | Depth (volume textures) or faces (cube maps). | Engine/Texture.h |
|
| Owner | UTexture * | Owner for associating BulkData with a package | Engine/Texture.h | |
| SizeX | int32 | Width of the texture. | Engine/Texture.h |
|
| SizeY | int32 | Height of the texture. | Engine/Texture.h |
|
| TornOffGammaSpace | TArray< EGammaSpace, TInlineAllocator< 1 > > | If Owner != null, check Owner->GetGammaSpace , if it is null, use TornOffGammaSpace do not check this directly, use GetGammaSpace. | Engine/Texture.h | |
| TornOffOwnerName | FString | For debugging : | Engine/Texture.h | |
| TornOffTextureClass | ETextureClass | TextureClass == Owner->GetTextureClass(); a copy is kept here for torn-off | Engine/Texture.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool AreAllBlocksPowerOfTwo() |
Engine/Texture.h | ||
int64 CalcMipOffset
(
int32 BlockIndex, |
Retrieve the size and offset for a source mip. The size includes all slices. | Engine/Texture.h | |
int64 CalcMipSize
(
int32 MipIndex |
Engine/Texture.h | ||
int64 CalcMipSize
(
int32 BlockIndex, |
Computes the size of a single mip in bytes. | Engine/Texture.h | |
void Compress() |
PNG Compresses the source art if possible or tells the bulk data to zlib compress when it saves out to disk. | Engine/Texture.h | |
bool ComputeChannelLinearMinMax
(
int32 InLayerIndex, |
Engine/Texture.h | ||
FTextureSource CopyTornOff() |
Make a copy with a torn-off BulkData that has the same Guid used for DDC as this->BulkData | Engine/Texture.h | |
void ExportCustomProperties
(
FOutputDevice& Out, |
Support for copy/paste | Engine/Texture.h | |
void ForceGenerateGuid () |
Force the GUID to change even if mip data has not been modified. | Engine/Texture.h | |
void GetBlock
(
int32 Index, |
Access the given block | Engine/Texture.h | |
FSharedBuffer GetBulkDataPayload() |
GetBulkDataPayload returns the raw bulkdata memory in compressed form, not decompressed (use LockMip or GetMipData for that) the shared buffer should be treated as read only! to modify, make a copy and call Init() on the source with the changed copy | Engine/Texture.h | |
int64 GetBytesPerPixel
(
int32 LayerIndex |
Computes the number of bytes per-pixel. | Engine/Texture.h | |
ETextureSourceFormat GetFormat
(
int32 LayerIndex |
Engine/Texture.h | ||
EGammaSpace GetGammaSpace
(
int LayerIndex |
Get GammaSpace for this Source (asks owner) | Engine/Texture.h | |
| GetId() returns a hash of the Id member (data hash) and also the attributes of the Source. | Engine/Texture.h | ||
FString GetIdString() |
Returns the unique ID string for this source art. | Engine/Texture.h | |
void GetLayerColorInfo
(
TArray< FTextureSourceLayerColorInfo >& OutLayerColorInfo |
Engine/Texture.h | ||
FIntPoint GetLogicalSize() |
Logical size of the texture includes all blocks | Engine/Texture.h | |
bool GetMipData
(
TArray64< uint8 >& OutMipData, |
Legacy API that defaults to LayerIndex 0. Prefer GetMipImage. | Engine/Texture.h | |
bool GetMipData
(
TArray64< uint8 >& OutMipData, |
Retrieve a copy of the data for a particular mip. Prefer GetMipImage. | Engine/Texture.h | |
FMipData GetMipData
(
IImageWrapperModule* ImageWrapperModule |
Returns a FMipData structure that wraps around the entire mip chain for read only operations. | Engine/Texture.h | |
bool GetMipImage
(
FImage& OutImage, |
Retrieve a copy of the MipData as an FImage. | Engine/Texture.h | |
bool GetMipImage
(
FImage& OutImage, |
Retrieve a copy of the MipData as an FImage | Engine/Texture.h | |
bool GetMipImageInfo
(
FImageInfo& OutImageInfo, |
Get ImageInfo of one mip. | Engine/Texture.h | |
int GetMippedNumSlices
(
int NumSlices, |
Get mipped number of slices (volumes mip but arrays don't) | Engine/Texture.h | |
int32 GetNumBlocks() |
Engine/Texture.h | ||
int32 GetNumLayers() |
Engine/Texture.h | ||
int32 GetNumMips() |
Engine/Texture.h | ||
int32 GetNumSlices() |
Engine/Texture.h | ||
| Trivial accessors. | Engine/Texture.h | ||
FIntPoint GetSizeInBlocks() |
Size of texture in blocks | Engine/Texture.h | |
int64 GetSizeOnDisk() |
Note: simple queries on BulkData are not taking the BulkDataLock , nor does BulkData internally mutex protect these | Engine/Texture.h | |
int64 GetSizeX() |
Engine/Texture.h | ||
int64 GetSizeY() |
Engine/Texture.h | ||
| Returns the compression format of the source data in enum format. | Engine/Texture.h | ||
FString GetSourceCompressionAsString() |
Returns the compression format of the source data in string format for use with the UI. | Engine/Texture.h | |
ETextureClass GetTextureClass() |
Get TextureClass for this Source (asks owner) | Engine/Texture.h | |
int64 GetTotalTopMipPixelCount () |
Total number of pixels in the top mip level over all blocks+layers. | Engine/Texture.h | |
int GetVolumeSizeZ() |
Returns volume depth, or 1 if not a volume | Engine/Texture.h | |
bool HasHadBulkDataCleared() |
Engine/Texture.h | ||
bool HasLayerColorInfo() |
Engine/Texture.h | ||
bool HasPayloadData() |
Engine/Texture.h | ||
void ImportCustomProperties
(
const TCHAR* SourceText, |
Engine/Texture.h | ||
void Init
(
int32 NewSizeX, |
Initialize the source data with the given size, number of mips, and format. | Engine/Texture.h | |
void Init
(
int32 NewSizeX, |
Initialize the source data with the given size, number of mips, and format. | Engine/Texture.h | |
void Init
(
const FImageView& Image |
Init and copy in texture bits from Image | Engine/Texture.h | |
void Init2DWithMipChain
(
int32 NewSizeX, |
Initializes the source data for a 2D texture with a full mip chain. | Engine/Texture.h | |
void InitBlocked
(
const ETextureSourceFormat* InLayerFormats, |
Engine/Texture.h | ||
void InitBlocked
(
const ETextureSourceFormat* InLayerFormats, |
Engine/Texture.h | ||
void InitCubeWithMipChain
(
int32 NewSizeX, |
Initializes the source data for a cubemap with a full mip chain. | Engine/Texture.h | |
void InitLayered
(
int32 NewSizeX, |
Engine/Texture.h | ||
void InitLayered
(
int32 NewSizeX, |
Engine/Texture.h | ||
void InitLayered2DWithMipChain
(
int32 NewSizeX, |
Engine/Texture.h | ||
void InitWithCompressedSourceData
(
int32 NewSizeX, |
Initialize the source data with the given size, number of mips, and format. | Engine/Texture.h | |
void InitWithCompressedSourceData
(
int32 NewSizeX, |
Initialize the source data with the given size, number of mips, and format. | Engine/Texture.h | |
bool IsBlockPowerOfTwo
(
int32 BlockIndex |
Return true if the source XY size is power-of-2. Does not check Z size for volumes. | Engine/Texture.h | |
bool IsBulkDataLoaded () |
Returns true if the texture's bulkdata payload is either already in memory or if the payload is 0 bytes in length. | Engine/Texture.h | |
bool IsCubeOrCubeArray () |
Warning: bLongLatCubemap is not correct. | Engine/Texture.h | |
bool IsLongLatCubemap() |
Engine/Texture.h | ||
bool IsPowerOfTwo
(
int32 BlockIndex |
Return true if the source XY size is power-of-2. Does not check Z size for volumes. | Engine/Texture.h | |
bool IsSourceCompressed() |
Engine/Texture.h | ||
bool IsValid() |
Returns true if source art is available. | Engine/Texture.h | |
bool IsVolume() |
Engine/Texture.h | ||
bool LoadBulkDataWithFileReader() |
Engine/Texture.h | ||
uint8 * LockMip
(
int32 BlockIndex, |
Lock a mip for editing. Note that Lock/Unlock for edit automatically does UseHashAsGuid. | Engine/Texture.h | |
uint8 * LockMip
(
int32 MipIndex |
Lock a mip for editing. | Engine/Texture.h | |
const uint8 * LockMipReadOnly
(
int32 MipIndex |
Lock a mip for reading. | Engine/Texture.h | |
const uint8 * LockMipReadOnly
(
int32 BlockIndex, |
Use FMipLock to encapsulate a locked mip Lock a mip for reading. | Engine/Texture.h | |
void OperateOnLoadedBulkData
(
TFunctionRef< void(const FSharedBuffer&BulkDataBuffer)> Operation |
Apply a visitor to the bulkdata : prefer GetBulkDataPayload() instead. | Engine/Texture.h | |
void ReleaseSourceMemory() |
Engine/Texture.h | ||
void RemoveBulkData() |
Engine/Texture.h | ||
void RemoveCompression() |
Engine/Texture.h | ||
void Reset() |
Reset the source to empty, frees all memory. | Engine/Texture.h | |
void ResetLayerColorInfo() |
Engine/Texture.h | ||
void SetId
(
const FGuid& InId, |
Sets the GUID to use, and whether that GUID is actually a hash of some data. | Engine/Texture.h | |
void SetLayerColorInfo
(
const TArray< FTextureSourceLayerColorInfo >& InLayerColorInfo |
Engine/Texture.h | ||
void SetOwner
(
UTexture* InOwner |
Engine/Texture.h | ||
void UnlockMip
(
int32 BlockIndex, |
Unlock a mip. | Engine/Texture.h | |
void UnlockMip
(
int32 MipIndex |
Engine/Texture.h | ||
bool UpdateChannelLinearMinMax () |
UpdateChannelLinearMinMax runs FImageCore::ComputeChannelLinearMinMax on all blocks and layers (but only mip0), returns false if the source was unable to be locked and leaves the channel minmax as unknown. | Engine/Texture.h | |
bool UpdateChannelMinMaxFromIncomingTextureData
(
FMemoryView InNewTextureData |
As per UpdateChannelLinearMinMax(), except acts on incoming new data rather than locking existing mips. | Engine/Texture.h | |
void UseHashAsGuid () |
Uses a hash as the GUID, useful to prevent creating new GUIDs on load for legacy assets. | Engine/Texture.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static int64 GetBytesPerPixel
(
ETextureSourceFormat Format |
Should match ERawImageFormat::GetBytesPerPixel | Engine/Texture.h | |
static bool IsHDR
(
ETextureSourceFormat Format |
Should match ERawImageFormat::IsHDR | Engine/Texture.h |