Esempio n. 1
0
        public static glTF_VRM_DegreeMap Deserialize_vrm_firstPerson_lookAtVerticalUp(ListTreeNode <JsonValue> parsed)
        {
            var value = new glTF_VRM_DegreeMap();

            foreach (var kv in parsed.ObjectItems())
            {
                var key = kv.Key.GetString();

                if (key == "curve")
                {
                    value.curve = Deserialize_vrm_firstPerson_lookAtVerticalUp_curve(kv.Value);
                    continue;
                }

                if (key == "xRange")
                {
                    value.xRange = kv.Value.GetSingle();
                    continue;
                }

                if (key == "yRange")
                {
                    value.yRange = kv.Value.GetSingle();
                    continue;
                }
            }
            return(value);
        }
        public static string ToJson(this glTF_VRM_DegreeMap self)
        {
            var f = new JsonFormatter();

            VRMSerializer.Serialize_vrm_firstPerson_lookAtHorizontalInner(f, self);
            return(f.ToString());
        }
        public void DegreeMapTest()
        {
            var model = new glTF_VRM_DegreeMap();

            var json = model.ToJson();

            Assert.AreEqual(@"{""xRange"":90,""yRange"":10}", json);
            Debug.Log(json);
        }
Esempio n. 4
0
 public void Apply(glTF_VRM_DegreeMap degreeMap)
 {
     CurveXRangeDegree = degreeMap.xRange;
     CurveYRangeDegree = degreeMap.yRange;
     if (degreeMap.curve != null)
     {
         Curve = new AnimationCurve(ToKeys(degreeMap.curve).ToArray());
     }
     else
     {
         Curve = AnimationCurve.Linear(0, 0, 1.0f, 1.0f);
     }
 }
Esempio n. 5
0
        public void DegreeMapTest()
        {
            var model = new glTF_VRM_DegreeMap();

            var json = model.ToJson();

            Assert.AreEqual(@"{""xRange"":90,""yRange"":10}", json);
            Debug.Log(json);

            var c = new JsonSchemaValidationContext("")
            {
                EnableDiagnosisForNotRequiredFields = true,
            };
            var json2 = JsonSchema.FromType <glTF_VRM_DegreeMap>().Serialize(model, c);

            Assert.AreEqual(json, json2);
        }
Esempio n. 6
0
        public static void Serialize_vrm_firstPerson_lookAtVerticalUp(JsonFormatter f, glTF_VRM_DegreeMap value)
        {
            f.BeginMap();


            if (value.curve != null && value.curve.Length >= 0)
            {
                f.Key("curve");
                Serialize_vrm_firstPerson_lookAtVerticalUp_curve(f, value.curve);
            }

            if (true)
            {
                f.Key("xRange");
                f.Value(value.xRange);
            }

            if (true)
            {
                f.Key("yRange");
                f.Value(value.yRange);
            }

            f.EndMap();
        }
Esempio n. 7
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;
 }