Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ShadowShape2DProvider.cs 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. #if UNITY_EDITOR
  6. using UnityEditor;
  7. #endif
  8. namespace UnityEngine.Rendering.Universal
  9. {
  10. /// <summary>
  11. /// Class <c>ShadowShape2DProvider</c> has methods called by a <c>ShadowCaster2D</c> to determine if it should be listed as a Casting Option, and to provide geometry if it is the active <c>ShadowShape2DProvider</c>
  12. /// </summary>
  13. public abstract class ShadowShape2DProvider
  14. {
  15. /// <summary>
  16. /// Gets the name to be listed in the <c>ShadowCaster2D</c> Casting Option drop down.
  17. /// </summary>
  18. /// <param name="componentName">The name of component associated with the provider.</param>
  19. /// <returns>The string to be listed in the <c>ShadowCaster2D</c> Casting Option drop down.</returns>
  20. public virtual string ProviderName(string componentName) { return componentName; }
  21. /// <summary>
  22. /// Gets the priority to be listed in the <c>ShadowCaster2D</c> Casting Option drop down.
  23. /// </summary>
  24. /// <returns>The priority to be listed in the <c>ShadowCaster2D</c> Casting Option drop down.</returns>
  25. public virtual int Priority() { return 0; }
  26. /// <summary>
  27. /// Called for the active <c>ShadowShape2DProvider</c> when the <c>ShadowCaster2D</c> becomes enabled
  28. /// </summary>
  29. /// <param name="sourceComponent">The component associated with the provider</param>
  30. public virtual void Enabled(Component sourceComponent) {}
  31. /// <summary>
  32. /// Called for the active <c>ShadowShape2DProvider</c> when the <c>ShadowCaster2D</c> becomes disabled
  33. /// </summary>
  34. /// <param name="sourceComponent">The component associated with the provider</param>
  35. public virtual void Disabled(Component sourceComponent) {}
  36. /// <summary>
  37. /// Called for each component on a <c>ShadowCaster2D's</c> <c>GameObject</c>. Returns true if the provided component is the data source of the <c>ShadowShapeProvider</c>.
  38. /// </summary>
  39. /// <param name="sourceComponent">The component to test as a source</param>
  40. /// <returns>Returns true if sourceComponent is the data source of the <c>ShadowShapeProvider</c>.</returns>
  41. public abstract bool IsShapeSource(Component sourceComponent);
  42. /// <summary>
  43. /// Called when the <c>ShadowShape2DProvider</c> is selected as the active Casting Option.
  44. /// </summary>
  45. /// <param name="sourceComponent">The component associated with the provider</param>
  46. /// <param name="persistantShadowShape">An instance of <c>ShadowShape2D</c> that is used by the <c>ShadowCaster2D</c></param>
  47. public virtual void OnPersistantDataCreated(Component sourceComponent, ShadowShape2D persistantShadowShape) { }
  48. /// <summary>
  49. /// Called before 2D lighting is rendered each frame
  50. /// </summary>
  51. /// <param name="sourceComponent">The component associated with the provider</param>
  52. /// <param name="worldCullingBounds">The bounds enclosing the region of the view frustum and all visible lights</param>
  53. /// <param name="persistantShadowShape">An instance of <c>ShadowShape2D</c> that is used by the <c>ShadowCaster2D</c></param>
  54. public virtual void OnBeforeRender(Component sourceComponent, Bounds worldCullingBounds, ShadowShape2D persistantShadowShape) { }
  55. }
  56. }