From c7354f9f0896ba981a0c30a276041799f8bcbbce Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 27 Jan 2021 17:06:40 +0900 Subject: [PATCH] MtoonGltfColorToUnity --- Assets/VRM10/Tests.PlayMode/MaterialTests.cs | 30 ++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/Assets/VRM10/Tests.PlayMode/MaterialTests.cs b/Assets/VRM10/Tests.PlayMode/MaterialTests.cs index 12df81084..de6ba76ea 100644 --- a/Assets/VRM10/Tests.PlayMode/MaterialTests.cs +++ b/Assets/VRM10/Tests.PlayMode/MaterialTests.cs @@ -174,11 +174,31 @@ namespace UniVRM10.Test var model = ToVrmModel(assets.Root); var gltfMaterial = model.Materials.First(x => x.Name == key.Name) as VrmLib.MToonMaterial; - gltfMaterial.Definition.Color.LitColor = new LinearColor { RGBA = srclinerColor }; - gltfMaterial.Definition.Color.ShadeColor = new LinearColor { RGBA = srclinerColor }; - gltfMaterial.Definition.Outline.OutlineColor = new LinearColor { RGBA = srclinerColor }; - gltfMaterial.Definition.Emission.EmissionColor = new LinearColor { RGBA = srclinerColor }; - gltfMaterial.Definition.Rim.RimColor = new LinearColor { RGBA = srclinerColor }; + if (gltfMaterial == null) + { + throw new NotImplementedException(); + } + + gltfMaterial.Definition = new VrmLib.MToon.MToonDefinition + { + Color = new VrmLib.MToon.ColorDefinition + { + LitColor = new LinearColor { RGBA = srclinerColor }, + ShadeColor = new LinearColor { RGBA = srclinerColor }, + }, + Outline = new VrmLib.MToon.OutlineDefinition + { + OutlineColor = new LinearColor { RGBA = srclinerColor }, + }, + Emission = new VrmLib.MToon.EmissionDefinition + { + EmissionColor = new LinearColor { RGBA = srclinerColor }, + }, + Rim = new VrmLib.MToon.RimDefinition + { + RimColor = new LinearColor { RGBA = srclinerColor }, + } + }; var bytes = model.ToGlb();