Class RenderToTextureControl
UI container control that can render children to texture and display pre-cached texture instead of drawing children every frame. It can be also used to render part of UI to texture and use it in material or shader.
Inheritance
Implements
Namespace: FlaxEngine.GUI
Assembly: FlaxEngine.CSharp.dll
Syntax
[ActorToolbox("GUI")]
public class RenderToTextureControl : ContainerControl, IComparable, IDrawable
Constructors
RenderToTextureControl()
Declaration
public RenderToTextureControl()
Properties
AutomaticInvalidate
Gets or sets the value whether cached texture data should be invalidated automatically (eg. when child control changes).
Declaration
[EditorOrder(30)]
public bool AutomaticInvalidate { get; set; }
Property Value
|
System.Boolean
|
AutomaticTextureSize
Gets or sets a value indicating whether automatically update size of texture when control dimensions gets changed.
Declaration
[EditorOrder(10)]
public bool AutomaticTextureSize { get; set; }
Property Value
|
System.Boolean
|
Bypass
If checked, the control will be bypassed and will not render its children to texture, instead draw children normally. It can be used to temporarily disable the effect of this control without removing it from the hierarchy.
Declaration
[EditorOrder(200)]
public bool Bypass { get; set; }
Property Value
|
System.Boolean
|
ConstantInvalidate
Gets or sets the value whether cached texture data should be invalidated every frame (eg. when UI is animated).
Declaration
[EditorOrder(40)]
public bool ConstantInvalidate { get; set; }
Property Value
|
System.Boolean
|
DrawMaterial
Gets or sets the GUI material used to draw the cached texture to the screen. Can be used to post-process underlying GUI with a custom shader (eg. chromatic-aberration, blur or tint). If not set, simple texture copy is performed. Materials has to be created with GUI domain and a GPUTexture parameter (default name is "Input") to be used as a source texture.
Declaration
[EditorOrder(100)]
public MaterialBase DrawMaterial { get; set; }
Property Value
|
MaterialBase
|
DrawTextureParameterName
Gets or sets the name of the GPUTexture parameter on the DrawMaterial to use as a source texture.
Declaration
[EditorOrder(110)]
[VisibleIf("HasDrawMaterial", false)]
public string DrawTextureParameterName { get; set; }
Property Value
|
System.String
|
Texture
Gets the texture with cached children controls.
Declaration
public GPUTexture Texture { get; }
Property Value
|
GPUTexture
|
TextureSize
Gets or sets the size of the texture (in pixels).
Declaration
[EditorOrder(20)]
[VisibleIf("AutomaticTextureSize", true)]
[Limit(0F, 4096F, 1F)]
public Float2 TextureSize { get; set; }
Property Value
|
Float2
|
Methods
Draw()
Draw the control and the children.
Declaration
public override void Draw()
Overrides
Invalidate()
Invalidates the cached image of children controls and invokes the redraw to the texture.
Declaration
public void Invalidate()
OnChildrenChanged()
Called when children collection gets changed (child added or removed).
Declaration
public override void OnChildrenChanged()
Overrides
OnChildResized(Control)
Called when child control gets resized.
Declaration
public override void OnChildResized(Control control)
Parameters
|
Control
control
The resized control. |
Overrides
OnDestroy()
Method called when managed instance should be destroyed
Declaration
public override void OnDestroy()
Overrides
OnSizeChanged()
Called when control size gets changed.
Declaration
protected override void OnSizeChanged()
Overrides
PerformLayoutBeforeChildren()
Perform layout for that container control before performing it for child controls.
Declaration
protected override void PerformLayoutBeforeChildren()