G1R AngelScript
Scripting reference for the Gothic 1 Remake
Loading...
Searching...
No Matches
UCanvasRenderTarget2D Class Reference

CanvasRenderTarget2D is 2D render target which exposes a Canvas interface to allow you to draw elements onto it directly. Use CreateCanvasRenderTarget2D() to create a render target texture by unique name, then bind a function to the OnCanvasRenderTargetUpdate delegate which will be called when the render target is updated. If you need to repaint your canvas every single frame, simply call UpdateResource() on it from a Tick function. Also, remember to hold onto your new canvas render target with a reference so that it doesn't get garbage collected. More...

Public Member Functions

Functions
void SetSampleCount (ETextureRenderTargetSampleCount InSampleCount)
ETextureRenderTargetSampleCount GetSampleCount () const
Public Member Functions inherited from UTextureRenderTarget2D
void SetbGPUSharedFlag (bool Value)
 Whether to support GPU sharing of the underlying native texture resource.
bool GetbAutoGenerateMips () const
 Whether to support Mip maps for this render target texture.
void SetbAutoGenerateMips (bool Value)
 Whether to support Mip maps for this render target texture.
bool GetbGPUSharedFlag () const
 Whether to support GPU sharing of the underlying native texture resource.
Public Member Functions inherited from UTexture
void Blueprint_GetTextureSourceDiskAndMemorySize (int64 &OutDiskSize, int64 &OutMemorySize) const
 Gets the memory size of the texture source top mip, in bytes, and the size on disk of the asset, which may be compressed. Uses texture source, not available in runtime games. Does not cause texture source to be loaded, queries cached values. Returns zero for error.
bool ComputeTextureSourceChannelMinMax (FLinearColor &OutColorMin, FLinearColor &OutColorMax) const
 Scan the texture source pixels to compute the min & max values of the RGBA channels. Uses texture source, not available in runtime games. Causes texture source data to be loaded, is computed by scanning pixels when called. Will set Min=Max=zero and return false on failure.
int64 Blueprint_GetMemorySize () const
 Gets the memory size of the texture, in bytes. This is the size in GPU memory of the built platformdata, accounting for LODBias, etc. Returns zero for error.
void SetCompressionNoAlpha (bool Value)
 If enabled, the texture's alpha channel will be forced to opaque for any compressed texture output format. Does not apply if output format is uncompressed RGBA.
bool GetCompressionNoAlpha () const
 If enabled, the texture's alpha channel will be forced to opaque for any compressed texture output format. Does not apply if output format is uncompressed RGBA.
bool GetCompressFinal () const
 If enabled, compress with Final quality during this Editor session.
void SetCompressFinal (bool Value)
 If enabled, compress with Final quality during this Editor session.
bool GetDeferCompression () const
 If enabled, defer compression of the texture until save or manually compressed in the texture editor.
void SetDeferCompression (bool Value)
 If enabled, defer compression of the texture until save or manually compressed in the texture editor.
bool GetbPreserveBorder () const
 When true the texture's border will be preserved during mipmap generation.
void SetbPreserveBorder (bool Value)
 When true the texture's border will be preserved during mipmap generation.
bool GetbFlipGreenChannel () const
 When true the texture's green channel will be inverted. This is useful for some normal maps.
void SetbFlipGreenChannel (bool Value)
 When true the texture's green channel will be inverted. This is useful for some normal maps.
bool GetSRGB () const
 Whether Texture and its source are in SRGB Gamma color space. Can only be used with 8-bit and compressed formats. This should be unchecked if using alpha channels individually as masks.
void SetSRGB (bool Value)
 Whether Texture and its source are in SRGB Gamma color space. Can only be used with 8-bit and compressed formats. This should be unchecked if using alpha channels individually as masks.
bool GetbNormalizeNormals () const
 Normalize colors in Normal Maps after mip generation for better and sharper quality; recommended on if not required to match legacy behavior.
void SetbNormalizeNormals (bool Value)
 Normalize colors in Normal Maps after mip generation for better and sharper quality; recommended on if not required to match legacy behavior.
bool GetbUseLegacyGamma () const
 A flag for using the simplified legacy gamma space e.g pow(color,1/2.2) for converting from FColor to FLinearColor, if we're doing sRGB.
void SetbUseLegacyGamma (bool Value)
 A flag for using the simplified legacy gamma space e.g pow(color,1/2.2) for converting from FColor to FLinearColor, if we're doing sRGB.
bool GetVirtualTextureStreaming () const
 Is this texture streamed in using VT.
void SetVirtualTextureStreaming (bool Value)
 Is this texture streamed in using VT.
Public Member Functions inherited from UStreamableRenderAsset
void SetForceMipLevelsToBeResident (float32 Seconds, int CinematicLODGroupMask=0)
 Tells the streaming system that it should force all mip-levels to be resident for a number of seconds.
