コード例 #1
0
 private void CameraData_ValueChanged(object sender, EventArgs e)
 {
     if (!ProgramIsChangingStuff & CurrentlySelectedCamera != -1)
     {
         ShadowCamera current = ListBoxCameras.Items[CurrentlySelectedCamera] as ShadowCamera;
         current.CameraNumber                  = (int)numericUpDown_cameraNumber.Value;
         current.CameraMode                    = (ShadowCameraMode)comboBox_cameraMode.SelectedItem;
         current.field_08                      = (int)numericUpDown_i08.Value;
         current.field_0C                      = (int)numericUpDown_i0C.Value;
         current.field_10                      = (int)numericUpDown_i10.Value;
         current.field_14                      = (int)numericUpDown_i14.Value;
         current.LookBLinkId                   = (int)numericUpDown_LookBLinkId.Value;
         current.field_1C                      = (int)numericUpDown_i1C.Value;
         current.TriggerPosition               = new Vector3((float)numericUpDown_TriggerPosX.Value, (float)numericUpDownTriggerPosY.Value, (float)numericUpDownTriggerPosZ.Value);
         current.TriggerRotation               = new Vector3((float)((float)numericUpDown_TriggerRotX.Value / (180f / Math.PI)), (float)((float)numericUpDownTriggerRotY.Value / (180f / Math.PI)), (float)((float)numericUpDownTriggerRotZ.Value / (180f / Math.PI)));
         current.TriggerScale                  = new Vector3((float)numericUpDown_TriggerScaleX.Value, (float)numericUpDownTriggerScaleY.Value, (float)numericUpDownTriggerScaleZ.Value);
         current.PointA_LookFrom_X             = (float)numericUpDown_PointA_LookFrom_X.Value;
         current.PointA_LookFrom_Y             = (float)numericUpDown_PointA_LookFrom_Y.Value;
         current.PointA_LookFrom_Z             = (float)numericUpDown_PointA_LookFrom_Z.Value;
         current.PointA_LookAt_X               = (float)numericUpDown_PointA_LookAt_X.Value;
         current.PointA_LookAt_Y               = (float)numericUpDown_PointA_LookAt_Y.Value;
         current.PointA_LookAt_Z               = (float)numericUpDown_PointA_LookAt_Z.Value;
         current.CameraRotation                = (float)((float)numericUpDown_CameraRotation.Value / (180f / Math.PI));
         current.FOV_Height                    = (float)((float)numericUpDown_FOV_Height.Value / (180f / Math.PI));
         current.FOV_Width                     = (float)((float)numericUpDown_FOV_Width.Value / (180f / Math.PI));
         current.field_68                      = (float)numericUpDown_f68.Value;
         current.field_6C                      = (float)numericUpDown_f6C.Value;
         current.field_70                      = (float)numericUpDown_f70.Value;
         current.field_74                      = (float)numericUpDown_f74.Value;
         current.PointB_LookFrom_X             = (float)numericUpDown_PointB_LookFrom_X.Value;
         current.PointB_LookFrom_Y             = (float)numericUpDown_PointB_LookFrom_Y.Value;
         current.PointB_LookFrom_Z             = (float)numericUpDown_PointB_LookFrom_Z.Value;
         current.PointB_LookAt_X               = (float)numericUpDown_PointB_LookAt_X.Value;
         current.PointB_LookAt_Y               = (float)numericUpDown_PointB_LookAt_Y.Value;
         current.PointB_LookAt_Z               = (float)numericUpDown_PointB_LookAt_Z.Value;
         current.CameraDistanceFromPlayerLookA = (float)numericUpDown_CameraDistanceFromPlayerLookA.Value;
         current.CameraHeightFromPlayerLookA   = (float)numericUpDown_CameraHeightFromPlayerLookA.Value;
         current.CameraDistanceFromPlayerLookB = (float)numericUpDown_CameraDistanceFromPlayerLookB.Value;
         current.CameraHeightFromPlayerLookB   = (float)numericUpDown_CameraHeightFromPlayerLookB.Value;
         current.field_A0                      = (float)numericUpDown_fA0.Value;
         current.field_A4                      = (float)numericUpDown_fA4.Value;
         current.field_A8                      = (float)numericUpDown_fA8.Value;
         current.field_AC                      = (float)numericUpDown_fAC.Value;
         current.TransitionTimeEnter           = (float)numericUpDown_TransitionTimeEnter.Value;
         current.TransitionTimeExit            = (float)numericUpDown_TransitionTimeExit.Value;
         current.field_B8                      = (float)numericUpDown_fB8.Value;
         current.field_BC                      = (float)numericUpDown_fBC.Value;
         current.field_C0                      = (float)numericUpDown_fC0.Value;
         current.field_C4                      = (float)numericUpDown_fC4.Value;
         current.field_C8                      = (float)numericUpDown_fC8.Value;
         current.field_CC                      = (float)numericUpDown_fCC.Value;
         current.field_D0                      = (float)numericUpDown_fD0.Value;
         current.field_D4                      = (float)numericUpDown_fD4.Value;
         current.field_D8                      = (float)numericUpDown_fD8.Value;
         current.CreateTransformMatrix();
         ListBoxCameras.Items[CurrentlySelectedCamera] = current;
     }
 }
