UTexture2D

Windows
MacOS
Linux

Inheritance Hierarchy

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

 

bForceMiplevelsToBeResident

Override whether to fully stream even if texture hasn't been rendered.

Public variable

uint8: 1

 

bGlobalForceMipLevelsToBeResident

Global and serialized version of ForceMiplevelsToBeResident.

Public variable

uint8: 1

 

bHasBeenPaintedInEditor

Whether the texture has been painted in the editor.

Public variable

uint8: 1

 

bHasStreamingUpdatePending

Whether some mips might be streamed soon.

Public variable

uint8: 1

 

bIgnoreStreamingMipBias

Ignores the streaming mip bias used to accommodate memory constraints.

Public variable

uint8: 1

 

bIsStreamable

Whether the texture is currently streamable or not.

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.

Protected variable

FTexture2DUpdat...

 

PendingUpdate

Helper to manage the current pending update following a call to StreamIn() or StreamOut().

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 Static

void

 

CalcAllowedMips

(
    int32 MipCount,
    int32 NumNonStreamingMips,
    int32 LODBias,
    int32& OuMinAllowedMips,
    int32& OutMaxAllowedMips
)

Computes the minimum and maximum allowed mips for a texture.

Public function Const

int32

 

CalcNumOptionalMips()

Public function Const

int32

 

CalcTextureMemorySize

(
    int32 MipCount
)

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

Public function

bool

 

CancelPendingMipChangeRequest()

Tries to cancel a pending mip change request.

Public function Static

void

 

CancelPendingTextureStreaming()

Cancels any pending texture streaming actions if possible.

Public function Static

UTexture2D &...

 

CreateTransient

(
    int32 InSizeX,
    int32 InSizeY,
    EPixelFormat InFormat
)

Creates and initializes a new Texture2D with the requested settings

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

float

 

GetLastRenderTimeForStreaming()

Retrieves the last render time used for streaming.

Public function Static

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

bool

 

GetMipDataFilename

(
    const int32 MipIndex,
    const FString*& BulkDataFilena...
)

Public function Const

int32

 

GetMipTailBaseIndex()

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

 

GetNumNonStreamingMips()

Returns the number of mips in this texture that are not able to be streamed.

Public function Const

int32

 

GetNumRequestedMips()

When the texture is being updated from StreamIn() or StreamOut(), returns the number of mips requested.

Public function Const

int32

 

GetNumResidentMips()

The number of mips currently in memory.

Public function Const

EPixelFormat

 

GetPixelFormat()

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

int32

 

GetStreamingIndex()

Public function Const

bool

 

HasAlphaChannel()

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

Public function Const

bool

 

HasPendingUpdate()

True if the texture is currently being updated through StreamIn() or StreamOut().

Public function

bool

 

HasSameSourceArt

(
    UTexture2D* InTexture
)

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

Public function

void

 

InvalidateLastRenderTimeForStreaming()

Invalidates the last render time used for streaming.

Public function

bool

 

IsFullyStreamedIn()

Whether all miplevels of this texture have been fully streamed in, LOD settings permitting.

Public function Const

bool

 

IsReadyForStreaming()

Returns whether the texture is ready for streaming aka whether it has had InitRHI called on it.

Public function

void

 

LinkStreaming()

Links texture to the texture streaming manager.

Public function Virtual

void

 

RefreshSamplerStates()

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

Public function Virtual

void

 

SetForceMipLevelsToBeResident

(
    float Seconds,
    int32 CinematicTextureGroups
)

Tells the streaming system that it should force all mip-levels to be resident for a number of seconds.

Public function Static

void

 

SetMinTextureResidentMipCount

(
    int32 InMinTextureResidentMipCount
)

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

Public function Const

bool

 

ShouldMipLevelsBeForcedResident()

Returns whether miplevels should be forced resident.

Public function

bool

 

StreamIn

(
    int32 NewMipCount,
    bool bHighPrio
)

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

Public function

bool

 

StreamOut

(
    int32 NewMipCount
)

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

Public function

void

 

TemporarilyDisableStreaming()

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

Public function

void

 

UnlinkStreaming()

Unlinks texture from the texture streaming manager.

Public function

void

 

UpdateTextureRegions

(
    int32 MipIndex,
    uint32 NumRegions,
    const FUpdateTextureRegion2D* ...,
    uint32 SrcPitch,
    uint32 SrcBpp,
    uint8* SrcData,
    TFunction< void(uint8*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

void

 

UpdateResource()

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

Public function Virtual

bool

 

UpdateStreamingStatus

(
    bool bWaitForMipFading
)

Updates the streaming status of the texture and performs finalization when appropriate.

Public function Virtual

void

 

WaitForStreaming()

Waits until all streaming requests for this texture has been fully processed.

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

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.

Constants

Name

Description

GMinTextureResidentMipCount

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

References

Module

Engine

Header

Runtime/Engine/Classes/Engine/Texture2D.h

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback