diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/IMaterialDescriptorGenerator.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/IMaterialDescriptorGenerator.cs index f9cf47e42..5f6afcc46 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/IMaterialDescriptorGenerator.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/IMaterialDescriptorGenerator.cs @@ -1,17 +1,25 @@ namespace UniGLTF { /// - /// generate a unity Material from a glTFMaterial. + /// 指定の index の glTFMaterial から Import できる Material の生成情報を生成する。 + /// glTFMaterial と Unity Material は 1:1 対応する。 + /// + /// IMaterialDescriptorGenerator の使われ方は MaterialFactory.LoadAsync を参照 /// public interface IMaterialDescriptorGenerator { /// /// Generate the MaterialDescriptor generated from the index i. + /// + /// glTFMaterial src = data.GLTF.materials[i]; + /// return new MaterialDescriptor(); + /// /// MaterialDescriptor Get(GltfData data, int i); /// - /// Generate the MaterialDescriptor for the non-specified glTF material. + /// Generate the fallback MaterialDescriptor for the non-specified glTF material. + /// /// MaterialDescriptor GetGltfDefault(string materialName = null); } diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptor.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptor.cs index f33d6a37a..f91c13fdb 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptor.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptor.cs @@ -5,18 +5,44 @@ using UnityEngine; namespace UniGLTF { + /// + /// Material information generated by IMaterialDescriptorGenerator + /// In recent versions, it is easy to manipulate Materials directly using Actions. + /// + /// Actions の使用例は UniGLTF.UrpGltfMaterialDescriptorGenerator を参照 + /// public sealed class MaterialDescriptor { public delegate Task MaterialGenerateAsyncFunc(Material m, GetTextureAsyncFunc getTexture, IAwaitCaller awaitCaller); + /// + /// + /// material.name = matDesc.SubAssetKey.Name; + /// + /// public readonly string Name; + + /// + /// + /// material = new Material(matDesc.Shader); + /// public readonly Shader Shader; + public readonly int? RenderQueue; public readonly IReadOnlyDictionary TextureSlots; public readonly IReadOnlyDictionary FloatValues; public readonly IReadOnlyDictionary Colors; public readonly IReadOnlyDictionary Vectors; + + /// + /// Process and construct the argument Material + /// + /// material.SetTexture(prop, texture); + /// material.SetColor(prop, color); + /// + /// public readonly IReadOnlyList> Actions; + public readonly IReadOnlyList AsyncActions; public SubAssetKey SubAssetKey => new SubAssetKey(SubAssetKey.MaterialType, Name);