CubismMaskTile.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. using UnityEngine;
  8. namespace Live2D.Cubism.Rendering.Masking
  9. {
  10. /// <summary>
  11. /// Single mask tile.
  12. /// </summary>
  13. public struct CubismMaskTile
  14. {
  15. #region Conversion
  16. /// <summary>
  17. /// Converts a <see cref="CubismMaskTile"/> to a <see cref="Vector4"/>.
  18. /// </summary>
  19. /// <param name="value">Value to convert.</param>
  20. public static implicit operator Vector4(CubismMaskTile value)
  21. {
  22. return new Vector4
  23. {
  24. x = value.Channel,
  25. y = value.Column,
  26. z = value.Row,
  27. w = value.Size
  28. };
  29. }
  30. #endregion
  31. /// <summary>
  32. /// Color channel of the tile.
  33. /// </summary>
  34. /// <remarks>
  35. /// Valid values are 0f, 1f, 2, and 3f.
  36. /// </remarks>
  37. public float Channel;
  38. /// <summary>
  39. /// Column index of the tile in subdivided texture.
  40. /// </summary>
  41. public float Column;
  42. /// <summary>
  43. /// Row index of the tile in subdivided texture.
  44. /// </summary>
  45. public float Row;
  46. /// <summary>
  47. /// Size of the tile in texture coordinates.
  48. /// </summary>
  49. public float Size;
  50. }
  51. }