void SetNeverStream (bool Value)
bool GetbGlobalForceMipLevelsToBeResident () const
 Global and serialized version of ForceMiplevelsToBeResident.
void SetbGlobalForceMipLevelsToBeResident (bool Value)
 Global and serialized version of ForceMiplevelsToBeResident.
bool GetNeverStream () const
Public Member Functions inherited from UObject
bool MarkPackageDirty () const
void RemoveFromRoot ()
bool GetIsRooted () const
bool IsTransient () const
bool Modify (bool bAlwaysMarkDirty=true)
void SetTransactional (bool bTransactional)
bool IsSupportedForNetworking () const
UClass GetClass () const
UObject GetOuter () const
UObject GetTypedOuter (TSubclassOf< UObject > Target) const
 Traverses the outer chain searching for the next object of a certain type.
UPackage GetOutermost () const
UPackage GetPackage () const
void AddToRoot ()
UWorld GetWorld () const
FName GetName () const
FString GetFullName (const UObject StopOuter=nullptr) const
FString GetPathName (const UObject StopOuter=nullptr) const
bool IsA (const UClass Class) const
 Returns true if this object is of the specified type, or a child of that type.
void SaveConfig ()
void LoadConfig ()
void ReloadConfig ()
void CopyScriptPropertiesFrom (const UObject OtherObject)
void opCast (?&Address) const
FString ToString () const

Static Public Member Functions

Static Functions
static UClass StaticClass ()
Static Public Member Functions inherited from UTextureRenderTarget2D
static UClass StaticClass ()
Static Public Member Functions inherited from UTextureRenderTarget
static UClass StaticClass ()
Static Public Member Functions inherited from UTexture
static UClass StaticClass ()
Static Public Member Functions inherited from UStreamableRenderAsset
static UClass StaticClass ()
Static Public Member Functions inherited from UObject
static UClass StaticClass ()

Public Attributes

TextureRenderTarget2D
ETextureRenderTargetSampleCount SampleCount
 MSAA sample count.
Public Attributes inherited from UTextureRenderTarget2D
ETextureRenderTargetFormat RenderTargetFormat
 Format of the texture render target. Data written to the render target will be quantized to this format, which can limit the range and precision. The largest format (RTF_RGBA32f) uses 16x more memory and bandwidth than the smallest (RTF_R8) and can greatly affect performance. Use the smallest format that has enough precision and range for what you are doing.
int SizeY
 The height of the texture.
FLinearColor ClearColor
 the color the texture is cleared to
TextureAddress AddressX
 The addressing mode to use for the X axis.
TextureAddress AddressY
 The addressing mode to use for the Y axis.
int SizeX
 The width of the texture.
TextureFilter MipsSamplerFilter
 Sampler filter type for AutoGenerateMips. Defaults to match texture filter.
TextureAddress MipsAddressU
 AutoGenerateMips sampler address mode for U channel. Defaults to clamp.
TextureAddress MipsAddressV
 AutoGenerateMips sampler address mode for V channel. Defaults to clamp.
bool bGPUSharedFlag
 Whether to support GPU sharing of the underlying native texture resource.
bool bAutoGenerateMips
 Whether to support Mip maps for this render target texture.
Public Attributes inherited from UTextureRenderTarget
float32 TargetGamma
 Will override FTextureRenderTarget2DResource::GetDisplayGamma if > 0.
Public Attributes inherited from UTexture
float32 ChromaKeyThreshold
 The threshold that components have to match for the texel to be considered equal to the ChromaKeyColor when chroma keying (<=, set to 0 to require a perfect exact match).
float32 AdjustBrightness
 Static texture brightness adjustment (scales HSV value.) (Non-destructive; Requires texture source art to be available.).
float32 AdjustBrightnessCurve
 Static texture curve adjustment (raises HSV value to the specified power.) (Non-destructive; Requires texture source art to be available.).
float32 AdjustVibrance
 Static texture "vibrance" adjustment (0 - 1) (HSV saturation algorithm adjustment.) (Non-destructive; Requires texture source art to be available.).
float32 AdjustSaturation
 Static texture saturation adjustment (scales HSV saturation.) (Non-destructive; Requires texture source art to be available.).
float32 AdjustRGBCurve
 Static texture RGB curve adjustment (raises linear-space RGB color to the specified power.) (Non-destructive; Requires texture source art to be available.).
float32 AdjustHue
 Static texture hue adjustment (0 - 360) (offsets HSV hue by value in degrees.) (Non-destructive; Requires texture source art to be available.).
float32 AdjustMinAlpha
 Remaps the alpha to the specified min/max range, defines the new value of 0 (Non-destructive; Requires texture source art to be available.).
float32 AdjustMaxAlpha
 Remaps the alpha to the specified min/max range, defines the new value of 1 (Non-destructive; Requires texture source art to be available.).
