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

Encapsulates the I/O of a viewport. 更多...

#include <UnrealClient.h>

+ 类 FViewport 继承关系图:

类

class  FHitProxyMap
 A map from 2D coordinates to cached hit proxies. 更多...
 

Public 成员函数

virtual ENGINE_API void BeginRenderFrame (FRHICommandListImmediate &RHICmdList)
 Starts a new rendering frame. 更多...
 
ENGINE_API FIntRect CalculateViewExtents (float AspectRatio, const FIntRect &ViewRect)
 Calculates the view inside the viewport when the aspect ratio is locked. 更多...
 
 DECLARE_MULTICAST_DELEGATE_TwoParams (FOnViewportResized, FViewport *, uint32)
 delegate type for viewport resize events ( Params: FViewport* Viewport, uint32 )
 
virtual ENGINE_API void DeferInvalidateHitProxy ()
 Invalidates the viewport's cached hit proxies at the end of the frame.
 
ENGINE_API void Draw (bool bShouldPresent=true)
 Updates the viewport's displayed pixels with the results of calling ViewportClient->Draw. 更多...
 
virtual int32 DrawStatsHUD (FCanvas *InCanvas, const int32 InX, const int32 InY)
 First chance for viewports to render custom stats text 更多...
 
virtual ENGINE_API void EndRenderFrame (FRHICommandListImmediate &RHICmdList, bool bPresent, bool bLockToVsync)
 Ends a rendering frame. 更多...
 
virtual ENGINE_API void EnqueueBeginRenderFrame (const bool bShouldPresent)
 Starts a new rendering frame. 更多...
 
virtual ENGINE_API void EnqueueEndRenderFrame (const bool bLockToVsync, const bool bShouldPresent)
 Ends a rendering frame. 更多...
 
ENGINE_API void GetActorsAndModelsInHitProxy (FIntRect InRect, TSet< AActor * > &OutActors, TSet< UModel * > &OutModels)
 Returns all actors and models found in the hit proxy within a specified region. 更多...
 
virtual FCanvas * GetDebugCanvas ()
 
virtual float GetDesiredAspectRatio () const
 
virtual ENGINE_API FRHIGPUMask GetGPUMask (FRHICommandListImmediate &RHICmdList) const override
 Returns the GPU nodes on which to render this viewport.
 
ENGINE_API HHitProxy * GetHitProxy (int32 X, int32 Y)
 Returns the dominant hit proxy at a given point. 更多...
 
ENGINE_API void GetHitProxyMap (FIntRect InRect, TArray< HHitProxy * > &OutMap)
 Copies the hit proxies from an area of the screen into a buffer. 更多...
 
virtual FIntPoint GetRenderTargetTextureSizeXY () const
 Returns dimensions of RenderTarget texture. 更多...
 
virtual FViewportFrame * GetViewportFrame ()=0
 Retrieves the interface to the viewport's frame, if it has one. 更多...
 
const FViewportRHIRef & GetViewportRHI () const
 Accessors for RHI resources
 
virtual ENGINE_API bool HasToggleFreezeCommand () override
 Returns if there is a command to freeze
 
ENGINE_API void Invalidate ()
 Invalidates cached hit proxies and the display.
 
virtual void InvalidateDisplay ()=0
 Invalidates the viewport's displayed pixels.
 
ENGINE_API void InvalidateHitProxy ()
 Invalidates cached hit proxies
 
virtual bool IsCursorVisible () const
 Returns true if the mouse cursor is currently visible 更多...
 
bool IsHDRViewport () const
 Returns true if this viewport should be rendered in HDR
 
virtual bool IsKeyboardAvailable (int32 ControllerID) const
 
virtual bool IsMouseAvailable (int32 ControllerID) const
 
bool IsPlayInEditorViewport () const
 Returns true if the viewport is for play in editor
 
bool IsSlateViewport () const
 Returns true if this is an FSlateSceneViewport
 
virtual bool IsStereoRenderingAllowed () const
 Should return true, if stereo rendering is allowed in this viewport
 
virtual ENGINE_API void ProcessToggleFreezeCommand () override
 Handles freezing/unfreezing of rendering
 
void SetHDRMode (bool bHDR)
 Sets HDR Status of Viewport
 
ENGINE_API void SetInitialSize (FIntPoint InitialSizeXY)
 Sets the initial size of this viewport. 更多...
 
void SetPlayInEditorViewport (bool bInPlayInEditorViewport)
 Sets this viewport as a play in editor viewport
 
