using System; using System.Collections.Generic; using Unity.Collections; using UnityEngine; namespace UnityEngine.Rendering.Universal { /// /// Class ShadowShape2D stores outline geometry for use with a shadow caster. /// public abstract class ShadowShape2D { /// /// Used when calling SetShape to describe the supplied indicies /// public enum OutlineTopology { /// /// Describes an index array where a set of two consecutive points describes a line segment. /// Lines, /// /// Describes an index array where a set of three consecutive points describes a triangle. /// Triangles } /// /// Used when calling SetShape to describe the winding direction of the supplied geometry /// public enum WindingOrder { /// /// Describes an index array where all polygons have vertices in a clockwise order /// Clockwise, /// /// Describes an index array where all polygons have vertices in a counterclockwise order /// CounterClockwise } /// /// SetFlip specifies how the shadow shape should be flipped when rendered /// /// Specifies flipping on the local x-axis /// Specifies flipping on the local y-axis public abstract void SetFlip(bool flipX, bool flipY); /// /// GetFlip returns how the shadow shape should be flipped when rendered /// /// Returns flipping on the local x-axis /// Returns flipping on the local y-axis public abstract void GetFlip(out bool flipX, out bool flipY); /// /// The value to initialize the trim when created /// /// Specifies the starting trim value. public abstract void SetDefaultTrim(float trim); /// /// SetShape creates shadow geometry using the supplied geometry /// /// The vertices used to create the shadow geometry. /// The indices used to create the shadow geometry (Lines topology) /// The radius at the vertex. Can be used to describe a capsule. /// The transform used to create the shadow geometry. /// The winding order of the supplied geometry. /// Specifies if the ShadowCaster2D is allowed to contract the supplied shape(s). /// Specifies if the ShadowCaster2D should create interior geometry. Required for shadow casters that do not use renderers as their source. public abstract void SetShape(NativeArray vertices, NativeArray indices, NativeArray radii, Matrix4x4 transform, WindingOrder windingOrder = WindingOrder.Clockwise, bool allowContraction = true, bool createInteriorGeometry = false); /// /// SetShape creates shadow geometry using the supplied geometry /// /// The vertices used to create the shadow geometry. /// The indices used to create the shadow geometry (Lines topology) /// The settings to create the renderer with. /// The winding order of the supplied geometry. /// Specifies if the ShadowCaster2D is allowed to contract the supplied shape(s). /// Specifies if the ShadowCaster2D should create interior geometry. Required for shadow casters that do not use renderers as their source. public abstract void SetShape(NativeArray vertices, NativeArray indices, OutlineTopology outlineTopology, WindingOrder windingOrder = WindingOrder.Clockwise, bool allowContraction = true, bool createInteriorGeometry = false); } }