FColor ChromaKeyColor
 The color that will be replaced with transparent black if chroma keying is enabled.
bool bChromaKeyTexture
 Whether to chroma key the image, replacing any pixels that match ChromaKeyColor with transparent black.
ECompositeTextureMode CompositeTextureMode
 defines how the CompositeTexture is applied, e.g. CTM_RoughnessFromNormalAlpha
UTexture CompositeTexture
float32 CompositePower
 default 1, high values result in a stronger effect e.g 1, 2, 4, 8 this is not a slider because the texture update would not be fast enough
bool CompressionNoAlpha
 If enabled, the texture's alpha channel will be forced to opaque for any compressed texture output format. Does not apply if output format is uncompressed RGBA.
bool bOodlePreserveExtremes
 If set to true, then Oodle encoder preserves 0 and 255 (0.0 and 1.0) values exactly in alpha channel for BC3/BC7 and in all channels for BC4/BC5.
TextureCookPlatformTilingSettings CookPlatformTilingSettings
 If the platform supports it, tile the texture when cooking, or keep it linear and tile it when it's actually submitted to the GPU.
TextureCompressionSettings CompressionSettings
 Compression settings to use when building the texture.
FName OodleTextureSdkVersion
 Oodle Texture SDK Version to encode with. Enter 'latest' to update; 'None' preserves legacy encoding to avoid patches.
bool DeferCompression
 If enabled, defer compression of the texture until save or manually compressed in the texture editor.
ETextureLossyCompressionAmount LossyCompressionAmount
 How aggressively should any relevant lossy compression be applied. For compressors that support EncodeSpeed (i.e. Oodle), this is only applied if enabled (see Project Settings -> Texture Encoding). Note that this is in addition to any unavoidable loss due to the target format - selecting "No Lossy Compression" will not result in zero distortion for BCn formats.
bool CompressFinal
 If enabled, compress with Final quality during this Editor session.
int MaxTextureSize
 The maximum resolution for generated textures. A value of 0 means the maximum size for the format on each platform.
ETextureCompressionQuality CompressionQuality
 The compression quality for generated ASTC textures (i.e. mobile platform textures).
FGuid CompressionCacheId
 Change this optional ID to force the texture to be recompressed by changing its cache key.
UAssetImportData AssetImportData
TextureMipGenSettings MipGenSettings
 Per asset specific setting to define the mip-map generation properties like sharpening and kernel size.
TextureGroup LODGroup
 Texture group this texture belongs to.
FPerPlatformFloat Downscale
 Downscale source texture, applied only to 2d textures without mips < 1.0 - use scale value from texture group 1.0 - do not scale texture.
int LODBias
 A bias to the index of the top mip level to use. That is, number of mip levels to drop when cooking.
ETextureDownscaleOptions DownscaleOptions
 Texture downscaling options.
bool bPreserveBorder
 When true the texture's border will be preserved during mipmap generation.
FColor PaddingColor
 The color used to pad the texture out if it is padded due to PowerOfTwoMode.
ETexturePowerOfTwoSetting PowerOfTwoMode
 How to pad the texture to a power of 2 size (if necessary).
ETextureMipLoadOptions MipLoadOptions
 The texture mip load options.
bool bPadWithBorderColor
 If set to true, texture padding will be performed using colors of the border pixels. This can be used to improve quality of the generated mipmaps for padded textures.
int ResizeDuringBuildX
 Width of the resized texture when using "Resize To Specific Resolution" padding and resizing option. If set to zero, original width will be used.
TextureFilter Filter
 The texture filtering mode to use when sampling this texture.
int ResizeDuringBuildY
 Width of the resized texture when using "Resize To Specific Resolution" padding and resizing option. If set to zero, original height will be used.
FTextureSourceColorSettings SourceColorSettings
 Texture color management settings: source encoding and color space.
TArray< TObjectPtr< UAssetUserData > > AssetUserData
 Array of user data stored with the asset.
bool bUseNewMipFilter
 Use faster mip generation filter, usually the same result but occasionally causes color shift in high contrast areas.
FVector4 AlphaCoverageThresholds
 Alpha values per channel to compare to when preserving alpha coverage. 0 means disable channel. Typical good values in 0.5 - 0.9, not 1.0.
bool bDoScaleMipsForAlphaCoverage
 Whether mip RGBA should be scaled to preserve the number of pixels with Value >= AlphaCoverageThresholds. AlphaCoverageThresholds are ignored if this is off.
ETextureAvailability Availability
 Whether the texture will be encoded to a gpu format and uploaded to the graphics card, or kept on the CPU for access by gamecode / blueprint. For CPU availability, the texture will still upload a tiny black texture as a placeholder. Only applies to 2d textures.
bool bFlipGreenChannel
 When true the texture's green channel will be inverted. This is useful for some normal maps.
