示例#1
0
 public void AddFrame(CameraMotion.Frame frame)
 {
     if (this.motionFile != null)
     {
         this.motionFile.listChannel[0].normal.Add(frame.cameraPosition);
         this.motionFile.listChannel[1].normal.Add(frame.LookAt);
         this.motionFile.listChannel[2].normal.Add(frame.Up);
         this.motionFile.listChannel[3].normal.Add(new Vector3(0f, 0f, 0f));
         this.motionFile.frameCount++;
     }
 }
示例#2
0
 public void GenerateFrames()
 {
     this.frameList = new List <CameraMotion.Frame>();
     for (int i = 0; i < this.motionFile.frameCount; i++)
     {
         CameraMotion.Frame item = new CameraMotion.Frame
         {
             cameraPosition = this.motionFile.listChannel[0].position[i] / 100f + CameraMotion.realPosition,
             LookAt         = this.motionFile.listChannel[1].position[i] / 100f + CameraMotion.realPosition,
             Up             = this.motionFile.listChannel[2].position[i] / 100f
         };
         this.frameList.Add(item);
     }
 }
示例#3
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();
     }
 }
示例#4
0
 public void GenerateFrames()
 {
     this.frameList = new List<CameraMotion.Frame>();
     for (int i = 0; i < this.motionFile.frameCount; i++)
     {
         CameraMotion.Frame item = new CameraMotion.Frame
         {
             cameraPosition = this.motionFile.listChannel[0].position[i] / 100f + CameraMotion.realPosition,
             LookAt = this.motionFile.listChannel[1].position[i] / 100f + CameraMotion.realPosition,
             Up = this.motionFile.listChannel[2].position[i] / 100f
         };
         this.frameList.Add(item);
     }
 }
示例#5
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();
     }
 }
示例#6
0
 public void ChangeFrame(CameraMotion.Frame newFrame, int indice)
 {
     this.motionFile.listChannel[0].normal[indice] = newFrame.cameraPosition;
     this.motionFile.listChannel[1].normal[indice] = newFrame.LookAt;
     this.motionFile.listChannel[2].normal[indice] = newFrame.Up;
 }
示例#7
0
 private void copyMenuItem_Click(object sender, EventArgs e)
 {
     if (this.treeViewFrame.SelectedNode != null)
     {
         int index = this.treeViewFrame.SelectedNode.Index;
         this.copiedFrame = this.panelPreview.GetMotionFrame(index);
     }
 }
示例#8
0
 private void addMenuItem_Click(object sender, EventArgs e)
 {
     if (this.treeViewFrame.SelectedNode != null)
     {
         AddFrameMessageBox addFrameMessageBox = new AddFrameMessageBox();
         if (addFrameMessageBox.ShowDialog() == DialogResult.OK)
         {
             int framePosition = addFrameMessageBox.GetFramePosition();
             int index = this.treeViewFrame.SelectedNode.Index;
             CameraMotion.Frame motionFrame = this.panelPreview.GetMotionFrame(index);
             CameraMotion.Frame item = new CameraMotion.Frame();
             item = motionFrame;
             List<CameraMotion.Frame> frames = this.camMotion.GetFrames();
             frames.Insert(index + framePosition, item);
             this.panelPreview.UpdateCameraMatrices();
             this.camMotion.GenerateVertices();
             this.DisplayFrames();
         }
     }
 }