using UnityEngine; namespace StixGames.GrassShader { public static class NatureGeometryUtility { /// /// Calculates the frustum planes, offsets them by , and sets the far clip plane to /// /// /// /// /// public static Plane[] CalculateFrustumPlanes(Camera current, float farClip, float offset) { var prevFarClipPlane = current.farClipPlane; current.farClipPlane = farClip; var planes = GeometryUtility.CalculateFrustumPlanes(current); OffsetFrustumPlanes(planes, offset); current.farClipPlane = prevFarClipPlane; return planes; } /// /// Offsets the frustum planes, to make the area inside smaller or larger by a constant distance in all directions /// /// /// public static void OffsetFrustumPlanes(Plane[] planes, float offset) { for (int i = 0; i < planes.Length; i++) { planes[i].distance += offset; } } } }