mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-25 07:28:51 -05:00
rename
This commit is contained in:
parent
848dfe4597
commit
9f16a268a6
|
|
@ -32,7 +32,7 @@ namespace UniGLTF
|
|||
}
|
||||
m_data = new GlbFileParser(m_importer.assetPath).Parse();
|
||||
|
||||
var materialGenerator = new GltfMaterialDescriptorGenerator();
|
||||
var materialGenerator = new BuiltInGltfMaterialDescriptorGenerator();
|
||||
var materialKeys = m_data.GLTF.materials.Select((_, i) => materialGenerator.Get(m_data, i).SubAssetKey);
|
||||
var textureKeys = new GltfTextureDescriptorGenerator(m_data).Get().GetEnumerable().Select(x => x.SubAssetKey);
|
||||
m_materialEditor = new RemapEditorMaterial(materialKeys.Concat(textureKeys), GetEditorMap, SetEditorMap);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace UniGLTF
|
|||
{
|
||||
if (m_renderPipeline == UniGLTF.RenderPipelineTypes.UniversalRenderPipeline)
|
||||
{
|
||||
if (Shader.Find(UniGLTF.GltfPbrUrpMaterialImporter.ShaderName) == null)
|
||||
if (Shader.Find(UniGLTF.UrpGltfPbrMaterialImporter.ShaderName) == null)
|
||||
{
|
||||
Debug.LogWarning("URP is not installed. Force to BuiltinRenderPipeline");
|
||||
m_renderPipeline = UniGLTF.RenderPipelineTypes.BuiltinRenderPipeline;
|
||||
|
|
@ -39,10 +39,10 @@ namespace UniGLTF
|
|||
switch (renderPipeline)
|
||||
{
|
||||
case RenderPipelineTypes.BuiltinRenderPipeline:
|
||||
return new GltfMaterialDescriptorGenerator();
|
||||
return new BuiltInGltfMaterialDescriptorGenerator();
|
||||
|
||||
case RenderPipelineTypes.UniversalRenderPipeline:
|
||||
return new GltfUrpMaterialDescriptorGenerator();
|
||||
return new UrpGltfMaterialDescriptorGenerator();
|
||||
|
||||
default:
|
||||
throw new System.NotImplementedException();
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace UniGLTF
|
|||
}
|
||||
m_data = new AutoGltfFileParser(m_importer.assetPath).Parse();
|
||||
|
||||
var materialGenerator = new GltfMaterialDescriptorGenerator();
|
||||
var materialGenerator = new BuiltInGltfMaterialDescriptorGenerator();
|
||||
var materialKeys = m_data.GLTF.materials.Select((_, i) => materialGenerator.Get(m_data, i).SubAssetKey);
|
||||
var textureKeys = new GltfTextureDescriptorGenerator(m_data).Get().GetEnumerable().Select(x => x.SubAssetKey);
|
||||
m_materialEditor = new RemapEditorMaterial(materialKeys.Concat(textureKeys), GetEditorMap, SetEditorMap);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace UniGLTF
|
|||
m_importer = target as ZipArchivedGltfScriptedImporter;
|
||||
m_data = new AutoGltfFileParser(m_importer.assetPath).Parse();
|
||||
|
||||
var materialGenerator = new GltfMaterialDescriptorGenerator();
|
||||
var materialGenerator = new BuiltInGltfMaterialDescriptorGenerator();
|
||||
var materialKeys = m_data.GLTF.materials.Select((_, i) => materialGenerator.Get(m_data, i).SubAssetKey);
|
||||
var textureKeys = new GltfTextureDescriptorGenerator(m_data).Get().GetEnumerable().Select(x => x.SubAssetKey);
|
||||
m_materialEditor = new RemapEditorMaterial(materialKeys.Concat(textureKeys), GetEditorMap, SetEditorMap);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace UniGLTF
|
|||
{
|
||||
Data = data;
|
||||
TextureDescriptorGenerator = new GltfTextureDescriptorGenerator(Data);
|
||||
MaterialDescriptorGenerator = materialGenerator ?? new GltfMaterialDescriptorGenerator();
|
||||
MaterialDescriptorGenerator = materialGenerator ?? new BuiltInGltfMaterialDescriptorGenerator();
|
||||
|
||||
ExternalObjectMap = externalObjectMap ?? new Dictionary<SubAssetKey, UnityEngine.Object>();
|
||||
textureDeserializer = textureDeserializer ?? new UnityTextureDeserializer();
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ namespace UniGLTF
|
|||
/// <summary>
|
||||
/// GLTF の MaterialImporter
|
||||
/// </summary>
|
||||
public sealed class GltfMaterialDescriptorGenerator : IMaterialDescriptorGenerator
|
||||
public sealed class BuiltInGltfMaterialDescriptorGenerator : IMaterialDescriptorGenerator
|
||||
{
|
||||
public MaterialDescriptor Get(GltfData data, int i)
|
||||
{
|
||||
if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out var param)) return param;
|
||||
if (GltfPbrMaterialImporter.TryCreateParam(data, i, out param)) return param;
|
||||
if (BuiltInGltfUnlitMaterialImporter.TryCreateParam(data, i, out var param)) return param;
|
||||
if (BuiltInGltfPbrMaterialImporter.TryCreateParam(data, i, out param)) return param;
|
||||
// fallback
|
||||
if (Symbols.VRM_DEVELOP)
|
||||
{
|
||||
|
|
@ -23,7 +23,7 @@ namespace UniGLTF
|
|||
|
||||
return new MaterialDescriptor(
|
||||
GetMaterialName(i, null),
|
||||
GltfPbrMaterialImporter.ShaderName,
|
||||
BuiltInGltfPbrMaterialImporter.ShaderName,
|
||||
null,
|
||||
new Dictionary<string, TextureDescriptor>(),
|
||||
new Dictionary<string, float>(),
|
||||
|
|
@ -39,7 +39,7 @@ namespace UniGLTF
|
|||
/// _ZWrite
|
||||
///
|
||||
/// </summary>
|
||||
public static class GltfPbrMaterialImporter
|
||||
public static class BuiltInGltfPbrMaterialImporter
|
||||
{
|
||||
private static readonly int SrcBlend = Shader.PropertyToID("_SrcBlend");
|
||||
private static readonly int DstBlend = Shader.PropertyToID("_DstBlend");
|
||||
|
|
@ -206,7 +206,7 @@ namespace UniGLTF
|
|||
});
|
||||
|
||||
matDesc = new MaterialDescriptor(
|
||||
GltfMaterialDescriptorGenerator.GetMaterialName(i, src),
|
||||
BuiltInGltfMaterialDescriptorGenerator.GetMaterialName(i, src),
|
||||
ShaderName,
|
||||
null,
|
||||
textureSlots,
|
||||
|
|
@ -7,7 +7,7 @@ using ColorSpace = VRMShaders.ColorSpace;
|
|||
|
||||
namespace UniGLTF
|
||||
{
|
||||
public static class GltfUnlitMaterialImporter
|
||||
public static class BuiltInGltfUnlitMaterialImporter
|
||||
{
|
||||
private static readonly int Cutoff = Shader.PropertyToID("_Cutoff");
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ namespace UniGLTF
|
|||
}
|
||||
|
||||
matDesc = new MaterialDescriptor(
|
||||
GltfMaterialDescriptorGenerator.GetMaterialName(i, src),
|
||||
BuiltInGltfMaterialDescriptorGenerator.GetMaterialName(i, src),
|
||||
UniUnlitUtil.ShaderName,
|
||||
null,
|
||||
textureSlots,
|
||||
|
|
@ -11,7 +11,7 @@ namespace UniGLTF
|
|||
///
|
||||
/// see: https://github.com/Unity-Technologies/Graphics/blob/v7.5.3/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineMaterialUpgrader.cs#L354-L379
|
||||
/// </summary>
|
||||
public static class GltfPbrUrpMaterialImporter
|
||||
public static class UrpGltfPbrMaterialImporter
|
||||
{
|
||||
private static readonly int SrcBlend = Shader.PropertyToID("_SrcBlend");
|
||||
private static readonly int DstBlend = Shader.PropertyToID("_DstBlend");
|
||||
|
|
@ -181,7 +181,7 @@ namespace UniGLTF
|
|||
});
|
||||
|
||||
matDesc = new MaterialDescriptor(
|
||||
GltfMaterialDescriptorGenerator.GetMaterialName(i, src),
|
||||
BuiltInGltfMaterialDescriptorGenerator.GetMaterialName(i, src),
|
||||
ShaderName,
|
||||
null,
|
||||
textureSlots,
|
||||
|
|
@ -10,12 +10,12 @@ namespace UniGLTF
|
|||
/// <summary>
|
||||
/// GLTF の MaterialImporter
|
||||
/// </summary>
|
||||
public sealed class GltfUrpMaterialDescriptorGenerator : IMaterialDescriptorGenerator
|
||||
public sealed class UrpGltfMaterialDescriptorGenerator : IMaterialDescriptorGenerator
|
||||
{
|
||||
public MaterialDescriptor Get(GltfData data, int i)
|
||||
{
|
||||
if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out var param)) return param;
|
||||
if (GltfPbrUrpMaterialImporter.TryCreateParam(data, i, out param)) return param;
|
||||
if (BuiltInGltfUnlitMaterialImporter.TryCreateParam(data, i, out var param)) return param;
|
||||
if (UrpGltfPbrMaterialImporter.TryCreateParam(data, i, out param)) return param;
|
||||
// fallback
|
||||
if (Symbols.VRM_DEVELOP)
|
||||
{
|
||||
|
|
@ -24,7 +24,7 @@ namespace UniGLTF
|
|||
|
||||
return new MaterialDescriptor(
|
||||
GetMaterialName(i, null),
|
||||
GltfPbrMaterialImporter.ShaderName,
|
||||
BuiltInGltfPbrMaterialImporter.ShaderName,
|
||||
null,
|
||||
new Dictionary<string, TextureDescriptor>(),
|
||||
new Dictionary<string, float>(),
|
||||
|
|
@ -226,7 +226,7 @@ namespace UniGLTF
|
|||
var path = Path.Combine(root.FullName, "DamagedHelmet/glTF-Binary/DamagedHelmet.glb");
|
||||
using (var data = new AutoGltfFileParser(path).Parse())
|
||||
{
|
||||
var matDesc = new GltfMaterialDescriptorGenerator().Get(data, 0);
|
||||
var matDesc = new BuiltInGltfMaterialDescriptorGenerator().Get(data, 0);
|
||||
Assert.AreEqual("Standard", matDesc.ShaderName);
|
||||
Assert.AreEqual(5, matDesc.TextureSlots.Count);
|
||||
var (key, value) = matDesc.EnumerateSubAssetKeyValue().First();
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ namespace VRM
|
|||
}
|
||||
|
||||
// unlit
|
||||
if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out matDesc))
|
||||
if (BuiltInGltfUnlitMaterialImporter.TryCreateParam(data, i, out matDesc))
|
||||
{
|
||||
return matDesc;
|
||||
}
|
||||
|
||||
// pbr
|
||||
if (GltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc))
|
||||
if (BuiltInGltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc))
|
||||
{
|
||||
return matDesc;
|
||||
}
|
||||
|
|
@ -43,8 +43,8 @@ namespace VRM
|
|||
// fallback
|
||||
Debug.LogWarning($"fallback");
|
||||
return new MaterialDescriptor(
|
||||
GltfMaterialDescriptorGenerator.GetMaterialName(i, null),
|
||||
GltfPbrMaterialImporter.ShaderName,
|
||||
BuiltInGltfMaterialDescriptorGenerator.GetMaterialName(i, null),
|
||||
BuiltInGltfPbrMaterialImporter.ShaderName,
|
||||
null,
|
||||
new Dictionary<string, TextureDescriptor>(),
|
||||
new Dictionary<string, float>(),
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@ namespace VRM
|
|||
{
|
||||
// mtoon URP "MToon" shader is not ready. import fallback to unlit
|
||||
// unlit "UniUnlit" work in URP
|
||||
if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out var matDesc)) return matDesc;
|
||||
if (BuiltInGltfUnlitMaterialImporter.TryCreateParam(data, i, out var matDesc)) return matDesc;
|
||||
// pbr "Standard" to "Universal Render Pipeline/Lit"
|
||||
if (GltfPbrUrpMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
|
||||
if (UrpGltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
|
||||
// fallback
|
||||
if (Symbols.VRM_DEVELOP)
|
||||
{
|
||||
Debug.LogWarning($"material: {i} out of range. fallback");
|
||||
}
|
||||
return new MaterialDescriptor(
|
||||
GltfMaterialDescriptorGenerator.GetMaterialName(i, null),
|
||||
GltfPbrMaterialImporter.ShaderName,
|
||||
BuiltInGltfMaterialDescriptorGenerator.GetMaterialName(i, null),
|
||||
BuiltInGltfPbrMaterialImporter.ShaderName,
|
||||
null,
|
||||
new Dictionary<string, TextureDescriptor>(),
|
||||
new Dictionary<string, float>(),
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace UniVRM10
|
|||
{
|
||||
if (RenderPipeline == UniGLTF.RenderPipelineTypes.UniversalRenderPipeline)
|
||||
{
|
||||
if (Shader.Find(UniGLTF.GltfPbrUrpMaterialImporter.ShaderName) == null)
|
||||
if (Shader.Find(UniGLTF.UrpGltfPbrMaterialImporter.ShaderName) == null)
|
||||
{
|
||||
Debug.LogWarning("URP is not installed. Force to BuiltinRenderPipeline");
|
||||
RenderPipeline = UniGLTF.RenderPipelineTypes.BuiltinRenderPipeline;
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@ namespace UniVRM10
|
|||
// mtoon
|
||||
if (Vrm10MToonMaterialImporter.TryCreateParam(data, i, out MaterialDescriptor matDesc)) return matDesc;
|
||||
// unlit
|
||||
if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
|
||||
if (BuiltInGltfUnlitMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
|
||||
// pbr
|
||||
if (GltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
|
||||
if (BuiltInGltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
|
||||
// fallback
|
||||
if (Symbols.VRM_DEVELOP)
|
||||
{
|
||||
Debug.LogWarning($"material: {i} out of range. fallback");
|
||||
}
|
||||
return new MaterialDescriptor(
|
||||
GltfMaterialDescriptorGenerator.GetMaterialName(i, null), GltfPbrMaterialImporter.ShaderName,
|
||||
BuiltInGltfMaterialDescriptorGenerator.GetMaterialName(i, null), BuiltInGltfPbrMaterialImporter.ShaderName,
|
||||
null,
|
||||
new Dictionary<string, TextureDescriptor>(),
|
||||
new Dictionary<string, float>(),
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ namespace UniVRM10
|
|||
public MaterialDescriptor Get(GltfData data, int i)
|
||||
{
|
||||
// unlit
|
||||
if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out MaterialDescriptor matDesc)) return matDesc;
|
||||
if (BuiltInGltfUnlitMaterialImporter.TryCreateParam(data, i, out MaterialDescriptor matDesc)) return matDesc;
|
||||
// pbr
|
||||
if (GltfPbrUrpMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
|
||||
if (UrpGltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
|
||||
// fallback
|
||||
Debug.LogWarning($"material: {i} out of range. fallback");
|
||||
return new MaterialDescriptor(
|
||||
GltfMaterialDescriptorGenerator.GetMaterialName(i, null),
|
||||
GltfPbrMaterialImporter.ShaderName,
|
||||
BuiltInGltfMaterialDescriptorGenerator.GetMaterialName(i, null),
|
||||
BuiltInGltfPbrMaterialImporter.ShaderName,
|
||||
null,
|
||||
new Dictionary<string, TextureDescriptor>(),
|
||||
new Dictionary<string, float>(),
|
||||
|
|
|
|||
|
|
@ -309,11 +309,11 @@ namespace UniVRM10.VRM10Viewer
|
|||
{
|
||||
if (useUrp)
|
||||
{
|
||||
return new GltfUrpMaterialDescriptorGenerator();
|
||||
return new UrpGltfMaterialDescriptorGenerator();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new GltfMaterialDescriptorGenerator();
|
||||
return new BuiltInGltfMaterialDescriptorGenerator();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -332,11 +332,11 @@ namespace VRM.SimpleViewer
|
|||
{
|
||||
if (useUrp)
|
||||
{
|
||||
return new GltfUrpMaterialDescriptorGenerator();
|
||||
return new UrpGltfMaterialDescriptorGenerator();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new GltfMaterialDescriptorGenerator();
|
||||
return new BuiltInGltfMaterialDescriptorGenerator();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user