mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-12 05:48:47 -05:00
Merge branch 'master' into fix/collidergroup_separate
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
namespace VRM10.MToon10
|
||||
using System;
|
||||
|
||||
namespace VRM10.MToon10
|
||||
{
|
||||
public static class MToon10Meta
|
||||
{
|
||||
public static readonly string UnityShaderName = "VRM10/MToon10";
|
||||
public static readonly string URPUnityShaderName = "VRM10/Universal Render Pipeline/MToon10";
|
||||
public static readonly string UnityUrpShaderName = "VRM10/Universal Render Pipeline/MToon10";
|
||||
|
||||
[Obsolete("Use UnityUrpShaderName instead")]
|
||||
public static readonly string URPUnityShaderName = UnityUrpShaderName;
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,18 @@ namespace UniVRM10
|
||||
{
|
||||
public class BuiltInVrm10MaterialExporter : IMaterialExporter
|
||||
{
|
||||
private readonly BuiltInGltfMaterialExporter _gltfExporter = new BuiltInGltfMaterialExporter();
|
||||
public BuiltInGltfMaterialExporter GltfExporter { get; set; } = new();
|
||||
public BuiltInVrm10MToonMaterialExporter MToonExporter { get; set; } = new();
|
||||
|
||||
public glTFMaterial ExportMaterial(Material m, ITextureExporter textureExporter, GltfExportSettings settings)
|
||||
{
|
||||
if (BuiltInVrm10MToonMaterialExporter.TryExportMaterialAsMToon(m, textureExporter, out var dst))
|
||||
if (MToonExporter.TryExportMaterial(m, textureExporter, out var dst))
|
||||
{
|
||||
return dst;
|
||||
}
|
||||
else
|
||||
{
|
||||
return _gltfExporter.ExportMaterial(m, textureExporter, settings);
|
||||
return GltfExporter.ExportMaterial(m, textureExporter, settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,18 @@ using ColorSpace = UniGLTF.ColorSpace;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
public static class BuiltInVrm10MToonMaterialExporter
|
||||
public class BuiltInVrm10MToonMaterialExporter
|
||||
{
|
||||
public static bool TryExportMaterialAsMToon(Material src, ITextureExporter textureExporter, out glTFMaterial dst)
|
||||
public Shader Shader { get; set; }
|
||||
|
||||
public BuiltInVrm10MToonMaterialExporter(Shader shader = null)
|
||||
{
|
||||
if (src.shader.name != MToon10Meta.UnityShaderName)
|
||||
Shader = shader != null ? shader : Shader.Find(MToon10Meta.UnityShaderName);
|
||||
}
|
||||
|
||||
public bool TryExportMaterial(Material src, ITextureExporter textureExporter, out glTFMaterial dst)
|
||||
{
|
||||
if (src.shader == null || src.shader != Shader)
|
||||
{
|
||||
dst = null;
|
||||
return false;
|
||||
@@ -203,5 +210,12 @@ namespace UniVRM10
|
||||
throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use TryExportMaterial")]
|
||||
public static bool TryExportMaterialAsMToon(Material src, ITextureExporter textureExporter, out glTFMaterial dst)
|
||||
{
|
||||
var exporter = new BuiltInVrm10MToonMaterialExporter();
|
||||
return exporter.TryExportMaterial(src, textureExporter, out dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f34870b7baf94fad98d958eea3368033
|
||||
timeCreated: 1730954293
|
||||
@@ -0,0 +1,29 @@
|
||||
using UniGLTF;
|
||||
using UnityEngine;
|
||||
using VRM10.MToon10;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
public class UrpVrm10MToonMaterialExporter
|
||||
{
|
||||
private readonly BuiltInVrm10MToonMaterialExporter _builtInExporter;
|
||||
|
||||
public Shader Shader
|
||||
{
|
||||
get => _builtInExporter.Shader;
|
||||
set => _builtInExporter.Shader = value;
|
||||
}
|
||||
|
||||
public UrpVrm10MToonMaterialExporter(Shader shader = null)
|
||||
{
|
||||
_builtInExporter = new BuiltInVrm10MToonMaterialExporter(
|
||||
shader != null ? shader : Shader.Find(MToon10Meta.UnityUrpShaderName)
|
||||
);
|
||||
}
|
||||
|
||||
public bool TryExportMaterial(Material src, ITextureExporter textureExporter, out glTFMaterial dst)
|
||||
{
|
||||
return _builtInExporter.TryExportMaterial(src, textureExporter, out dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d97f9c3e4a2454e829349d47f8bd1f7
|
||||
timeCreated: 1730954308
|
||||
@@ -5,15 +5,19 @@ namespace UniVRM10
|
||||
{
|
||||
public class UrpVrm10MaterialExporter : IMaterialExporter
|
||||
{
|
||||
public UrpGltfMaterialExporter GltfExporter { get; set; } = new();
|
||||
public UrpVrm10MToonMaterialExporter MToonExporter { get; set; } = new();
|
||||
|
||||
public glTFMaterial ExportMaterial(Material m, ITextureExporter textureExporter, GltfExportSettings settings)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return new glTFMaterial{
|
||||
name = "dummyForTest",
|
||||
};
|
||||
#else
|
||||
throw new System.NotImplementedException();
|
||||
#endif
|
||||
if (MToonExporter.TryExportMaterial(m, textureExporter, out var dst))
|
||||
{
|
||||
return dst;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GltfExporter.ExportMaterial(m, textureExporter, settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,9 @@ GraphicsSettings:
|
||||
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
- {fileID: 4800000, guid: 8c17b56f4bf084c47872edcb95237e4a, type: 3}
|
||||
- {fileID: 4800000, guid: 0781c64b7f2a1604ea6aa7e252080372, type: 3}
|
||||
m_PreloadedShaders: []
|
||||
m_PreloadShadersBatchTimeLimit: -1
|
||||
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
|
||||
|
||||
Reference in New Issue
Block a user