SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.1 KiB

4 years ago
  1. using System;
  2. using UnityEngine;
  3. namespace UnityEditor.XR.ARSubsystems.InternalBridge
  4. {
  5. /// <summary>
  6. /// Extension methods for the <c>UnityEditor.TextureImporter</c>.
  7. /// </summary>
  8. public static class TextureImporterInternals
  9. {
  10. /// <summary>
  11. /// Gets the original image dimensions. The texture import settings can affect the resulting
  12. /// texture size, for instance: rounding to a power of 2.
  13. /// </summary>
  14. /// <param name="textureImporter">The <c>TextureImporter</c> on which to operate.</param>
  15. /// <returns>The original dimensions of the imported image.</returns>
  16. /// <exception cref="System.ArgumentNullException">Thrown if <paramref name="textureImporter"/> is <c>null</c>.</exception>
  17. public static Vector2Int GetSourceTextureDimensions(TextureImporter textureImporter)
  18. {
  19. if (textureImporter == null)
  20. throw new ArgumentNullException("textureImporter");
  21. int width = 0;
  22. int height = 0;
  23. textureImporter.GetWidthAndHeight(ref width, ref height);
  24. return new Vector2Int(width, height);
  25. }
  26. }
  27. }