Files
Test/Library/PackageCache/com.unity.render-pipelines.universal@ffe395a3a1d1/Runtime/2D/Shadows/Providers/ShadowShapeProvider2D_Utility.cs
T
2026-11-01 23:39:55 +02:00

22 lines
612 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
internal static class ShadowShapeProvider2DUtility
{
static public float GetTrimEdgeFromBounds(Bounds bounds, float trimMultipler)
{
Vector3 size = bounds.size;
// Pick the smaller side
float trimEdge = trimMultipler * (size.x < size.y ? size.x : size.y);
// Clean up the trim value to one significant digit
float multiplier = Mathf.Pow(10, -Mathf.Floor(Mathf.Log10(trimEdge)));
trimEdge = Mathf.Floor(trimEdge * multiplier) / multiplier;
return trimEdge;
}
}