engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | Public 属性 | 所有成员列表
UCanvasRenderTarget2D类 参考

CanvasRenderTarget2D is 2D render target which exposes a Canvas interface to allow you to draw elements onto it directly. 更多...

#include <CanvasRenderTarget2D.h>

+ 类 UCanvasRenderTarget2D 继承关系图:

Public 成员函数

void FastUpdateResource ()
 Don't delete the underlying resource if it already exists
 
void GetSize (int32 &Width, int32 &Height)
 Gets a specific render target's size from the global map of canvas render targets. 更多...
 
void ReceiveUpdate (UCanvas *Canvas, int32 Width, int32 Height)
 Allows a Blueprint to implement how this Canvas Render Target 2D should be updated. 更多...
 
virtual void UpdateResource () override
 Updates the the canvas render target texture's resource. 更多...
 

静态 Public 成员函数

static UCanvasRenderTarget2D * CreateCanvasRenderTarget2D (UObject *WorldContextObject, TSubclassOf< UCanvasRenderTarget2D > CanvasRenderTarget2DClass, int32 Width=1024, int32 Height=1024)
 Creates a new canvas render target and initializes it to the specified dimensions 更多...
 

Public 属性

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

详细描述

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.

成员函数说明

◆ CreateCanvasRenderTarget2D()

static UCanvasRenderTarget2D * UCanvasRenderTarget2D::CreateCanvasRenderTarget2D ( UObject *  WorldContextObject,
TSubclassOf< UCanvasRenderTarget2D >  CanvasRenderTarget2DClass,
int32  Width = 1024,
int32  Height = 1024 
)
static

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

参数
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 the instanced render target.

◆ GetSize()

void UCanvasRenderTarget2D::GetSize ( int32 &  Width,
int32 &  Height 
)

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

参数
WidthOutput variable for the render target's width
HeightOutput variable for the render target's height

◆ ReceiveUpdate()

void UCanvasRenderTarget2D::ReceiveUpdate ( UCanvas *  Canvas,
int32  Width,
int32  Height 
)

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

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

◆ UpdateResource()

virtual void UCanvasRenderTarget2D::UpdateResource ( )
overridevirtual

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.


该类的文档由以下文件生成: