CubismSortingModeExtensionMethods.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Copyright(c) Live2D Inc. All rights reserved.
  3. *
  4. * Use of this source code is governed by the Live2D Open Software license
  5. * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
  6. */
  7. namespace Live2D.Cubism.Rendering
  8. {
  9. /// <summary>
  10. /// Extensions for <see cref="CubismSortingMode"/>.
  11. /// </summary>
  12. public static class CubismSortingModeExtensionMethods
  13. {
  14. /// <summary>
  15. /// Checks whether a mode sorts by depth.
  16. /// </summary>
  17. /// <param name="self">Mode to query.</param>
  18. /// <returns><see langword="true"/> if mode sorts by depth; <see langword="false"/> otherwise.</returns>
  19. public static bool SortByDepth(this CubismSortingMode self)
  20. {
  21. return self == CubismSortingMode.BackToFrontZ || self == CubismSortingMode.FrontToBackZ;
  22. }
  23. /// <summary>
  24. /// Checks whether a mode sorts by order.
  25. /// </summary>
  26. /// <param name="self">Mode to query.</param>
  27. /// <returns><see langword="true"/> if mode sorts by order; <see langword="false"/> otherwise.</returns>
  28. public static bool SortByOrder(this CubismSortingMode self)
  29. {
  30. return !self.SortByDepth();
  31. }
  32. }
  33. }