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.
|
virtual |
Starts a new rendering frame.
Called from the rendering thread.
被 FSceneViewport , 以及 FDummyViewport 重载.
| 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 |
| ENGINE_API void FViewport::Draw | ( | bool | bShouldPresent = true | ) |
Updates the viewport's displayed pixels with the results of calling ViewportClient->Draw.
| bShouldPresent | Whether we want this frame to be presented |
|
inlinevirtual |
First chance for viewports to render custom stats text
| InCanvas | - Canvas for rendering |
| InX | - Starting X for drawing |
| InY | - Starting Y for drawing |
|
virtual |
Ends a rendering frame.
Called from the rendering thread.
| bPresent | Whether the frame should be presented to the screen |
| bLockToVsync | Whether the GPU should block until VSYNC before presenting |
被 FSceneViewport , 以及 FDummyViewport 重载.
|
virtual |
Starts a new rendering frame.
Called from the game thread thread.
| bShouldPresent | Whether the frame will be presented to the screen |
被 FSceneViewport 重载.
|
virtual |
Ends a rendering frame.
Called from the game thread.
| bPresent | Whether the frame should be presented to the screen |
被 FSceneViewport 重载.
| 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.
|
inlinevirtual |
被 FSceneViewport , 以及 FDummyViewport 重载.
|
inlinevirtual |
| 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.
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.
|
inlinevirtual |
|
pure virtual |
Retrieves the interface to the viewport's frame, if it has one.
在 FSceneViewport , 以及 FDummyViewport 内被实现.
|
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 重载.
|
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 重载.
|
inlinevirtual |
Returns true if the mouse cursor is currently visible
被 FSceneViewport 重载.
|
inlinestatic |
Returns whether rendering is globally enabled or disabled.
|
inlinevirtual |
|
inlinevirtual |
|
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 .
|
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 重载.
|
static |
Globally enables/disables rendering
| bIsEnabled | true if drawing should occur |
| PresentAndStopMovieDelay | Number of frames to delay before enabling bPresent in RHIEndDrawingViewport, and before stopping the movie |
| ENGINE_API void FViewport::SetInitialSize | ( | FIntPoint | InitialSizeXY | ) |
Sets the initial size of this viewport.
Will do nothing if the viewport has already been sized
| InitialSizeXY | The initial size of the viewport |
|
virtual |
Sets a viewport client if one wasn't provided at construction time.
| InViewportClient | - The viewport client to set. |
| 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
|
protectedvirtual |
Updates the viewport RHI with the current viewport state.
| bDestroyed | - True if the viewport has been destroyed. |
被 FSceneViewport 重载.
|
pure virtual |
Transforms a coordinate in the local space of this viewport into a virtual desktop pixel.
| ViewportCoordiante | Normalized coordniate in the rate [0..1]; (0,0) is upper left and (1,1) is lower right. |
在 FSceneViewport , 以及 FDummyViewport 内被实现.
|
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
| VirtualDesktopPointPx | Coordinate on the virtual desktop in pixel units. Desktop is considered virtual because multiple monitors are supported. |
在 FSceneViewport , 以及 FDummyViewport 内被实现.
|
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.