Encapsulates the canvas state. 更多...
#include <CanvasTypes.h>
类 | |
| class | FCanvasSortElement |
| Contains all of the batched elements that need to be rendered at a certain depth sort key 更多... | |
| class | FTransformEntry |
| Entry for the transform stack which stores a matrix and its CRC for faster comparisons 更多... | |
Public 类型 | |
| enum | ECanvasAllowModes |
| Enum for canvas features that are allowed | |
| enum | EElementType |
| Enum that describes what type of element we are currently batching. | |
Public 成员函数 | |
| ENGINE_API void | AddTileRenderItem (float X, float Y, float SizeX, float SizeY, float U, float V, float SizeU, float SizeV, const FMaterialRenderProxy *MaterialRenderProxy, FHitProxyId HitProxyId, bool bFreezeTime, FColor InColor) |
| Generates a new FCanvasTileRendererItem for the current sortkey and adds it to the sortelement list of items to render | |
| ENGINE_API void | AddTriangleRenderItem (const FCanvasUVTri &Tri, const FMaterialRenderProxy *MaterialRenderProxy, FHitProxyId HitProxyId, bool bFreezeTime) |
| Generates a new FCanvasTriangleRendererItem for the current sortkey and adds it to the sortelement list of items to render | |
| ENGINE_API void | Clear (const FLinearColor &Color) |
| Clear the canvas 更多... | |
| void | ClearBatchesToRender () |
| Clear the list of dirty batches that need to be rendered by the canvas | |
| ENGINE_API void | CopyTransformStack (const FCanvas &Copy) |
| Copy the conents of the TransformStack from an existing canvas 更多... | |
| ENGINE_API void | DrawItem (FCanvasItem &Item) |
| Draw a CanvasItem 更多... | |
| ENGINE_API void | DrawItem (FCanvasItem &Item, const FVector2D &InPosition) |
| Draw a CanvasItem at the given coordinates 更多... | |
| ENGINE_API void | DrawItem (FCanvasItem &Item, float X, float Y) |
| Draw a CanvasItem at the given coordinates 更多... | |
| ENGINE_API int32 | DrawShadowedString (float StartX, float StartY, const TCHAR *Text, const UFont *Font, const FLinearColor &Color, const FLinearColor &ShadowColor=FLinearColor::Black) |
| Draw an string centered on given location. 更多... | |
| ENGINE_API void | DrawTile (float X, float Y, float SizeX, float SizeY, float U, float V, float SizeU, float SizeV, const FLinearColor &Color, const FTexture *Texture=NULL, bool AlphaBlend=true) |
| Draw arbitrary aligned rectangle. 更多... | |
| ENGINE_API | FCanvas (FRenderTarget *InRenderTarget, FHitProxyConsumer *InHitProxyConsumer, float InRealTime, float InWorldTime, float InWorldDeltaTime, ERHIFeatureLevel::Type InFeatureLevel, float InDPIScale=1.0f) |
| Constructor. 更多... | |
| ENGINE_API | FCanvas (FRenderTarget *InRenderTarget, FHitProxyConsumer *InHitProxyConsumer, UWorld *InWorld, ERHIFeatureLevel::Type InFeatureLevel, ECanvasDrawMode DrawMode=CDM_DeferDrawing, float InDPIScale=1.0f) |
| Constructor. | |
| ENGINE_API void | Flush_GameThread (bool bForce=false) |
| Sends a message to the rendering thread to draw the batched elements. 更多... | |
| ENGINE_API void | Flush_RenderThread (FRHICommandListImmediate &RHICmdList, bool bForce=false, bool bInsideRenderPass=false) |
| Sends a message to the rendering thread to draw the batched elements. 更多... | |
| uint32 | GetAllowedModes () const |
| Accessor for allowed canvas modes 更多... | |
| ENGINE_API FBatchedElements * | GetBatchedElements (EElementType InElementType, FBatchedElementParameters *InBatchedElementParameters=NULL, const FTexture *Texture=NULL, ESimpleElementBlendMode BlendMode=SE_BLEND_MAX, const FDepthFieldGlowInfo &GlowInfo=FDepthFieldGlowInfo(), bool bApplyDPIScale=true) |
| Returns a FBatchedElements pointer to be used for adding vertices and primitives for rendering. 更多... | |
| ENGINE_API const FMatrix & | GetBottomTransform () const |
| Get the bottom-most element of the transform stack. 更多... | |
| float | GetCurrentDeltaWorldTime () const |
| Access current delta time | |
| float | GetCurrentRealTime () const |
| Access current real time | |
| float | GetCurrentWorldTime () const |
| Access current world time | |
| ERHIFeatureLevel::Type | GetFeatureLevel () const |
| Access current feature level 更多... | |
| ENGINE_API const FMatrix & | GetFullTransform () const |
| Get the current top-most transform entry 更多... | |
| ENGINE_API FORCEINLINE FRenderTarget * | GetRenderTarget () const |
| Get the current render target for the canvas | |
| EShaderPlatform | GetShaderPlatform () const |
| Access current shader platform 更多... | |
| ENGINE_API FCanvasSortElement & | GetSortElement (int32 DepthSortKey) |
| Get the sort element for the given sort key. 更多... | |
| ENGINE_API FMatrix | GetTransform () const |
| Get the current top-most transform entry without the canvas projection 更多... | |
| FORCEINLINE const TArray< FTransformEntry > & | GetTransformStack () const |
| returns the transform stack | |
| bool | HasBatchesToRender () const |
| Determine if the canvas has dirty batches that need to be rendered 更多... | |
| int32 | PopDepthSortKey () |
| Pop sort key off of the stack. 更多... | |
| ENGINE_API void | PopTransform () |
| Removes the top transform from the canvas's transform stack. | |
| ENGINE_API void | PushAbsoluteTransform (const FMatrix &Transform) |
| Pushes a transform onto the canvas's transform stack. 更多... | |
| void | PushDepthSortKey (int32 InSortKey) |
| Push sort key onto the stack. 更多... | |
| ENGINE_API void | PushRelativeTransform (const FMatrix &Transform) |
| Pushes a transform onto the canvas's transform stack, multiplying it with the current top of the stack. 更多... | |
| void | SetAllowedModes (uint32 InAllowedModes) |
| Toggle allowed canvas modes 更多... | |
| ENGINE_API void | SetBaseTransform (const FMatrix &Transform) |
| Replace the base (ie. 更多... | |
| ENGINE_API void | SetHitProxy (HHitProxy *HitProxy) |
| Sets the hit proxy which will be used for subsequent canvas primitives. | |
| ENGINE_API void | SetRenderTarget_GameThread (FRenderTarget *NewRenderTarget) |
| Sets the render target which will be used for subsequent canvas primitives. | |
| void | SetRenderTargetDirty (bool bDirty) |
| Marks render target as dirty so that it will be resolved to texture | |
| ENGINE_API void | SetRenderTargetRect (const FIntRect &ViewRect) |
| Sets a rect that should be used to offset rendering into the viewport render target If not set the canvas will render to the full target 更多... | |
| ENGINE_API void | SetRenderTargetScissorRect (const FIntRect &ScissorRect) |
| The clipping rectangle used when rendering this canvas 更多... | |
| int32 | TopDepthSortKey () |
| Return top sort key of the stack. 更多... | |
| ENGINE_API | ~FCanvas () |
| Destructor. | |
静态 Public 成员函数 | |
| static ENGINE_API FMatrix | CalcBaseTransform2D (uint32 ViewSizeX, uint32 ViewSizeY) |
| Generate a 2D projection for the canvas. 更多... | |
| static ENGINE_API FMatrix | CalcBaseTransform3D (uint32 ViewSizeX, uint32 ViewSizeY, float fFOV, float NearPlane) |
| Generate a 3D projection for the canvas. 更多... | |
| static ENGINE_API FMatrix | CalcProjectionMatrix (uint32 ViewSizeX, uint32 ViewSizeY, float fFOV, float NearPlane) |
| Generate a projection matrix for the canvas. 更多... | |
| static ENGINE_API FMatrix | CalcViewMatrix (uint32 ViewSizeX, uint32 ViewSizeY, float fFOV) |
| Generate a view matrix for the canvas. 更多... | |
Public 属性 | |
| int32 | LastElementIndex |
| Store index of last Element off to avoid semi expensive Find() | |
| TMap< int32, int32 > | SortedElementLookupMap |
| Map from sortkey to array index of SortedElements for faster lookup of existing entries | |
| TArray< FCanvasSortElement > | SortedElements |
| Batched canvas elements to be sorted for rendering. 更多... | |
| TSharedPtr< FCanvasWordWrapper > | WordWrapper |
| Private class for handling word wrapping behavior. | |
Encapsulates the canvas state.
| ENGINE_API FCanvas::FCanvas | ( | FRenderTarget * | InRenderTarget, |
| FHitProxyConsumer * | InHitProxyConsumer, | ||
| float | InRealTime, | ||
| float | InWorldTime, | ||
| float | InWorldDeltaTime, | ||
| ERHIFeatureLevel::Type | InFeatureLevel, | ||
| float | InDPIScale = 1.0f |
||
| ) |
Constructor.
For situations where a world is not available, but time information is
|
static |
Generate a 2D projection for the canvas.
Use this if you only want to transform in 2D on the XY plane
| ViewSizeX | - Viewport width |
| ViewSizeY | - Viewport height |
|
static |
Generate a 3D projection for the canvas.
Use this if you want to transform in 3D
| ViewSizeX | - Viewport width |
| ViewSizeY | - Viewport height |
| fFOV | - Field of view for the projection |
| NearPlane | - Distance to the near clip plane |
|
static |
Generate a projection matrix for the canvas.
Used for CalcBaseTransform3D
| ViewSizeX | - Viewport width |
| ViewSizeY | - Viewport height |
| fFOV | - Field of view for the projection |
| NearPlane | - Distance to the near clip plane |
|
static |
Generate a view matrix for the canvas.
Used for CalcBaseTransform3D
| ViewSizeX | - Viewport width |
| ViewSizeY | - Viewport height |
| fFOV | - Field of view for the projection |
| ENGINE_API void FCanvas::Clear | ( | const FLinearColor & | Color | ) |
Clear the canvas
| Color | Color to clear with. |
| ENGINE_API void FCanvas::CopyTransformStack | ( | const FCanvas & | Copy | ) |
Copy the conents of the TransformStack from an existing canvas
| Copy | canvas to copy from |
| ENGINE_API void FCanvas::DrawItem | ( | FCanvasItem & | Item | ) |
Draw a CanvasItem
| Item | Item to draw |
| ENGINE_API void FCanvas::DrawItem | ( | FCanvasItem & | Item, |
| const FVector2D & | InPosition | ||
| ) |
Draw a CanvasItem at the given coordinates
| Item | Item to draw |
| InPosition | Position to draw item |
| ENGINE_API void FCanvas::DrawItem | ( | FCanvasItem & | Item, |
| float | X, | ||
| float | Y | ||
| ) |
Draw a CanvasItem at the given coordinates
| Item | Item to draw |
| X | X Position to draw item |
| Y | Y Position to draw item |
| ENGINE_API int32 FCanvas::DrawShadowedString | ( | float | StartX, |
| float | StartY, | ||
| const TCHAR * | Text, | ||
| const UFont * | Font, | ||
| const FLinearColor & | Color, | ||
| const FLinearColor & | ShadowColor = FLinearColor::Black |
||
| ) |
Draw an string centered on given location.
This function is being deprecated. a FCanvasTextItem should be used instead.
| StartX | - X point |
| StartY | - Y point |
| Text | - Text to draw |
| Font | - Font to use |
| Color | - Color of the text |
| ShadowColor | - Shadow color to draw underneath the text (ignored for distance field fonts) |
| ENGINE_API void FCanvas::DrawTile | ( | float | X, |
| float | Y, | ||
| float | SizeX, | ||
| float | SizeY, | ||
| float | U, | ||
| float | V, | ||
| float | SizeU, | ||
| float | SizeV, | ||
| const FLinearColor & | Color, | ||
| const FTexture * | Texture = NULL, |
||
| bool | AlphaBlend = true |
||
| ) |
Draw arbitrary aligned rectangle.
| X | - X position to draw tile at |
| Y | - Y position to draw tile at |
| SizeX | - Width of tile |
| SizeY | - Height of tile |
| U | - Horizontal position of the upper left corner of the portion of the texture to be shown(texels) |
| V | - Vertical position of the upper left corner of the portion of the texture to be shown(texels) |
| SizeU | - The width of the portion of the texture to be drawn. This value is in texels. |
| SizeV | - The height of the portion of the texture to be drawn. This value is in texels. |
| Color | - tint applied to tile |
| Texture | - Texture to draw |
| AlphaBlend | - true to alphablend |
| ENGINE_API void FCanvas::Flush_GameThread | ( | bool | bForce = false | ) |
Sends a message to the rendering thread to draw the batched elements.
| bForce | - force the flush even if Allow_Flush is not enabled |
| ENGINE_API void FCanvas::Flush_RenderThread | ( | FRHICommandListImmediate & | RHICmdList, |
| bool | bForce = false, |
||
| bool | bInsideRenderPass = false |
||
| ) |
Sends a message to the rendering thread to draw the batched elements.
| RHICmdList | - command list to use |
| bForce | - force the flush even if Allow_Flush is not enabled |
| bInsideRenderPass | - Set to true if flushing inside a render pass (e.g. Render Graph pass). This will skip creating a render pass internally, and assert if the command list is not in a render pass. |
|
inline |
Accessor for allowed canvas modes
| ENGINE_API FBatchedElements * FCanvas::GetBatchedElements | ( | EElementType | InElementType, |
| FBatchedElementParameters * | InBatchedElementParameters = NULL, |
||
| const FTexture * | Texture = NULL, |
||
| ESimpleElementBlendMode | BlendMode = SE_BLEND_MAX, |
||
| const FDepthFieldGlowInfo & | GlowInfo = FDepthFieldGlowInfo(), |
||
| bool | bApplyDPIScale = true |
||
| ) |
Returns a FBatchedElements pointer to be used for adding vertices and primitives for rendering.
Adds a new render item to the sort element entry based on the current sort key.
| InElementType | - Type of element we are going to draw. |
| InBatchedElementParameters | - Parameters for this element |
| InTexture | - New texture that will be set. |
| InBlendMode | - New blendmode that will be set. |
| GlowInfo | - info for optional glow effect when using depth field rendering |
|
inline |
Get the bottom-most element of the transform stack.
|
inline |
Access current feature level
|
inline |
Get the current top-most transform entry
|
inline |
Access current shader platform
| ENGINE_API FCanvasSortElement & FCanvas::GetSortElement | ( | int32 | DepthSortKey | ) |
Get the sort element for the given sort key.
Allocates a new entry if one does not exist
| DepthSortKey | - the key used to find the sort element entry |
|
inline |
Get the current top-most transform entry without the canvas projection
| bool FCanvas::HasBatchesToRender | ( | ) | const |
Determine if the canvas has dirty batches that need to be rendered
|
inline |
Pop sort key off of the stack.
| ENGINE_API void FCanvas::PushAbsoluteTransform | ( | const FMatrix & | Transform | ) |
Pushes a transform onto the canvas's transform stack.
| Transform | - The transform to push onto the stack. |
|
inline |
Push sort key onto the stack.
Rendering is done with the current sort key stack entry.
| InSortKey | - key value to push onto the stack |
| ENGINE_API void FCanvas::PushRelativeTransform | ( | const FMatrix & | Transform | ) |
Pushes a transform onto the canvas's transform stack, multiplying it with the current top of the stack.
| Transform | - The transform to push onto the stack. |
|
inline |
Toggle allowed canvas modes
| InAllowedModes | New modes to set |
| ENGINE_API void FCanvas::SetBaseTransform | ( | const FMatrix & | Transform | ) |
Replace the base (ie.
TransformStack(0)) transform for the canvas with the given matrix
| Transform | - The transform to use for the base |
| ENGINE_API void FCanvas::SetRenderTargetRect | ( | const FIntRect & | ViewRect | ) |
Sets a rect that should be used to offset rendering into the viewport render target If not set the canvas will render to the full target
| ViewRect | The rect to use |
| ENGINE_API void FCanvas::SetRenderTargetScissorRect | ( | const FIntRect & | ScissorRect | ) |
The clipping rectangle used when rendering this canvas
| ScissorRect | The rect to use |
|
inline |
Return top sort key of the stack.
| TArray<FCanvasSortElement> FCanvas::SortedElements |
Batched canvas elements to be sorted for rendering.
Sort order is back-to-front