using System.Collections.Generic;
namespace UnityEngine.Rendering.LookDev
{
///
/// Interface that Scriptable Render Pipelines should implement to be able to use LookDev window
///
public interface IDataProvider
{
/// Additional configuration required by this SRP on LookDev's scene creation
/// Access element of the LookDev's scene
void FirstInitScene(StageRuntimeInterface stage);
/// Notify the SRP that sky have changed in LookDev
/// The camera of the LookDev's scene
/// The new Sky informations
/// The new Shadow information
/// Access element of the LookDev's scene
void UpdateSky(Camera camera, Sky sky, StageRuntimeInterface stage);
/// Notify the LookDev about what debug view mode are available in this SRP
/// The list of the mode, None is not required.
IEnumerable supportedDebugModes { get; }
/// Notify the SRP about a change in the DebugMode used
///
/// -1: None
/// Others: map the result of
///
void UpdateDebugMode(int debugIndex);
///
/// Compute the shadow mask in SRP for LookDev sun simulation
///
/// The computed ShadowMask
/// Access element of the LookDev's scene
void GetShadowMask(ref RenderTexture output, StageRuntimeInterface stage);
}
///
/// Runtime container representing Sky data given to the scriptable render pipeline for rendering
///
public struct Sky
{
public Cubemap cubemap;
public float longitudeOffset;
public float exposure;
}
/// Runtime link to reflect some Stage functionality for SRP editing
public class StageRuntimeInterface
{
System.Func m_AddGameObject;
System.Func m_GetCamera;
System.Func m_GetSunLight;
public StageRuntimeInterface(
System.Func AddGameObject,
System.Func GetCamera,
System.Func GetSunLight)
{
m_AddGameObject = AddGameObject;
m_GetCamera = GetCamera;
m_GetSunLight = GetSunLight;
}
/// Create a gameObject in the stage
///
/// [OPTIONAL] If true, the object is not recreated with the scene update.
/// Default value: false.
///
///
public GameObject AddGameObject(bool persistent = false)
=> m_AddGameObject?.Invoke(persistent);
/// Get the camera used in the stage
public Camera camera => m_GetCamera?.Invoke();
/// Get the sun used in the stage
public Light sunLight => m_GetSunLight?.Invoke();
/// Custom data pointer for convenience
public object SRPData;
}
}