コード例 #2
0
        private void buttonDuplicate_Click(object sender, EventArgs e)
        {
            ShadowCamera newCamera = new ShadowCamera((ShadowCamera)ListBoxCameras.Items[CurrentlySelectedCamera]);

            newCamera.CreateTransformMatrix();
            ListBoxCameras.Items.Add(newCamera);
            ListBoxCameras.SelectedIndex = ListBoxCameras.Items.Count - 1;
            UpdateLabelCameraCount();
        }
コード例 #3
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            ShadowCamera newCamera = new ShadowCamera()
            {
                TriggerPosition = Program.MainForm.renderer.Camera.GetPosition()
            };

            newCamera.CreateTransformMatrix();
            ListBoxCameras.Items.Add(newCamera);
            ListBoxCameras.SelectedIndex = ListBoxCameras.Items.Count - 1;
            UpdateLabelCameraCount();
        }
コード例 #4
0
 public ShadowCamera(ShadowCamera camera)
 {
     CameraNumber                  = camera.CameraNumber;
     CameraMode                    = camera.CameraMode;
     field_08                      = camera.field_08;
     field_0C                      = camera.field_0C;
     field_10                      = camera.field_10;
     field_14                      = camera.field_14;
     LookBLinkId                   = camera.LookBLinkId;
     field_1C                      = camera.field_1C;
     TriggerPosition               = camera.TriggerPosition;
     TriggerRotation               = camera.TriggerRotation;
     TriggerScale                  = camera.TriggerScale;
     PointA_LookFrom_X             = camera.PointA_LookFrom_X;
     PointA_LookFrom_Y             = camera.PointA_LookFrom_Y;
     PointA_LookFrom_Z             = camera.PointA_LookFrom_Z;
     PointA_LookAt_X               = camera.PointA_LookAt_X;
     PointA_LookAt_Y               = camera.PointA_LookAt_Y;
     PointA_LookAt_Z               = camera.PointA_LookAt_Z;
     CameraRotation                = camera.CameraRotation;
     FOV_Height                    = camera.FOV_Height;
     FOV_Width                     = camera.FOV_Width;
     field_68                      = camera.field_68;
     field_6C                      = camera.field_6C;
     field_70                      = camera.field_70;
     field_74                      = camera.field_74;
     PointB_LookFrom_X             = camera.PointB_LookFrom_X;
     PointB_LookFrom_Y             = camera.PointB_LookFrom_Y;
     PointB_LookFrom_Z             = camera.PointB_LookFrom_Z;
     PointB_LookAt_X               = camera.PointB_LookAt_X;
     PointB_LookAt_Y               = camera.PointB_LookAt_Y;
     PointB_LookAt_Z               = camera.PointB_LookAt_Z;
     CameraDistanceFromPlayerLookA = camera.CameraDistanceFromPlayerLookA;
     CameraHeightFromPlayerLookA   = camera.CameraHeightFromPlayerLookA;
     CameraDistanceFromPlayerLookB = camera.CameraDistanceFromPlayerLookB;
     CameraHeightFromPlayerLookB   = camera.CameraHeightFromPlayerLookB;
     field_A0                      = camera.field_A0;
     field_A4                      = camera.field_A4;
     field_A8                      = camera.field_A8;
     field_AC                      = camera.field_AC;
     TransitionTimeEnter           = camera.TransitionTimeEnter;
     TransitionTimeExit            = camera.TransitionTimeExit;
     field_B8                      = camera.field_B8;
     field_BC                      = camera.field_BC;
     field_C0                      = camera.field_C0;
     field_C4                      = camera.field_C4;
     field_C8                      = camera.field_C8;
     field_CC                      = camera.field_CC;
     field_D0                      = camera.field_D0;
     field_D4                      = camera.field_D4;
     field_D8                      = camera.field_D8;
 }
