The Retainer Box renders children widgets to a render target first before later rendering that render target to the screen. 更多...
#include <RetainerBox.h>
继承自 UContentWidget .
Public 成员函数 | |
| UMaterialInstanceDynamic * | GetEffectMaterial () const |
| Get the current dynamic effect material applied to the retainer box. | |
| void | RequestRender () |
| Requests the retainer redrawn the contents it has. | |
| void | SetEffectMaterial (UMaterialInterface *EffectMaterial) |
| Set a new effect material to the retainer widget. | |
| void | SetRenderingPhase (int RenderPhase, int32 TotalPhases) |
| Requests the retainer redrawn the contents it has. | |
| void | SetRetainRendering (bool bInRetainRendering) |
| Set the flag for if we retain the render or pass-through | |
| void | SetTextureParameter (FName TextureParameter) |
| Sets the name of the texture parameter to set the render target to on the material. | |
Public 属性 | |
| int32 | Phase |
| The Phase this widget will draw on. 更多... | |
| int32 | PhaseCount |
| The PhaseCount controls how many phases are possible know what to modulus the current frame count by to determine if this is the current frame to draw the widget on. 更多... | |
| bool | RenderOnInvalidation |
| Should this widget redraw the contents it has every time it receives an invalidation request from it's children, similar to the invalidation panel. | |
| bool | RenderOnPhase |
| Should this widget redraw the contents it has every time the phase occurs. | |
Protected 成员函数 | |
| virtual TSharedRef< SWidget > | RebuildWidget () override |
| Function implemented by all subclasses of UWidget is called when the underlying SWidget needs to be constructed. | |
| virtual void | SynchronizeProperties () override |
| Applies all properties to the native widget if possible. 更多... | |
Protected 属性 | |
| UMaterialInterface * | EffectMaterial |
| The effect to optionally apply to the render target. 更多... | |
| FName | TextureParameter |
| The texture sampler parameter of the @EffectMaterial, that we'll set to the render target. | |
The Retainer Box renders children widgets to a render target first before later rendering that render target to the screen.
This allows both frequency and phase to be controlled so that the UI can actually render less often than the frequency of the main game render. It also has the side benefit of allow materials to be applied to the render target after drawing the widgets to apply a simple post process.
|
overrideprotectedvirtual |
Applies all properties to the native widget if possible.
This is called after a widget is constructed. It can also be called by the editor to update modified state, so ensure all initialization to a widgets properties are performed here, or the property and visual state may become unsynced.
重载 UWidget .
|
protected |
The effect to optionally apply to the render target.
We will set the texture sampler based on the name set in the @TextureParameter property.
If you want to adjust transparency of the final image, make sure you set Blend Mode to AlphaComposite (Pre-Multiplied Alpha) and make sure to multiply the alpha you're apply across the surface to the color and the alpha of the render target, otherwise you won't see the expected color.
| int32 URetainerBox::Phase |
The Phase this widget will draw on.
If the Phase is 0, and the PhaseCount is 1, the widget will be drawn fresh every frame. If the Phase were 0, and the PhaseCount were 2, this retainer would draw a fresh frame every other frame. So in a 60Hz game, the UI would render at 30Hz.
| int32 URetainerBox::PhaseCount |
The PhaseCount controls how many phases are possible know what to modulus the current frame count by to determine if this is the current frame to draw the widget on.
If the Phase is 0, and the PhaseCount is 1, the widget will be drawn fresh every frame.
If the Phase were 0, and the PhaseCount were 2, this retainer would draw a fresh frame every other frame. So in a 60Hz game, the UI would render at 30Hz.