using UnityEngine;
namespace Rive.Components
{
///
/// Settings for controlling the timing of when render objects are drawn.
///
public enum DrawTimingOption
{
///
/// Batch the render objects and draw them all at once. If a panel is requested to be drawn multiple times in a frame, the render objects will be drawn only once on the next frame.
///
DrawBatched = 0,
///
/// Draw the render objects immediately. If a panel is requested to be drawn multiple times in a frame, the render objects will be drawn multiple times.
///
DrawImmediate = 1,
}
///
/// Interface for classes that provide a strategy for rendering Rive panels to a render target.
///
public interface IRenderTargetStrategy
{
public DrawTimingOption DrawTiming { get; set; }
///
/// Registers a panel to be rendered by this strategy.
///
/// The panel to register the render object with.
/// True if the render object was successfully registered, false otherwise.
bool RegisterPanel(IRivePanel panel);
///
/// Removes a panel from being rendered by this strategy.
///
/// The panel to remove the render object from.
/// True if the render object was successfully removed, false otherwise.
bool UnregisterPanel(IRivePanel panel);
///
/// Returns whether the given panel is registered with this strategy.
///
/// The panel to check for the render object.
/// True if the render object is registered, false otherwise.
bool IsPanelRegistered(IRivePanel panel);
///
/// Returns the render texture for the given panel.
///
/// The panel to get the render texture for.
/// The render texture for the given render object.
RenderTexture GetRenderTexture(IRivePanel panel);
///
/// Returns the offset for the given panel in UV space.
///
/// The panel to get the offset for.
/// The offset for the given panel in UV space.
Vector2 GetPanelOffset(IRivePanel panel);
///
/// Returns the scale for the given panel within the render target.
///
/// The panel to get the scale for.
/// The scale for the given panel within the render target.
Vector2 GetPanelScale(IRivePanel panel);
///
/// Draws the given panel to the render target. This should handle being called multiple times in a single frame.
///
///
void DrawPanel(IRivePanel panel);
///
/// Triggers when the render target is updated.
///
event System.Action OnRenderTargetUpdated;
///
/// Triggers when a panel is registered.
///
///
event System.Action OnPanelRegistered;
///
/// Triggers when a panel is unregistered.
///
///
event System.Action OnPanelUnregistered;
}
}