コード例 #5
0
        private void ListBoxCameras_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProgramIsChangingStuff = true;

            if (!hasRemoved & CurrentlySelectedCamera != -1)
            {
                (ListBoxCameras.Items[CurrentlySelectedCamera] as ShadowCamera).isSelected = false;
            }
            else if (hasRemoved)
            {
                hasRemoved = false;
            }

            CurrentlySelectedCamera = ListBoxCameras.SelectedIndex;

            if (CurrentlySelectedCamera != -1)
            {
                try {
                    ShadowCamera current = ListBoxCameras.Items[CurrentlySelectedCamera] as ShadowCamera;

                    current.isSelected = true;

                    numericUpDown_cameraNumber.Value                  = current.CameraNumber;
                    comboBox_cameraMode.SelectedItem                  = current.CameraMode;
                    numericUpDown_i08.Value                           = current.field_08;
                    numericUpDown_i0C.Value                           = current.field_0C;
                    numericUpDown_i10.Value                           = current.field_10;
                    numericUpDown_i14.Value                           = current.field_14;
                    numericUpDown_LookBLinkId.Value                   = current.LookBLinkId;
                    numericUpDown_i1C.Value                           = current.field_1C;
                    numericUpDown_TriggerPosX.Value                   = (decimal)current.TriggerPosition.X;
                    numericUpDownTriggerPosY.Value                    = (decimal)current.TriggerPosition.Y;
                    numericUpDownTriggerPosZ.Value                    = (decimal)current.TriggerPosition.Z;
                    numericUpDown_TriggerRotX.Value                   = (decimal)(current.TriggerRotation.X * (180f / Math.PI));
                    numericUpDownTriggerRotY.Value                    = (decimal)(current.TriggerRotation.Y * (180f / Math.PI));
                    numericUpDownTriggerRotZ.Value                    = (decimal)(current.TriggerRotation.Z * (180f / Math.PI));
                    numericUpDown_TriggerScaleX.Value                 = (decimal)current.TriggerScale.X;
                    numericUpDownTriggerScaleY.Value                  = (decimal)current.TriggerScale.Y;
                    numericUpDownTriggerScaleZ.Value                  = (decimal)current.TriggerScale.Z;
                    numericUpDown_PointA_LookFrom_X.Value             = (decimal)current.PointA_LookFrom_X;
                    numericUpDown_PointA_LookFrom_Y.Value             = (decimal)current.PointA_LookFrom_Y;
                    numericUpDown_PointA_LookFrom_Z.Value             = (decimal)current.PointA_LookFrom_Z;
                    numericUpDown_PointA_LookAt_X.Value               = (decimal)current.PointA_LookAt_X;
                    numericUpDown_PointA_LookAt_Y.Value               = (decimal)current.PointA_LookAt_Y;
                    numericUpDown_PointA_LookAt_Z.Value               = (decimal)current.PointA_LookAt_Z;
                    numericUpDown_CameraRotation.Value                = (decimal)(current.CameraRotation * (180f / Math.PI));
                    numericUpDown_FOV_Height.Value                    = (decimal)(current.FOV_Height * (180f / Math.PI));
                    numericUpDown_FOV_Width.Value                     = (decimal)(current.FOV_Width * (180f / Math.PI));
                    numericUpDown_f68.Value                           = (decimal)current.field_68;
                    numericUpDown_f6C.Value                           = (decimal)current.field_6C;
                    numericUpDown_f70.Value                           = (decimal)current.field_70;
                    numericUpDown_f74.Value                           = (decimal)current.field_74;
                    numericUpDown_PointB_LookFrom_X.Value             = (decimal)current.PointB_LookFrom_X;
                    numericUpDown_PointB_LookFrom_Y.Value             = (decimal)current.PointB_LookFrom_Y;
                    numericUpDown_PointB_LookFrom_Z.Value             = (decimal)current.PointB_LookFrom_Z;
                    numericUpDown_PointB_LookAt_X.Value               = (decimal)current.PointB_LookAt_X;
                    numericUpDown_PointB_LookAt_Y.Value               = (decimal)current.PointB_LookAt_Y;
                    numericUpDown_PointB_LookAt_Z.Value               = (decimal)current.PointB_LookAt_Z;
                    numericUpDown_CameraDistanceFromPlayerLookA.Value = (decimal)current.CameraDistanceFromPlayerLookA;
                    numericUpDown_CameraHeightFromPlayerLookA.Value   = (decimal)current.CameraHeightFromPlayerLookA;
                    numericUpDown_CameraDistanceFromPlayerLookB.Value = (decimal)current.CameraDistanceFromPlayerLookB;
                    numericUpDown_CameraHeightFromPlayerLookB.Value   = (decimal)current.CameraHeightFromPlayerLookB;
                    numericUpDown_fA0.Value                           = (decimal)current.field_A0;
                    numericUpDown_fA4.Value                           = (decimal)current.field_A4;
                    numericUpDown_fA8.Value                           = (decimal)current.field_A8;
                    numericUpDown_fAC.Value                           = (decimal)current.field_AC;
                    numericUpDown_TransitionTimeEnter.Value           = (decimal)current.TransitionTimeEnter;
                    numericUpDown_TransitionTimeExit.Value            = (decimal)current.TransitionTimeExit;
                    numericUpDown_fB8.Value                           = (decimal)current.field_B8;
                    numericUpDown_fBC.Value                           = (decimal)current.field_BC;
                    numericUpDown_fC0.Value                           = (decimal)current.field_C0;
                    numericUpDown_fC4.Value                           = (decimal)current.field_C4;
                    numericUpDown_fC8.Value                           = (decimal)current.field_C8;
                    numericUpDown_fCC.Value                           = (decimal)current.field_CC;
                    numericUpDown_fD0.Value                           = (decimal)current.field_D0;
                    numericUpDown_fD4.Value                           = (decimal)current.field_D4;
                    numericUpDown_fD8.Value                           = (decimal)current.field_D8;
                } catch {
                    MessageBox.Show("Could not load this camera properly: one or more properties are unsupported.");
                }
            }

            UpdateLabelCameraCount();
            ProgramIsChangingStuff = false;
        }
