Exemplo n.º 1
0
        public void VRMLookAtCurveMapTest()
        {
            var data = new GlbFileParser(AliciaPath).Parse();

            byte[]      bytes           = default;
            CurveMapper horizontalInner = default;

            using (data)
                using (var loader = new VRMImporterContext(new VRMData(data)))
                    using (var loaded = loader.Load())
                    {
                        loaded.ShowMeshes();

                        var go     = loaded.gameObject;
                        var fp     = go.GetComponent <VRMFirstPerson>();
                        var lookAt = go.GetComponent <VRMLookAtBoneApplyer>();
                        horizontalInner = lookAt.HorizontalInner;
                        bytes           = VRMEditorExporter.Export(go, null, new VRMExportSettings
                        {
                            PoseFreeze = false,
                        });
                    }

            using (var data2 = new GlbLowLevelParser(AliciaPath, bytes).Parse())
                using (var loader = new VRMImporterContext(new VRMData(data2)))
                    using (var loaded = loader.Load())
                    {
                        loaded.ShowMeshes();

                        var lookAt = loaded.GetComponent <VRMLookAtBoneApplyer>();
                        Assert.AreEqual(horizontalInner.CurveXRangeDegree, lookAt.HorizontalInner.CurveXRangeDegree);
                        Assert.AreEqual(horizontalInner.CurveYRangeDegree, lookAt.HorizontalInner.CurveYRangeDegree);
                    }
        }
Exemplo n.º 2
0
        public void VRMLookAtCurveMapTest()
        {
            var parser = new GltfParser();

            parser.ParsePath(AliciaPath);
            byte[]      bytes           = default;
            CurveMapper horizontalInner = default;

            using (var loader = new VRMImporterContext(parser))
            {
                loader.Load();
                loader.ShowMeshes();

                var go     = loader.Root;
                var fp     = go.GetComponent <VRMFirstPerson>();
                var lookAt = go.GetComponent <VRMLookAtBoneApplyer>();
                horizontalInner = lookAt.HorizontalInner;
                bytes           = VRMEditorExporter.Export(go, null, new VRMExportSettings
                {
                    PoseFreeze = false,
                });
            }

            var parser2 = new GltfParser();

            parser2.Parse(AliciaPath, bytes);
            using (var loader = new VRMImporterContext(parser2))
            {
                loader.Load();
                loader.ShowMeshes();

                var lookAt = loader.Root.GetComponent <VRMLookAtBoneApplyer>();
                Assert.AreEqual(horizontalInner.CurveXRangeDegree, lookAt.HorizontalInner.CurveXRangeDegree);
                Assert.AreEqual(horizontalInner.CurveYRangeDegree, lookAt.HorizontalInner.CurveYRangeDegree);
            }
        }
Exemplo n.º 3
0
 public static void Apply(this glTF_VRM_DegreeMap map, CurveMapper mapper)
 {
     map.curve  = mapper.Curve.keys.SelectMany(x => new float[] { x.time, x.value, x.inTangent, x.outTangent }).ToArray();
     map.xRange = mapper.CurveXRangeDegree;
     map.yRange = mapper.CurveYRangeDegree;
 }
Exemplo n.º 4
0
 public void Apply(CurveMapper mapper)
 {
     curve  = mapper.Curve.keys.SelectMany(x => new float[] { x.time, x.value, x.inTangent, x.outTangent }).ToArray();
     xRange = mapper.CurveXRangeDegree;
     yRange = mapper.CurveYRangeDegree;
 }