Ejemplo n.º 1
0
            public static void AddBezierKeyframes(byte[] interpolation, int type, VMDHSConverter.FloatKeyframe prev_keyframe, VMDHSConverter.FloatKeyframe cur_keyframe, int interpolationQuality, ref List <VMDHSConverter.FloatKeyframe> keyframes, ref int index)
            {
                if (prev_keyframe == null || VMDHSConverter.IsLinear(interpolation, type))
                {
                    keyframes.Add(cur_keyframe);
                    index = keyframes.Count <VMDHSConverter.FloatKeyframe>();
                    return;
                }
                Vector2 bezierHandle  = VMDHSConverter.GetBezierHandle(interpolation, type, 0);
                Vector2 bezierHandle2 = VMDHSConverter.GetBezierHandle(interpolation, type, 1);

                for (int i = 0; i < interpolationQuality; i++)
                {
                    float   t  = (float)(i + 1) / (float)interpolationQuality;
                    Vector2 t2 = VMDHSConverter.SampleBezier(bezierHandle, bezierHandle2, t);
                    keyframes.Add(VMDHSConverter.FloatKeyframe.Lerp(prev_keyframe, cur_keyframe, t2));
                    index = keyframes.Count <VMDHSConverter.FloatKeyframe>();
                }
            }
Ejemplo n.º 2
0
            public static void AddBezierKeyframes(byte[] interpolation, int type, VMDHSConverter.QuaternionKeyframe prev_keyframe, VMDHSConverter.QuaternionKeyframe cur_keyframe, int interpolationQuality, ref VMDHSConverter.QuaternionKeyframe[] keyframes, ref int index)
            {
                if (prev_keyframe == null || VMDHSConverter.IsLinear(interpolation, type))
                {
                    VMDHSConverter.QuaternionKeyframe[] array = keyframes;
                    int num = index;
                    index      = num + 1;
                    array[num] = cur_keyframe;
                    return;
                }
                Vector2 bezierHandle  = VMDHSConverter.GetBezierHandle(interpolation, type, 0);
                Vector2 bezierHandle2 = VMDHSConverter.GetBezierHandle(interpolation, type, 1);

                for (int i = 0; i < interpolationQuality; i++)
                {
                    float   t  = (float)(i + 1) / (float)interpolationQuality;
                    Vector2 t2 = VMDHSConverter.SampleBezier(bezierHandle, bezierHandle2, t);
                    VMDHSConverter.QuaternionKeyframe[] array2 = keyframes;
                    int num = index;
                    index       = num + 1;
                    array2[num] = VMDHSConverter.QuaternionKeyframe.Lerp(prev_keyframe, cur_keyframe, t2);
                }
            }