コード例 #6
0
        public static Tuple <ShadowCameraFileHeader, List <ShadowCamera> > ImportCameraFile(string fileName)
        {
            List <ShadowCamera>    list = new List <ShadowCamera>();
            ShadowCameraFileHeader header;

            using (BinaryReader camReader = new BinaryReader(new FileStream(fileName, FileMode.Open)))
            {
                camReader.BaseStream.Position = 0;
                header = new ShadowCameraFileHeader(
                    camReader.ReadInt32(), camReader.ReadInt32(), camReader.ReadInt32(),
                    camReader.ReadInt32(), camReader.ReadInt32(), camReader.ReadInt32()
                    );

                while (camReader.BaseStream.Position != camReader.BaseStream.Length)
                {
                    ShadowCamera TempCam = new ShadowCamera(
                        camReader.ReadInt32(), //i_00
                        camReader.ReadInt32(),
                        camReader.ReadInt32(),
                        camReader.ReadInt32(),
                        camReader.ReadInt32(),
                        camReader.ReadInt32(),
                        camReader.ReadInt32(),
                        camReader.ReadInt32(), //i_1C
                        new Vector3(camReader.ReadSingle(), camReader.ReadSingle(), camReader.ReadSingle()),
                        new Vector3(camReader.ReadSingle(), camReader.ReadSingle(), camReader.ReadSingle()),
                        new Vector3(camReader.ReadSingle(), camReader.ReadSingle(), camReader.ReadSingle()),
                        camReader.ReadSingle(), //i_44
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(), //i_58
                        camReader.ReadSingle(),
                        camReader.ReadSingle(), //60
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(), //70
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(), //80
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(), //90
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(), //A0
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(), //B0
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(), //C0
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(),
                        camReader.ReadSingle(), //D0
                        camReader.ReadSingle(),
                        camReader.ReadSingle()
                        );

                    //if (TempCam.CameraType == 0 & TempCam.CameraSpeed == 0 & TempCam.Integer3 == 0 & TempCam.ActivationType == 0 & TempCam.TriggerShape == 0)
                    //   continue;

                    TempCam.CreateTransformMatrix();

                    list.Add(TempCam);
                }
            }
            return(Tuple.Create(header, list));
        }