diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/Import/UnitySupportedImageTypeDeserializer.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/Import/UnitySupportedImageTypeDeserializer.cs index b81445311..05a71c1df 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/Import/UnitySupportedImageTypeDeserializer.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/Import/UnitySupportedImageTypeDeserializer.cs @@ -9,6 +9,18 @@ namespace UniGLTF /// public sealed class UnitySupportedImageTypeDeserializer : ITextureDeserializer { + /// + /// `true` を指定すると、テクスチャを Non-Readable なものとしてデシリアライズする。 + /// + /// + /// `UnityEngine.ImageConversion.LoadImage` の第二引数 `markNonReadable` に相当。 + /// デフォルト値は `false`。 + /// テクスチャ編集を行わないアプリケーションプログラム等では、 + /// この値を `true` にすることでメモリ使用量の削減を期待できる。 + /// このフラグの効用については `UnityEngine.Texture2D.Apply` に記述がある。 + /// + public bool MarkNonReadable { get; set; } = false; + public async Task LoadTextureAsync(DeserializingTextureInfo textureInfo, IAwaitCaller awaitCaller) { if (textureInfo.ImageData == null) return null; @@ -16,7 +28,7 @@ namespace UniGLTF try { var texture = new Texture2D(2, 2, TextureFormat.ARGB32, textureInfo.UseMipmap, textureInfo.ColorSpace == ColorSpace.Linear); - texture.LoadImage(textureInfo.ImageData); + texture.LoadImage(textureInfo.ImageData, MarkNonReadable); await awaitCaller.NextFrame(); texture.wrapModeU = textureInfo.WrapModeU;