bool SRGB
 Whether Texture and its source are in SRGB Gamma color space. Can only be used with 8-bit and compressed formats. This should be unchecked if using alpha channels individually as masks.
bool bNormalizeNormals
 Normalize colors in Normal Maps after mip generation for better and sharper quality; recommended on if not required to match legacy behavior.
bool bUseLegacyGamma
 A flag for using the simplified legacy gamma space e.g pow(color,1/2.2) for converting from FColor to FLinearColor, if we're doing sRGB.
bool VirtualTextureStreaming
 Is this texture streamed in using VT.
Public Attributes inherited from UStreamableRenderAsset
bool NeverStream
bool bGlobalForceMipLevelsToBeResident
 Global and serialized version of ForceMiplevelsToBeResident.
int NumCinematicMipLevels
 Number of mip-levels to use for cinematic quality.
Public Attributes inherited from UObject
const UClass Class
const UObject Outer
const UPackage Outermost
const UPackage Package
const UWorld World
const FName Name
const bool IsRooted

Canvas Render Target 2D

FOnCanvasRenderTargetUpdate OnCanvasRenderTargetUpdate
 Called when this Canvas Render Target is asked to update its texture resource.
void GetSize (int &Width, int &Height)
 Gets a specific render target's size from the global map of canvas render targets.
void Update (UCanvas Canvas, int Width, int Height)
 Allows a Blueprint to implement how this Canvas Render Target 2D should be updated.
void UpdateResource ()
 Updates the the canvas render target texture's resource. This is where the render target will create or find a canvas object to use. It also calls UpdateResourceImmediate() to clear the render target texture from the deferred rendering list, to stop the texture from being cleared the next frame. From there it will ask the rendering thread to set up the RHI viewport. The canvas is then set up for rendering and then the user's update delegate is called. The canvas is then flushed and the RHI resolves the texture to make it available for rendering.
static UCanvasRenderTarget2D CreateCanvasRenderTarget2D (TSubclassOf< UCanvasRenderTarget2D > CanvasRenderTarget2DClass, int Width=1024, int Height=1024)
 Creates a new canvas render target and initializes it to the specified dimensions.

Detailed Description

CanvasRenderTarget2D is 2D render target which exposes a Canvas interface to allow you to draw elements onto it directly. Use CreateCanvasRenderTarget2D() to create a render target texture by unique name, then bind a function to the OnCanvasRenderTargetUpdate delegate which will be called when the render target is updated. If you need to repaint your canvas every single frame, simply call UpdateResource() on it from a Tick function. Also, remember to hold onto your new canvas render target with a reference so that it doesn't get garbage collected.

Member Function Documentation

◆ CreateCanvasRenderTarget2D()

UCanvasRenderTarget2D CreateCanvasRenderTarget2D ( TSubclassOf< UCanvasRenderTarget2D > CanvasRenderTarget2DClass,
int Width = 1024,
int Height = 1024 )
static

Creates a new canvas render target and initializes it to the specified dimensions.

Parameters
WorldContextObjectThe world where this render target will be rendered for
CanvasRenderTarget2DClassClass of the render target. Unless you want to use a special sub-class, you can simply pass UCanvasRenderTarget2D::StaticClass() here.
WidthWidth of the render target.
HeightHeight of the render target.
Returns
Returns the instanced render target.

◆ GetSampleCount()

ETextureRenderTargetSampleCount GetSampleCount ( ) const

◆ GetSize()

void GetSize ( int & Width,
int & Height )

Gets a specific render target's size from the global map of canvas render targets.

Parameters
WidthOutput variable for the render target's width
HeightOutput variable for the render target's height

◆ SetSampleCount()

void SetSampleCount ( ETextureRenderTargetSampleCount InSampleCount)

◆ StaticClass()

UClass StaticClass ( )
static

◆ Update()

void Update ( UCanvas Canvas,
int Width,
int Height )

Allows a Blueprint to implement how this Canvas Render Target 2D should be updated.

Parameters
CanvasCanvas object that can be used to paint to the render target
WidthWidth of the render target.
HeightHeight of the render target.

◆ UpdateResource()

void UpdateResource ( )

Updates the the canvas render target texture's resource. This is where the render target will create or find a canvas object to use. It also calls UpdateResourceImmediate() to clear the render target texture from the deferred rendering list, to stop the texture from being cleared the next frame. From there it will ask the rendering thread to set up the RHI viewport. The canvas is then set up for rendering and then the user's update delegate is called. The canvas is then flushed and the RHI resolves the texture to make it available for rendering.

Member Data Documentation

◆ OnCanvasRenderTargetUpdate

FOnCanvasRenderTargetUpdate OnCanvasRenderTargetUpdate

Called when this Canvas Render Target is asked to update its texture resource.

◆ SampleCount

MSAA sample count.