コメント復活。追加。

This commit is contained in:
ousttrue
2025-03-04 13:35:25 +09:00
parent 15ef107f1d
commit 5d16112bf4
2 changed files with 36 additions and 2 deletions

View File

@@ -1,17 +1,25 @@
namespace UniGLTF
{
/// <summary>
/// generate a unity Material from a glTFMaterial.
/// 指定の index の glTFMaterial から Import できる Material の生成情報を生成する。
/// glTFMaterial と Unity Material は 1:1 対応する。
///
/// IMaterialDescriptorGenerator の使われ方は MaterialFactory.LoadAsync を参照
/// </summary>
public interface IMaterialDescriptorGenerator
{
/// <summary>
/// Generate the MaterialDescriptor generated from the index i.
/// <code>
/// glTFMaterial src = data.GLTF.materials[i];
/// return new MaterialDescriptor();
/// </code>
/// </summary>
MaterialDescriptor Get(GltfData data, int i);
/// <summary>
/// Generate the MaterialDescriptor for the non-specified glTF material.
/// Generate the fallback MaterialDescriptor for the non-specified glTF material.
/// <see href="https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#default-material"/>
/// </summary>
MaterialDescriptor GetGltfDefault(string materialName = null);
}

View File

@@ -5,18 +5,44 @@ using UnityEngine;
namespace UniGLTF
{
/// <summary>
/// Material information generated by IMaterialDescriptorGenerator
/// In recent versions, it is easy to manipulate Materials directly using Actions.
///
/// Actions の使用例は UniGLTF.UrpGltfMaterialDescriptorGenerator を参照
/// </summary>
public sealed class MaterialDescriptor
{
public delegate Task MaterialGenerateAsyncFunc(Material m, GetTextureAsyncFunc getTexture, IAwaitCaller awaitCaller);
/// <summary>
/// <code>
/// material.name = matDesc.SubAssetKey.Name;
/// </code>
/// </summary>
public readonly string Name;
/// <summary>
/// <code>
/// material = new Material(matDesc.Shader);
/// </summary>
public readonly Shader Shader;
public readonly int? RenderQueue;
public readonly IReadOnlyDictionary<string, TextureDescriptor> TextureSlots;
public readonly IReadOnlyDictionary<string, float> FloatValues;
public readonly IReadOnlyDictionary<string, Color> Colors;
public readonly IReadOnlyDictionary<string, Vector4> Vectors;
/// <summary>
/// Process and construct the argument Material
/// <code>
/// material.SetTexture(prop, texture);
/// material.SetColor(prop, color);
/// </code>
/// </summary>
public readonly IReadOnlyList<Action<Material>> Actions;
public readonly IReadOnlyList<MaterialGenerateAsyncFunc> AsyncActions;
public SubAssetKey SubAssetKey => new SubAssetKey(SubAssetKey.MaterialType, Name);