示例#1
0
        float[] CreateRatios(List <VmdSkinFrame> frames)
        {
            frames.Sort();

            float[] ratios = new float[frame_length];
            for (int i = 1; i < frames.Count; i++)
            {
                VmdSkinFrame fa = frames[i - 1];
                VmdSkinFrame fb = frames[i];
                for (int index = fa.index; index < fb.index; index++)
                {
                    float ratio = ((float)(index - fa.index)) / ((float)(fb.index - fa.index));
                    ratios[index] = Lerp(fa.ratio, fb.ratio, ratio);
                }
                {
                    ratios[fb.index] = fb.ratio;
                }
            }
            {
                VmdSkinFrame last_frame = frames[frames.Count - 1];
                for (int index = last_frame.index; index < frame_length; index++)
                {
                    ratios[index] = last_frame.ratio;
                }
            }
            return(ratios);
        }
示例#2
0
 public int CompareTo(object obj)
 {
     if (obj is VmdSkinFrame)
     {
         VmdSkinFrame other = (VmdSkinFrame)obj;
         return(index.CompareTo(other.index));
     }
     else
     {
         throw new ArgumentException("Object is not a VmdSkinFrame");
     }
 }