Beispiel #1
0
        // Parses keyframe point to Vector4
        private void parsePoint(string vec, LoziAnimationKeyPoint points, Keyframe[] keys)
        {
            if (points.time == null)
            {
                points.size  = keys.Length;
                points.time  = new float  [keys.Length];
                points.point = new Vector4[keys.Length];
            }

            for (int num = 0; num < keys.Length; num++)
            {
                Vector4 temp = points.point[num];
                switch (vec)
                {
                case "x": { points.point[num] = new Vector4(keys[num].value, temp.y, temp.z, temp.w); break; }

                case "y": { points.point[num] = new Vector4(temp.x, temp.y, keys[num].value, temp.w); break; }

                case "z": { points.point[num] = new Vector4(temp.x, keys[num].value, temp.z, temp.w); break; }

                case "w": { points.point[num] = new Vector4(temp.x, temp.y, temp.z, keys[num].value); break; }
                }
                points.time[num] = keys[num].time;
            }
        }
Beispiel #2
0
        // Gets points array by provided time
        private float[] getPointArrayByTime(LoziAnimationKeyPoint keyPoint, float time, int length)
        {
            float[] arr = new float[length];

            if (keyPoint.time != null)
            {
                for (int num = 0; num < keyPoint.time.Length; num++)
                {
                    if (time == keyPoint.time[num])
                    {
                        Vector4 point = keyPoint.point[num];

                        arr[0] = point.x;
                        arr[2] = point.y;
                        arr[1] = point.z;

                        if (length > 3)
                        {
                            arr[3] = point.w;
                        }
                        return(arr);
                    }
                }
            }
            return(null);
        }