/// <summary> /// ヒエラルキーからエクスポートする Mesh の情報を収集する /// </summary> /// <param name="root"></param> /// <param name="list"></param> /// <param name="settings"></param> /// <param name="blendShapeFilter"> blendShape の export を filtering する </param> public void GetInfo(IEnumerable <Transform> nodes, GltfExportSettings settings) { m_list.Clear(); foreach (var node in nodes) { var renderer = node.GetComponent <Renderer>(); if (renderer == null) { continue; } var found = m_list.FirstOrDefault(x => x.IsSameMeshAndMaterials(renderer)); if (found != null) { found.PushRenderer(renderer); continue; } var info = new MeshExportInfo(renderer, settings); if (info.Mesh != null) { m_list.Add(info); } } }
public VRMExporter(ExportingGltfData data, GltfExportSettings exportSettings) : base(data, exportSettings) { if (exportSettings == null || exportSettings.InverseAxis != Vrm0xSpecificationInverseAxis) { throw new Exception($"VRM specification requires InverseAxis settings as {Vrm0xSpecificationInverseAxis}"); } _gltf.extensionsUsed.Add(glTF_VRM_extensions.ExtensionName); }
public static ExportingGltfData Export(GltfExportSettings configuration, GameObject go, ITextureSerializer textureSerializer) { var data = new ExportingGltfData(); using (var exporter = new VRMExporter(data, configuration)) { exporter.Prepare(go); exporter.Export(textureSerializer); } return data; }
public static glTF Export(GltfExportSettings configuration, GameObject go, ITextureSerializer textureSerializer) { var gltf = new glTF(); using (var exporter = new VRMExporter(gltf)) { exporter.Prepare(go); exporter.Export(configuration, textureSerializer); } return(gltf); }
public Vrm10Exporter(ITextureSerializer textureSerializer, GltfExportSettings settings) { m_settings = settings; if (textureSerializer == null) { throw new ArgumentException(nameof(textureSerializer)); } Storage.Gltf.extensionsUsed.Add(glTF_KHR_texture_transform.ExtensionName); Storage.Gltf.extensionsUsed.Add(UniGLTF.Extensions.VRMC_vrm.VRMC_vrm.ExtensionName); Storage.Gltf.extensionsUsed.Add(glTF_KHR_materials_unlit.ExtensionName); 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 override glTFMaterial ExportMaterial(Material m, ITextureExporter textureExporter, GltfExportSettings settings) { if (Vrm10MToonMaterialExporter.TryExportMaterialAsMToon(m, textureExporter, out var dst)) { return(dst); } else { return(base.ExportMaterial(m, textureExporter, settings)); } }
static IEnumerable <glTFMaterial> ExportMaterials(Model model, ITextureExporter textureExporter, GltfExportSettings settings) { var materialExporter = new Vrm10MaterialExporter(); foreach (Material material in model.Materials) { yield return(materialExporter.ExportMaterial(material, textureExporter, settings)); } }