Exemple #1
0
 public void Interpolate(int min, int max, int step)
 {
     if (min >= 0 && max < this.frameList.Count && min <= max)
     {
         float num = 0f;
         CameraMotion.Curve3D curve3D  = new CameraMotion.Curve3D();
         CameraMotion.Curve3D curve3D2 = new CameraMotion.Curve3D();
         CameraMotion.Curve3D curve3D3 = new CameraMotion.Curve3D();
         int i = min;
         while (i < max + 1)
         {
             curve3D.AddKey(this.frameList[i].cameraPosition, num);
             curve3D2.AddKey(this.frameList[i].LookAt, num);
             curve3D3.AddKey(this.frameList[i].Up, num);
             i++;
             num += (float)step;
         }
         curve3D.SetTangents();
         curve3D2.SetTangents();
         curve3D3.SetTangents();
         List <CameraMotion.Frame> list = new List <CameraMotion.Frame>();
         for (i = 0; i < (max - min) * step; i++)
         {
             CameraMotion.Frame item = new CameraMotion.Frame
             {
                 cameraPosition = curve3D.GetPointOnCurve((float)i),
                 LookAt         = curve3D2.GetPointOnCurve((float)i),
                 Up             = curve3D3.GetPointOnCurve((float)i)
             };
             list.Add(item);
         }
         this.frameList.RemoveRange(min, max - min);
         this.frameList.InsertRange(min, list);
         this.GenerateViewMatrices();
         this.GenerateVertices();
     }
 }
 public void Interpolate(int min, int max, int step)
 {
     if (min >= 0 && max < this.frameList.Count && min <= max)
     {
         float num = 0f;
         CameraMotion.Curve3D curve3D = new CameraMotion.Curve3D();
         CameraMotion.Curve3D curve3D2 = new CameraMotion.Curve3D();
         CameraMotion.Curve3D curve3D3 = new CameraMotion.Curve3D();
         int i = min;
         while (i < max + 1)
         {
             curve3D.AddKey(this.frameList[i].cameraPosition, num);
             curve3D2.AddKey(this.frameList[i].LookAt, num);
             curve3D3.AddKey(this.frameList[i].Up, num);
             i++;
             num += (float)step;
         }
         curve3D.SetTangents();
         curve3D2.SetTangents();
         curve3D3.SetTangents();
         List<CameraMotion.Frame> list = new List<CameraMotion.Frame>();
         for (i = 0; i < (max - min) * step; i++)
         {
             CameraMotion.Frame item = new CameraMotion.Frame
             {
                 cameraPosition = curve3D.GetPointOnCurve((float)i),
                 LookAt = curve3D2.GetPointOnCurve((float)i),
                 Up = curve3D3.GetPointOnCurve((float)i)
             };
             list.Add(item);
         }
         this.frameList.RemoveRange(min, max - min);
         this.frameList.InsertRange(min, list);
         this.GenerateViewMatrices();
         this.GenerateVertices();
     }
 }