diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptor.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptor.cs
index f91c13fdb..e5f614834 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptor.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptor.cs
@@ -25,13 +25,47 @@ namespace UniGLTF
///
///
/// material = new Material(matDesc.Shader);
+ ///
///
public readonly Shader Shader;
+ ///
+ ///
+ /// material.renderQueue = matDesc.RenderQueue.Value;
+ ///
+ ///
public readonly int? RenderQueue;
+
public readonly IReadOnlyDictionary TextureSlots;
+
+ ///
+ ///
+ /// foreach (var kv in matDesc.FloatValues)
+ /// {
+ /// material.SetFloat(kv.Key, kv.Value);
+ /// }
+ ///
+ ///
public readonly IReadOnlyDictionary FloatValues;
+
+ ///
+ ///
+ /// foreach (var kv in matDesc.Colors)
+ /// {
+ /// material.SetColor(kv.Key, kv.Value);
+ /// }
+ ///
+ ///
public readonly IReadOnlyDictionary Colors;
+
+ ///
+ ///
+ /// foreach (var kv in matDesc.Vectors)
+ /// {
+ /// material.SetVector(kv.Key, kv.Value);
+ /// }
+ ///
+ ///
public readonly IReadOnlyDictionary Vectors;
///
@@ -43,6 +77,10 @@ namespace UniGLTF
///
public readonly IReadOnlyList> Actions;
+ ///
+ /// New api. for new code, this is a convenience.
+ /// MaterialGenerateAsyncFunc has full access to material and can get all textures.
+ ///
public readonly IReadOnlyList AsyncActions;
public SubAssetKey SubAssetKey => new SubAssetKey(SubAssetKey.MaterialType, Name);
@@ -68,5 +106,21 @@ namespace UniGLTF
Actions = actions;
AsyncActions = asyncActions ?? new List();
}
+
+ public MaterialDescriptor(
+ string name,
+ Shader shader,
+ IReadOnlyList asyncActions)
+ {
+ Name = name;
+ Shader = shader;
+ RenderQueue = default;
+ TextureSlots = new Dictionary();
+ FloatValues = new Dictionary();
+ Colors = new Dictionary();
+ Vectors = new Dictionary();
+ Actions = new List>();
+ AsyncActions = asyncActions;
+ }
}
}
\ No newline at end of file
diff --git a/Assets/VRM10_Samples/VRM10Viewer/MaterialImporter/TinyMToonMaterialImporter.cs b/Assets/VRM10_Samples/VRM10Viewer/MaterialImporter/TinyMToonMaterialImporter.cs
index b5f5003e0..062c6138e 100644
--- a/Assets/VRM10_Samples/VRM10Viewer/MaterialImporter/TinyMToonMaterialImporter.cs
+++ b/Assets/VRM10_Samples/VRM10Viewer/MaterialImporter/TinyMToonMaterialImporter.cs
@@ -36,12 +36,6 @@ namespace UniVRM10.VRM10Viewer
matDesc = new MaterialDescriptor(
GltfMaterialImportUtils.ImportMaterialName(i, src),
src.alphaMode == "BLEND" ? m_alphablend.shader : m_opaque.shader,
- null,
- new Dictionary(),
- new Dictionary(),
- new Dictionary(),
- new Dictionary(),
- new List>(),
new[] { (MaterialDescriptor.MaterialGenerateAsyncFunc)AsyncAction }
);
return true;
diff --git a/Assets/VRM10_Samples/VRM10Viewer/MaterialImporter/TinyPbrMaterialImporter.cs b/Assets/VRM10_Samples/VRM10Viewer/MaterialImporter/TinyPbrMaterialImporter.cs
index 35f137a28..0f055cf48 100644
--- a/Assets/VRM10_Samples/VRM10Viewer/MaterialImporter/TinyPbrMaterialImporter.cs
+++ b/Assets/VRM10_Samples/VRM10Viewer/MaterialImporter/TinyPbrMaterialImporter.cs
@@ -32,12 +32,6 @@ namespace UniVRM10.VRM10Viewer
matDesc = new MaterialDescriptor(
GltfMaterialImportUtils.ImportMaterialName(i, src),
src.alphaMode == "BLEND" ? m_alphablend.shader : m_opaque.shader,
- null,
- new Dictionary(),
- new Dictionary(),
- new Dictionary(),
- new Dictionary(),
- new List>(),
new[] { (MaterialDescriptor.MaterialGenerateAsyncFunc)AsyncAction }
);
return true;