예제 #1
0
        public void CalculatePosition(float timestamp)
        {
            Logger.Write(name + ".CalculatePosition(" + timestamp + ")");

            if (vertex.current_keyframe.t != timestamp)
            {
                Logger.Write("---->: result not cached, calculate");

                Interpolator2D interp = Interpolator2D.GetByName(interpolation);

                if (interp != null)
                {
                    vertex.current_keyframe = interp.Calculate(timestamp, vertex.frames);
                }
                else
                {
                    Logger.Write("---->: can't find Interpolator2D for type: " + interpolation);
                    return;
                }
            }

            vertex.local_pos = vertex.current_keyframe.point;

            if (parent == null)
            {
                Logger.Write("---->: is root node");
                vertex.global_pos = vertex.local_pos;
            }
            else
            {
                Logger.Write("---->: is child node");
                parent.CalculatePosition(timestamp);
                vertex.global_pos = vertex.local_pos + parent.vertex.global_pos;
            }
        }
예제 #2
0
        public static Interpolator2D GetByName(String name)
        {
            Interpolator2D interp = interpolators.Find(p => p.ToString() == name);

            if (interp == null && interpolators.Count > 0)
            {
                interp = interpolators[0];
            }

            return(interp);
        }
예제 #3
0
        public static void LoadPlugins()
        {
            Logger.Write("Start load plugins...");

            string[] files = System.IO.Directory.GetFiles("plugins", "*.dll");

            foreach (string name in files)
            {
                Assembly asm = Assembly.LoadFrom(name);

                foreach (Type t in asm.GetExportedTypes())
                {
                    if (typeof(Interpolator2D).IsAssignableFrom(t))
                    {
                        Interpolator2D interp = (Interpolator2D)asm.CreateInstance(t.FullName);
                        interpolators.Add(interp);

                        Logger.Write("----> : [" + interp.ToString() + "] is loaded");
                    }
                }
            }
        }
예제 #4
0
 private void AddInterpolator(Interpolator2D interpolator)
 {
     InterpolatorsComboBox.Items.Add( interpolator );
     InterpolatorsComboBox.SelectedIndex = 0;
 }