virtual void SetPreCaptureMousePosFromSlateCursor ()
 Sets PreCapture coordinates from the current position of the slate cursor.
 
virtual void SetRequiresVsync (bool bShouldVsync)
 Indicate that the viewport should be block for vsync.
 
virtual ENGINE_API void SetViewportClient (FViewportClient *InViewportClient)
 Sets a viewport client if one wasn't provided at construction time. 更多...
 
ENGINE_API bool TakeHighResScreenShot ()
 Trigger a high res screenshot. 更多...
 
void UpdateRenderTargetSurfaceRHIToCurrentBackBuffer ()
 Update the render target surface RHI to the current back buffer
 
virtual FIntPoint ViewportToVirtualDesktopPixel (FVector2D ViewportCoordinate) const =0
 Transforms a coordinate in the local space of this viewport into a virtual desktop pixel. 更多...
 
virtual FVector2D VirtualDesktopPixelToViewport (FIntPoint VirtualDesktopPointPx) const =0
 Transforms a virtual desktop pixel (the origin is in the primary screen's top left corner) to the local space of this viewport 更多...
 
- Public 成员函数 继承自 FRenderTarget
virtual ENGINE_API float GetDisplayGamma () const
 
virtual ENGINE_API FRHIGPUMask GetGPUMask (FRHICommandListImmediate &RHICmdList) const
 Returns the GPU nodes on which to render this rendertarget.
 
virtual ENGINE_API const FTexture2DRHIRef & GetRenderTargetTexture () const
 Accessor for the surface RHI when setting this render target 更多...
 
virtual bool HasToggleFreezeCommand ()
 Returns if there is a command to toggle freezerendering
 
virtual void ProcessToggleFreezeCommand ()
 Handles freezing/unfreezing of rendering
 
ENGINE_API bool ReadFloat16Pixels (TArray< FFloat16Color > &OutputBuffer, ECubeFace CubeFace=CubeFace_PosX)
 Reads the viewport's displayed pixels into the given color buffer. 更多...
 
ENGINE_API bool ReadLinearColorPixels (TArray< FLinearColor > &OutputBuffer, FReadSurfaceDataFlags InFlags=FReadSurfaceDataFlags(RCM_MinMax, CubeFace_MAX), FIntRect InRect=FIntRect(0, 0, 0, 0))
 Reads the viewport's displayed pixels into the given color buffer. 更多...
 
ENGINE_API bool ReadPixels (TArray< FColor > &OutImageData, FReadSurfaceDataFlags InFlags=FReadSurfaceDataFlags(RCM_UNorm, CubeFace_MAX), FIntRect InRect=FIntRect(0, 0, 0, 0))
 Reads the viewport's displayed pixels into a preallocated color buffer. 更多...
 
ENGINE_API bool ReadPixelsPtr (FColor *OutImageBytes, FReadSurfaceDataFlags InFlags=FReadSurfaceDataFlags(RCM_UNorm, CubeFace_MAX), FIntRect InSrcRect=FIntRect(0, 0, 0, 0))
 Reads the viewport's displayed pixels into a preallocated color buffer. 更多...
 

静态 Public 成员函数

static ENGINE_API bool IsGameRenderingEnabled ()
 Returns whether rendering is globally enabled or disabled. 更多...
 
static ENGINE_API void SetGameRenderingEnabled (bool bIsEnabled, int32 PresentAndStopMovieDelay=0)
 Globally enables/disables rendering 更多...
 

Public 属性

FString AppVersionString
 The current version of the running instance
 

静态 Public 属性

static ENGINE_API FOnViewportResized ViewportResizedEvent
 Send when a viewport is resized
 

Protected 成员函数

void HighResScreenshot ()
 Take a high-resolution screenshot and save to disk.
 
virtual ENGINE_API void InitDynamicRHI () override
 Initializes the dynamic RHI resource and/or RHI render target used by this resource. 更多...
 
virtual ENGINE_API void InitRHI () override
 Initializes the RHI resources used by this resource. 更多...
 
virtual ENGINE_API void ReleaseDynamicRHI () override
 Releases the dynamic RHI resource and/or RHI render target resources used by this resource. 更多...
 
virtual ENGINE_API void ReleaseRHI () override
 Releases the RHI resources used by this resource. 更多...
 
virtual ENGINE_API void UpdateViewportRHI (bool bDestroyed, uint32 NewSizeX, uint32 NewSizeY, EWindowMode::Type NewWindowMode, EPixelFormat PreferredPixelFormat)
 Updates the viewport RHI with the current viewport state. 更多...
 
- Protected 成员函数 继承自 FRenderTarget
bool ReadFloat16Pixels (FFloat16Color *OutImageBytes, ECubeFace CubeFace=CubeFace_PosX)
 Reads the viewport's displayed pixels into a preallocated color buffer. 更多...
 
 FRenderResource ()
 Default constructor.
 
 FRenderResource (ERHIFeatureLevel::Type InFeatureLevel)
 Constructor when we know what feature level this resource should support
 
virtual FString GetFriendlyName () const
 
virtual void InitDynamicRHI ()
 Initializes the dynamic RHI resource and/or RHI render target used by this resource. 更多...
 
virtual void InitResource ()
 Initializes the resource. 更多...
 
virtual void InitRHI ()
 Initializes the RHI resources used by this resource. 更多...
 
virtual void ReleaseDynamicRHI ()
 Releases the dynamic RHI resource and/or RHI render target resources used by this resource. 更多...
 
virtual void ReleaseResource ()
 Prepares the resource for deletion. 更多...
 
virtual void ReleaseRHI ()
 Releases the RHI resources used by this resource. 更多...
 
void UpdateRHI ()
 If the resource's RHI resources have been initialized, then release and reinitialize it. 更多...
 
virtual ~FRenderResource ()
 Destructor used to catch unreleased resources.
 

Protected 属性

uint32 bHasRequestedToggleFreeze: 1
 If a toggle freeze request has been made
 
uint32 bHitProxiesCached: 1
 True if the hit proxy buffer buffer has up to date hit proxies for this viewport.
 
uint32 bIsHDR: 1
 If true this viewport is being displayed on a HDR monitor
 
uint32 bIsPlayInEditorViewport: 1
 if true this viewport is for play in editor
 
uint32 bIsSlateViewport: 1
 If true this viewport is an FSlateSceneViewport
 
uint32 bRequiresHitProxyStorage: 1
 True if the viewport client requires hit proxy storage.
 
bool bTakeHighResScreenShot
 Triggers the taking of a high res screen shot for this viewport.
 
TArray< FColor > CachedHitProxyData
 Cached hit proxy data.
 
FHitProxyMap HitProxyMap
 The viewport's hit proxy map.
 
uint32 HitProxySize
 The size of the region to check hit proxies
 
uint32 InitialPositionX
 The initial position of the viewport.
 
uint32 InitialPositionY
 The initial position of the viewport.
 
uint32 SizeX
 The width of the viewport.
 
uint32 SizeY
 The height of the viewport.
 
FViewportClient * ViewportClient
 The viewport's client.
 
FViewportRHIRef ViewportRHI
 The RHI viewport.
 
FName ViewportType
 Used internally for testing runtime instance type before casting
 
EWindowMode::Type WindowMode
 What is the current window mode.
 

静态 Protected 属性

static ENGINE_API bool bIsGameRenderingEnabled
 true if we should draw game viewports (has no effect on Editor viewports)
 
static int32 PresentAndStopMovieDelay
 Delay in frames to disable present (but still render scene) and stopping of a movie. 更多...
 

额外继承的成员函数

- 静态 Protected 成员函数 继承自 FRenderResource
static void InitPreRHIResources ()
 Initialize all resources initialized before the RHI was initialized
 

详细描述

Encapsulates the I/O of a viewport.

The viewport display is implemented using the platform independent RHI.

成员函数说明

◆ BeginRenderFrame()

virtual ENGINE_API void FViewport::BeginRenderFrame ( FRHICommandListImmediate &  RHICmdList)
virtual

Starts a new rendering frame.

Called from the rendering thread.

被 FSceneViewport , 以及 FDummyViewport 重载.

◆ CalculateViewExtents()

ENGINE_API FIntRect FViewport::CalculateViewExtents ( float  AspectRatio,
const FIntRect &  ViewRect 
)

Calculates the view inside the viewport when the aspect ratio is locked.

Used for creating cinematic bars.

参数
Aspect[in] ratio to lock to
ViewRect[in] unconstrained view rectangle
返回
constrained view rectangle

◆ Draw()

ENGINE_API void FViewport::Draw ( bool  bShouldPresent = true)

Updates the viewport's displayed pixels with the results of calling ViewportClient->Draw.

参数
bShouldPresentWhether we want this frame to be presented

◆ DrawStatsHUD()

virtual int32 FViewport::DrawStatsHUD ( FCanvas *  InCanvas,
const int32  InX,
const int32  InY 
)
inlinevirtual

First chance for viewports to render custom stats text

参数
InCanvas- Canvas for rendering
InX- Starting X for drawing
InY- Starting Y for drawing
返回
- Y for next stat drawing

◆ EndRenderFrame()

virtual ENGINE_API void FViewport::EndRenderFrame ( FRHICommandListImmediate &  RHICmdList,
bool  bPresent,
bool  bLockToVsync 
)
virtual

Ends a rendering frame.

Called from the rendering thread.

参数
bPresentWhether the frame should be presented to the screen
bLockToVsyncWhether the GPU should block until VSYNC before presenting

被 FSceneViewport , 以及 FDummyViewport 重载.

◆ EnqueueBeginRenderFrame()

virtual ENGINE_API void FViewport::EnqueueBeginRenderFrame ( const bool  bShouldPresent)
virtual

Starts a new rendering frame.

Called from the game thread thread.

参数
bShouldPresentWhether the frame will be presented to the screen

被 FSceneViewport 重载.

◆ EnqueueEndRenderFrame()

virtual ENGINE_API void FViewport::EnqueueEndRenderFrame ( const bool  bLockToVsync,
const bool  bShouldPresent 
)
virtual

Ends a rendering frame.

Called from the game thread.

参数
bPresentWhether the frame should be presented to the screen

被 FSceneViewport 重载.

◆ GetActorsAndModelsInHitProxy()

ENGINE_API void FViewport::GetActorsAndModelsInHitProxy ( FIntRect  InRect,
TSet< AActor * > &  OutActors,
TSet< UModel * > &  OutModels 
)

Returns all actors and models found in the hit proxy within a specified region.

InRect must be entirely within the viewport's client area. If the hit proxies are not cached, this will call ViewportClient->Draw with a hit-testing canvas.

◆ GetDebugCanvas()

virtual FCanvas * FViewport::GetDebugCanvas ( )
inlinevirtual
返回
A canvas that can be used while this viewport is being drawn to render debug elements on top of everything else

被 FSceneViewport , 以及 FDummyViewport 重载.

◆ GetDesiredAspectRatio()

virtual float FViewport::GetDesiredAspectRatio ( ) const
inlinevirtual
返回
aspect ratio that this viewport should be rendered at

◆ GetHitProxy()

ENGINE_API HHitProxy * FViewport::GetHitProxy ( int32  X,
int32  Y 
)

Returns the dominant hit proxy at a given point.

If X,Y are outside the client area of the viewport, returns NULL. Caution is required as calling Invalidate after this will free the returned HHitProxy.

◆ GetHitProxyMap()

ENGINE_API void FViewport::GetHitProxyMap ( FIntRect  InRect,
TArray< HHitProxy * > &  OutMap 
)

Copies the hit proxies from an area of the screen into a buffer.

InRect must be entirely within the viewport's client area. If the hit proxies are not cached, this will call ViewportClient->Draw with a hit-testing canvas.

◆ GetRenderTargetTextureSizeXY()

virtual FIntPoint FViewport::GetRenderTargetTextureSizeXY ( ) const
inlinevirtual

Returns dimensions of RenderTarget texture.

Can be called on a game thread.

被 FSceneViewport 重载.

◆ GetViewportFrame()

virtual FViewportFrame * FViewport::GetViewportFrame ( )
pure virtual

Retrieves the interface to the viewport's frame, if it has one.

返回
The viewport's frame interface.

在 FSceneViewport , 以及 FDummyViewport 内被实现.

◆ InitDynamicRHI()

virtual ENGINE_API void FViewport::InitDynamicRHI ( )
overrideprotectedvirtual

Initializes the dynamic RHI resource and/or RHI render target used by this resource.

Called when the resource is initialized, or when reseting all RHI resources. Resources that need to initialize after a D3D device reset must implement this function. This is only called by the rendering thread.

重载 FRenderResource .

被 FDummyViewport 重载.

◆ InitRHI()

virtual ENGINE_API void FViewport::InitRHI ( )
overrideprotectedvirtual

Initializes the RHI resources used by this resource.

Called when entering the state where both the resource and the RHI have been initialized. This is only called by the rendering thread.

重载 FRenderResource .

被 FDummyViewport 重载.

◆ IsCursorVisible()

virtual bool FViewport::IsCursorVisible ( ) const
inlinevirtual

Returns true if the mouse cursor is currently visible

返回
True if the mouse cursor is currently visible, otherwise false.

被 FSceneViewport 重载.

◆ IsGameRenderingEnabled()

static ENGINE_API bool FViewport::IsGameRenderingEnabled ( )
inlinestatic

Returns whether rendering is globally enabled or disabled.

返回
true if rendering is globally enabled, otherwise false.

◆ IsKeyboardAvailable()

virtual bool FViewport::IsKeyboardAvailable ( int32  ControllerID) const
inlinevirtual
返回
whether or not this Controller has a keyboard available to be used

◆ IsMouseAvailable()

virtual bool FViewport::IsMouseAvailable ( int32  ControllerID) const
inlinevirtual
返回
whether or not this Controller has a mouse available to be used

◆ ReleaseDynamicRHI()

virtual ENGINE_API void FViewport::ReleaseDynamicRHI ( )
overrideprotectedvirtual

Releases the dynamic RHI resource and/or RHI render target resources used by this resource.

Called when the resource is released, or when reseting all RHI resources. Resources that need to release before a D3D device reset must implement this function. This is only called by the rendering thread.

重载 FRenderResource .

◆ ReleaseRHI()

virtual ENGINE_API void FViewport::ReleaseRHI ( )
overrideprotectedvirtual

Releases the RHI resources used by this resource.

Called when leaving the state where both the resource and the RHI have been initialized. This is only called by the rendering thread.

重载 FRenderResource .

被 FDummyViewport 重载.

◆ SetGameRenderingEnabled()

static ENGINE_API void FViewport::SetGameRenderingEnabled ( bool  bIsEnabled,
int32  PresentAndStopMovieDelay = 0 
)
static

Globally enables/disables rendering

参数
bIsEnabledtrue if drawing should occur
PresentAndStopMovieDelayNumber of frames to delay before enabling bPresent in RHIEndDrawingViewport, and before stopping the movie

◆ SetInitialSize()

ENGINE_API void FViewport::SetInitialSize ( FIntPoint  InitialSizeXY)

Sets the initial size of this viewport.

Will do nothing if the viewport has already been sized

参数
InitialSizeXYThe initial size of the viewport

◆ SetViewportClient()

virtual ENGINE_API void FViewport::SetViewportClient ( FViewportClient *  InViewportClient)
virtual

Sets a viewport client if one wasn't provided at construction time.

参数
InViewportClient- The viewport client to set.

◆ TakeHighResScreenShot()

ENGINE_API bool FViewport::TakeHighResScreenShot ( )

Trigger a high res screenshot.

Returns true if the screenshot can be taken, and false if it can't. The screenshot can fail if the requested multiplier makes the screen too big for the GPU to cope with

◆ UpdateViewportRHI()

virtual ENGINE_API void FViewport::UpdateViewportRHI ( bool  bDestroyed,
uint32  NewSizeX,
uint32  NewSizeY,
EWindowMode::Type  NewWindowMode,
EPixelFormat  PreferredPixelFormat 
)
protectedvirtual

Updates the viewport RHI with the current viewport state.

参数
bDestroyed- True if the viewport has been destroyed.

被 FSceneViewport 重载.

◆ ViewportToVirtualDesktopPixel()

virtual FIntPoint FViewport::ViewportToVirtualDesktopPixel ( FVector2D  ViewportCoordinate) const
pure virtual

Transforms a coordinate in the local space of this viewport into a virtual desktop pixel.

参数
ViewportCoordianteNormalized coordniate in the rate [0..1]; (0,0) is upper left and (1,1) is lower right.
返回
the transformed coordinate. It is in virtual desktop pixels.

在 FSceneViewport , 以及 FDummyViewport 内被实现.

◆ VirtualDesktopPixelToViewport()

virtual FVector2D FViewport::VirtualDesktopPixelToViewport ( FIntPoint  VirtualDesktopPointPx) const
pure virtual

Transforms a virtual desktop pixel (the origin is in the primary screen's top left corner) to the local space of this viewport

参数
VirtualDesktopPointPxCoordinate on the virtual desktop in pixel units. Desktop is considered virtual because multiple monitors are supported.
返回
The transformed pixel. It is normalized to the range [0, 1]

在 FSceneViewport , 以及 FDummyViewport 内被实现.

类成员变量说明

◆ PresentAndStopMovieDelay

int32 FViewport::PresentAndStopMovieDelay
staticprotected

Delay in frames to disable present (but still render scene) and stopping of a movie.

This is useful to keep playing a movie while driver caches things on the first frame, which can be slow.


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