示例#1
0
        private void MoveCameraToPosition(_AtlVector3 newPos)
        {
            _AtlVector3 oldpos = new _AtlVector3(), oldlookat = new _AtlVector3();

            SceneSceneEditor.GetCameraPosLookat(ref oldpos, ref oldlookat);
            _AtlVector3 delta = new _AtlVector3();

            delta.x = oldlookat.x - oldpos.x; delta.y = oldlookat.y - oldpos.y; delta.z = oldlookat.z - oldpos.z;
            _AtlVector3 newpos = new _AtlVector3();

            newpos.x = newPos.x - delta.x; newpos.y = newPos.y - delta.y; newpos.z = newPos.z - delta.z;
            SceneSceneEditor.SetCameraPosLookat(ref newpos, ref newPos);
        }
示例#2
0
        /// <summary>
        /// 设置相机坐标 ahpho suntao
        /// </summary>
        /// <param name="x">x坐标</param>
        /// <param name="y">y坐标</param>
        /// <param name="z">z坐标</param>
        public void SetCameraFocus(int x, int y, int z)
        {
            _AtlVector3 cameraLocation = new _AtlVector3();
            _AtlVector3 cameraLookAt   = new _AtlVector3();
            _AtlVector3 delta          = new _AtlVector3();

            SceneSceneEditor.GetCameraPosLookat(ref cameraLocation, ref cameraLookAt);

            delta.x = cameraLookAt.x - cameraLocation.x;
            delta.y = cameraLookAt.y - cameraLocation.y;
            delta.z = cameraLookAt.z - cameraLocation.z;

            cameraLookAt.x = x;
            cameraLookAt.y = y;
            cameraLookAt.z = z;

            cameraLocation.x = x - delta.x;
            cameraLocation.y = y - delta.y;
            cameraLocation.z = z - delta.z;

            SceneSceneEditor.SetCameraPosLookat(ref cameraLocation, ref cameraLookAt);
        }
示例#3
0
        private void BaseForm_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Shift)
            {
                m_shiftPress = true;
            }
            if (e.Control)
            {
                m_ctrlPress = true;
            }

            if (!(this.ActiveControl is PanelDockContainer) && this.ActiveControl != this.PanelView)
            {
                return;
            }
            if (!e.Alt && !e.Shift && e.Control && e.KeyCode == Keys.Enter)
            {
                ToggleFullScreen();
                return;
            }
            if (!e.Alt && !e.Shift && !e.Control && e.KeyCode == Keys.P)
            {
                TogglePMode();
                return;
            }
            if (!e.Alt && !e.Shift && !e.Control && e.KeyCode == Keys.T)
            {
                ToggleTopView();
                return;
            }
            if (!e.Alt && !e.Shift && !e.Control && e.KeyCode == Keys.X)
            {
                SceneSceneEditor.DropSelectedEntity();
            }
            if (!e.Alt && !e.Shift && !e.Control && e.KeyCode == Keys.Z)
            {
                SceneSceneEditor.ZoomToObj();
            }
            if (e.Shift && e.KeyCode >= Keys.F1 && e.KeyCode <= Keys.F1 + CAMERA_STORAGE - 1)
            {
                int saveindex = e.KeyCode - Keys.F1;
                m_bPosSaved[saveindex] = true;
                SceneSceneEditor.GetCameraPosLookat(ref m_SavedCameraPos[saveindex], ref m_SavedCameraLookat[saveindex]);
                return;
            }
            if (!e.Shift && e.KeyCode >= Keys.F1 && e.KeyCode <= Keys.F1 + CAMERA_STORAGE - 1)
            {
                int saveindex = e.KeyCode - Keys.F1;
                if (m_bPosSaved[saveindex])
                {
                    SceneSceneEditor.SetCameraPosLookat(ref m_SavedCameraPos[saveindex], ref m_SavedCameraLookat[saveindex]);
                }
                return;
            }
            if (!e.Shift && !e.Control && e.KeyCode == Keys.Enter)
            {
                ShowProperties();
            }

            switch (e.KeyCode)
            {
            case Keys.Oemcomma:
            {
                NpcPlayNextAction();
                return;
            }

            case Keys.OemPeriod:
            {
                NpcPlayPreviousAction();
                return;
            }

            case Keys.G:
            {
                EditGroup();
                return;
            }

            case Keys.Oem1:
            {
                editMode = EditMode.None;
                break;
            }

            case Keys.W:
            {
                cameraLookAtBox.Text = GetCameraLookAt();
                break;
            }

            case Keys.S:
            {
                cameraLookAtBox.Text = GetCameraLookAt();
                break;
            }

            case Keys.A:
            {
                cameraLookAtBox.Text = GetCameraLookAt();
                break;
            }

            case Keys.D:
            {
                cameraLookAtBox.Text = GetCameraLookAt();
                break;
            }

            case Keys.Delete:
            {
                DeleteSelectedObject();
                break;
            }

            case Keys.Add:
                goto case Keys.Oemplus;

            case Keys.Oemplus:
            {
                m_parent.m_sliderCameraSpeed.Value++;
                m_parent.UpdateCameraSpeedToUI();
                break;
            }

            case Keys.Subtract:
                goto case Keys.OemMinus;

            case Keys.OemMinus:
            {
                m_parent.m_sliderCameraSpeed.Value--;
                m_parent.UpdateCameraSpeedToUI();
                break;
            }
            }

            EngineLayer.ATLBase.ProcessMessage((uint)WM_KEYDOWN, e.KeyValue, e.KeyValue);
        }