using System; using System.Collections; using System.Collections.Generic; using UnityEngine; #if UNITY_EDITOR using UnityEditor; #endif namespace UnityEngine.Rendering.Universal { /// /// Class ShadowShape2DProvider has methods called by a ShadowCaster2D to determine if it should be listed as a Casting Option, and to provide geometry if it is the active ShadowShape2DProvider /// [Serializable] public abstract class ShadowShape2DProvider : ScriptableObject { /// /// Gets the name to be listed in the ShadowCaster2D Casting Option drop down. /// /// The name of component associated with the provider. /// The string to be listed in the ShadowCaster2D Casting Option drop down. public virtual string ProviderName(string componentName) { return componentName; } /// /// Gets the priority to be listed in the ShadowCaster2D Casting Option drop down. /// /// The priority to be listed in the ShadowCaster2D Casting Option drop down. public virtual int Priority() { return 0; } /// /// Called for the active ShadowShape2DProvider when the ShadowCaster2D becomes enabled /// /// The component associated with the provider public virtual void Enabled(in Component sourceComponent) {} /// /// Called for the active ShadowShape2DProvider when the ShadowCaster2D becomes disabled /// /// The component associated with the provider public virtual void Disabled(in Component sourceComponent) {} #if UNITY_EDITOR public virtual void OnInspectorEnabled(SerializedObject serializedObject) { } public virtual void OnInspectorGUI(SerializedObject serializedObject) { } #endif /// /// Called for each component on a ShadowCaster2D's GameObject. Returns true if the provided component is the data source of the ShadowShapeProvider. /// /// The component to test as a source /// Returns true if sourceComponent is the data source of the ShadowShapeProvider. public abstract bool IsShapeSource(in Component sourceComponent); /// /// Called when the ShadowShape2DProvider is selected as the active Casting Option. /// /// The component associated with the provider /// An instance of ShadowShape2D that is used by the ShadowCaster2D public abstract void OnPersistantDataCreated(in Component sourceComponent, ShadowShape2D persistantShadowShape); /// /// Called before 2D lighting is rendered each frame /// /// The component associated with the provider /// The bounds enclosing the region of the view frustum and all visible lights /// An instance of ShadowShape2D that is used by the ShadowCaster2D public virtual void OnBeforeRender(in Component sourceComponent, in Bounds worldCullingBounds, ShadowShape2D persistantShadowShape) { } } }