UTexture2D

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/Texture2D.h

Include

#include "Engine/Texture2D.h"

Syntax

class UTexture2D : public UTexture

Variables

Name Description

Public variable

TEnumAsByte< en...

 

AddressX

The addressing mode to use for the X axis.

Public variable

TEnumAsByte< en...

 

AddressY

The addressing mode to use for the Y axis.

Public variable

uint8: 1

 

bHasBeenPaintedInEditor

Whether the texture has been painted in the editor.

Public variable

TMap< FString, ...

 

CookedPlatformData

Cooked platform data for this texture

Public variable

int32

 

FirstResourceMemMip

Keep track of first mip level used for ResourceMem creation

Public variable

int32

 

LevelIndex

Level scope index of this texture.

Public variable

FTexturePlatfor...

 

PlatformData

The derived data for this texture on this platform.

Public variable

FTexture2DResou...

 

ResourceMem

Memory used for directly loading bulk mip data

Constructors

Name Description

Public function

UTexture2D

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Const

int32

 

Blueprint_GetSizeX()

Gets the X size of the texture, in pixels

Public function Const

int32

 

Blueprint_GetSizeY()

Gets the Y size of the texture, in pixels

Public function Const

int32

 

CalcTextureMemorySize

(
    int32 MipCount
)

Calculates the size of this texture in bytes if it had MipCount miplevels streamed in.

Public function Static

void

 

CancelPendingTextureStreaming()

Cancels any pending texture streaming actions if possible.

Public function Static

UTexture2D &...

 

CreateTransient

(
    int32 InSizeX,
    int32 InSizeY,
    EPixelFormat InFormat,
    const FName InName
)

Creates and initializes a new Texture2D with the requested settings

Public function Const

int32

 

GetExtData()

Public function Static

float

 

GetGlobalMipMapLODBias()

Returns the global mip map bias applied as an offset for 2d textures.

Public function Const

FIntPoint

 

GetImportedSize()

Retrieves the size of the source image from which the texture was created.

Public function Const

int32

 

GetMinTextureResidentMipCount()

Returns the minimum number of mips that must be resident in memory (cannot be streamed).

Public function

void

 

GetMipData

(
    int32 FirstMipToLoad,
    void** OutMipData
)

Get mip data starting with the specified mip index.

Public function Const

int32

 

GetNumMips()

Public function Const

int32

 

GetNumMipsAllowed

(
    bool bIgnoreMinResidency
)

Calculates the maximum number of mips the engine allows to be loaded for this texture.

Public function Const

int32

 

GetNumResidentMips()

Public function Const

EPixelFormat

 

GetPixelFormat

(
    uint32 LayerIndex
)

Public function Const

const TIndir...

 

GetPlatformMips()

Public function

bool

 

GetResourceMemSettings

(
    int32 FirstMipIdx,
    int32& OutSizeX,
    int32& OutSizeY,
    int32& OutNumMips,
    uint32& OutTexCreateFlags
)

Calculates and returns the corresponding ResourceMem parameters for this texture.

Public function Const

int32

 

GetSizeX()

Trivial accessors.

Public function Const

int32

 

GetSizeY()

Public function

bool

 

GetSourceArtCRC

(
    uint32& OutSourceCRC
)

Get the CRC of the source art pixels.

Public function Const

bool

 

HasAlphaChannel()

Returns true if the runtime texture has an alpha channel that is not completely white.

Public function

bool

 

HasSameSourceArt

(
    UTexture2D* InTexture
)

See if the source art of the two textures matches...

Public function Virtual Const

bool

 

IsVirtualTexturedWithContinuousUpdate()

Returns true if this virtual texture requests round-robin updates of the virtual texture pages.

Public function Virtual Const

bool

 

IsVirtualTexturedWithSinglePhysicalSpace()

Returns true if this virtual texture uses a single physical space all of its texture layers.

Public function Virtual

void

 

RefreshSamplerStates()

Update the offset for mip map lod bias. This is added to any existing mip bias values.

Public function

void

 

TemporarilyDisableStreaming()

Temporarily disable streaming so we update subregions of this texture without streaming clobbering it.

Public function

void

 

UpdateTextureRegions

(
    int32 MipIndex,
    uint32 NumRegions,
    const FUpdateTextureRegion2D* ...,
    uint32 SrcPitch,
    uint32 SrcBpp,
    uint8* SrcData,
    TFunction< void*SrcData,...
)

Asynchronously update a set of regions of a texture with new data.

Overridden from UTexture

Name Description

Public function Virtual Const

uint32

 

CalcTextureMemorySizeEnum

(
    ETextureMipCount Enum
)

Calculates the size of this texture if it had MipCount miplevels streamed in.

Public function Virtual

FTextureReso...

 

CreateResource()

Implemented by subclasses to create a new resource for the texture.

Public function Virtual

float

 

GetAverageBrightness

(
    bool bIgnoreTrueBlack,
    bool bUseGrayscale
)

Gets the average brightness of the texture (in linear space)

Public function Virtual

TMap< FStrin...

 

GetCookedPlatformData()

Public function Virtual Const

EMaterialVal...

 

GetMaterialType()

Public function Virtual

FTexturePlat...

 

GetRunningPlatformData()

Textures that use the derived data cache must override this function and provide a pointer to the linked list of platform data.

Public function Virtual Const

float

 

GetSurfaceHeight()

Public function Virtual Const

float

 

GetSurfaceWidth()

Public function Virtual Const

bool

 

IsCurrentlyVirtualTextured()

Returns if the texture is actually being rendered using virtual texturing right now.

Public function Virtual

void

 

UpdateResource()

Creates a new resource for the texture, and updates any cached references to the resource.

Overridden from UStreamableRenderAsset

Name Description

Public function Virtual Const

int32

 

CalcCumulativeLODSize

(
    int32 NumLODs
)

Public function Virtual

bool

 

StreamIn

(
    int32 NewMipCount,
    bool bHighPrio
)

Loads mips from disk to memory. Only usable if the asset is streamable.

Public function Virtual

bool

 

StreamOut

(
    int32 NewMipCount
)

Unload some mips from memory. Only usable if the asset is streamable.

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual Const

void

 

GetAssetRegistryTags

(
    TArray< FAssetRegistryTag >& OutTa...
)

Gathers a list of asset registry searchable tags which are name/value pairs with some type information This only needs to be implemented for asset objects

Public function Virtual

FString

 

GetDesc()

Return a one line description of an object for viewing in the thumbnail view of the generic browser

Public function Virtual

void

 

GetResourceSizeEx

(
    FResourceSizeEx& CumulativeResourc...
)

Returns the size of the object/ resource for display to artists/ LDs in the Editor.

Public function Virtual Const

bool

 

IsReadyForAsyncPostLoad()

Called before calling PostLoad() in FAsyncPackage::PostLoadObjects().

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostEditUndo()

Called after an editor or undo operation is formed on texture

Public function Virtual

void

 

PostLinkerChange()

Called in response to the linker changing, this can only happen in the editor

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

PreSave

(
    const ITargetPlatform* TargetP...
)

Presave function.

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss