From 2336a280673e1f01122d1ebff939a8e0ef02f01e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 30 Mar 2021 15:32:46 +0900 Subject: [PATCH] WIP vrm, material --- Assets/VRM10/Runtime/IO/ImageAdapter.cs | 100 ------ Assets/VRM10/Runtime/IO/ImageAdapter.cs.meta | 11 - Assets/VRM10/Runtime/IO/MToonAdapter.cs | 131 -------- Assets/VRM10/Runtime/IO/MToonAdapter.cs.meta | 11 - .../Runtime/IO/MToonUtilsFromDefinition.cs | 312 ------------------ .../IO/MToonUtilsFromDefinition.cs.meta | 11 - Assets/VRM10/Runtime/IO/MaterialAdapter.cs | 128 ------- .../VRM10/Runtime/IO/MaterialAdapter.cs.meta | 11 - Assets/VRM10/Runtime/IO/TextureAdapter.cs | 21 -- .../VRM10/Runtime/IO/TextureAdapter.cs.meta | 11 - Assets/VRM10/Runtime/IO/Vrm10Exporter.cs | 62 ---- .../Runtime/IO/Vrm10ExporterExtensions.cs | 23 -- .../VRM10/Runtime/IO/VrmExpressionAdapter.cs | 236 ------------- .../Runtime/IO/VrmExpressionAdapter.cs.meta | 11 - .../VRM10/Runtime/IO/VrmFirstPersonAdapter.cs | 57 ---- .../Runtime/IO/VrmFirstPersonAdapter.cs.meta | 11 - Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs | 64 ---- .../VRM10/Runtime/IO/VrmLookAtAdapter.cs.meta | 11 - Assets/VRM10/Runtime/IO/VrmMetaAdapter.cs | 100 ------ .../VRM10/Runtime/IO/VrmMetaAdapter.cs.meta | 11 - .../VRM10/Runtime/IO/VrmSpringBoneAdapter.cs | 111 ------- .../Runtime/IO/VrmSpringBoneAdapter.cs.meta | 11 - Assets/VRM10/Tests/SerializationTests.cs | 116 +++---- 23 files changed, 45 insertions(+), 1526 deletions(-) delete mode 100644 Assets/VRM10/Runtime/IO/ImageAdapter.cs delete mode 100644 Assets/VRM10/Runtime/IO/ImageAdapter.cs.meta delete mode 100644 Assets/VRM10/Runtime/IO/MToonAdapter.cs delete mode 100644 Assets/VRM10/Runtime/IO/MToonAdapter.cs.meta delete mode 100644 Assets/VRM10/Runtime/IO/MToonUtilsFromDefinition.cs delete mode 100644 Assets/VRM10/Runtime/IO/MToonUtilsFromDefinition.cs.meta delete mode 100644 Assets/VRM10/Runtime/IO/MaterialAdapter.cs delete mode 100644 Assets/VRM10/Runtime/IO/MaterialAdapter.cs.meta delete mode 100644 Assets/VRM10/Runtime/IO/TextureAdapter.cs delete mode 100644 Assets/VRM10/Runtime/IO/TextureAdapter.cs.meta delete mode 100644 Assets/VRM10/Runtime/IO/VrmExpressionAdapter.cs delete mode 100644 Assets/VRM10/Runtime/IO/VrmExpressionAdapter.cs.meta delete mode 100644 Assets/VRM10/Runtime/IO/VrmFirstPersonAdapter.cs delete mode 100644 Assets/VRM10/Runtime/IO/VrmFirstPersonAdapter.cs.meta delete mode 100644 Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs delete mode 100644 Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs.meta delete mode 100644 Assets/VRM10/Runtime/IO/VrmMetaAdapter.cs delete mode 100644 Assets/VRM10/Runtime/IO/VrmMetaAdapter.cs.meta delete mode 100644 Assets/VRM10/Runtime/IO/VrmSpringBoneAdapter.cs delete mode 100644 Assets/VRM10/Runtime/IO/VrmSpringBoneAdapter.cs.meta diff --git a/Assets/VRM10/Runtime/IO/ImageAdapter.cs b/Assets/VRM10/Runtime/IO/ImageAdapter.cs deleted file mode 100644 index d6bfda66f..000000000 --- a/Assets/VRM10/Runtime/IO/ImageAdapter.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using UniGLTF; - -namespace UniVRM10 -{ - public static class ImageAdapter - { - public static VrmLib.Image FromGltf(this glTFImage x, Vrm10Storage storage) - { - if (x.bufferView == -1) - { - // 外部参照? - throw new Exception(); - } - - var view = storage.Gltf.bufferViews[x.bufferView]; - - var buffer = storage.Gltf.buffers[view.buffer]; - - // テクスチャの用途を調べる - var usage = default(VrmLib.ImageUsage); - foreach (var material in storage.Gltf.materials) - { - var colorImage = GetColorImage(storage, material); - if (colorImage == x) - { - usage |= VrmLib.ImageUsage.Color; - } - - var normalImage = GetNormalImage(storage, material); - if (normalImage == x) - { - usage |= VrmLib.ImageUsage.Normal; - } - } - - var memory = storage.GetBufferBytes(buffer); - return new VrmLib.Image(x.name, - x.mimeType, - usage, - memory.Slice(view.byteOffset, view.byteLength)); - } - - static glTFImage GetTexture(Vrm10Storage storage, int index) - { - if (index < 0 || index >= storage.Gltf.textures.Count) - { - return null; - } - var texture = storage.Gltf.textures[index]; - if (texture.source < 0 || texture.source >= storage.Gltf.images.Count) - { - return null; - } - return storage.Gltf.images[texture.source]; - } - - static glTFImage GetColorImage(Vrm10Storage storage, glTFMaterial m) - { - if (m.pbrMetallicRoughness == null) - { - return null; - } - if (m.pbrMetallicRoughness.baseColorTexture == null) - { - return null; - } - if (!m.pbrMetallicRoughness.baseColorTexture.index.TryGetValidIndex(storage.TextureCount, out int index)) - { - return null; - } - return GetTexture(storage, index); - } - - static glTFImage GetNormalImage(Vrm10Storage storage, glTFMaterial m) - { - if (m.normalTexture == null) - { - return null; - } - if (!m.normalTexture.index.TryGetValidIndex(storage.TextureCount, out int index)) - { - return null; - } - return GetTexture(storage, index); - } - - public static glTFImage ToGltf(this VrmLib.Image src, Vrm10Storage storage) - { - var viewIndex = storage.AppendToBuffer(0, src.Bytes); - var gltf = storage.Gltf; - return new glTFImage - { - name = src.Name, - mimeType = src.MimeType, - bufferView = viewIndex, - }; - } - } -} \ No newline at end of file diff --git a/Assets/VRM10/Runtime/IO/ImageAdapter.cs.meta b/Assets/VRM10/Runtime/IO/ImageAdapter.cs.meta deleted file mode 100644 index efc311140..000000000 --- a/Assets/VRM10/Runtime/IO/ImageAdapter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d48a6bb715d0d024fa5af64bb63f695e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/MToonAdapter.cs b/Assets/VRM10/Runtime/IO/MToonAdapter.cs deleted file mode 100644 index 15151d0e3..000000000 --- a/Assets/VRM10/Runtime/IO/MToonAdapter.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Collections.Generic; -using VrmLib.MToon; -using VrmLib; -using UniGLTF; -using UniGLTF.Extensions.VRMC_materials_mtoon; - - -namespace UniVRM10 -{ - public static class MToonAdapter - { - static (string, bool) GetRenderMode(RenderMode mode) - { - switch (mode) - { - case RenderMode.Opaque: return ("OPAQUE", false); - case RenderMode.Cutout: return ("MASK", false); - case RenderMode.Transparent: return ("BLEND", false); - case RenderMode.TransparentWithZWrite: return ("BLEND", true); - } - - throw new NotImplementedException(); - } - - public static glTFMaterial MToonToGltf(this MToonMaterial mtoon, List textures) - { - var material = mtoon.UnlitToGltf(textures); - - var dst = new VRMC_materials_mtoon(); - - // Color - material.pbrMetallicRoughness.baseColorFactor = mtoon.Definition.Color.LitColor.ToFloat4(); - if (mtoon.Definition.Color.LitMultiplyTexture != null) - { - material.pbrMetallicRoughness.baseColorTexture = new glTFMaterialBaseColorTextureInfo - { - index = mtoon.Definition.Color.LitMultiplyTexture.ToIndex(textures).Value - }; - } - dst.ShadeFactor = mtoon.Definition.Color.ShadeColor.ToFloat3(); - dst.ShadeMultiplyTexture = mtoon.Definition.Color.ShadeMultiplyTexture.ToIndex(textures); - material.alphaCutoff = mtoon.Definition.Color.CutoutThresholdValue; - - // Outline - dst.OutlineColorMode = (UniGLTF.Extensions.VRMC_materials_mtoon.OutlineColorMode)mtoon.Definition.Outline.OutlineColorMode; - dst.OutlineFactor = mtoon.Definition.Outline.OutlineColor.ToFloat3(); - dst.OutlineLightingMixFactor = mtoon.Definition.Outline.OutlineLightingMixValue; - dst.OutlineScaledMaxDistanceFactor = mtoon.Definition.Outline.OutlineScaledMaxDistanceValue; - dst.OutlineWidthMode = (UniGLTF.Extensions.VRMC_materials_mtoon.OutlineWidthMode)mtoon.Definition.Outline.OutlineWidthMode; - dst.OutlineWidthFactor = mtoon.Definition.Outline.OutlineWidthValue; - dst.OutlineWidthMultiplyTexture = mtoon.Definition.Outline.OutlineWidthMultiplyTexture.ToIndex(textures); - - // Emission - material.emissiveFactor = mtoon.Definition.Emission.EmissionColor.ToFloat3(); - if (mtoon.Definition.Emission.EmissionMultiplyTexture != null) - { - material.emissiveTexture = new glTFMaterialEmissiveTextureInfo - { - index = textures.IndexOfNullable(mtoon.Definition.Emission.EmissionMultiplyTexture.Texture).Value - }; - } - - // Light - dst.GiIntensityFactor = mtoon.Definition.Lighting.LightingInfluence.GiIntensityValue; - dst.LightColorAttenuationFactor = mtoon.Definition.Lighting.LightingInfluence.LightColorAttenuationValue; - dst.ShadingShiftFactor = mtoon.Definition.Lighting.LitAndShadeMixing.ShadingShiftValue; - dst.ShadingToonyFactor = mtoon.Definition.Lighting.LitAndShadeMixing.ShadingToonyValue; - if (mtoon.Definition.Lighting.Normal.NormalTexture != null) - { - material.normalTexture = new glTFMaterialNormalTextureInfo - { - index = textures.IndexOfNullable(mtoon.Definition.Lighting.Normal.NormalTexture.Texture).Value, - scale = mtoon.Definition.Lighting.Normal.NormalScaleValue - }; - } - - // matcap - dst.AdditiveTexture = mtoon.Definition.MatCap.AdditiveTexture.ToIndex(textures); - - // rendering - switch (mtoon.Definition.Rendering.CullMode) - { - case CullMode.Back: - material.doubleSided = false; - break; - - case CullMode.Off: - material.doubleSided = true; - break; - - case CullMode.Front: - // GLTF not support - material.doubleSided = false; - break; - - default: - throw new NotImplementedException(); - } - (material.alphaMode, dst.TransparentWithZWrite) = GetRenderMode(mtoon.Definition.Rendering.RenderMode); - dst.RenderQueueOffsetNumber = mtoon.Definition.Rendering.RenderQueueOffsetNumber; - - // rim - dst.RimFactor = mtoon.Definition.Rim.RimColor.ToFloat3(); - dst.RimMultiplyTexture = mtoon.Definition.Rim.RimMultiplyTexture.ToIndex(textures); - dst.RimLiftFactor = mtoon.Definition.Rim.RimLiftValue; - dst.RimFresnelPowerFactor = mtoon.Definition.Rim.RimFresnelPowerValue; - dst.RimLightingMixFactor = mtoon.Definition.Rim.RimLightingMixValue; - - // texture option - dst.UvAnimationMaskTexture = mtoon.Definition.TextureOption.UvAnimationMaskTexture.ToIndex(textures); - dst.UvAnimationRotationSpeedFactor = mtoon.Definition.TextureOption.UvAnimationRotationSpeedValue; - dst.UvAnimationScrollXSpeedFactor = mtoon.Definition.TextureOption.UvAnimationScrollXSpeedValue; - dst.UvAnimationScrollYSpeedFactor = mtoon.Definition.TextureOption.UvAnimationScrollYSpeedValue; - if (material.pbrMetallicRoughness.baseColorTexture != null) - { - var offset = mtoon.Definition.TextureOption.MainTextureLeftBottomOriginOffset; - var scale = mtoon.Definition.TextureOption.MainTextureLeftBottomOriginScale; - glTF_KHR_texture_transform.Serialize( - material.pbrMetallicRoughness.baseColorTexture, - (offset.X, offset.Y), - (scale.X, scale.Y) - ); - } - - UniGLTF.Extensions.VRMC_materials_mtoon.GltfSerializer.SerializeTo(ref material.extensions, dst); - - return material; - } - } -} diff --git a/Assets/VRM10/Runtime/IO/MToonAdapter.cs.meta b/Assets/VRM10/Runtime/IO/MToonAdapter.cs.meta deleted file mode 100644 index 363b4ce47..000000000 --- a/Assets/VRM10/Runtime/IO/MToonAdapter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dfbed4ddbad0e1941862133ed8219c4c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/MToonUtilsFromDefinition.cs b/Assets/VRM10/Runtime/IO/MToonUtilsFromDefinition.cs deleted file mode 100644 index 06cdb74c6..000000000 --- a/Assets/VRM10/Runtime/IO/MToonUtilsFromDefinition.cs +++ /dev/null @@ -1,312 +0,0 @@ -using Color = System.Numerics.Vector4; -using Material = UniGLTF.glTFMaterial; -using System.Collections.Generic; -using VrmLib; -using VrmLib.MToon; -using System; - -namespace UniVRM10 -{ - public static partial class Utils - { - public static void ToProtobuf(this LinearColor color, Action add, bool hasAlpha) - { - add(color.RGBA.X); - add(color.RGBA.Y); - add(color.RGBA.Z); - if (hasAlpha) - { - add(color.RGBA.W); - } - } - - // public static void SetMToonParametersToMaterial(Material material, MToonDefinition parameters, List textures) - // { - // var mtoon = material.Extensions.VRMCMaterialsMtoon; - - // { - // var meta = parameters.Meta; - // mtoon.Version = meta.VersionNumber.ToString(); - // } - // // TODO: - // // { - // // var rendering = parameters.Rendering; - // // ValidateBlendMode(material, rendering.RenderMode, isChangedByUser: true); - // // ValidateCullMode(material, rendering.CullMode); - // // ValidateRenderQueue(material, offset: rendering.RenderQueueOffsetNumber); - // // } - // { - // var color = parameters.Color; - - // // SetColor(material, MToonUtils.PropColor, color.LitColor); - // color.LitColor.ToProtobuf(mtoon.LitFactor.Add, true); - - // // SetTexture(material, MToonUtils.PropMainTex, color.LitMultiplyTexture, textures); - // mtoon.LitMultiplyTexture = textures.IndexOfNullable(color.LitMultiplyTexture.Texture); - - // // SetColor(material, MToonUtils.PropShadeColor, color.ShadeColor); - // color.ShadeColor.ToProtobuf(mtoon.ShadeFactor.Add, false); - - // // SetTexture(material, MToonUtils.PropShadeTexture, color.ShadeMultiplyTexture, textures); - // mtoon.ShadeMultiplyTexture = textures.IndexOfNullable(color.ShadeMultiplyTexture.Texture); - - // // SetValue(material, MToonUtils.PropCutoff, color.CutoutThresholdValue); - // mtoon.CutoutThresholdFactor = color.CutoutThresholdValue; - // } - // { - // var lighting = parameters.Lighting; - // { - // var prop = lighting.LitAndShadeMixing; - // // SetValue(material, MToonUtils.PropShadeShift, prop.ShadingShiftValue); - // mtoon.ShadingShiftFactor = prop.ShadingShiftValue; - - // // SetValue(material, MToonUtils.PropShadeToony, prop.ShadingToonyValue); - // mtoon.ShadingToonyFactor = prop.ShadingToonyValue; - // } - // { - // var prop = lighting.LightingInfluence; - // // SetValue(material, MToonUtils.PropLightColorAttenuation, prop.LightColorAttenuationValue); - // mtoon.LightColorAttenuationFactor = prop.LightColorAttenuationValue; - - // // SetValue(material, MToonUtils.PropIndirectLightIntensity, prop.GiIntensityValue); - // mtoon.GiIntensityFactor = prop.GiIntensityValue; - // } - // { - // var prop = lighting.Normal; - // // SetTexture(material, MToonUtils.PropBumpMap, prop.NormalTexture, textures); - // mtoon.NormalTexture = textures.IndexOfNullable(prop.NormalTexture.Texture); - - // // SetValue(material, MToonUtils.PropBumpScale, prop.NormalScaleValue); - // mtoon.NormalScaleFactor = prop.NormalScaleValue; - // } - // } - // { - // var emission = parameters.Emission; - // // SetColor(material, MToonUtils.PropEmissionColor, emission.EmissionColor); - // emission.EmissionColor.ToProtobuf(mtoon.EmissionFactor.Add, false); - - // // SetTexture(material, MToonUtils.PropEmissionMap, emission.EmissionMultiplyTexture, textures); - // mtoon.EmissionMultiplyTexture = textures.IndexOfNullable(emission.EmissionMultiplyTexture.Texture); - // } - // { - // var matcap = parameters.MatCap; - // // SetTexture(material, MToonUtils.PropSphereAdd, matcap.AdditiveTexture, textures); - // mtoon.AdditiveTexture = textures.IndexOfNullable(matcap.AdditiveTexture.Texture); - // } - // { - // var rim = parameters.Rim; - // // SetColor(material, MToonUtils.PropRimColor, rim.RimColor); - // rim.RimColor.ToProtobuf(mtoon.RimFactor.Add, false); - - // // SetTexture(material, MToonUtils.PropRimTexture, rim.RimMultiplyTexture, textures); - // mtoon.RimMultiplyTexture = textures.IndexOfNullable(rim.RimMultiplyTexture.Texture); - - // // SetValue(material, MToonUtils.PropRimLightingMix, rim.RimLightingMixValue); - // mtoon.RimLightingMixFactor = rim.RimLightingMixValue; - - // // SetValue(material, MToonUtils.PropRimFresnelPower, rim.RimFresnelPowerValue); - // mtoon.RimFresnelPowerFactor = rim.RimFresnelPowerValue; - - // // SetValue(material, MToonUtils.PropRimLift, rim.RimLiftValue); - // mtoon.RimLiftFactor = rim.RimLiftValue; - // } - // { - // var outline = parameters.Outline; - // // SetValue(material, MToonUtils.PropOutlineWidth, outline.OutlineWidthValue); - // mtoon.OutlineWidthFactor = outline.OutlineWidthValue; - - // // SetTexture(material, MToonUtils.PropOutlineWidthTexture, outline.OutlineWidthMultiplyTexture, textures); - // mtoon.OutlineWidthMultiplyTexture = textures.IndexOfNullable(outline.OutlineWidthMultiplyTexture.Texture); - - // // SetValue(material, MToonUtils.PropOutlineScaledMaxDistance, outline.OutlineScaledMaxDistanceValue); - // mtoon.OutlineScaledMaxDistanceFactor = outline.OutlineScaledMaxDistanceValue; - - // // SetColor(material, MToonUtils.PropOutlineColor, outline.OutlineColor); - // outline.OutlineColor.ToProtobuf(mtoon.OutlineFactor.Add, false); - - // // SetValue(material, MToonUtils.PropOutlineLightingMix, outline.OutlineLightingMixValue); - // mtoon.OutlineLightingMixFactor = outline.OutlineLightingMixValue; - - // // ValidateOutlineMode(material, outline.OutlineWidthMode, outline.OutlineColorMode); - // } - // { - // var textureOptions = parameters.TextureOption; - // // TODO: - // // material.SetTextureScale(MToonUtils.PropMainTex, textureOptions.MainTextureLeftBottomOriginScale); - // // material.SetTextureOffset(MToonUtils.PropMainTex, textureOptions.MainTextureLeftBottomOriginOffset); - - // // material.SetTexture(MToonUtils.PropUvAnimMaskTexture, textureOptions.UvAnimationMaskTexture, textures); - // mtoon.UvAnimationMaskTexture = textures.IndexOfNullable(textureOptions.UvAnimationMaskTexture.Texture); - - // // material.SetFloat(MToonUtils.PropUvAnimScrollX, textureOptions.UvAnimationScrollXSpeedValue); - // mtoon.UvAnimationScrollXSpeedFactor = textureOptions.UvAnimationScrollXSpeedValue; - - // // material.SetFloat(MToonUtils.PropUvAnimScrollY, textureOptions.UvAnimationScrollYSpeedValue); - // mtoon.UvAnimationScrollYSpeedFactor = textureOptions.UvAnimationScrollYSpeedValue; - - // // material.SetFloat(MToonUtils.PropUvAnimRotation, textureOptions.UvAnimationRotationSpeedValue); - // mtoon.UvAnimationRotationSpeedFactor = textureOptions.UvAnimationRotationSpeedValue; - // } - // } - - // /// - // /// Validate properties and Set hidden properties, keywords. - // /// if isBlendModeChangedByUser is true, renderQueue will set specified render mode's default value. - // /// - // /// - // /// - // public static void ValidateProperties(Material material, List textures, bool isBlendModeChangedByUser = false) - // { - // ValidateBlendMode(material, (RenderMode)material.GetFloat(MToonUtils.PropBlendMode), isBlendModeChangedByUser); - // ValidateNormalMode(material, material.GetTexture(MToonUtils.PropBumpMap, textures) != null); - // ValidateOutlineMode(material, - // (OutlineWidthMode)material.GetFloat(MToonUtils.PropOutlineWidthMode), - // (OutlineColorMode)material.GetFloat(MToonUtils.PropOutlineColorMode)); - // ValidateDebugMode(material, (DebugMode)material.GetFloat(MToonUtils.PropDebugMode)); - // ValidateCullMode(material, (CullMode)material.GetFloat(MToonUtils.PropCullMode)); - - // var mainTex = material.GetTexture(MToonUtils.PropMainTex, textures); - // var shadeTex = material.GetTexture(MToonUtils.PropShadeTexture, textures); - // if (mainTex != null && shadeTex == null) - // { - // material.SetTexture(MToonUtils.PropShadeTexture, mainTex, textures); - // } - // } - - // private static void ValidateDebugMode(Material material, DebugMode debugMode) - // { - // switch (debugMode) - // { - // case DebugMode.None: - // SetKeyword(material, MToonUtils.KeyDebugNormal, false); - // SetKeyword(material, MToonUtils.KeyDebugLitShadeRate, false); - // break; - // case DebugMode.Normal: - // SetKeyword(material, MToonUtils.KeyDebugNormal, true); - // SetKeyword(material, MToonUtils.KeyDebugLitShadeRate, false); - // break; - // case DebugMode.LitShadeRate: - // SetKeyword(material, MToonUtils.KeyDebugNormal, false); - // SetKeyword(material, MToonUtils.KeyDebugLitShadeRate, true); - // break; - // } - // } - - // public static void ValidateBlendMode(Material material, RenderMode renderMode, bool isChangedByUser) - // { - // switch (renderMode) - // { - // case RenderMode.Opaque: - // material.SetOverrideTag(MToonUtils.TagRenderTypeKey, MToonUtils.TagRenderTypeValueOpaque); - // material.SetInt(MToonUtils.PropSrcBlend, BlendMode.One); - // material.SetInt(MToonUtils.PropDstBlend, BlendMode.Zero); - // material.SetInt(MToonUtils.PropZWrite, MToonUtils.EnabledIntValue); - // material.SetInt(MToonUtils.PropAlphaToMask, MToonUtils.DisabledIntValue); - // SetKeyword(material, MToonUtils.KeyAlphaTestOn, false); - // SetKeyword(material, MToonUtils.KeyAlphaBlendOn, false); - // SetKeyword(material, MToonUtils.KeyAlphaPremultiplyOn, false); - // break; - // case RenderMode.Cutout: - // material.SetOverrideTag(MToonUtils.TagRenderTypeKey, MToonUtils.TagRenderTypeValueTransparentCutout); - // material.SetInt(MToonUtils.PropSrcBlend, BlendMode.One); - // material.SetInt(MToonUtils.PropDstBlend, BlendMode.Zero); - // material.SetInt(MToonUtils.PropZWrite, MToonUtils.EnabledIntValue); - // material.SetInt(MToonUtils.PropAlphaToMask, MToonUtils.EnabledIntValue); - // SetKeyword(material, MToonUtils.KeyAlphaTestOn, true); - // SetKeyword(material, MToonUtils.KeyAlphaBlendOn, false); - // SetKeyword(material, MToonUtils.KeyAlphaPremultiplyOn, false); - // break; - // case RenderMode.Transparent: - // material.SetOverrideTag(MToonUtils.TagRenderTypeKey, MToonUtils.TagRenderTypeValueTransparent); - // material.SetInt(MToonUtils.PropSrcBlend, BlendMode.SrcAlpha); - // material.SetInt(MToonUtils.PropDstBlend, BlendMode.OneMinusSrcAlpha); - // material.SetInt(MToonUtils.PropZWrite, MToonUtils.DisabledIntValue); - // material.SetInt(MToonUtils.PropAlphaToMask, MToonUtils.DisabledIntValue); - // SetKeyword(material, MToonUtils.KeyAlphaTestOn, false); - // SetKeyword(material, MToonUtils.KeyAlphaBlendOn, true); - // SetKeyword(material, MToonUtils.KeyAlphaPremultiplyOn, false); - // break; - // case RenderMode.TransparentWithZWrite: - // material.SetOverrideTag(MToonUtils.TagRenderTypeKey, MToonUtils.TagRenderTypeValueTransparent); - // material.SetInt(MToonUtils.PropSrcBlend, BlendMode.SrcAlpha); - // material.SetInt(MToonUtils.PropDstBlend, BlendMode.OneMinusSrcAlpha); - // material.SetInt(MToonUtils.PropZWrite, MToonUtils.EnabledIntValue); - // material.SetInt(MToonUtils.PropAlphaToMask, MToonUtils.DisabledIntValue); - // SetKeyword(material, MToonUtils.KeyAlphaTestOn, false); - // SetKeyword(material, MToonUtils.KeyAlphaBlendOn, true); - // SetKeyword(material, MToonUtils.KeyAlphaPremultiplyOn, false); - // break; - // } - - // if (isChangedByUser) - // { - // // ValidateRenderQueue(material, offset: 0); - // } - // else - // { - // var requirement = MToonUtils.GetRenderQueueRequirement(renderMode); - // // ValidateRenderQueue(material, offset: material.renderQueue - requirement.DefaultValue); - // } - // } - - // private static void ValidateRenderQueue(Material material, int offset) - // { - // var requirement = MToonUtils.GetRenderQueueRequirement(GetBlendMode(material)); - // var value = Mathf.Clamp(requirement.DefaultValue + offset, requirement.MinValue, requirement.MaxValue); - // material.renderQueue = value; - // } - - // private static void ValidateOutlineMode(Material material, OutlineWidthMode outlineWidthMode, - // OutlineColorMode outlineColorMode) - // { - // var isFixed = outlineColorMode == OutlineColorMode.FixedColor; - // var isMixed = outlineColorMode == OutlineColorMode.MixedLighting; - - // switch (outlineWidthMode) - // { - // case OutlineWidthMode.None: - // SetKeyword(material, MToonUtils.KeyOutlineWidthWorld, false); - // SetKeyword(material, MToonUtils.KeyOutlineWidthScreen, false); - // SetKeyword(material, MToonUtils.KeyOutlineColorFixed, false); - // SetKeyword(material, MToonUtils.KeyOutlineColorMixed, false); - // break; - // case OutlineWidthMode.WorldCoordinates: - // SetKeyword(material, MToonUtils.KeyOutlineWidthWorld, true); - // SetKeyword(material, MToonUtils.KeyOutlineWidthScreen, false); - // SetKeyword(material, MToonUtils.KeyOutlineColorFixed, isFixed); - // SetKeyword(material, MToonUtils.KeyOutlineColorMixed, isMixed); - // break; - // case OutlineWidthMode.ScreenCoordinates: - // SetKeyword(material, MToonUtils.KeyOutlineWidthWorld, false); - // SetKeyword(material, MToonUtils.KeyOutlineWidthScreen, true); - // SetKeyword(material, MToonUtils.KeyOutlineColorFixed, isFixed); - // SetKeyword(material, MToonUtils.KeyOutlineColorMixed, isMixed); - // break; - // } - // } - - // private static void ValidateNormalMode(Material material, bool requireNormalMapping) - // { - // SetKeyword(material, MToonUtils.KeyNormalMap, requireNormalMapping); - // } - - // private static void ValidateCullMode(Material material, CullMode cullMode) - // { - // switch (cullMode) - // { - // case CullMode.Back: - // material.SetInt(MToonUtils.PropCullMode, CullMode.Back); - // material.SetInt(MToonUtils.PropOutlineCullMode, CullMode.Front); - // break; - // case CullMode.Front: - // material.SetInt(MToonUtils.PropCullMode, CullMode.Front); - // material.SetInt(MToonUtils.PropOutlineCullMode, CullMode.Back); - // break; - // case CullMode.Off: - // material.SetInt(MToonUtils.PropCullMode, CullMode.Off); - // material.SetInt(MToonUtils.PropOutlineCullMode, CullMode.Front); - // break; - // } - // } - } -} \ No newline at end of file diff --git a/Assets/VRM10/Runtime/IO/MToonUtilsFromDefinition.cs.meta b/Assets/VRM10/Runtime/IO/MToonUtilsFromDefinition.cs.meta deleted file mode 100644 index 22f9e9fba..000000000 --- a/Assets/VRM10/Runtime/IO/MToonUtilsFromDefinition.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 269eb140bd3b26043a6afac332268766 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/MaterialAdapter.cs b/Assets/VRM10/Runtime/IO/MaterialAdapter.cs deleted file mode 100644 index ac618a1da..000000000 --- a/Assets/VRM10/Runtime/IO/MaterialAdapter.cs +++ /dev/null @@ -1,128 +0,0 @@ -using VrmLib; -using System.Collections.Generic; -using System.Numerics; -using UniJSON; -using UniGLTF; -using System; - -namespace UniVRM10 -{ - public static class MaterialAdapter - { - static string CastAlphaMode(VrmLib.AlphaModeType alphaMode) - { - if (alphaMode == AlphaModeType.BLEND_ZWRITE) - { - return "BLEND"; - } - return alphaMode.ToString(); - } - - static glTFMaterial ToGltf(this VrmLib.Material src, List textures) - { - var material = new glTFMaterial - { - name = src.Name, - pbrMetallicRoughness = new glTFPbrMetallicRoughness - { - baseColorFactor = src.BaseColorFactor.ToFloat4(), - }, - alphaMode = CastAlphaMode(src.AlphaMode), - alphaCutoff = src.AlphaCutoff, - doubleSided = src.DoubleSided, - }; - if (src.BaseColorTexture != null) - { - material.pbrMetallicRoughness.baseColorTexture = new glTFMaterialBaseColorTextureInfo - { - index = textures.IndexOfNullable(src.BaseColorTexture.Texture).Value, - }; - } - return material; - } - - public static glTFMaterial PBRToGltf(this PBRMaterial pbr, List textures) - { - var material = pbr.ToGltf(textures); - - // MetallicRoughness - material.pbrMetallicRoughness.baseColorFactor = pbr.BaseColorFactor.ToFloat4(); - if (pbr.BaseColorTexture != null) - { - material.pbrMetallicRoughness.baseColorTexture = new glTFMaterialBaseColorTextureInfo - { - index = textures.IndexOfNullable(pbr.BaseColorTexture.Texture).Value, - }; - } - material.pbrMetallicRoughness.metallicFactor = pbr.MetallicFactor; - material.pbrMetallicRoughness.roughnessFactor = pbr.RoughnessFactor; - if (pbr.MetallicRoughnessTexture != null) - { - material.pbrMetallicRoughness.metallicRoughnessTexture = new glTFMaterialMetallicRoughnessTextureInfo - { - index = textures.IndexOfNullable(pbr.MetallicRoughnessTexture).Value, - }; - } - - // Normal - if (pbr.NormalTexture != null) - { - material.normalTexture = new glTFMaterialNormalTextureInfo - { - index = textures.IndexOfNullable(pbr.NormalTexture).Value, - scale = pbr.NormalTextureScale - }; - } - - // Occlusion - if (pbr.OcclusionTexture != null) - { - material.occlusionTexture = new glTFMaterialOcclusionTextureInfo - { - index = textures.IndexOfNullable(pbr.OcclusionTexture).Value, - strength = pbr.OcclusionTextureStrength, - }; - } - - // Emissive - if (pbr.EmissiveTexture != null) - { - material.emissiveTexture = new glTFMaterialEmissiveTextureInfo - { - index = textures.IndexOfNullable(pbr.EmissiveTexture).Value, - }; - } - material.emissiveFactor = pbr.EmissiveFactor.ToFloat3(); - - // AlphaMode - material.alphaMode = CastAlphaMode(pbr.AlphaMode); - - // AlphaCutoff - material.alphaCutoff = pbr.AlphaCutoff; - - // DoubleSided - material.doubleSided = pbr.DoubleSided; - - return material; - } - - public static glTFMaterial UnlitToGltf(this UnlitMaterial unlit, List textures) - { - var material = unlit.ToGltf(textures); - - if (!(material.extensions is glTFExtensionExport extensions)) - { - extensions = new glTFExtensionExport(); - material.extensions = extensions; - } - extensions.Add( - glTF_KHR_materials_unlit.ExtensionName, - new ArraySegment(glTF_KHR_materials_unlit.Raw)); - - material.pbrMetallicRoughness.roughnessFactor = 0.9f; - material.pbrMetallicRoughness.metallicFactor = 0.0f; - - return material; - } - } -} diff --git a/Assets/VRM10/Runtime/IO/MaterialAdapter.cs.meta b/Assets/VRM10/Runtime/IO/MaterialAdapter.cs.meta deleted file mode 100644 index 9d7888645..000000000 --- a/Assets/VRM10/Runtime/IO/MaterialAdapter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 82c26e1eaa170df4a876714ae8e73046 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/TextureAdapter.cs b/Assets/VRM10/Runtime/IO/TextureAdapter.cs deleted file mode 100644 index ef09d36e2..000000000 --- a/Assets/VRM10/Runtime/IO/TextureAdapter.cs +++ /dev/null @@ -1,21 +0,0 @@ -using VrmLib; -using System; -using System.Collections.Generic; -using UniGLTF; - -namespace UniVRM10 -{ - public static class TextureAdapter - { - public static glTFTextureSampler ToGltf(this TextureSampler src) - { - return new glTFTextureSampler - { - wrapS = (glWrap)src.WrapS, - wrapT = (glWrap)src.WrapT, - minFilter = (glFilter)src.MinFilter, - magFilter = (glFilter)src.MagFilter, - }; - } - } -} diff --git a/Assets/VRM10/Runtime/IO/TextureAdapter.cs.meta b/Assets/VRM10/Runtime/IO/TextureAdapter.cs.meta deleted file mode 100644 index f850f482d..000000000 --- a/Assets/VRM10/Runtime/IO/TextureAdapter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7d307745b90c1da4297bba9f3ff4b325 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs index 7bce4fde5..df76fb212 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using UniGLTF; using UniJSON; @@ -63,67 +62,6 @@ namespace UniVRM10 Storage.Reserve(bytesLength); } - public void ExportImageAndTextures(List images, List textures) - { - foreach (var x in images) - { - Storage.Gltf.images.Add(x.ToGltf(Storage)); - } - foreach (var x in textures) - { - if (x is ImageTexture imageTexture) - { - var samplerIndex = Storage.Gltf.samplers.Count; - Storage.Gltf.samplers.Add(x.Sampler.ToGltf()); - Storage.Gltf.textures.Add(new glTFTexture - { - name = x.Name, - source = images.IndexOfThrow(imageTexture.Image), - sampler = samplerIndex, - // extensions - // = imageTexture.Image.MimeType.Equals("image/webp") ? new GltfTextureExtensions() { EXT_texture_webp = new EXT_texture_webp() { source = images.IndexOf(imageTexture.Image) } } - // : imageTexture.Image.MimeType.Equals("image/vnd-ms.dds") ? new GltfTextureExtensions() { MSFT_texture_dds = new MSFT_texture_dds() { source = images.IndexOf(imageTexture.Image) } } - // : null - }); - } - else - { - throw new NotImplementedException(); - } - } - } - - public void ExportMaterialPBR(Material src, PBRMaterial pbr, List textures) - { - var material = pbr.PBRToGltf(textures); - Storage.Gltf.materials.Add(material); - } - - public void ExportMaterialUnlit(Material src, UnlitMaterial unlit, List textures) - { - var material = unlit.UnlitToGltf(textures); - Storage.Gltf.materials.Add(material); - if (!Storage.Gltf.extensionsUsed.Contains(UnlitMaterial.ExtensionName)) - { - Storage.Gltf.extensionsUsed.Add(UnlitMaterial.ExtensionName); - } - } - - public void ExportMaterialMToon(Material src, MToonMaterial mtoon, List textures) - { - if (!Storage.Gltf.extensionsUsed.Contains(UnlitMaterial.ExtensionName)) - { - Storage.Gltf.extensionsUsed.Add(UnlitMaterial.ExtensionName); - } - - var material = mtoon.MToonToGltf(textures); - Storage.Gltf.materials.Add(material); - if (!Storage.Gltf.extensionsUsed.Contains(MToonMaterial.ExtensionName)) - { - Storage.Gltf.extensionsUsed.Add(MToonMaterial.ExtensionName); - } - } - public void ExportMeshes(List groups, List materials, ExportArgs option) { foreach (var group in groups) diff --git a/Assets/VRM10/Runtime/IO/Vrm10ExporterExtensions.cs b/Assets/VRM10/Runtime/IO/Vrm10ExporterExtensions.cs index cdbbbee21..f63fff96f 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10ExporterExtensions.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10ExporterExtensions.cs @@ -44,29 +44,6 @@ namespace UniVRM10 exporter.Reserve(reserveBytes); } - exporter.ExportImageAndTextures(m.Images, m.Textures); - - // material - foreach (var src in m.Materials) - { - if (src is MToonMaterial mtoon) - { - exporter.ExportMaterialMToon(src, mtoon, m.Textures); - } - else if (src is UnlitMaterial unlit) - { - exporter.ExportMaterialUnlit(src, unlit, m.Textures); - } - else if (src is PBRMaterial pbr) - { - exporter.ExportMaterialPBR(src, pbr, m.Textures); - } - else - { - throw new NotImplementedException(); - } - } - // mesh exporter.ExportMeshes(m.MeshGroups, m.Materials, option); diff --git a/Assets/VRM10/Runtime/IO/VrmExpressionAdapter.cs b/Assets/VRM10/Runtime/IO/VrmExpressionAdapter.cs deleted file mode 100644 index 8a8512b67..000000000 --- a/Assets/VRM10/Runtime/IO/VrmExpressionAdapter.cs +++ /dev/null @@ -1,236 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Numerics; -using VrmLib; - -namespace UniVRM10 -{ - public static class ExpressionAdapter - { - public static VrmLib.Expression FromGltf(this UniGLTF.Extensions.VRMC_vrm.Expression x, List nodes, List materials) - { - var expression = new VrmLib.Expression(x.Preset.ToVrmFormat(), - x.Name, - x.IsBinary.HasValue && x.IsBinary.Value) - { - OverrideBlink = EnumUtil.Cast(x.OverrideBlink), - OverrideLookAt = EnumUtil.Cast(x.OverrideLookAt), - OverrideMouth = EnumUtil.Cast(x.OverrideMouth), - }; - - if (x.MorphTargetBinds != null) - { - foreach (var y in x.MorphTargetBinds) - { - var node = nodes[y.Node.Value]; - var blendShapeName = node.Mesh.MorphTargets[y.Index.Value].Name; - var blendShapeBind = new MorphTargetBind(node, blendShapeName, y.Weight.Value); - expression.MorphTargetBinds.Add(blendShapeBind); - } - } - - if (x.MaterialColorBinds != null) - { - foreach (var y in x.MaterialColorBinds) - { - var material = materials[y.Material.Value]; - var materialColorBind = new MaterialColorBind(material, EnumUtil.Cast(y.Type), y.TargetValue.ToVector4(Vector4.Zero)); - expression.MaterialColorBinds.Add(materialColorBind); - } - } - - if (x.TextureTransformBinds != null) - { - foreach (var y in x.TextureTransformBinds) - { - var material = materials[y.Material.Value]; - var materialUVBind = new TextureTransformBind(material, - y.Scaling.ToVector2(Vector2.One), - y.Offset.ToVector2(Vector2.Zero)); - expression.TextureTransformBinds.Add(materialUVBind); - } - } - - return expression; - } - // public static ExpressionManager FromGltf(this UniGLTF.VRMC_vrm.Expression master, List nodes, List materials) - // { - // var manager = new ExpressionManager(); - // foreach (var x in master.BlendShapeGroups) - // { - // VrmLib.Expression expression = FromGltf(x, nodes, materials); - - // manager.ExpressionList.Add(expression); - // }; - // return manager; - // } - - public static UniGLTF.Extensions.VRMC_vrm.MorphTargetBind ToGltf(this MorphTargetBind self, List nodes) - { - var name = self.Name; - var value = self.Value; - var index = self.Node.Mesh.MorphTargets.FindIndex(x => x.Name == name); - if (index < 0) - { - throw new IndexOutOfRangeException(string.Format("MorphTargetName {0} is not found", name)); - } - - return new UniGLTF.Extensions.VRMC_vrm.MorphTargetBind - { - Node = nodes.IndexOfThrow(self.Node), - Index = self.Node.Mesh.MorphTargets.FindIndex(x => x.Name == name), - Weight = value, - }; - } - - public static UniGLTF.Extensions.VRMC_vrm.MaterialColorBind ToGltf(this MaterialColorBind self, List materials) - { - var m = new UniGLTF.Extensions.VRMC_vrm.MaterialColorBind - { - Material = materials.IndexOfThrow(self.Material), - Type = EnumUtil.Cast(self.BindType), - TargetValue = self.Property.Value.ToFloat4() - }; - return m; - } - - public static UniGLTF.Extensions.VRMC_vrm.TextureTransformBind ToGltf(this TextureTransformBind self, List materials) - { - var m = new UniGLTF.Extensions.VRMC_vrm.TextureTransformBind - { - Material = materials.IndexOfThrow(self.Material), - Scaling = self.Scale.ToFloat2(), - Offset = self.Offset.ToFloat2(), - }; - return m; - } - - public static UniGLTF.Extensions.VRMC_vrm.Expression ToGltf(this VrmLib.Expression x, List nodes, List materials) - { - var g = new UniGLTF.Extensions.VRMC_vrm.Expression - { - Preset = x.Preset.ToGltfFormat(), - Name = x.Name, - IsBinary = x.IsBinary, - OverrideBlink = EnumUtil.Cast(x.OverrideBlink), - OverrideLookAt = EnumUtil.Cast(x.OverrideLookAt), - OverrideMouth = EnumUtil.Cast(x.OverrideMouth), - }; - - g.MorphTargetBinds = new List(); - foreach (var blendShapeBind in x.MorphTargetBinds) - { - g.MorphTargetBinds.Add(blendShapeBind.ToGltf(nodes)); - } - - g.MaterialColorBinds = new List(); - foreach (var materialColorBind in x.MaterialColorBinds) - { - g.MaterialColorBinds.Add(materialColorBind.ToGltf(materials)); - } - - g.TextureTransformBinds = new List(); - foreach (var materialUVBind in x.TextureTransformBinds) - { - g.TextureTransformBinds.Add(materialUVBind.ToGltf(materials)); - } - - return g; - } - - // public static UniGLTF.VRMC_vrm.BlendShape ToGltf(this ExpressionManager src, List nodes, List materials) - // { - // var blendShape = new UniGLTF.VRMC_vrm.BlendShape - // { - // }; - // if (src != null) - // { - // foreach (var x in src.ExpressionList) - // { - // blendShape.BlendShapeGroups.Add(x.ToGltf(nodes, materials)); - // } - // } - // return blendShape; - // } - - private static UniGLTF.Extensions.VRMC_vrm.ExpressionPreset ToGltfFormat(this VrmLib.ExpressionPreset preset) - { - switch (preset) - { - case ExpressionPreset.Custom: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.custom; - // 喜怒哀楽驚 - case ExpressionPreset.Happy: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.happy; - case ExpressionPreset.Angry: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.angry; - case ExpressionPreset.Sad: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.sad; - case ExpressionPreset.Relaxed: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.relaxed; - case ExpressionPreset.Surprised: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.surprised; - // Procedural(LipSync) - case ExpressionPreset.Aa: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.aa; - case ExpressionPreset.Ih: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.ih; - case ExpressionPreset.Ou: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.ou; - case ExpressionPreset.Ee: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.ee; - case ExpressionPreset.Oh: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.oh; - // Procedural(Blink) - case ExpressionPreset.Blink: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.blink; - case ExpressionPreset.BlinkLeft: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.blinkLeft; - case ExpressionPreset.BlinkRight: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.blinkRight; - // Procedural(LookAt) - case ExpressionPreset.LookUp: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.lookUp; - case ExpressionPreset.LookDown: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.lookDown; - case ExpressionPreset.LookLeft: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.lookLeft; - case ExpressionPreset.LookRight: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.lookRight; - // Other - case ExpressionPreset.Neutral: - return UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.neutral; - default: - throw new ArgumentOutOfRangeException(nameof(preset), preset, null); - } - } - - private static VrmLib.ExpressionPreset ToVrmFormat(this UniGLTF.Extensions.VRMC_vrm.ExpressionPreset preset) - { - switch (preset) - { - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.custom: return ExpressionPreset.Custom; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.aa: return ExpressionPreset.Aa; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.ih: return ExpressionPreset.Ih; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.ou: return ExpressionPreset.Ou; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.ee: return ExpressionPreset.Ee; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.oh: return ExpressionPreset.Oh; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.blink: return ExpressionPreset.Blink; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.happy: return ExpressionPreset.Happy; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.angry: return ExpressionPreset.Angry; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.sad: return ExpressionPreset.Sad; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.relaxed: return ExpressionPreset.Relaxed; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.lookUp: return ExpressionPreset.LookUp; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.surprised: return ExpressionPreset.Surprised; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.lookDown: return ExpressionPreset.LookDown; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.lookLeft: return ExpressionPreset.LookLeft; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.lookRight: return ExpressionPreset.LookRight; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.blinkLeft: return ExpressionPreset.BlinkLeft; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.blinkRight: return ExpressionPreset.BlinkRight; - case UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.neutral: return ExpressionPreset.Neutral; - default: - throw new ArgumentOutOfRangeException(nameof(preset), preset, null); - } - } - } -} diff --git a/Assets/VRM10/Runtime/IO/VrmExpressionAdapter.cs.meta b/Assets/VRM10/Runtime/IO/VrmExpressionAdapter.cs.meta deleted file mode 100644 index 5ec3b69eb..000000000 --- a/Assets/VRM10/Runtime/IO/VrmExpressionAdapter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cadc48d0e68ee5847b158dcef9b7b9a8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/VrmFirstPersonAdapter.cs b/Assets/VRM10/Runtime/IO/VrmFirstPersonAdapter.cs deleted file mode 100644 index 0101e5f0f..000000000 --- a/Assets/VRM10/Runtime/IO/VrmFirstPersonAdapter.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using VrmLib; - -namespace UniVRM10 -{ - public static class FirstPersonAdapter - { - public static VrmLib.FirstPersonMeshType FromGltf(this UniGLTF.Extensions.VRMC_vrm.FirstPersonType src) - { - switch (src) - { - case UniGLTF.Extensions.VRMC_vrm.FirstPersonType.auto: return FirstPersonMeshType.Auto; - case UniGLTF.Extensions.VRMC_vrm.FirstPersonType.both: return FirstPersonMeshType.Both; - case UniGLTF.Extensions.VRMC_vrm.FirstPersonType.firstPersonOnly: return FirstPersonMeshType.FirstPersonOnly; - case UniGLTF.Extensions.VRMC_vrm.FirstPersonType.thirdPersonOnly: return FirstPersonMeshType.ThirdPersonOnly; - } - - throw new NotImplementedException(); - } - - public static FirstPerson FromGltf(this UniGLTF.Extensions.VRMC_vrm.FirstPerson fp, List nodes) - { - var self = new FirstPerson(); - - if (fp.MeshAnnotations != null) - { - self.Annotations.AddRange(fp.MeshAnnotations - .Select(x => new FirstPersonMeshAnnotation(nodes[x.Node.Value], x.FirstPersonType.FromGltf()))); - } - return self; - } - public static UniGLTF.Extensions.VRMC_vrm.FirstPerson ToGltf(this FirstPerson self, List nodes) - { - if (self == null) - { - return null; - } - - var firstPerson = new UniGLTF.Extensions.VRMC_vrm.FirstPerson - { - - }; - - foreach (var x in self.Annotations) - { - firstPerson.MeshAnnotations.Add(new UniGLTF.Extensions.VRMC_vrm.MeshAnnotation - { - Node = nodes.IndexOfThrow(x.Node), - FirstPersonType = EnumUtil.Cast(x.FirstPersonFlag), - }); - } - return firstPerson; - } - } -} diff --git a/Assets/VRM10/Runtime/IO/VrmFirstPersonAdapter.cs.meta b/Assets/VRM10/Runtime/IO/VrmFirstPersonAdapter.cs.meta deleted file mode 100644 index dd2200fb9..000000000 --- a/Assets/VRM10/Runtime/IO/VrmFirstPersonAdapter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 32f13c918ad866647bfc8f91f3ec7815 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs b/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs deleted file mode 100644 index 843c21da8..000000000 --- a/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using VrmLib; - -namespace UniVRM10 -{ - public static class LookAtAdapter - { - public static LookAtRangeMap FromGltf(this UniGLTF.Extensions.VRMC_vrm.LookAtRangeMap map) - { - return new LookAtRangeMap - { - InputMaxValue = map.InputMaxValue.Value, - OutputScaling = map.OutputScale.Value, - }; - } - - public static LookAtType FromGltf(this UniGLTF.Extensions.VRMC_vrm.LookAtType src) - { - switch (src) - { - case UniGLTF.Extensions.VRMC_vrm.LookAtType.bone: return LookAtType.Bone; - case UniGLTF.Extensions.VRMC_vrm.LookAtType.expression: return LookAtType.Expression; - } - - throw new NotImplementedException(); - } - - public static LookAt FromGltf(this UniGLTF.Extensions.VRMC_vrm.LookAt src) - { - return new LookAt - { - OffsetFromHeadBone = src.OffsetFromHeadBone.ToVector3(), - LookAtType = src.LookAtType.FromGltf(), - HorizontalInner = src.LookAtHorizontalInner.FromGltf(), - HorizontalOuter = src.LookAtHorizontalOuter.FromGltf(), - VerticalUp = src.LookAtVerticalUp.FromGltf(), - VerticalDown = src.LookAtVerticalDown.FromGltf(), - }; - } - - public static UniGLTF.Extensions.VRMC_vrm.LookAtRangeMap ToGltf(this LookAtRangeMap map) - { - return new UniGLTF.Extensions.VRMC_vrm.LookAtRangeMap - { - InputMaxValue = map.InputMaxValue, - OutputScale = map.OutputScaling, - }; - } - - public static UniGLTF.Extensions.VRMC_vrm.LookAt ToGltf(this LookAt lookAt) - { - var dst = new UniGLTF.Extensions.VRMC_vrm.LookAt - { - LookAtType = (UniGLTF.Extensions.VRMC_vrm.LookAtType)lookAt.LookAtType, - LookAtHorizontalInner = lookAt.HorizontalInner.ToGltf(), - LookAtHorizontalOuter = lookAt.HorizontalOuter.ToGltf(), - LookAtVerticalUp = lookAt.VerticalUp.ToGltf(), - LookAtVerticalDown = lookAt.VerticalDown.ToGltf(), - OffsetFromHeadBone = lookAt.OffsetFromHeadBone.ToFloat3(), - }; - return dst; - } - } -} \ No newline at end of file diff --git a/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs.meta b/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs.meta deleted file mode 100644 index 636b08d80..000000000 --- a/Assets/VRM10/Runtime/IO/VrmLookAtAdapter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 68385357d73a5a3428e68eb49742baa9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/VrmMetaAdapter.cs b/Assets/VRM10/Runtime/IO/VrmMetaAdapter.cs deleted file mode 100644 index 44da848d0..000000000 --- a/Assets/VRM10/Runtime/IO/VrmMetaAdapter.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Collections.Generic; -using VrmLib; - -namespace UniVRM10 -{ - public static class VrmMetaAdapter - { - public static AvatarPermission ToAvaterPermission(this UniGLTF.Extensions.VRMC_vrm.Meta self) - { - return new AvatarPermission - { - AvatarUsage = (AvatarUsageType)self.AvatarPermission, - IsAllowedViolentUsage = self.AllowExcessivelyViolentUsage.Value, - IsAllowedSexualUsage = self.AllowExcessivelySexualUsage.Value, - CommercialUsage = (CommercialUsageType)self.CommercialUsage, - // OtherPermissionUrl = self.OtherPermissionUrl, - IsAllowedPoliticalOrReligiousUsage = self.AllowPoliticalOrReligiousUsage.Value, - }; - } - - public static RedistributionLicense ToRedistributionLicense(this UniGLTF.Extensions.VRMC_vrm.Meta self) - { - return new RedistributionLicense - { - CreditNotation = (CreditNotationType)self.CreditNotation, - IsAllowRedistribution = self.AllowRedistribution.Value, - ModificationLicense = (ModificationLicenseType)self.Modification, - OtherLicenseUrl = self.OtherLicenseUrl, - }; - } - - public static Meta FromGltf(this UniGLTF.Extensions.VRMC_vrm.Meta self, List textures) - { - var meta = new Meta - { - Name = self.Name, - Version = self.Version, - ContactInformation = self.ContactInformation, - AvatarPermission = ToAvaterPermission(self), - RedistributionLicense = ToRedistributionLicense(self), - }; - if (self.References != null) - { - meta.References.AddRange(self.References); - } - if (self.Authors != null) - { - meta.Authors.AddRange(self.Authors); - } - if (self.ThumbnailImage.HasValue) - { - var texture = textures[self.ThumbnailImage.Value] as ImageTexture; - if (texture != null) - { - meta.Thumbnail = texture.Image; - } - } - - return meta; - } - - public static UniGLTF.Extensions.VRMC_vrm.Meta ToGltf(this Meta self, List textures) - { - var meta = new UniGLTF.Extensions.VRMC_vrm.Meta - { - Name = self.Name, - Version = self.Version, - ContactInformation = self.ContactInformation, - CopyrightInformation = self.CopyrightInformation, - // AvatarPermission - AvatarPermission = (UniGLTF.Extensions.VRMC_vrm.AvatarPermissionType)self.AvatarPermission.AvatarUsage, - AllowExcessivelyViolentUsage = self.AvatarPermission.IsAllowedViolentUsage, - AllowExcessivelySexualUsage = self.AvatarPermission.IsAllowedSexualUsage, - CommercialUsage = (UniGLTF.Extensions.VRMC_vrm.CommercialUsageType)self.AvatarPermission.CommercialUsage, - AllowPoliticalOrReligiousUsage = self.AvatarPermission.IsAllowedPoliticalOrReligiousUsage, - // OtherPermissionUrl = self.AvatarPermission.OtherPermissionUrl, - // RedistributionLicense - CreditNotation = (UniGLTF.Extensions.VRMC_vrm.CreditNotationType)self.RedistributionLicense.CreditNotation, - AllowRedistribution = self.RedistributionLicense.IsAllowRedistribution, - Modification = (UniGLTF.Extensions.VRMC_vrm.ModificationType)self.RedistributionLicense.ModificationLicense, - OtherLicenseUrl = self.RedistributionLicense.OtherLicenseUrl, - References = self.References, - Authors = self.Authors, - }; - if (self.Thumbnail != null) - { - for (int i = 0; i < textures.Count; ++i) - { - var texture = textures[i] as ImageTexture; - if (texture.Image == self.Thumbnail) - { - meta.ThumbnailImage = i; - break; - } - } - } - return meta; - } - } -} diff --git a/Assets/VRM10/Runtime/IO/VrmMetaAdapter.cs.meta b/Assets/VRM10/Runtime/IO/VrmMetaAdapter.cs.meta deleted file mode 100644 index 27ecfcd8b..000000000 --- a/Assets/VRM10/Runtime/IO/VrmMetaAdapter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ba45f21a0e4c4fd488473e928f70cd98 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Runtime/IO/VrmSpringBoneAdapter.cs b/Assets/VRM10/Runtime/IO/VrmSpringBoneAdapter.cs deleted file mode 100644 index 24666b69c..000000000 --- a/Assets/VRM10/Runtime/IO/VrmSpringBoneAdapter.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UniGLTF; -using UniGLTF.Extensions.VRMC_springBone; -using UniGLTF.Extensions.VRMC_node_collider; -using VrmLib; - -namespace UniVRM10 -{ - public static class SpringBoneAdapter - { - public static VRMC_springBone ToGltf(this SpringBoneManager self, List nodes, - List gltfNodes) - { - if (self == null) - { - return null; - } - - var springBone = new VRMC_springBone - { - Springs = new List(), - }; - - // - // VRMC_node_collider - // - foreach (var nodeCollider in self.Springs.SelectMany(x => x.Colliders)) - { - var index = nodes.IndexOfThrow(nodeCollider.Node); - var gltfCollider = new VRMC_node_collider - { - Shapes = new List(), - }; - foreach (var y in nodeCollider.Colliders) - { - switch (y.ColliderType) - { - case VrmSpringBoneColliderTypes.Sphere: - { - var sphere = new ColliderShapeSphere - { - Radius = y.Radius, - Offset = y.Offset.ToFloat3(), - }; - gltfCollider.Shapes.Add(new ColliderShape - { - Sphere = sphere, - }); - break; - } - - case VrmSpringBoneColliderTypes.Capsule: - { - var capsule = new ColliderShapeCapsule - { - Radius = y.Radius, - Offset = y.Offset.ToFloat3(), - Tail = y.CapsuleTail.ToFloat3(), - }; - gltfCollider.Shapes.Add(new ColliderShape - { - Capsule = capsule, - }); - } - break; - - default: - throw new NotImplementedException(); - } - } - - // - // add to node.extensions - // - UniGLTF.Extensions.VRMC_node_collider.GltfSerializer.SerializeTo(ref gltfNodes[index].extensions, gltfCollider); - } - - // - // VRMC_springBone - // - foreach (var x in self.Springs) - { - var spring = new Spring - { - Name = x.Comment, - Colliders = x.Colliders.Select(y => nodes.IndexOfThrow(y.Node)).ToArray(), - Joints = new List(), - }; - - foreach (var y in x.Joints) - { - spring.Joints.Add(new SpringBoneJoint - { - Node = nodes.IndexOfThrow(y.Node), - HitRadius = y.HitRadius, - DragForce = y.DragForce, - GravityDir = y.GravityDir.ToFloat3(), - GravityPower = y.GravityPower, - Stiffness = y.Stiffness, - }); - } - - springBone.Springs.Add(spring); - } - - return springBone; - } - } -} diff --git a/Assets/VRM10/Runtime/IO/VrmSpringBoneAdapter.cs.meta b/Assets/VRM10/Runtime/IO/VrmSpringBoneAdapter.cs.meta deleted file mode 100644 index 5cbacdf8b..000000000 --- a/Assets/VRM10/Runtime/IO/VrmSpringBoneAdapter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3d523ab537ffdbe40ae4fbd372693cb3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10/Tests/SerializationTests.cs b/Assets/VRM10/Tests/SerializationTests.cs index 80ab2d612..29c3e8212 100644 --- a/Assets/VRM10/Tests/SerializationTests.cs +++ b/Assets/VRM10/Tests/SerializationTests.cs @@ -70,32 +70,6 @@ namespace UniVRM10 } } - static (UniGLTF.glTFMaterial, bool) ToProtobufMaterial(VrmLib.Material vrmlibMaterial, List textures) - { - if (vrmlibMaterial is VrmLib.MToonMaterial mtoon) - { - // MToon - var protobufMaterial = UniVRM10.MToonAdapter.MToonToGltf(mtoon, textures); - return (protobufMaterial, true); - } - else if (vrmlibMaterial is VrmLib.UnlitMaterial unlit) - { - // Unlit - var protobufMaterial = UniVRM10.MaterialAdapter.UnlitToGltf(unlit, textures); - return (protobufMaterial, true); - } - else if (vrmlibMaterial is VrmLib.PBRMaterial pbr) - { - // PBR - var protobufMaterial = UniVRM10.MaterialAdapter.PBRToGltf(pbr, textures); - return (protobufMaterial, false); - } - else - { - throw new NotImplementedException(); - } - } - static void CompareUnityMaterial(Material lhs, Material rhs) { Assert.AreEqual(lhs.name, rhs.name); @@ -189,20 +163,20 @@ namespace UniVRM10 var vrmLibMaterial = converter.Export10(src, (a, b, c, d) => null); Assert.AreEqual(vrmLibMaterialType, vrmLibMaterial.GetType()); - // vrmlib => gltf - var textures = new List(); - var (gltfMaterial, hasKhrUnlit) = ToProtobufMaterial(vrmLibMaterial, textures); - if (gltfMaterial.extensions != null) - { - gltfMaterial.extensions = gltfMaterial.extensions.Deserialize(); - } - Assert.AreEqual(hasKhrUnlit, glTF_KHR_materials_unlit.IsEnable(gltfMaterial)); + // // vrmlib => gltf + // var textures = new List(); + // var (gltfMaterial, hasKhrUnlit) = ToProtobufMaterial(vrmLibMaterial, textures); + // if (gltfMaterial.extensions != null) + // { + // gltfMaterial.extensions = gltfMaterial.extensions.Deserialize(); + // } + // Assert.AreEqual(hasKhrUnlit, glTF_KHR_materials_unlit.IsEnable(gltfMaterial)); - // gltf => json - var jsonMaterial = Serialize(gltfMaterial, UniGLTF.GltfSerializer.Serialize_gltf_materials_ITEM); + // // gltf => json + // var jsonMaterial = Serialize(gltfMaterial, UniGLTF.GltfSerializer.Serialize_gltf_materials_ITEM); - // gltf <= json - var deserialized = UniGLTF.GltfDeserializer.Deserialize_gltf_materials_LIST(jsonMaterial.ParseAsJson()); + // // gltf <= json + // var deserialized = UniGLTF.GltfDeserializer.Deserialize_gltf_materials_LIST(jsonMaterial.ParseAsJson()); // // vrmlib <= gltf // var loaded = deserialized.FromGltf(textures); @@ -249,46 +223,46 @@ namespace UniVRM10 OverrideMouth = VrmLib.ExpressionOverrideType.Blend, }; - // export - var gltf = UniVRM10.ExpressionAdapter.ToGltf(expression, new List(), new List()); - Assert.AreEqual(UniGLTF.Extensions.VRMC_vrm.ExpressionOverrideType.none, gltf.OverrideBlink); - Assert.AreEqual(UniGLTF.Extensions.VRMC_vrm.ExpressionOverrideType.block, gltf.OverrideLookAt); - Assert.AreEqual(UniGLTF.Extensions.VRMC_vrm.ExpressionOverrideType.blend, gltf.OverrideMouth); + // // export + // var gltf = UniVRM10.ExpressionAdapter.ToGltf(expression, new List(), new List()); + // Assert.AreEqual(UniGLTF.Extensions.VRMC_vrm.ExpressionOverrideType.none, gltf.OverrideBlink); + // Assert.AreEqual(UniGLTF.Extensions.VRMC_vrm.ExpressionOverrideType.block, gltf.OverrideLookAt); + // Assert.AreEqual(UniGLTF.Extensions.VRMC_vrm.ExpressionOverrideType.blend, gltf.OverrideMouth); - // import - var imported = UniVRM10.ExpressionAdapter.FromGltf(gltf, new List(), new List()); - Assert.AreEqual(VrmLib.ExpressionOverrideType.None, imported.OverrideBlink); - Assert.AreEqual(VrmLib.ExpressionOverrideType.Block, imported.OverrideLookAt); - Assert.AreEqual(VrmLib.ExpressionOverrideType.Blend, imported.OverrideMouth); + // // import + // var imported = UniVRM10.ExpressionAdapter.FromGltf(gltf, new List(), new List()); + // Assert.AreEqual(VrmLib.ExpressionOverrideType.None, imported.OverrideBlink); + // Assert.AreEqual(VrmLib.ExpressionOverrideType.Block, imported.OverrideLookAt); + // Assert.AreEqual(VrmLib.ExpressionOverrideType.Blend, imported.OverrideMouth); } { - // export - foreach (var preset in Enum.GetValues(typeof(VrmLib.ExpressionPreset)) as VrmLib.ExpressionPreset[]) - { - var expression = new VrmLib.Expression(preset, "", false); + // // export + // foreach (var preset in Enum.GetValues(typeof(VrmLib.ExpressionPreset)) as VrmLib.ExpressionPreset[]) + // { + // var expression = new VrmLib.Expression(preset, "", false); - // expect no exception - var gltf = ExpressionAdapter.ToGltf( - expression, - new List(), - new List()); - } + // // expect no exception + // var gltf = ExpressionAdapter.ToGltf( + // expression, + // new List(), + // new List()); + // } - // import - foreach (var preset in Enum.GetValues(typeof(UniGLTF.Extensions.VRMC_vrm.ExpressionPreset)) as UniGLTF.Extensions.VRMC_vrm.ExpressionPreset[]) - { - var gltf = new UniGLTF.Extensions.VRMC_vrm.Expression - { - Preset = preset, - }; + // // import + // foreach (var preset in Enum.GetValues(typeof(UniGLTF.Extensions.VRMC_vrm.ExpressionPreset)) as UniGLTF.Extensions.VRMC_vrm.ExpressionPreset[]) + // { + // var gltf = new UniGLTF.Extensions.VRMC_vrm.Expression + // { + // Preset = preset, + // }; - // expect no exception - ExpressionAdapter.FromGltf( - gltf, - new List(), - new List()); - } + // // expect no exception + // ExpressionAdapter.FromGltf( + // gltf, + // new List(), + // new List()); + // } } } }