diff --git a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/GltfExportWindow.cs b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/GltfExportWindow.cs
index b05c56076..75a9686b4 100644
--- a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/GltfExportWindow.cs
+++ b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/GltfExportWindow.cs
@@ -109,11 +109,12 @@ namespace UniGLTF
{
var data = new ExportingGltfData();
using (var exporter = new gltfExporter(data, Settings,
- progress: new EditorProgress(),
- animationExporter: new EditorAnimationExporter()))
+ progress: new EditorProgress(),
+ animationExporter: new EditorAnimationExporter(),
+ textureSerializer: new EditorTextureSerializer()))
{
exporter.Prepare(State.ExportRoot);
- exporter.Export(new EditorTextureSerializer());
+ exporter.Export();
}
if (isGlb)
diff --git a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterBase.cs b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterBase.cs
index 4637c4ecb..f467c9d3c 100644
--- a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterBase.cs
+++ b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterBase.cs
@@ -19,35 +19,7 @@ namespace UniGLTF
public ScriptedImporterAxes m_reverseAxis = default;
[SerializeField]
- [Header("Experimental")]
- public RenderPipelineTypes m_renderPipeline;
-
- void OnValidate()
- {
- if (m_renderPipeline == UniGLTF.RenderPipelineTypes.UniversalRenderPipeline)
- {
- if (Shader.Find(UniGLTF.UrpGltfPbrMaterialImporter.ShaderName) == null)
- {
- Debug.LogWarning("URP is not installed. Force to BuiltinRenderPipeline");
- m_renderPipeline = UniGLTF.RenderPipelineTypes.BuiltinRenderPipeline;
- }
- }
- }
-
- static IMaterialDescriptorGenerator GetMaterialGenerator(RenderPipelineTypes renderPipeline)
- {
- switch (renderPipeline)
- {
- case RenderPipelineTypes.BuiltinRenderPipeline:
- return new BuiltInGltfMaterialDescriptorGenerator();
-
- case RenderPipelineTypes.UniversalRenderPipeline:
- return new UrpGltfMaterialDescriptorGenerator();
-
- default:
- throw new System.NotImplementedException();
- }
- }
+ public ImporterRenderPipelineTypes m_renderPipeline;
///
/// glb をパースして、UnityObject化、さらにAsset化する
@@ -55,7 +27,8 @@ namespace UniGLTF
///
///
///
- protected static void Import(ScriptedImporter scriptedImporter, AssetImportContext context, Axes reverseAxis, RenderPipelineTypes renderPipeline)
+ ///
+ protected static void Import(ScriptedImporter scriptedImporter, AssetImportContext context, Axes reverseAxis, ImporterRenderPipelineTypes renderPipeline)
{
UniGLTFLogger.Log("OnImportAsset to " + scriptedImporter.assetPath);
@@ -68,7 +41,7 @@ namespace UniGLTF
.Where(x => x.Value != null)
.ToDictionary(kv => new SubAssetKey(kv.Value.GetType(), kv.Key.name), kv => kv.Value);
- IMaterialDescriptorGenerator materialGenerator = GetMaterialGenerator(renderPipeline);
+ var materialGenerator = GetMaterialDescriptorGenerator(renderPipeline);
using (var data = new AutoGltfFileParser(scriptedImporter.assetPath).Parse())
using (var loader = new ImporterContext(data, extractedObjects, materialGenerator: materialGenerator))
@@ -94,5 +67,16 @@ namespace UniGLTF
context.SetMainObject(root);
}
}
+
+ private static IMaterialDescriptorGenerator GetMaterialDescriptorGenerator(ImporterRenderPipelineTypes renderPipeline)
+ {
+ return renderPipeline switch
+ {
+ ImporterRenderPipelineTypes.Auto => MaterialDescriptorGeneratorUtility .GetValidGltfMaterialDescriptorGenerator(),
+ ImporterRenderPipelineTypes.BuiltinRenderPipeline => MaterialDescriptorGeneratorUtility .GetGltfMaterialDescriptorGenerator(RenderPipelineTypes.BuiltinRenderPipeline),
+ ImporterRenderPipelineTypes.UniversalRenderPipeline => MaterialDescriptorGeneratorUtility .GetGltfMaterialDescriptorGenerator(RenderPipelineTypes.UniversalRenderPipeline),
+ _ => MaterialDescriptorGeneratorUtility.GetValidGltfMaterialDescriptorGenerator(),
+ };
+ }
}
}
diff --git a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/ImporterRenderPipelineTypes.cs b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/ImporterRenderPipelineTypes.cs
new file mode 100644
index 000000000..0acad15f1
--- /dev/null
+++ b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/ImporterRenderPipelineTypes.cs
@@ -0,0 +1,9 @@
+namespace UniGLTF
+{
+ public enum ImporterRenderPipelineTypes
+ {
+ Auto = 0,
+ BuiltinRenderPipeline = 1,
+ UniversalRenderPipeline = 2,
+ }
+}
\ No newline at end of file
diff --git a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/ImporterRenderPipelineTypes.cs.meta b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/ImporterRenderPipelineTypes.cs.meta
new file mode 100644
index 000000000..fcc3507a5
--- /dev/null
+++ b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/ImporterRenderPipelineTypes.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: d4f38213d6e442ef986fd3e633991ba7
+timeCreated: 1722347490
\ No newline at end of file
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs
index 967fb0c07..d7c56f709 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs
@@ -307,7 +307,7 @@ namespace UniGLTF
using (MeasureTime("BuildMesh"))
{
var meshWithMaterials = await MeshUploader.BuildMeshAndUploadAsync(awaitCaller, meshData,
- (int? materialIndex) =>
+ async materialIndex =>
{
if (materialIndex.HasValidIndex())
{
@@ -315,7 +315,7 @@ namespace UniGLTF
}
else
{
- return MaterialFactory.DefaultMaterial;
+ return await MaterialFactory.GetDefaultMaterialAsync(awaitCaller);
}
});
var mesh = meshWithMaterials.Mesh;
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Export/MaterialExporterUtility.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Export/MaterialExporterUtility.cs
new file mode 100644
index 000000000..449e9f735
--- /dev/null
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Export/MaterialExporterUtility.cs
@@ -0,0 +1,15 @@
+namespace UniGLTF
+{
+ public static class MaterialExporterUtility
+ {
+ public static IMaterialExporter GetValidGltfMaterialExporter()
+ {
+ return RenderPipelineUtility.GetRenderPipelineType() switch
+ {
+ RenderPipelineTypes.UniversalRenderPipeline => throw new System.NotImplementedException(),
+ RenderPipelineTypes.BuiltinRenderPipeline => new BuiltInGltfMaterialExporter(),
+ _ => new BuiltInGltfMaterialExporter(),
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Export/MaterialExporterUtility.cs.meta b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Export/MaterialExporterUtility.cs.meta
new file mode 100644
index 000000000..9a2cbdb44
--- /dev/null
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Export/MaterialExporterUtility.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: ce72b16c8b374add909ab887c14a0f44
+timeCreated: 1722257666
\ No newline at end of file
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptorGeneratorUtility.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptorGeneratorUtility.cs
new file mode 100644
index 000000000..97dda7c77
--- /dev/null
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptorGeneratorUtility.cs
@@ -0,0 +1,21 @@
+namespace UniGLTF
+{
+ public static class MaterialDescriptorGeneratorUtility
+ {
+ public static IMaterialDescriptorGenerator GetValidGltfMaterialDescriptorGenerator()
+ {
+ return GetGltfMaterialDescriptorGenerator(RenderPipelineUtility.GetRenderPipelineType());
+ }
+
+ public static IMaterialDescriptorGenerator GetGltfMaterialDescriptorGenerator(RenderPipelineTypes renderPipelineType)
+ {
+ return renderPipelineType switch
+ {
+ RenderPipelineTypes.UniversalRenderPipeline => new UrpGltfMaterialDescriptorGenerator(),
+ RenderPipelineTypes.BuiltinRenderPipeline => new BuiltInGltfMaterialDescriptorGenerator(),
+ _ => new BuiltInGltfMaterialDescriptorGenerator(),
+ };
+ }
+ }
+}
+
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineMaterialDescriptorUtility.cs.meta b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptorGeneratorUtility.cs.meta
similarity index 100%
rename from Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineMaterialDescriptorUtility.cs.meta
rename to Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialDescriptorGeneratorUtility.cs.meta
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialFactory.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialFactory.cs
index f54b4d160..ccf38deb0 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialFactory.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/Import/MaterialFactory.cs
@@ -11,28 +11,17 @@ namespace UniGLTF
{
private readonly IReadOnlyDictionary m_externalMap;
- MaterialDescriptor m_defaultMaterialParams;
+ ///
+ /// デフォルトマテリアルの MaterialDescriptor は IMaterialDescriptorGenerator の実装によって異なるので外から渡す
+ ///
+ private readonly MaterialDescriptor m_defaultMaterialParams;
///
/// gltfPritmitive.material が無い場合のデフォルトマテリアル
/// https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#default-material
+ ///
///
- Material m_defaultMaterial;
-
- public Material DefaultMaterial
- {
- get
- {
- if (m_defaultMaterial == null)
- {
- // default material にバリエーションがある?
- var task = LoadAsync(m_defaultMaterialParams, (_x, _y) => Task.FromResult(null), new ImmediateCaller());
- task.Wait();
- m_defaultMaterial = task.Result;
- }
- return m_defaultMaterial;
- }
- }
+ private Material m_defaultMaterial;
public MaterialFactory(IReadOnlyDictionary externalMaterialMap, MaterialDescriptor defaultMaterialParams)
{
@@ -110,6 +99,16 @@ namespace UniGLTF
return m_materials[index].Asset;
}
+ public async Task GetDefaultMaterialAsync(IAwaitCaller awaitCaller)
+ {
+ if (m_defaultMaterial == null)
+ {
+ m_defaultMaterial = await LoadAsync(m_defaultMaterialParams, (_, _) => null, awaitCaller);
+ }
+ return m_defaultMaterial;
+ }
+
+
public async Task LoadAsync(MaterialDescriptor matDesc, GetTextureAsyncFunc getTexture, IAwaitCaller awaitCaller)
{
if (m_externalMap.TryGetValue(matDesc.SubAssetKey, out Material material))
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineMaterialDescriptorUtility.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineUtility.cs
similarity index 57%
rename from Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineMaterialDescriptorUtility.cs
rename to Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineUtility.cs
index 927e6f6e6..76ecc0547 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineMaterialDescriptorUtility.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineUtility.cs
@@ -1,8 +1,8 @@
-using UnityEngine.Rendering;
+using UnityEngine.Rendering;
namespace UniGLTF
{
- public static class MaterialDescriptorGeneratorUtility
+ public static class RenderPipelineUtility
{
public static RenderPipelineTypes GetRenderPipelineType()
{
@@ -25,16 +25,5 @@ namespace UniGLTF
return RenderPipelineTypes.Unknown;
}
-
- public static IMaterialDescriptorGenerator GetValidGltfMaterialDescriptorGenerator()
- {
- return GetRenderPipelineType() switch
- {
- RenderPipelineTypes.UniversalRenderPipeline => new UrpGltfMaterialDescriptorGenerator(),
- RenderPipelineTypes.BuiltinRenderPipeline => new BuiltInGltfMaterialDescriptorGenerator(),
- _ => new BuiltInGltfMaterialDescriptorGenerator(),
- };
- }
}
-}
-
+}
\ No newline at end of file
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineUtility.cs.meta b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineUtility.cs.meta
new file mode 100644
index 000000000..2f54eddfe
--- /dev/null
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/RenderPipelineUtility.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 0fd29db9c49145cd9f56f92e6153c8db
+timeCreated: 1722257774
\ No newline at end of file
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshUploader.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshUploader.cs
index 337e30af9..98450f1c9 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshUploader.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshUploader.cs
@@ -89,7 +89,7 @@ namespace UniGLTF
public static async Task BuildMeshAndUploadAsync(
IAwaitCaller awaitCaller,
MeshData data,
- Func materialFromIndex)
+ Func> materialFromIndex)
{
//Debug.Log(prims.ToJson());
@@ -117,10 +117,16 @@ namespace UniGLTF
mesh.RecalculateTangents();
await awaitCaller.NextFrame();
+ var materials = new Material[data.MaterialIndices.Count];
+ for (var idx = 0; idx < data.MaterialIndices.Count; ++idx)
+ {
+ materials[idx] = await materialFromIndex(data.MaterialIndices[idx]);
+ }
+
var result = new MeshWithMaterials
{
Mesh = mesh,
- Materials = data.MaterialIndices.Select(materialFromIndex).ToArray(),
+ Materials = materials,
ShouldSetRendererNodeAsBone = data.ShouldSetRendererNodeAsBone,
};
await awaitCaller.NextFrame();
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs
index 15d8cd9af..57d423dd1 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/gltfExporter.cs
@@ -45,11 +45,6 @@ namespace UniGLTF
private set;
}
- protected virtual IMaterialExporter CreateMaterialExporter()
- {
- return new BuiltInGltfMaterialExporter();
- }
-
protected ITextureExporter TextureExporter => _textureExporter;
private TextureExporter _textureExporter;
@@ -66,10 +61,18 @@ namespace UniGLTF
m_progress.Report(new ExportProgress("gltfExporter", msg, progress));
}
- IAnimationExporter m_animationExporter;
+ private readonly IAnimationExporter m_animationExporter;
+ private readonly IMaterialExporter m_materialExporter;
+ private readonly ITextureSerializer m_textureSerializer;
- public gltfExporter(ExportingGltfData data, GltfExportSettings settings, IProgress progress = null,
- IAnimationExporter animationExporter = null)
+ public gltfExporter(
+ ExportingGltfData data,
+ GltfExportSettings settings,
+ IProgress progress = null,
+ IAnimationExporter animationExporter = null,
+ IMaterialExporter materialExporter = null,
+ ITextureSerializer textureSerializer = null
+ )
{
_data = data;
@@ -87,6 +90,8 @@ namespace UniGLTF
}
m_animationExporter = animationExporter;
+ m_materialExporter = materialExporter ?? MaterialExporterUtility.GetValidGltfMaterialExporter();
+ m_textureSerializer = textureSerializer ?? new RuntimeTextureSerializer();
}
GameObject m_tmpParent = null;
@@ -224,7 +229,7 @@ namespace UniGLTF
// do nothing
}
- public virtual void Export(ITextureSerializer textureSerializer)
+ public virtual void Export()
{
if (m_settings.FreezeMesh)
{
@@ -249,10 +254,9 @@ namespace UniGLTF
ReportProgress("Materials and Textures", 0.2f);
Materials = uniqueUnityMeshes.GetUniqueMaterials().ToList();
- _textureExporter = new TextureExporter(textureSerializer);
+ _textureExporter = new TextureExporter(m_textureSerializer);
- var materialExporter = CreateMaterialExporter();
- _gltf.materials = Materials.Select(x => materialExporter.ExportMaterial(x, TextureExporter, m_settings)).ToList();
+ _gltf.materials = Materials.Select(x => m_materialExporter.ExportMaterial(x, TextureExporter, m_settings)).ToList();
#endregion
#region Meshes
@@ -346,14 +350,14 @@ namespace UniGLTF
m_animationExporter.Export(_data, Copy, Nodes);
}
- ExportExtensions(textureSerializer);
+ ExportExtensions(m_textureSerializer);
// Extension で Texture が増える場合があるので最後に呼ぶ
var exported = _textureExporter.Export();
for (var exportedTextureIdx = 0; exportedTextureIdx < exported.Count; ++exportedTextureIdx)
{
var (unityTexture, colorSpace) = exported[exportedTextureIdx];
- GltfTextureExporter.PushGltfTexture(_data, unityTexture, colorSpace, textureSerializer);
+ GltfTextureExporter.PushGltfTexture(_data, unityTexture, colorSpace, m_textureSerializer);
}
FixName(_gltf);
diff --git a/Assets/VRM/Settings.meta b/Assets/UniGLTF/Tests/Objects.meta
similarity index 77%
rename from Assets/VRM/Settings.meta
rename to Assets/UniGLTF/Tests/Objects.meta
index 3259186ec..895ef31b1 100644
--- a/Assets/VRM/Settings.meta
+++ b/Assets/UniGLTF/Tests/Objects.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 6cf41692967c5544b8ceeb148cad87b3
+guid: 257f9efac603801459934018928760de
folderAsset: yes
DefaultImporter:
externalObjects: {}
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_linear.png b/Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_linear.png
similarity index 100%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_linear.png
rename to Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_linear.png
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_linear.png.meta b/Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_linear.png.meta
similarity index 86%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_linear.png.meta
rename to Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_linear.png.meta
index 34e2b319c..8cff80177 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_linear.png.meta
+++ b/Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_linear.png.meta
@@ -3,7 +3,7 @@ guid: fc1ba24d4a4141d4d9e9ae0a0d3ecd0a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
- serializedVersion: 11
+ serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
@@ -24,6 +24,7 @@ TextureImporter:
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
+ ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
@@ -62,6 +63,7 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
+ cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
@@ -99,6 +101,18 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Server
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
@@ -112,6 +126,7 @@ TextureImporter:
edges: []
weights: []
secondaryTextures: []
+ nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_normal_map.png b/Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_normal_map.png
similarity index 100%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_normal_map.png
rename to Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_normal_map.png
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_normal_map.png.meta b/Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_normal_map.png.meta
similarity index 86%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_normal_map.png.meta
rename to Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_normal_map.png.meta
index 4862a8127..aa67d0199 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_normal_map.png.meta
+++ b/Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_normal_map.png.meta
@@ -3,7 +3,7 @@ guid: b5d17df8d14f2324692a7c69f24cf658
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
- serializedVersion: 11
+ serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
@@ -24,6 +24,7 @@ TextureImporter:
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
+ ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
@@ -62,6 +63,7 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
+ cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
@@ -99,6 +101,18 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Server
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
@@ -112,6 +126,7 @@ TextureImporter:
edges: []
weights: []
secondaryTextures: []
+ nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_srgb.png b/Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_srgb.png
similarity index 100%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_srgb.png
rename to Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_srgb.png
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_srgb.png.meta b/Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_srgb.png.meta
similarity index 86%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_srgb.png.meta
rename to Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_srgb.png.meta
index 39acaa02f..c2e9bfc6f 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_srgb.png.meta
+++ b/Assets/UniGLTF/Tests/Objects/4x4_gray_import_as_srgb.png.meta
@@ -3,7 +3,7 @@ guid: 0f7acf68f1798ae48a5505519abac457
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
- serializedVersion: 11
+ serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
@@ -24,6 +24,7 @@ TextureImporter:
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
+ ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
@@ -62,6 +63,7 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
+ cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
@@ -99,6 +101,18 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Server
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
@@ -112,6 +126,7 @@ TextureImporter:
edges: []
weights: []
secondaryTextures: []
+ nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_non_readable.png b/Assets/UniGLTF/Tests/Objects/4x4_non_readable.png
similarity index 100%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_non_readable.png
rename to Assets/UniGLTF/Tests/Objects/4x4_non_readable.png
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_non_readable.png.meta b/Assets/UniGLTF/Tests/Objects/4x4_non_readable.png.meta
similarity index 100%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_non_readable.png.meta
rename to Assets/UniGLTF/Tests/Objects/4x4_non_readable.png.meta
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_non_readable_compressed.DDS b/Assets/UniGLTF/Tests/Objects/4x4_non_readable_compressed.DDS
similarity index 100%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_non_readable_compressed.DDS
rename to Assets/UniGLTF/Tests/Objects/4x4_non_readable_compressed.DDS
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_non_readable_compressed.DDS.meta b/Assets/UniGLTF/Tests/Objects/4x4_non_readable_compressed.DDS.meta
similarity index 100%
rename from Assets/UniGLTF/Tests/UniGLTF/4x4_non_readable_compressed.DDS.meta
rename to Assets/UniGLTF/Tests/Objects/4x4_non_readable_compressed.DDS.meta
diff --git a/Assets/UniGLTF/Tests/UniGLTF/New Material.mat b/Assets/UniGLTF/Tests/Objects/New Material.mat
similarity index 100%
rename from Assets/UniGLTF/Tests/UniGLTF/New Material.mat
rename to Assets/UniGLTF/Tests/Objects/New Material.mat
diff --git a/Assets/UniGLTF/Tests/UniGLTF/New Material.mat.meta b/Assets/UniGLTF/Tests/Objects/New Material.mat.meta
similarity index 100%
rename from Assets/UniGLTF/Tests/UniGLTF/New Material.mat.meta
rename to Assets/UniGLTF/Tests/Objects/New Material.mat.meta
diff --git a/Assets/UniGLTF/Tests/UniGLTF/AssetTests.cs b/Assets/UniGLTF/Tests/UniGLTF/AssetTests.cs
index 50b0a6867..1fddabbee 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/AssetTests.cs
+++ b/Assets/UniGLTF/Tests/UniGLTF/AssetTests.cs
@@ -33,6 +33,8 @@ namespace UniGLTF
var tmp = AssetDatabase.LoadAssetAtPath(assetPath);
Assert.Null(tmp);
+
+ AssetDatabase.DeleteAsset(assetPath);
}
AssetDatabase.Refresh();
diff --git a/Assets/UniGLTF/Tests/UniGLTF/CopyTextureTests.cs b/Assets/UniGLTF/Tests/UniGLTF/CopyTextureTests.cs
index 8170541d9..d8304c00b 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/CopyTextureTests.cs
+++ b/Assets/UniGLTF/Tests/UniGLTF/CopyTextureTests.cs
@@ -1,13 +1,10 @@
using NUnit.Framework;
-using UnityEditor;
using UnityEngine;
namespace UniGLTF
{
public sealed class CopyTextureTests
{
- private static string AssetPath = "Assets/VRMShaders/GLTF/IO/Tests";
-
private static readonly Color32 Black = new Color32(0, 0, 0, 255);
private static readonly Color32 Gray = new Color32(127, 127, 127, 255);
private static readonly Color32 White = new Color32(255, 255, 255, 255);
@@ -32,7 +29,7 @@ namespace UniGLTF
[Test]
public void CopyFromNonReadableSRgbPng()
{
- var nonReadableTex = AssetDatabase.LoadAssetAtPath($"{AssetPath}/4x4_non_readable.png");
+ var nonReadableTex = TestAssets.LoadAsset("4x4_non_readable.png");
Assert.False(nonReadableTex.isReadable);
var copiedTex = TextureConverter.CopyTexture(nonReadableTex, ColorSpace.sRGB, true, null);
var pixels = copiedTex.GetPixels32(miplevel: 0);
@@ -46,7 +43,7 @@ namespace UniGLTF
[Test]
public void CopyFromNonReadableSRgbDds()
{
- var compressedTex = AssetDatabase.LoadAssetAtPath($"{AssetPath}/4x4_non_readable_compressed.dds");
+ var compressedTex = TestAssets.LoadAsset("4x4_non_readable_compressed.dds");
Assert.False(compressedTex.isReadable);
var copiedTex = TextureConverter.CopyTexture(compressedTex, ColorSpace.sRGB, true, null);
var pixels = copiedTex.GetPixels32(miplevel: 0);
@@ -60,7 +57,7 @@ namespace UniGLTF
[Test]
public void CopyAttributes()
{
- var src = AssetDatabase.LoadAssetAtPath($"{AssetPath}/4x4_non_readable.png");
+ var src = TestAssets.LoadAsset("4x4_non_readable.png");
var dst = TextureConverter.CopyTexture(src, ColorSpace.sRGB, false, null);
Assert.AreEqual(src.name, dst.name);
Assert.AreEqual(src.anisoLevel, dst.anisoLevel);
diff --git a/Assets/UniGLTF/Tests/UniGLTF/EditorTextureSerializerTests.cs b/Assets/UniGLTF/Tests/UniGLTF/EditorTextureSerializerTests.cs
index 3766f9d4f..a0a128da1 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/EditorTextureSerializerTests.cs
+++ b/Assets/UniGLTF/Tests/UniGLTF/EditorTextureSerializerTests.cs
@@ -1,18 +1,16 @@
using NUnit.Framework;
-using UnityEditor;
using UnityEngine;
namespace UniGLTF
{
public sealed class EditorTextureSerializerTests
{
- private static readonly string AssetPath = "Assets/UniGLTF/Tests/UniGLTF";
private static readonly string SrgbGrayImageName = "4x4_gray_import_as_srgb";
private static readonly string LinearGrayImageName = "4x4_gray_import_as_linear";
private static readonly string NormalMapGrayImageName = "4x4_gray_import_as_normal_map";
- private static readonly Texture2D SrgbGrayTex = AssetDatabase.LoadAssetAtPath($"{AssetPath}/{SrgbGrayImageName}.png");
- private static readonly Texture2D LinearGrayTex = AssetDatabase.LoadAssetAtPath($"{AssetPath}/{LinearGrayImageName}.png");
- private static readonly Texture2D NormalMapGrayTex = AssetDatabase.LoadAssetAtPath($"{AssetPath}/{NormalMapGrayImageName}.png");
+ private static readonly Texture2D SrgbGrayTex = TestAssets.LoadAsset($"{SrgbGrayImageName}.png");
+ private static readonly Texture2D LinearGrayTex = TestAssets.LoadAsset($"{LinearGrayImageName}.png");
+ private static readonly Texture2D NormalMapGrayTex = TestAssets.LoadAsset($"{NormalMapGrayImageName}.png");
private static readonly Color32 JustGray = new Color32(127, 127, 127, 255);
private static readonly Color32 SrgbGrayInSrgb = JustGray;
private static readonly Color32 SrgbGrayInLinear = ((Color)SrgbGrayInSrgb).linear;
@@ -113,23 +111,28 @@ namespace UniGLTF
{
// Prepare
var root = GameObject.CreatePrimitive(PrimitiveType.Cube);
- var mat = new Material(Shader.Find("Standard"));
+ var mat = new Material(Shader.Find(BuiltInStandardMaterialExporter.TargetShaderName));
mat.SetTexture(propertyName, srcTex);
root.GetComponentOrThrow().sharedMaterial = mat;
// Export glTF
var data = new ExportingGltfData();
- using (var exporter = new gltfExporter(data, new GltfExportSettings
- {
- InverseAxis = Axes.X,
- ExportOnlyBlendShapePosition = false,
- UseSparseAccessorForMorphTarget = false,
- DivideVertexBuffer = false,
- }))
- {
- exporter.Prepare(root);
- exporter.Export(new EditorTextureSerializer());
- }
+ using var exporter = new gltfExporter(
+ data,
+ new GltfExportSettings
+ {
+ InverseAxis = Axes.X,
+ ExportOnlyBlendShapePosition = false,
+ UseSparseAccessorForMorphTarget = false,
+ DivideVertexBuffer = false,
+ },
+ materialExporter: new BuiltInGltfMaterialExporter(),
+ textureSerializer: new EditorTextureSerializer()
+ );
+
+ exporter.Prepare(root);
+ exporter.Export();
+
var gltf = data.Gltf;
Assert.AreEqual(1, gltf.images.Count);
var exportedImage = gltf.images[0];
diff --git a/Assets/UniGLTF/Tests/UniGLTF/GltfLoadTests.cs b/Assets/UniGLTF/Tests/UniGLTF/GltfLoadTests.cs
index 7231079b6..58e0f7e76 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/GltfLoadTests.cs
+++ b/Assets/UniGLTF/Tests/UniGLTF/GltfLoadTests.cs
@@ -68,7 +68,7 @@ namespace UniGLTF
using (var exporter = new gltfExporter(data, new GltfExportSettings()))
{
exporter.Prepare(root);
- exporter.Export(new EditorTextureSerializer());
+ exporter.Export();
}
return data.ToGlbBytes();
}
diff --git a/Assets/UniGLTF/Tests/UniGLTF/TestAssets.cs b/Assets/UniGLTF/Tests/UniGLTF/TestAssets.cs
new file mode 100644
index 000000000..96319bbf4
--- /dev/null
+++ b/Assets/UniGLTF/Tests/UniGLTF/TestAssets.cs
@@ -0,0 +1,12 @@
+namespace UniGLTF
+{
+ public static class TestAssets
+ {
+ public static readonly string AssetPath = "Assets/UniGLTF/Tests/Objects";
+
+ public static T LoadAsset(string filename) where T : UnityEngine.Object
+ {
+ return UnityEditor.AssetDatabase.LoadAssetAtPath($"{AssetPath}/{filename}");
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/UniGLTF/Tests/UniGLTF/TestAssets.cs.meta b/Assets/UniGLTF/Tests/UniGLTF/TestAssets.cs.meta
new file mode 100644
index 000000000..ce8bf83a6
--- /dev/null
+++ b/Assets/UniGLTF/Tests/UniGLTF/TestAssets.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 8519ebb2f0f84833a752bb564b59c47c
+timeCreated: 1722263712
\ No newline at end of file
diff --git a/Assets/UniGLTF/Tests/UniGLTF/TestGltf.cs b/Assets/UniGLTF/Tests/UniGLTF/TestGltf.cs
new file mode 100644
index 000000000..36baddf65
--- /dev/null
+++ b/Assets/UniGLTF/Tests/UniGLTF/TestGltf.cs
@@ -0,0 +1,52 @@
+using UnityEngine;
+
+namespace UniGLTF
+{
+ public static class TestGltf
+ {
+ public static RuntimeGltfInstance LoadBytesAsBuiltInRP(byte[] bytes)
+ {
+ return GltfUtility.LoadBytesAsync(
+ "",
+ bytes,
+ awaitCaller: new ImmediateCaller(),
+ materialGenerator: new BuiltInGltfMaterialDescriptorGenerator()
+ ).Result;
+ }
+
+ public static RuntimeGltfInstance LoadPathAsBuiltInRP(string path)
+ {
+ return GltfUtility.LoadAsync(
+ path,
+ awaitCaller: new ImmediateCaller(),
+ materialGenerator: new BuiltInGltfMaterialDescriptorGenerator()
+ ).Result;
+ }
+
+ public static ExportingGltfData ExportAsBuiltInRP(GameObject gameObject, GltfExportSettings exportSettings = null)
+ {
+ var data = new ExportingGltfData();
+ using var exporter = new gltfExporter(
+ data,
+ exportSettings ?? new GltfExportSettings(),
+ progress: new EditorProgress(),
+ animationExporter: new EditorAnimationExporter(),
+ materialExporter: new BuiltInGltfMaterialExporter(),
+ textureSerializer: new EditorTextureSerializer()
+ );
+ exporter.Prepare(gameObject);
+ exporter.Export();
+
+ return data;
+ }
+
+ public static GameObject CreatePrimitiveAsBuiltInRP(PrimitiveType primitiveType)
+ {
+ var go = GameObject.CreatePrimitive(primitiveType);
+ var shader = Shader.Find("Standard");
+ var material = new Material(shader);
+ go.GetComponent().sharedMaterial = material;
+ return go;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/UniGLTF/Tests/UniGLTF/TestGltf.cs.meta b/Assets/UniGLTF/Tests/UniGLTF/TestGltf.cs.meta
new file mode 100644
index 000000000..affb261b4
--- /dev/null
+++ b/Assets/UniGLTF/Tests/UniGLTF/TestGltf.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 11719ab072944cc2b7c0eaafa0cdff2e
+timeCreated: 1722267047
\ No newline at end of file
diff --git a/Assets/UniGLTF/Tests/UniGLTF/TextureBytesTests.cs b/Assets/UniGLTF/Tests/UniGLTF/TextureBytesTests.cs
index f4ef96a2f..f99019151 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/TextureBytesTests.cs
+++ b/Assets/UniGLTF/Tests/UniGLTF/TextureBytesTests.cs
@@ -1,17 +1,14 @@
using NUnit.Framework;
-using UnityEditor;
using UnityEngine;
namespace UniGLTF
{
public class TextureBytesTests
{
- static string AssetPath = "Assets/VRMShaders/GLTF/IO/Tests";
-
[Test]
public void NonReadablePng()
{
- var nonReadableTex = AssetDatabase.LoadAssetAtPath($"{AssetPath}/4x4_non_readable.png");
+ var nonReadableTex = TestAssets.LoadAsset("4x4_non_readable.png");
Assert.False(nonReadableTex.isReadable);
var (bytes, mime) = new EditorTextureSerializer().ExportBytesWithMime(nonReadableTex, ColorSpace.sRGB);
Assert.NotNull(bytes);
@@ -20,7 +17,7 @@ namespace UniGLTF
[Test]
public void NonReadableDds()
{
- var readonlyTexture = AssetDatabase.LoadAssetAtPath($"{AssetPath}/4x4_non_readable_compressed.dds");
+ var readonlyTexture = TestAssets.LoadAsset("4x4_non_readable_compressed.dds");
Assert.False(readonlyTexture.isReadable);
var (bytes, mime) = new EditorTextureSerializer().ExportBytesWithMime(readonlyTexture, ColorSpace.sRGB);
Assert.NotNull(bytes);
diff --git a/Assets/UniGLTF/Tests/UniGLTF/UniGLTFTests.cs b/Assets/UniGLTF/Tests/UniGLTF/UniGLTFTests.cs
index 5b918f109..a96368fc3 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/UniGLTFTests.cs
+++ b/Assets/UniGLTF/Tests/UniGLTF/UniGLTFTests.cs
@@ -100,18 +100,17 @@ namespace UniGLTF
// export
var data = new ExportingGltfData();
+ using var exporter = new gltfExporter(
+ data,
+ new GltfExportSettings(),
+ materialExporter: new BuiltInGltfMaterialExporter());
+ exporter.Prepare(go);
+ exporter.Export();
- string json = null;
- using (var exporter = new gltfExporter(data, new GltfExportSettings()))
- {
- exporter.Prepare(go);
- exporter.Export(new EditorTextureSerializer());
+ // remove empty buffer
+ data.Gltf.buffers.Clear();
- // remove empty buffer
- data.Gltf.buffers.Clear();
-
- json = data.Gltf.ToJson();
- }
+ var json = data.Gltf.ToJson();
// parse
using (var parsed = GltfData.CreateFromExportForTest(data))
@@ -353,12 +352,7 @@ namespace UniGLTF
[Test]
public void GlTFToJsonTest()
{
- var data = new ExportingGltfData();
- using (var exporter = new gltfExporter(data, new GltfExportSettings()))
- {
- exporter.Prepare(CreateSimpleScene());
- exporter.Export(new EditorTextureSerializer());
- }
+ var data = TestGltf.ExportAsBuiltInRP(CreateSimpleScene());
var expected = data.Gltf.ToJson().ParseAsJson();
expected.AddKey(Utf8String.From("meshes"));
@@ -565,7 +559,7 @@ namespace UniGLTF
{
var shader = Shader.Find("Unlit/Color");
- var cubeA = GameObject.CreatePrimitive(PrimitiveType.Cube);
+ var cubeA = TestGltf.CreatePrimitiveAsBuiltInRP(PrimitiveType.Cube);
{
cubeA.transform.SetParent(go.transform);
var material = new Material(shader);
@@ -586,16 +580,8 @@ namespace UniGLTF
}
// export
- var data = new ExportingGltfData();
+ var data = TestGltf.ExportAsBuiltInRP(go);
var gltf = data.Gltf;
- var json = default(string);
- using (var exporter = new gltfExporter(data, new GltfExportSettings()))
- {
- exporter.Prepare(go);
- exporter.Export(new EditorTextureSerializer());
-
- json = gltf.ToJson();
- }
Assert.AreEqual(2, gltf.meshes.Count);
@@ -658,22 +644,14 @@ namespace UniGLTF
try
{
{
- var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
+ var cube = TestGltf.CreatePrimitiveAsBuiltInRP(PrimitiveType.Cube);
cube.transform.SetParent(go.transform);
UnityEngine.Object.DestroyImmediate(cube.GetComponent());
}
// export
- var data = new ExportingGltfData();
+ var data = TestGltf.ExportAsBuiltInRP(go);
var gltf = data.Gltf;
- string json;
- using (var exporter = new gltfExporter(data, new GltfExportSettings()))
- {
- exporter.Prepare(go);
- exporter.Export(new EditorTextureSerializer());
-
- json = gltf.ToJson();
- }
Assert.AreEqual(0, gltf.meshes.Count);
Assert.AreEqual(1, gltf.nodes.Count);
@@ -682,7 +660,7 @@ namespace UniGLTF
// import
using (var parsed = GltfData.CreateFromExportForTest(data))
{
- using (var context = new ImporterContext(parsed))
+ using (var context = new ImporterContext(parsed, materialGenerator: new BuiltInGltfMaterialDescriptorGenerator()))
using (var loaded = context.Load())
{
Assert.AreEqual(1, loaded.transform.GetChildren().Count());
@@ -708,14 +686,14 @@ namespace UniGLTF
try
{
{
- var child = GameObject.CreatePrimitive(PrimitiveType.Cube);
+ var child = TestGltf.CreatePrimitiveAsBuiltInRP(PrimitiveType.Cube);
child.transform.SetParent(root.transform);
// remove MeshFilter
Component.DestroyImmediate(child.GetComponent());
}
{
- var child = GameObject.CreatePrimitive(PrimitiveType.Cube);
+ var child = TestGltf.CreatePrimitiveAsBuiltInRP(PrimitiveType.Cube);
child.transform.SetParent(root.transform);
// set null
child.GetComponent().sharedMesh = null;
@@ -727,16 +705,9 @@ namespace UniGLTF
Assert.True(vs.All(x => x.CanExport));
// export
- var data = new ExportingGltfData();
+ var data = TestGltf.ExportAsBuiltInRP(root);
var gltf = data.Gltf;
- string json;
- using (var exporter = new gltfExporter(data, new GltfExportSettings()))
- {
- exporter.Prepare(root);
- exporter.Export(new EditorTextureSerializer());
-
- json = gltf.ToJson();
- }
+ var json = gltf.ToJson();
Assert.AreEqual(0, gltf.meshes.Count);
Assert.AreEqual(2, gltf.nodes.Count);
diff --git a/Assets/UniGLTF/UniUnlit/Resources.meta b/Assets/UniGLTF/UniUnlit/Resources.meta
deleted file mode 100644
index cec1abd10..000000000
--- a/Assets/UniGLTF/UniUnlit/Resources.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 3254d78d0dc8f2845a12b4646c4334a8
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/UniGLTF/UniUnlit/Resources/UniGLTF.meta b/Assets/UniGLTF/UniUnlit/Shaders.meta
similarity index 100%
rename from Assets/UniGLTF/UniUnlit/Resources/UniGLTF.meta
rename to Assets/UniGLTF/UniUnlit/Shaders.meta
diff --git a/Assets/UniGLTF/UniUnlit/Resources/UniGLTF/UniUnlit.shader b/Assets/UniGLTF/UniUnlit/Shaders/UniUnlit.shader
similarity index 100%
rename from Assets/UniGLTF/UniUnlit/Resources/UniGLTF/UniUnlit.shader
rename to Assets/UniGLTF/UniUnlit/Shaders/UniUnlit.shader
diff --git a/Assets/UniGLTF/UniUnlit/Resources/UniGLTF/UniUnlit.shader.meta b/Assets/UniGLTF/UniUnlit/Shaders/UniUnlit.shader.meta
similarity index 100%
rename from Assets/UniGLTF/UniUnlit/Resources/UniGLTF/UniUnlit.shader.meta
rename to Assets/UniGLTF/UniUnlit/Shaders/UniUnlit.shader.meta
diff --git a/Assets/VRM/Editor/Format/VRMEditorExporter.cs b/Assets/VRM/Editor/Format/VRMEditorExporter.cs
index 427da420d..6e48f7d88 100644
--- a/Assets/VRM/Editor/Format/VRMEditorExporter.cs
+++ b/Assets/VRM/Editor/Format/VRMEditorExporter.cs
@@ -16,12 +16,17 @@ namespace VRM
///
/// 出力先
/// エクスポート設定
- public static byte[] Export(GameObject exportRoot, VRMMetaObject meta, VRMExportSettings settings)
+ public static byte[] Export(
+ GameObject exportRoot,
+ VRMMetaObject meta,
+ VRMExportSettings settings,
+ IMaterialExporter materialExporter = null
+ )
{
List destroy = new List();
try
{
- return Export(exportRoot, meta, settings, destroy);
+ return Export(exportRoot, meta, settings, materialExporter, destroy);
}
finally
{
@@ -143,9 +148,12 @@ namespace VRM
///
///
/// 作業が終わったらDestoryするべき一時オブジェクト
- static byte[] Export(GameObject exportRoot, VRMMetaObject meta,
- VRMExportSettings settings,
- List destroy)
+ private static byte[] Export(
+ GameObject exportRoot,
+ VRMMetaObject meta,
+ VRMExportSettings settings,
+ IMaterialExporter materialExporter,
+ List destroy)
{
var target = exportRoot;
@@ -226,10 +234,12 @@ namespace VRM
var data = new UniGLTF.ExportingGltfData();
var gltfExportSettings = settings.GltfExportSettings;
using (var exporter = new VRMExporter(data, gltfExportSettings,
- settings.KeepAnimation ? new EditorAnimationExporter() : null))
+ animationExporter: settings.KeepAnimation ? new EditorAnimationExporter() : null,
+ materialExporter: materialExporter,
+ textureSerializer: new EditorTextureSerializer()))
{
exporter.Prepare(target);
- exporter.Export(new EditorTextureSerializer());
+ exporter.Export();
}
var bytes = data.ToGlbBytes();
Debug.LogFormat("Export elapsed {0}", sw.Elapsed);
diff --git a/Assets/VRM/MToon/Resources.meta b/Assets/VRM/MToon/Resources.meta
deleted file mode 100644
index f1a215fdd..000000000
--- a/Assets/VRM/MToon/Resources.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 9491ac346386a2b4e9f3c801c6786818
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/VRM/MToon/Resources/Shaders.meta b/Assets/VRM/MToon/Shaders.meta
similarity index 100%
rename from Assets/VRM/MToon/Resources/Shaders.meta
rename to Assets/VRM/MToon/Shaders.meta
diff --git a/Assets/VRM/MToon/Resources/Shaders/MToon.shader b/Assets/VRM/MToon/Shaders/MToon.shader
similarity index 100%
rename from Assets/VRM/MToon/Resources/Shaders/MToon.shader
rename to Assets/VRM/MToon/Shaders/MToon.shader
diff --git a/Assets/VRM/MToon/Resources/Shaders/MToon.shader.meta b/Assets/VRM/MToon/Shaders/MToon.shader.meta
similarity index 100%
rename from Assets/VRM/MToon/Resources/Shaders/MToon.shader.meta
rename to Assets/VRM/MToon/Shaders/MToon.shader.meta
diff --git a/Assets/VRM/MToon/Resources/Shaders/MToonCore.cginc b/Assets/VRM/MToon/Shaders/MToonCore.cginc
similarity index 100%
rename from Assets/VRM/MToon/Resources/Shaders/MToonCore.cginc
rename to Assets/VRM/MToon/Shaders/MToonCore.cginc
diff --git a/Assets/VRM/MToon/Resources/Shaders/MToonCore.cginc.meta b/Assets/VRM/MToon/Shaders/MToonCore.cginc.meta
similarity index 100%
rename from Assets/VRM/MToon/Resources/Shaders/MToonCore.cginc.meta
rename to Assets/VRM/MToon/Shaders/MToonCore.cginc.meta
diff --git a/Assets/VRM/MToon/Resources/Shaders/MToonSM3.cginc b/Assets/VRM/MToon/Shaders/MToonSM3.cginc
similarity index 100%
rename from Assets/VRM/MToon/Resources/Shaders/MToonSM3.cginc
rename to Assets/VRM/MToon/Shaders/MToonSM3.cginc
diff --git a/Assets/VRM/MToon/Resources/Shaders/MToonSM3.cginc.meta b/Assets/VRM/MToon/Shaders/MToonSM3.cginc.meta
similarity index 100%
rename from Assets/VRM/MToon/Resources/Shaders/MToonSM3.cginc.meta
rename to Assets/VRM/MToon/Shaders/MToonSM3.cginc.meta
diff --git a/Assets/VRM/MToon/Resources/Shaders/MToonSM4.cginc b/Assets/VRM/MToon/Shaders/MToonSM4.cginc
similarity index 100%
rename from Assets/VRM/MToon/Resources/Shaders/MToonSM4.cginc
rename to Assets/VRM/MToon/Shaders/MToonSM4.cginc
diff --git a/Assets/VRM/MToon/Resources/Shaders/MToonSM4.cginc.meta b/Assets/VRM/MToon/Shaders/MToonSM4.cginc.meta
similarity index 100%
rename from Assets/VRM/MToon/Resources/Shaders/MToonSM4.cginc.meta
rename to Assets/VRM/MToon/Shaders/MToonSM4.cginc.meta
diff --git a/Assets/VRM/Runtime/IO/MaterialIO/VRMRenderPipelineMaterialDescriptorGeneratorUtility.cs b/Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialDescriptorGeneratorUtility.cs
similarity index 63%
rename from Assets/VRM/Runtime/IO/MaterialIO/VRMRenderPipelineMaterialDescriptorGeneratorUtility.cs
rename to Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialDescriptorGeneratorUtility.cs
index 282e4d8c3..6aa838ca1 100644
--- a/Assets/VRM/Runtime/IO/MaterialIO/VRMRenderPipelineMaterialDescriptorGeneratorUtility.cs
+++ b/Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialDescriptorGeneratorUtility.cs
@@ -6,7 +6,12 @@ namespace VRM
{
public static IMaterialDescriptorGenerator GetValidVrmMaterialDescriptorGenerator(glTF_VRM_extensions vrm)
{
- return MaterialDescriptorGeneratorUtility.GetRenderPipelineType() switch
+ return GetVrmMaterialDescriptorGenerator(vrm, RenderPipelineUtility.GetRenderPipelineType());
+ }
+
+ public static IMaterialDescriptorGenerator GetVrmMaterialDescriptorGenerator(glTF_VRM_extensions vrm, RenderPipelineTypes renderPipelineType)
+ {
+ return renderPipelineType switch
{
RenderPipelineTypes.UniversalRenderPipeline => new UrpVrmMaterialDescriptorGenerator(vrm),
RenderPipelineTypes.BuiltinRenderPipeline => new BuiltInVrmMaterialDescriptorGenerator(vrm),
diff --git a/Assets/VRM/Runtime/IO/MaterialIO/VRMRenderPipelineMaterialDescriptorGeneratorUtility.cs.meta b/Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialDescriptorGeneratorUtility.cs.meta
similarity index 100%
rename from Assets/VRM/Runtime/IO/MaterialIO/VRMRenderPipelineMaterialDescriptorGeneratorUtility.cs.meta
rename to Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialDescriptorGeneratorUtility.cs.meta
diff --git a/Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialExporterUtility.cs b/Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialExporterUtility.cs
new file mode 100644
index 000000000..9c220c65c
--- /dev/null
+++ b/Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialExporterUtility.cs
@@ -0,0 +1,17 @@
+using UniGLTF;
+
+namespace VRM
+{
+ public static class VrmMaterialExporterUtility
+ {
+ public static IMaterialExporter GetValidVrmMaterialExporter()
+ {
+ return RenderPipelineUtility.GetRenderPipelineType() switch
+ {
+ RenderPipelineTypes.UniversalRenderPipeline => throw new System.NotImplementedException(),
+ RenderPipelineTypes.BuiltinRenderPipeline => new BuiltInVrmMaterialExporter(),
+ _ => new BuiltInVrmMaterialExporter(),
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialExporterUtility.cs.meta b/Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialExporterUtility.cs.meta
new file mode 100644
index 000000000..cb4b69cfe
--- /dev/null
+++ b/Assets/VRM/Runtime/IO/MaterialIO/VrmMaterialExporterUtility.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: c195ef8334f647febbfc517181117548
+timeCreated: 1722258234
\ No newline at end of file
diff --git a/Assets/VRM/Runtime/IO/VRMExporter.cs b/Assets/VRM/Runtime/IO/VRMExporter.cs
index f1f5d02b2..64e77cb80 100644
--- a/Assets/VRM/Runtime/IO/VRMExporter.cs
+++ b/Assets/VRM/Runtime/IO/VRMExporter.cs
@@ -14,18 +14,29 @@ namespace VRM
public static ExportingGltfData Export(GltfExportSettings configuration, GameObject go, ITextureSerializer textureSerializer)
{
var data = new ExportingGltfData();
- using (var exporter = new VRMExporter(data, configuration))
+ using (var exporter = new VRMExporter(data, configuration, textureSerializer: textureSerializer))
{
exporter.Prepare(go);
- exporter.Export(textureSerializer);
+ exporter.Export();
}
return data;
}
public readonly VRM.glTF_VRM_extensions VRM = new glTF_VRM_extensions();
- public VRMExporter(ExportingGltfData data, GltfExportSettings exportSettings, IAnimationExporter animationExporter = null) : base(
- data, exportSettings, animationExporter: animationExporter)
+ public VRMExporter(
+ ExportingGltfData data,
+ GltfExportSettings exportSettings,
+ IAnimationExporter animationExporter = null,
+ IMaterialExporter materialExporter = null,
+ ITextureSerializer textureSerializer = null
+ ) : base(
+ data,
+ exportSettings,
+ animationExporter: animationExporter,
+ materialExporter: materialExporter ?? VrmMaterialExporterUtility.GetValidVrmMaterialExporter(),
+ textureSerializer: textureSerializer
+ )
{
if (exportSettings == null)
{
@@ -40,11 +51,6 @@ namespace VRM
_gltf.extensionsUsed.Add(glTF_VRM_extensions.ExtensionName);
}
- protected override IMaterialExporter CreateMaterialExporter()
- {
- return new BuiltInVrmMaterialExporter();
- }
-
public override void ExportExtensions(ITextureSerializer textureSerializer)
{
var getBone = UniHumanoid.Humanoid.Get_GetBoneTransform(Copy);
diff --git a/Assets/VRM/Settings/VRMShaders.shadervariants b/Assets/VRM/Settings/VRMShaders.shadervariants
deleted file mode 100644
index 9ae663e70..000000000
--- a/Assets/VRM/Settings/VRMShaders.shadervariants
+++ /dev/null
@@ -1,19 +0,0 @@
-%YAML 1.1
-%TAG !u! tag:unity3d.com,2011:
---- !u!200 &20000000
-ShaderVariantCollection:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_Name: VRMShaders
- m_Shaders:
- - first: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
- second:
- variants: []
- - first: {fileID: 4800000, guid: 1a97144e4ad27a04aafd70f7b915cedb, type: 3}
- second:
- variants: []
- - first: {fileID: 4800000, guid: 8c17b56f4bf084c47872edcb95237e4a, type: 3}
- second:
- variants: []
diff --git a/Assets/VRM/Settings/VRMShaders.shadervariants.meta b/Assets/VRM/Settings/VRMShaders.shadervariants.meta
deleted file mode 100644
index 6cccfe0a3..000000000
--- a/Assets/VRM/Settings/VRMShaders.shadervariants.meta
+++ /dev/null
@@ -1,9 +0,0 @@
-fileFormatVersion: 2
-guid: 486ebb794ada0de41be4f35c56876f82
-timeCreated: 1520840003
-licenseType: Free
-NativeFormatImporter:
- mainObjectFileID: 20000000
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/VRM/Tests/SampleTests/VRMImportExportTests.cs b/Assets/VRM/Tests/SampleTests/VRMImportExportTests.cs
index 9cf0e3591..d0ce6b581 100644
--- a/Assets/VRM/Tests/SampleTests/VRMImportExportTests.cs
+++ b/Assets/VRM/Tests/SampleTests/VRMImportExportTests.cs
@@ -33,9 +33,11 @@ namespace VRM.Samples
public void ImportExportTest()
{
var path = AliciaPath;
- using (var data = new GlbFileParser(path).Parse())
- using (var context = new VRMImporterContext(new VRMData(data)))
- using (var loaded = context.Load())
+ using var data = new GlbFileParser(path).Parse();
+ var vrmData = new VRMData(data);
+ var materialGenerator = new BuiltInVrmMaterialDescriptorGenerator(vrmData.VrmExtension);
+ using var context = new VRMImporterContext(vrmData, materialGenerator: materialGenerator);
+ using var loaded = context.Load();
{
loaded.ShowMeshes();
loaded.EnableUpdateWhenOffscreen();
@@ -126,9 +128,11 @@ namespace VRM.Samples
public void MeshCopyTest()
{
var path = AliciaPath;
- using (var data = new GlbFileParser(path).Parse())
- using (var context = new VRMImporterContext(new VRMData(data)))
- using (var loaded = context.Load())
+ using var data = new GlbFileParser(path).Parse();
+ var vrmData = new VRMData(data);
+ var materialGenerator = new BuiltInVrmMaterialDescriptorGenerator(vrmData.VrmExtension);
+ using var context = new VRMImporterContext(vrmData, materialGenerator: materialGenerator);
+ using var loaded = context.Load();
{
loaded.ShowMeshes();
loaded.EnableUpdateWhenOffscreen();
@@ -147,8 +151,10 @@ namespace VRM.Samples
// Aliciaを古いデシリアライザでロードする
var path = AliciaPath;
- using (var data = new GlbFileParser(path).Parse())
- using (var context = new VRMImporterContext(new VRMData(data)))
+ using var data = new GlbFileParser(path).Parse();
+ var vrmData = new VRMData(data);
+ var materialGenerator = new BuiltInVrmMaterialDescriptorGenerator(vrmData.VrmExtension);
+ using var context = new VRMImporterContext(vrmData, materialGenerator: materialGenerator);
{
var oldJson = context.GLTF.ToJson().ParseAsJson().ToString(" ");
diff --git a/Assets/VRM/Tests/TestVrm0X.cs b/Assets/VRM/Tests/TestVrm0X.cs
new file mode 100644
index 000000000..6f99e905d
--- /dev/null
+++ b/Assets/VRM/Tests/TestVrm0X.cs
@@ -0,0 +1,32 @@
+using UniGLTF;
+using UnityEngine;
+
+namespace VRM
+{
+ public static class TestVrm0X
+ {
+ public static RuntimeGltfInstance LoadBytesAsBuiltInRP(byte[] bytes)
+ {
+ return VrmUtility.LoadBytesAsync(
+ "",
+ bytes,
+ awaitCaller: new ImmediateCaller(),
+ materialGeneratorCallback: x => new BuiltInVrmMaterialDescriptorGenerator(x)
+ ).Result;
+ }
+
+ public static RuntimeGltfInstance LoadPathAsBuiltInRP(string path)
+ {
+ return VrmUtility.LoadAsync(
+ path,
+ awaitCaller: new ImmediateCaller(),
+ materialGeneratorCallback: x => new BuiltInVrmMaterialDescriptorGenerator(x)
+ ).Result;
+ }
+
+ public static byte[] ExportAsBuiltInRP(GameObject gameObject, VRMExportSettings exportSettings)
+ {
+ return VRMEditorExporter.Export(gameObject, null, exportSettings, new BuiltInVrmMaterialExporter());
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/VRM/Tests/TestVrm0X.cs.meta b/Assets/VRM/Tests/TestVrm0X.cs.meta
new file mode 100644
index 000000000..32d715a00
--- /dev/null
+++ b/Assets/VRM/Tests/TestVrm0X.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 47b1209d83114ccbaa0bf02436b8eb04
+timeCreated: 1722265572
\ No newline at end of file
diff --git a/Assets/VRM/Tests/VRMLookAtTests.cs b/Assets/VRM/Tests/VRMLookAtTests.cs
index a9a07b4a3..40d9424aa 100644
--- a/Assets/VRM/Tests/VRMLookAtTests.cs
+++ b/Assets/VRM/Tests/VRMLookAtTests.cs
@@ -21,11 +21,8 @@ namespace VRM
[Test]
public void VRMLookAtTest()
{
- var data = new GlbFileParser(AliciaPath).Parse();
byte[] bytes = default;
- using (data)
- using (var loader = new VRMImporterContext(new VRMData(data)))
- using (var loaded = loader.Load())
+ using var loaded = TestVrm0X.LoadPathAsBuiltInRP(AliciaPath);
{
loaded.ShowMeshes();
@@ -35,12 +32,12 @@ namespace VRM
var lookAt = go.AddComponent();
var settings = (VRMExportSettings)ScriptableObject.CreateInstance();
settings.PoseFreeze = true;
- bytes = VRMEditorExporter.Export(go, null, settings);
- }
+ bytes = TestVrm0X.ExportAsBuiltInRP(go, settings);
+ }
- using (var data2 = new GlbLowLevelParser(AliciaPath, bytes).Parse())
- using (var loader2 = new VRMImporterContext(new VRMData(data2)))
{
+ using var data2 = new GlbLowLevelParser(AliciaPath, bytes).Parse();
+ using var loader2 = new VRMImporterContext(new VRMData(data2));
Assert.AreEqual(LookAtType.BlendShape, loader2.VRM.firstPerson.lookAtType);
}
}
@@ -48,13 +45,10 @@ namespace VRM
[Test]
public void VRMLookAtCurveMapWithFreezeTest()
{
- var data = new GlbFileParser(AliciaPath).Parse();
- byte[] bytes = default;
+ byte[] bytes;
CurveMapper horizontalInner = default;
- using (data)
- using (var loader = new VRMImporterContext(new VRMData(data)))
- using (var loaded = loader.Load())
{
+ using var loaded = TestVrm0X.LoadPathAsBuiltInRP(AliciaPath);
loaded.ShowMeshes();
var go = loaded.gameObject;
@@ -63,13 +57,11 @@ namespace VRM
horizontalInner = lookAt.HorizontalInner;
var settings = ScriptableObject.CreateInstance();
settings.PoseFreeze = true;
- bytes = VRMEditorExporter.Export(go, null, settings);
+ bytes = TestVrm0X.ExportAsBuiltInRP(go, settings);
}
- using (var data2 = new GlbLowLevelParser(AliciaPath, bytes).Parse())
- using (var loader = new VRMImporterContext(new VRMData(data2)))
- using (var loaded = loader.Load())
{
+ using var loaded = TestVrm0X.LoadBytesAsBuiltInRP(bytes);
loaded.ShowMeshes();
var lookAt = loaded.GetComponent();
@@ -81,13 +73,10 @@ namespace VRM
[Test]
public void VRMLookAtCurveMapTest()
{
- var data = new GlbFileParser(AliciaPath).Parse();
- byte[] bytes = default;
+ byte[] bytes;
CurveMapper horizontalInner = default;
- using (data)
- using (var loader = new VRMImporterContext(new VRMData(data)))
- using (var loaded = loader.Load())
{
+ using var loaded = TestVrm0X.LoadPathAsBuiltInRP(AliciaPath);
loaded.ShowMeshes();
var go = loaded.gameObject;
@@ -96,13 +85,11 @@ namespace VRM
horizontalInner = lookAt.HorizontalInner;
var settings = (VRMExportSettings)ScriptableObject.CreateInstance();
settings.PoseFreeze = false;
- bytes = VRMEditorExporter.Export(go, null, settings);
+ bytes = TestVrm0X.ExportAsBuiltInRP(go, settings);
}
- using (var data2 = new GlbLowLevelParser(AliciaPath, bytes).Parse())
- using (var loader = new VRMImporterContext(new VRMData(data2)))
- using (var loaded = loader.Load())
{
+ using var loaded = TestVrm0X.LoadBytesAsBuiltInRP(bytes);
loaded.ShowMeshes();
var lookAt = loaded.GetComponent();
diff --git a/Assets/VRM/Tests/VrmDividedMeshTests.cs b/Assets/VRM/Tests/VrmDividedMeshTests.cs
index 543b10486..658cda4eb 100644
--- a/Assets/VRM/Tests/VrmDividedMeshTests.cs
+++ b/Assets/VRM/Tests/VrmDividedMeshTests.cs
@@ -67,13 +67,21 @@ namespace VRM
var path = AliciaPath;
var loaded = Load(File.ReadAllBytes(path), path);
- var exported = VRMExporter.Export(new UniGLTF.GltfExportSettings
+ var exportSettings = new GltfExportSettings
{
DivideVertexBuffer = true, // test this
ExportOnlyBlendShapePosition = true,
ExportTangents = false,
UseSparseAccessorForMorphTarget = true,
- }, loaded, new EditorTextureSerializer());
+ };
+ var exported = new ExportingGltfData();
+ using var exporter = new VRMExporter(
+ exported,
+ exportSettings,
+ textureSerializer: new EditorTextureSerializer(),
+ materialExporter: new BuiltInVrmMaterialExporter());
+ exporter.Prepare(loaded);
+ exporter.Export();
var bytes = exported.ToGlbBytes();
var divided = Load(bytes, path);
diff --git a/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporter.cs b/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporter.cs
index be82aec15..2981e8ead 100644
--- a/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporter.cs
+++ b/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporter.cs
@@ -1,4 +1,5 @@
-using UnityEngine;
+using UniGLTF;
+using UnityEngine;
#if UNITY_2020_2_OR_NEWER
using UnityEditor.AssetImporters;
#else
@@ -15,23 +16,11 @@ namespace UniVRM10
public bool MigrateToVrm1 = default;
[SerializeField]
- public UniGLTF.RenderPipelineTypes RenderPipeline = default;
+ public ImporterRenderPipelineTypes RenderPipeline = default;
public override void OnImportAsset(AssetImportContext ctx)
{
VrmScriptedImporterImpl.Import(this, ctx, MigrateToVrm1, RenderPipeline);
}
-
- void OnValidate()
- {
- if (RenderPipeline == UniGLTF.RenderPipelineTypes.UniversalRenderPipeline)
- {
- if (Shader.Find(UniGLTF.UrpGltfPbrMaterialImporter.ShaderName) == null)
- {
- Debug.LogWarning("URP is not installed. Force to BuiltinRenderPipeline");
- RenderPipeline = UniGLTF.RenderPipelineTypes.BuiltinRenderPipeline;
- }
- }
- }
}
}
diff --git a/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterImpl.cs b/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterImpl.cs
index 32ef5d600..395cc480b 100644
--- a/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterImpl.cs
+++ b/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterImpl.cs
@@ -15,23 +15,7 @@ namespace UniVRM10
{
public static class VrmScriptedImporterImpl
{
- static IMaterialDescriptorGenerator GetMaterialDescriptorGenerator(RenderPipelineTypes renderPipeline)
- {
- var settings = Vrm10ProjectEditorSettings.instance;
- if (settings.MaterialDescriptorGeneratorFactory != null)
- {
- return settings.MaterialDescriptorGeneratorFactory.Create();
- }
-
- return renderPipeline switch
- {
- RenderPipelineTypes.BuiltinRenderPipeline => new BuiltInVrm10MaterialDescriptorGenerator(),
- RenderPipelineTypes.UniversalRenderPipeline => new UrpVrm10MaterialDescriptorGenerator(),
- _ => throw new NotImplementedException()
- };
- }
-
- static void Process(Vrm10Data result, ScriptedImporter scriptedImporter, AssetImportContext context, RenderPipelineTypes renderPipeline)
+ static void Process(Vrm10Data result, ScriptedImporter scriptedImporter, AssetImportContext context, ImporterRenderPipelineTypes renderPipeline)
{
//
// Import(create unity objects)
@@ -73,7 +57,7 @@ namespace UniVRM10
/// vrm0 だった場合に vrm1 化する
///
/// normalize する
- public static void Import(ScriptedImporter scriptedImporter, AssetImportContext context, bool doMigrate, RenderPipelineTypes renderPipeline)
+ public static void Import(ScriptedImporter scriptedImporter, AssetImportContext context, bool doMigrate, ImporterRenderPipelineTypes renderPipeline)
{
if (Symbols.VRM_DEVELOP)
{
@@ -113,5 +97,22 @@ namespace UniVRM10
return;
}
}
+
+ private static IMaterialDescriptorGenerator GetMaterialDescriptorGenerator(ImporterRenderPipelineTypes renderPipeline)
+ {
+ var settings = Vrm10ProjectEditorSettings.instance;
+ if (settings.MaterialDescriptorGeneratorFactory != null)
+ {
+ return settings.MaterialDescriptorGeneratorFactory.Create();
+ }
+
+ return renderPipeline switch
+ {
+ ImporterRenderPipelineTypes.Auto => Vrm10MaterialDescriptorGeneratorUtility.GetValidVrm10MaterialDescriptorGenerator(),
+ ImporterRenderPipelineTypes.BuiltinRenderPipeline => Vrm10MaterialDescriptorGeneratorUtility.GetVrm10MaterialDescriptorGenerator(RenderPipelineTypes.BuiltinRenderPipeline),
+ ImporterRenderPipelineTypes.UniversalRenderPipeline => Vrm10MaterialDescriptorGeneratorUtility.GetVrm10MaterialDescriptorGenerator(RenderPipelineTypes.UniversalRenderPipeline),
+ _ => Vrm10MaterialDescriptorGeneratorUtility.GetValidVrm10MaterialDescriptorGenerator(),
+ };
+ }
}
}
\ No newline at end of file
diff --git a/Assets/VRM10/Editor/Vrm10ExportDialog.cs b/Assets/VRM10/Editor/Vrm10ExportDialog.cs
index 64b8a6e7a..a2c9195aa 100644
--- a/Assets/VRM10/Editor/Vrm10ExportDialog.cs
+++ b/Assets/VRM10/Editor/Vrm10ExportDialog.cs
@@ -311,7 +311,10 @@ namespace UniVRM10
model.ConvertCoordinate(VrmLib.Coordinates.Vrm1, ignoreVrm: false);
// export vrm-1.0
- var exporter = new UniVRM10.Vrm10Exporter(new EditorTextureSerializer(), m_settings.MeshExportSettings);
+ var exporter = new Vrm10Exporter(
+ m_settings.MeshExportSettings,
+ textureSerializer: new EditorTextureSerializer()
+ );
var option = new VrmLib.ExportArgs
{
sparse = m_settings.MorphTargetUseSparse,
diff --git a/Assets/VRM10/MToon10/Resources.meta b/Assets/VRM10/MToon10/Resources.meta
deleted file mode 100644
index 6b69de785..000000000
--- a/Assets/VRM10/MToon10/Resources.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: d5b5138c63fcb784595ae54e08a0e9e7
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/VRM10/MToon10/Resources/VRM10.meta b/Assets/VRM10/MToon10/Shaders.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10.meta
rename to Assets/VRM10/MToon10/Shaders.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon.shader b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon.shader
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon.shader
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon.shader
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon.shader.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon.shader.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon.shader.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon.shader.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_attribute.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_attribute.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_attribute.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_attribute.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_attribute.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_define.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_define.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_define.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_define.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_define.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_define.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_define.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_define.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_fragment.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthnormals_fragment.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_fragment.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthnormals_fragment.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_fragment.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthnormals_fragment.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_fragment.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthnormals_fragment.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_vertex.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthnormals_vertex.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_vertex.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthnormals_vertex.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_vertex.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthnormals_vertex.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthnormals_vertex.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthnormals_vertex.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_fragment.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthonly_fragment.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_fragment.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthonly_fragment.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_fragment.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthonly_fragment.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_fragment.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthonly_fragment.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_vertex.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthonly_vertex.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_vertex.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthonly_vertex.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_vertex.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthonly_vertex.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_depthonly_vertex.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_depthonly_vertex.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_fragment.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_forward_fragment.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_fragment.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_forward_fragment.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_fragment.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_forward_fragment.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_fragment.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_forward_fragment.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_vertex.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_forward_vertex.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_vertex.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_forward_vertex.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_vertex.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_forward_vertex.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_forward_vertex.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_forward_vertex.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_alpha.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_alpha.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_alpha.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_alpha.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_alpha.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_alpha.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_alpha.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_alpha.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_normal.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_normal.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_normal.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_normal.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_normal.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_normal.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_normal.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_normal.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_uv.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_uv.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_uv.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_uv.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_uv.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_uv.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_uv.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_uv.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_vertex.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_vertex.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_vertex.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_vertex.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_vertex.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_vertex.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_vertex.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_geometry_vertex.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_input.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_input.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_input.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_input.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_input.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_input.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_input.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_input.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_mtoon.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_lighting_mtoon.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_mtoon.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_lighting_mtoon.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_mtoon.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_lighting_mtoon.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_mtoon.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_lighting_mtoon.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_unity.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_lighting_unity.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_unity.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_lighting_unity.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_unity.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_lighting_unity.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_lighting_unity.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_lighting_unity.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_render_pipeline.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_render_pipeline.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_render_pipeline.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_render_pipeline.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_render_pipeline.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_render_pipeline.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_render_pipeline.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_render_pipeline.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_shadowcaster_fragment.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_shadowcaster_fragment.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_shadowcaster_fragment.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_shadowcaster_fragment.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_shadowcaster_fragment.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_shadowcaster_fragment.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_shadowcaster_fragment.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_shadowcaster_fragment.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_shadowcaster_vertex.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_shadowcaster_vertex.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_shadowcaster_vertex.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_shadowcaster_vertex.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_shadowcaster_vertex.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_shadowcaster_vertex.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_shadowcaster_vertex.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_shadowcaster_vertex.hlsl.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_urp.shader b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_urp.shader
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_urp.shader
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_urp.shader
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_urp.shader.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_urp.shader.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_urp.shader.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_urp.shader.meta
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_utility.hlsl b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_utility.hlsl
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_utility.hlsl
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_utility.hlsl
diff --git a/Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_utility.hlsl.meta b/Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_utility.hlsl.meta
similarity index 100%
rename from Assets/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_utility.hlsl.meta
rename to Assets/VRM10/MToon10/Shaders/vrmc_materials_mtoon_utility.hlsl.meta
diff --git a/Assets/VRM10/Runtime/IO/Material/URP/Import/VRM10RenderPipelineMaterialDescriptorGeneratorUtility.cs b/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialDescriptorGeneratorUtility.cs
similarity index 56%
rename from Assets/VRM10/Runtime/IO/Material/URP/Import/VRM10RenderPipelineMaterialDescriptorGeneratorUtility.cs
rename to Assets/VRM10/Runtime/IO/Material/Vrm10MaterialDescriptorGeneratorUtility.cs
index 9bd072165..3dcdc745c 100644
--- a/Assets/VRM10/Runtime/IO/Material/URP/Import/VRM10RenderPipelineMaterialDescriptorGeneratorUtility.cs
+++ b/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialDescriptorGeneratorUtility.cs
@@ -2,11 +2,16 @@ using UniGLTF;
namespace UniVRM10
{
- public static class Vrm10MaterialDescriptorGeneratorDescriptorUtility
+ public static class Vrm10MaterialDescriptorGeneratorUtility
{
public static IMaterialDescriptorGenerator GetValidVrm10MaterialDescriptorGenerator()
{
- return MaterialDescriptorGeneratorUtility.GetRenderPipelineType() switch
+ return GetVrm10MaterialDescriptorGenerator(RenderPipelineUtility.GetRenderPipelineType());
+ }
+
+ public static IMaterialDescriptorGenerator GetVrm10MaterialDescriptorGenerator(RenderPipelineTypes renderPipelineType)
+ {
+ return renderPipelineType switch
{
RenderPipelineTypes.UniversalRenderPipeline => new UrpVrm10MaterialDescriptorGenerator(),
RenderPipelineTypes.BuiltinRenderPipeline => new BuiltInVrm10MaterialDescriptorGenerator(),
diff --git a/Assets/VRM10/Runtime/IO/Material/URP/Import/VRM10RenderPipelineMaterialDescriptorGeneratorUtility.cs.meta b/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialDescriptorGeneratorUtility.cs.meta
similarity index 100%
rename from Assets/VRM10/Runtime/IO/Material/URP/Import/VRM10RenderPipelineMaterialDescriptorGeneratorUtility.cs.meta
rename to Assets/VRM10/Runtime/IO/Material/Vrm10MaterialDescriptorGeneratorUtility.cs.meta
diff --git a/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialExporterUtility.cs b/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialExporterUtility.cs
new file mode 100644
index 000000000..5f8e61397
--- /dev/null
+++ b/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialExporterUtility.cs
@@ -0,0 +1,17 @@
+using UniGLTF;
+
+namespace UniVRM10
+{
+ public static class Vrm10MaterialExporterUtility
+ {
+ public static IMaterialExporter GetValidVrm10MaterialExporter()
+ {
+ return RenderPipelineUtility.GetRenderPipelineType() switch
+ {
+ RenderPipelineTypes.UniversalRenderPipeline => throw new System.NotImplementedException(),
+ RenderPipelineTypes.BuiltinRenderPipeline => new BuiltInVrm10MaterialExporter(),
+ _ => new BuiltInVrm10MaterialExporter(),
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialExporterUtility.cs.meta b/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialExporterUtility.cs.meta
new file mode 100644
index 000000000..753c36dfc
--- /dev/null
+++ b/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialExporterUtility.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 6f58deb399404ebd81647dcf52ad7929
+timeCreated: 1722258791
\ No newline at end of file
diff --git a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs
index 2f0e8f49d..efa2ecfbb 100644
--- a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs
+++ b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs
@@ -22,19 +22,22 @@ namespace UniVRM10
public readonly string VrmExtensionName = "VRMC_vrm";
+ IMaterialExporter m_materialExporter;
ITextureSerializer m_textureSerializer;
TextureExporter m_textureExporter;
GltfExportSettings m_settings;
- public Vrm10Exporter(ITextureSerializer textureSerializer, GltfExportSettings settings)
+ public Vrm10Exporter(
+ GltfExportSettings settings,
+ IMaterialExporter materialExporter = null,
+ ITextureSerializer textureSerializer = null
+ )
{
- m_settings = settings;
-
- if (textureSerializer == null)
- {
- throw new ArgumentException(nameof(textureSerializer));
- }
+ m_settings = settings ?? throw new ArgumentException(nameof(settings));
+ m_materialExporter = materialExporter ?? Vrm10MaterialExporterUtility.GetValidVrm10MaterialExporter();
+ m_textureSerializer = textureSerializer ?? new RuntimeTextureSerializer();
+ m_textureExporter = new TextureExporter(m_textureSerializer);
Storage.Gltf.extensionsUsed.Add(glTF_KHR_texture_transform.ExtensionName);
Storage.Gltf.extensionsUsed.Add(UniGLTF.Extensions.VRMC_vrm.VRMC_vrm.ExtensionName);
@@ -42,9 +45,6 @@ namespace UniVRM10
Storage.Gltf.extensionsUsed.Add(UniGLTF.Extensions.VRMC_materials_mtoon.VRMC_materials_mtoon.ExtensionName);
Storage.Gltf.extensionsUsed.Add(UniGLTF.Extensions.VRMC_springBone.VRMC_springBone.ExtensionName);
Storage.Gltf.extensionsUsed.Add(UniGLTF.Extensions.VRMC_node_constraint.VRMC_node_constraint.ExtensionName);
-
- m_textureSerializer = textureSerializer;
- m_textureExporter = new TextureExporter(m_textureSerializer);
}
public void Dispose()
@@ -170,9 +170,8 @@ namespace UniVRM10
return reserveBytes;
}
- static IEnumerable ExportMaterials(Model model, ITextureExporter textureExporter, GltfExportSettings settings)
+ static IEnumerable ExportMaterials(Model model, IMaterialExporter materialExporter, ITextureExporter textureExporter, GltfExportSettings settings)
{
- var materialExporter = new BuiltInVrm10MaterialExporter();
foreach (Material material in model.Materials)
{
yield return materialExporter.ExportMaterial(material, textureExporter, settings);
@@ -185,7 +184,7 @@ namespace UniVRM10
Storage.Reserve(CalcReserveBytes(model));
- foreach (var material in ExportMaterials(model, m_textureExporter, m_settings))
+ foreach (var material in ExportMaterials(model, m_materialExporter, m_textureExporter, m_settings))
{
Storage.Gltf.materials.Add(material);
}
@@ -918,7 +917,11 @@ namespace UniVRM10
///
///
///
- public static byte[] Export(GameObject go, ITextureSerializer textureSerializer = null, VRM10ObjectMeta vrmMeta = null)
+ public static byte[] Export(
+ GameObject go,
+ IMaterialExporter materialExporter = null,
+ ITextureSerializer textureSerializer = null,
+ VRM10ObjectMeta vrmMeta = null)
{
using (var arrayManager = new NativeArrayManager())
{
@@ -930,7 +933,7 @@ namespace UniVRM10
model.ConvertCoordinate(VrmLib.Coordinates.Vrm1);
// Model と go から VRM-1.0 にExport
- var exporter10 = new Vrm10Exporter(textureSerializer ?? new RuntimeTextureSerializer(), new GltfExportSettings());
+ var exporter10 = new Vrm10Exporter(new GltfExportSettings(), materialExporter, textureSerializer);
var option = new VrmLib.ExportArgs
{
};
diff --git a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs
index 6fb7d0a1f..a9447fea7 100644
--- a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs
+++ b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs
@@ -41,7 +41,7 @@ namespace UniVRM10
m_useControlRig = useControlRig;
TextureDescriptorGenerator = new Vrm10TextureDescriptorGenerator(Data);
- MaterialDescriptorGenerator = materialGenerator ?? Vrm10MaterialDescriptorGeneratorDescriptorUtility.GetValidVrm10MaterialDescriptorGenerator();
+ MaterialDescriptorGenerator = materialGenerator ?? Vrm10MaterialDescriptorGeneratorUtility.GetValidVrm10MaterialDescriptorGenerator();
m_externalMap = externalObjectMap;
if (m_externalMap == null)
@@ -238,7 +238,7 @@ namespace UniVRM10
continue;
}
- CreateRenderer(node, go, map, MaterialFactory);
+ await CreateRendererAsync(node, go, map, MaterialFactory, awaitCaller);
await awaitCaller.NextFrame();
}
}
@@ -799,7 +799,7 @@ namespace UniVRM10
///
/// MeshFilter + MeshRenderer もしくは SkinnedMeshRenderer を構築する
///
- public static Renderer CreateRenderer(VrmLib.Node node, GameObject go, ModelMap map, MaterialFactory materialFactory)
+ public static async Task CreateRendererAsync(VrmLib.Node node, GameObject go, ModelMap map, MaterialFactory materialFactory, IAwaitCaller awaitCaller)
{
Renderer renderer = null;
var hasBlendShape = node.MeshGroup.Meshes[0].MorphTargets.Any();
@@ -833,35 +833,38 @@ namespace UniVRM10
}
else if (node.MeshGroup.Meshes.Count == 1)
{
- var materials = node.MeshGroup.Meshes[0].Submeshes.Select(
- x =>
+ var materialCount = node.MeshGroup.Meshes[0].Submeshes.Count;
+ var materials = new Material[materialCount];
+ for (var idx = 0; idx < materialCount; ++idx)
+ {
+ var materialIndex = node.MeshGroup.Meshes[0].Submeshes[idx].Material;
+ if (materialIndex.HasValidIndex())
{
- if (x.Material.HasValidIndex())
- {
- return materialFactory.Materials[x.Material.Value].Asset;
- }
- else
- {
- return materialFactory.DefaultMaterial;
- }
+ materials[idx] = materialFactory.Materials[materialIndex.Value].Asset;
}
- ).ToArray();
+ else
+ {
+ materials[idx] = await materialFactory.GetDefaultMaterialAsync(awaitCaller);
+ }
+ }
renderer.sharedMaterials = materials;
}
else
{
- var materials = node.MeshGroup.Meshes.Select(x =>
+ var materialCount = node.MeshGroup.Meshes.Count;
+ var materials = new Material[materialCount];
+ for (var idx = 0; idx < materialCount; ++idx)
{
- if (x.Submeshes[0].Material.HasValidIndex())
+ var materialIndex = node.MeshGroup.Meshes[idx].Submeshes[0].Material;
+ if (materialIndex.HasValidIndex())
{
- return materialFactory.Materials[x.Submeshes[0].Material.Value].Asset;
+ materials[idx] = materialFactory.Materials[materialIndex.Value].Asset;
}
else
{
- return materialFactory.DefaultMaterial;
+ materials[idx] = await materialFactory.GetDefaultMaterialAsync(awaitCaller);
}
}
- ).ToArray();
renderer.sharedMaterials = materials;
}
diff --git a/Assets/VRM10/Runtime/IO/VrmAnimationExporter.cs b/Assets/VRM10/Runtime/IO/VrmAnimationExporter.cs
index 4cda49aa5..d61369b64 100644
--- a/Assets/VRM10/Runtime/IO/VrmAnimationExporter.cs
+++ b/Assets/VRM10/Runtime/IO/VrmAnimationExporter.cs
@@ -80,7 +80,7 @@ namespace UniVRM10
public void Export(Action addFrames)
{
- base.Export(new RuntimeTextureSerializer());
+ base.Export();
addFrames(this);
diff --git a/Assets/VRM10/Settings.meta b/Assets/VRM10/Settings.meta
deleted file mode 100644
index 1a4cea139..000000000
--- a/Assets/VRM10/Settings.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 163e23db776ac5949b74480605c68c90
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/VRM10/Settings/VRM10Shaders.shadervariants b/Assets/VRM10/Settings/VRM10Shaders.shadervariants
deleted file mode 100644
index 862245327..000000000
--- a/Assets/VRM10/Settings/VRM10Shaders.shadervariants
+++ /dev/null
@@ -1,19 +0,0 @@
-%YAML 1.1
-%TAG !u! tag:unity3d.com,2011:
---- !u!200 &20000000
-ShaderVariantCollection:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_Name: VRM10Shaders
- m_Shaders:
- - first: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
- second:
- variants: []
- - first: {fileID: 4800000, guid: e0edbf68d81d1f340ae8b110086b7063, type: 3}
- second:
- variants: []
- - first: {fileID: 4800000, guid: 8c17b56f4bf084c47872edcb95237e4a, type: 3}
- second:
- variants: []
diff --git a/Assets/VRM10/Settings/VRM10Shaders.shadervariants.meta b/Assets/VRM10/Settings/VRM10Shaders.shadervariants.meta
deleted file mode 100644
index d725f5ce2..000000000
--- a/Assets/VRM10/Settings/VRM10Shaders.shadervariants.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 58f01bf8180084642a5f4c17a3c8cd4b
-NativeFormatImporter:
- externalObjects: {}
- mainObjectFileID: 0
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/VRM10/Tests/ApiSampleTests.cs b/Assets/VRM10/Tests/ApiSampleTests.cs
index 326a2eee3..3f9d1f58f 100644
--- a/Assets/VRM10/Tests/ApiSampleTests.cs
+++ b/Assets/VRM10/Tests/ApiSampleTests.cs
@@ -7,49 +7,20 @@ namespace UniVRM10.Test
{
public class ApiSampleTests
{
- VrmLib.Model ReadModel(string path)
- {
- var bytes = MigrationVrm.Migrate(File.ReadAllBytes(path));
-
- var data = new GlbLowLevelParser(path, bytes).Parse();
-
- var model = ModelReader.Read(data);
- return model;
- }
-
- GameObject BuildGameObject(Vrm10Data data, bool showMesh)
- {
- using (var loader = new Vrm10Importer(data, null))
- {
- var loaded = loader.Load();
- if (showMesh)
- {
- loaded.ShowMeshes();
- }
- loaded.EnableUpdateWhenOffscreen();
- return loaded.gameObject;
- }
- }
-
[Test]
public void Sample()
{
var path = "Tests/Models/Alicia_vrm-0.51/AliciaSolid_vrm-0.51.vrm";
Debug.Log($"load: {path}");
- using (var data = new GlbFileParser(path).Parse())
- using (var migrated = Vrm10Data.Migrate(data, out Vrm10Data result, out MigrationData migration))
- {
- Assert.NotNull(result);
+ var instance = TestVrm10.LoadPathAsBuiltInRP(path, canLoadVrm0X: true);
+ Assert.NotNull(instance);
- var go = BuildGameObject(result, true);
- Debug.Log(go);
+ var go = instance.gameObject;
+ Debug.Log(go);
- // export
- var vrmBytes = Vrm10Exporter.Export(go, new EditorTextureSerializer());
-
- Debug.Log($"export {vrmBytes.Length} bytes");
- }
+ var vrmBytes = TestVrm10.ExportAsBuiltInRP(go);
+ Debug.Log($"export {vrmBytes.Length} bytes");
}
}
}
diff --git a/Assets/VRM10/Tests/MigrationTests.cs b/Assets/VRM10/Tests/MigrationTests.cs
index 09add1b02..999584449 100644
--- a/Assets/VRM10/Tests/MigrationTests.cs
+++ b/Assets/VRM10/Tests/MigrationTests.cs
@@ -197,7 +197,7 @@ namespace UniVRM10
{
try
{
- Vrm10.LoadPathAsync(gltf.FullName, true, controlRigGenerationOption: ControlRigGenerationOption.None).Wait();
+ TestVrm10.LoadPathAsBuiltInRP(gltf.FullName);
}
catch (UnNormalizedException)
{
@@ -372,7 +372,7 @@ namespace UniVRM10
new Color(2.0f, 2.0f, 2.0f, 1),
};
- var instance106 = Vrm10.LoadBytesAsync(model106, awaitCaller: new ImmediateCaller()).Result;
+ var instance106 = TestVrm10.LoadBytesAsBuiltInRP(model106);
var materials106 = instance106.GetComponent().Materials;
Assert.AreEqual(materialCount, materials106.Count);
for (var idx = 0; idx < materialCount; ++idx)
@@ -384,7 +384,7 @@ namespace UniVRM10
if (correctEmissions[idx].HasValue) AssertAreApproximatelyEqualColor(correctEmissions[idx].Value, material.GetColor(emissionName));
}
- var instance107 = Vrm10.LoadBytesAsync(model107, awaitCaller: new ImmediateCaller()).Result;
+ var instance107 = TestVrm10.LoadBytesAsBuiltInRP(model107);
var materials107 = instance107.GetComponent().Materials;
Assert.AreEqual(materialCount, materials107.Count);
for (var idx = 0; idx < materialCount; ++idx)
diff --git a/Assets/VRM10/Tests/TestAsset.cs b/Assets/VRM10/Tests/TestAsset.cs
index 6077c2c44..5982583ee 100644
--- a/Assets/VRM10/Tests/TestAsset.cs
+++ b/Assets/VRM10/Tests/TestAsset.cs
@@ -16,10 +16,7 @@ namespace UniVRM10
public static Vrm10Instance LoadAlicia()
{
- var task = Vrm10.LoadPathAsync(AliciaPath, canLoadVrm0X: true);
- task.Wait();
- var instance = task.Result;
-
+ var instance = TestVrm10.LoadPathAsBuiltInRP(AliciaPath, canLoadVrm0X: true);
return instance.GetComponent();
}
}
diff --git a/Assets/VRM10/Tests/TestVrm10.cs b/Assets/VRM10/Tests/TestVrm10.cs
new file mode 100644
index 000000000..108c6d321
--- /dev/null
+++ b/Assets/VRM10/Tests/TestVrm10.cs
@@ -0,0 +1,37 @@
+using UniGLTF;
+using UnityEngine;
+
+namespace UniVRM10
+{
+ public static class TestVrm10
+ {
+ public static Vrm10Instance LoadBytesAsBuiltInRP(byte[] bytes, bool canLoadVrm0X = true)
+ {
+ return Vrm10.LoadBytesAsync(
+ bytes,
+ canLoadVrm0X: canLoadVrm0X,
+ awaitCaller: new ImmediateCaller(),
+ materialGenerator: new BuiltInVrm10MaterialDescriptorGenerator()
+ ).Result;
+ }
+
+ public static Vrm10Instance LoadPathAsBuiltInRP(string path, bool canLoadVrm0X = true)
+ {
+ return Vrm10.LoadPathAsync(
+ path,
+ canLoadVrm0X: canLoadVrm0X,
+ awaitCaller: new ImmediateCaller(),
+ materialGenerator: new BuiltInVrm10MaterialDescriptorGenerator()
+ ).Result;
+ }
+
+ public static byte[] ExportAsBuiltInRP(GameObject gameObject)
+ {
+ return Vrm10Exporter.Export(
+ gameObject,
+ materialExporter: new BuiltInVrm10MaterialExporter(),
+ textureSerializer: new EditorTextureSerializer()
+ );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/VRM10/Tests/TestVrm10.cs.meta b/Assets/VRM10/Tests/TestVrm10.cs.meta
new file mode 100644
index 000000000..69837185f
--- /dev/null
+++ b/Assets/VRM10/Tests/TestVrm10.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 4c9e0897ac194db3b7a55132871e6d75
+timeCreated: 1722265007
\ No newline at end of file
diff --git a/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10RuntimeExporter.cs b/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10RuntimeExporter.cs
index 76c5ebc2c..f76da8c6b 100644
--- a/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10RuntimeExporter.cs
+++ b/Assets/VRM10_Samples/VRM10RuntimeExporterSample/VRM10RuntimeExporter.cs
@@ -142,10 +142,7 @@ namespace UniVRM10.RuntimeExporterSample
model.ConvertCoordinate(VrmLib.Coordinates.Vrm1, ignoreVrm: false);
// export vrm-1.0
- var exporter = new UniVRM10.Vrm10Exporter(new RuntimeTextureSerializer(), new GltfExportSettings
- {
-
- });
+ var exporter = new Vrm10Exporter(new GltfExportSettings());
exporter.Export(root, model, converter, new VrmLib.ExportArgs
{
}, meta);