CanvasRenderTarget2D is 2D render target which exposes a Canvas interface to allow you to draw elements onto it directly.
更多...
#include <CanvasRenderTarget2D.h>
|
|
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. 更多...
|
| |
|
|
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()
Creates a new canvas render target and initializes it to the specified dimensions
- 参数
-
| WorldContextObject | The world where this render target will be rendered for |
| CanvasRenderTarget2DClass | Class of the render target. Unless you want to use a special sub-class, you can simply pass UCanvasRenderTarget2D::StaticClass() here. |
| Width | Width of the render target. |
| Height | Height 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.
- 参数
-
| Width | Output variable for the render target's width |
| Height | Output 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.
- 参数
-
| Canvas | Canvas object that can be used to paint to the render target |
| Width | Width of the render target. |
| Height | Height 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.
该类的文档由以下文件生成: