mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-16 07:34:05 -05:00
Merge pull request #2610 from matsutaka-pxv/texture-marknonreadable
Some checks failed
Expired Issues Closure / cycle-weekly-close (push) Has been cancelled
Some checks failed
Expired Issues Closure / cycle-weekly-close (push) Has been cancelled
Add: UnitySupportedImageTypeDeserializer に MarkNonReadable プロパティを追加
This commit is contained in:
commit
38c4313d95
|
|
@ -9,6 +9,18 @@ namespace UniGLTF
|
|||
/// </summary>
|
||||
public sealed class UnitySupportedImageTypeDeserializer : ITextureDeserializer
|
||||
{
|
||||
/// <summary>
|
||||
/// `true` を指定すると、テクスチャを Non-Readable なものとしてデシリアライズする。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// `UnityEngine.ImageConversion.LoadImage` の第二引数 `markNonReadable` に相当。
|
||||
/// デフォルト値は `false`。
|
||||
/// テクスチャ編集を行わないアプリケーションプログラム等では、
|
||||
/// この値を `true` にすることでメモリ使用量の削減を期待できる。
|
||||
/// このフラグの効用については `UnityEngine.Texture2D.Apply` に記述がある。
|
||||
/// </remarks>
|
||||
public bool MarkNonReadable { get; set; } = false;
|
||||
|
||||
public async Task<Texture2D> 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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user