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

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.

构造及析构函数说明

◆ FCanvas()

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

成员函数说明

◆ CalcBaseTransform2D()

static ENGINE_API FMatrix FCanvas::CalcBaseTransform2D ( uint32  ViewSizeX,
uint32  ViewSizeY 
)
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
返回
Matrix for canvas projection

◆ CalcBaseTransform3D()

static ENGINE_API FMatrix FCanvas::CalcBaseTransform3D ( uint32  ViewSizeX,
uint32  ViewSizeY,
float  fFOV,
float  NearPlane 
)
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
返回
Matrix for canvas projection

◆ CalcProjectionMatrix()

static ENGINE_API FMatrix FCanvas::CalcProjectionMatrix ( uint32  ViewSizeX,
uint32  ViewSizeY,
float  fFOV,
float  NearPlane 
)
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
返回
Matrix for canvas projection

◆ CalcViewMatrix()

static ENGINE_API FMatrix FCanvas::CalcViewMatrix ( uint32  ViewSizeX,
uint32  ViewSizeY,
float  fFOV 
)
static

Generate a view matrix for the canvas.

Used for CalcBaseTransform3D

参数
ViewSizeX- Viewport width
ViewSizeY- Viewport height
fFOV- Field of view for the projection
返回
Matrix for canvas view orientation

◆ Clear()

ENGINE_API void FCanvas::Clear ( const FLinearColor &  Color)

Clear the canvas

参数
ColorColor to clear with.

◆ CopyTransformStack()

ENGINE_API void FCanvas::CopyTransformStack ( const FCanvas &  Copy)

Copy the conents of the TransformStack from an existing canvas

参数
Copycanvas to copy from

◆ DrawItem() [1/3]

ENGINE_API void FCanvas::DrawItem ( FCanvasItem &  Item)

Draw a CanvasItem

参数
ItemItem to draw

◆ DrawItem() [2/3]

ENGINE_API void FCanvas::DrawItem ( FCanvasItem &  Item,
const FVector2D &  InPosition 
)

Draw a CanvasItem at the given coordinates

参数
ItemItem to draw
InPositionPosition to draw item

◆ DrawItem() [3/3]

ENGINE_API void FCanvas::DrawItem ( FCanvasItem &  Item,
float  X,
float  Y 
)

Draw a CanvasItem at the given coordinates

参数
ItemItem to draw
XX Position to draw item
YY Position to draw item

◆ DrawShadowedString()

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)
返回
total size in pixels of text drawn

◆ DrawTile()

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

◆ Flush_GameThread()

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

◆ Flush_RenderThread()

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.

◆ GetAllowedModes()

uint32 FCanvas::GetAllowedModes ( ) const
inline

Accessor for allowed canvas modes

返回
current allowed modes

◆ GetBatchedElements()

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
返回
Returns a pointer to a FBatchedElements object.

◆ GetBottomTransform()

ENGINE_API const FMatrix & FCanvas::GetBottomTransform ( ) const
inline

Get the bottom-most element of the transform stack.

返回
matrix from transform stack.

◆ GetFeatureLevel()

ERHIFeatureLevel::Type FCanvas::GetFeatureLevel ( ) const
inline

Access current feature level

返回
feature level that this canvas is rendering at

◆ GetFullTransform()

ENGINE_API const FMatrix & FCanvas::GetFullTransform ( ) const
inline

Get the current top-most transform entry

返回
matrix from transform stack.

◆ GetShaderPlatform()

EShaderPlatform FCanvas::GetShaderPlatform ( ) const
inline

Access current shader platform

返回
shader platform that this canvas is rendering at

◆ GetSortElement()

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
返回
sort element entry

◆ GetTransform()

ENGINE_API FMatrix FCanvas::GetTransform ( ) const
inline

Get the current top-most transform entry without the canvas projection

返回
matrix from transform stack.

◆ HasBatchesToRender()

bool FCanvas::HasBatchesToRender ( ) const

Determine if the canvas has dirty batches that need to be rendered

返回
true if the canvas has any element to render

◆ PopDepthSortKey()

int32 FCanvas::PopDepthSortKey ( )
inline

Pop sort key off of the stack.

返回
top entry of the sort key stack

◆ PushAbsoluteTransform()

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.

◆ PushDepthSortKey()

void FCanvas::PushDepthSortKey ( int32  InSortKey)
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

◆ PushRelativeTransform()

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.

◆ SetAllowedModes()

void FCanvas::SetAllowedModes ( uint32  InAllowedModes)
inline

Toggle allowed canvas modes

参数
InAllowedModesNew modes to set

◆ SetBaseTransform()

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

◆ SetRenderTargetRect()

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

参数
ViewRectThe rect to use

◆ SetRenderTargetScissorRect()

ENGINE_API void FCanvas::SetRenderTargetScissorRect ( const FIntRect &  ScissorRect)

The clipping rectangle used when rendering this canvas

参数
ScissorRectThe rect to use

◆ TopDepthSortKey()

int32 FCanvas::TopDepthSortKey ( )
inline

Return top sort key of the stack.

返回
top entry of the sort key stack

类成员变量说明

◆ SortedElements

TArray<FCanvasSortElement> FCanvas::SortedElements

Batched canvas elements to be sorted for rendering.

Sort order is back-to-front


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