示例#1
0
文件: Editor.cs 项目: Tokter/TokED
        public Editor()
        {
            _tools = new Tools(this);

            _manager = new RenderManager();
            if (_editorCamera == null)
            {
                _editorCamera = new Camera();
                _editorCamera.CameraType = CameraType.Orthogonal;
                _editorCamera.Position = new Vector3(0, 0, 200);
                _editorCamera.LookAt = new Vector3(0, 0, 0);
                _editorCamera.ZNear = 0;
                _editorCamera.ZFar = 10000;
                _editorCamera.Up = new Vector3(0, 1, 0);
                _editorCamera.Fov = 1.0f;
            }

            if (_guiCamera == null)
            {
                _guiCamera = new Camera();
                _guiCamera.CameraType = CameraType.HUD;
                _guiCamera.Position = new Vector3(0, 0, 200);
                _guiCamera.LookAt = new Vector3(0, 0, 0);
                _guiCamera.ZNear = 0;
                _guiCamera.ZFar = 10000;
                _guiCamera.Up = new Vector3(0, 1, 0);
            }
            _guiFont = new TokGL.Font(Plugins.LoadResourceStream("ArialWhite.png"), Plugins.LoadResourceStream("ArialWhite.info"));

            _spriteBatch = new SpriteBatch();
            _lineBatch = new LineBatch();
        }
示例#2
0
 public override void Mouse_Down(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Middle)
     {
         _camera = Editor.Camera.Clone();
         _mouseStartPos = new Vector2(e.X, e.Y);
     }
 }
示例#3
0
 public override void Mouse_Down(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Middle)
     {
         //freeze camera
         _camera = Editor.Camera.Clone();
         _startMouseRay = _camera.GetWorldRay(new Vector2(e.X, e.Y));
         _cameraPlane = new Plane(_camera.LookAt, _camera.LookAt + _camera.Right, _camera.LookAt + _camera.UpEffective);
     }
 }
示例#4
0
文件: Camera.cs 项目: Tokter/TokED
 public Camera Clone()
 {
     var result = new Camera();
     result.CameraType = this.CameraType;
     result.LookAt = this.LookAt;
     result.Position = this.Position;
     result.Up = this.Up;
     result.Width = this.Width;
     result.Height = this.Height;
     result.Fov = this.Fov;
     result.ZNear = this.ZNear;
     result.ZFar = this.ZFar;
     return result;
 }