コード例 #1
0
        void IMouseHandler.canvas_MouseDown(object sender, GLMouseEventArgs e)
        {
            this.lastBindingMouseButtons = this.BindingMouseButtons;
            if ((e.Button & this.lastBindingMouseButtons) != GLMouseButtons.None)
            {
                var control = sender as Control;
                this.SetBounds(control.Width, control.Height);

                if (!cameraState.IsSameState(this.camera))
                {
                    SetCamera(this.camera.Position, this.camera.Target, this.camera.UpVector);
                }

                this._startPosition = GetArcBallPosition(e.X, e.Y);

                mouseDownFlag = true;

                {
                    var mouseDown = this.MouseDown;
                    if (mouseDown != null)
                    {
                        mouseDown(this, e);
                    }
                }
            }
        }
コード例 #2
0
 void IMouseHandler.canvas_MouseDown(object sender, GLMouseEventArgs e)
 {
     this.lastBindingMouseButtons = this.BindingMouseButtons;
     if ((e.Button & this.lastBindingMouseButtons) != GLMouseButtons.None)
     {
         this.mouseDownFlag = true;
         this.lastPosition  = e.Location;
     }
 }
コード例 #3
0
        /// <summary>
        /// Rotate model using arc-ball method.
        /// </summary>
        /// <param name="bindingMouseButtons"></param>
        public ArcBallManipulater(GLMouseButtons bindingMouseButtons = GLMouseButtons.Left)
        {
            this.MouseSensitivity    = 6.0f;
            this.BindingMouseButtons = bindingMouseButtons;

            this.mouseDownEvent  = (((IMouseHandler)this).canvas_MouseDown);
            this.mouseMoveEvent  = (((IMouseHandler)this).canvas_MouseMove);
            this.mouseUpEvent    = (((IMouseHandler)this).canvas_MouseUp);
            this.mouseWheelEvent = (((IMouseHandler)this).canvas_MouseWheel);
        }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 public SatelliteManipulater(GLMouseButtons bindingMouseButtons = GLMouseButtons.Right)
 {
     this.HorizontalRotationFactor = 4;
     this.VerticalRotationFactor   = 4;
     this.BindingMouseButtons      = bindingMouseButtons;
     this.mouseDownEvent           = (((IMouseHandler)this).canvas_MouseDown);
     this.mouseMoveEvent           = (((IMouseHandler)this).canvas_MouseMove);
     this.mouseUpEvent             = (((IMouseHandler)this).canvas_MouseUp);
     this.mouseWheelEvent          = (((IMouseHandler)this).canvas_MouseWheel);
 }
コード例 #5
0
        /// <summary>
        /// Rotate model using arc-ball method.
        /// </summary>
        /// <param name="renderer"></param>
        /// <param name="bindingMouseButtons"></param>
        public TranslateManipulater(SceneNodeBase renderer, GLMouseButtons bindingMouseButtons = GLMouseButtons.Left)
        {
            this.renderer            = renderer;
            this.MouseSensitivity    = 6.0f;
            this.BindingMouseButtons = bindingMouseButtons;

            this.mouseDownEvent  = (((IMouseHandler)this).canvas_MouseDown);
            this.mouseMoveEvent  = (((IMouseHandler)this).canvas_MouseMove);
            this.mouseUpEvent    = (((IMouseHandler)this).canvas_MouseUp);
            this.mouseWheelEvent = (((IMouseHandler)this).canvas_MouseWheel);
        }
コード例 #6
0
 void IMouseHandler.canvas_MouseDown(object sender, GLMouseEventArgs e)
 {
     this.lastBindingMouseButtons = this.BindingMouseButtons;
     if ((e.Button & this.lastBindingMouseButtons) != GLMouseButtons.None)
     {
         this.lastPosition = e.Location;
         var control = sender as Control;
         this.SetBounds(control.Width, control.Height);
         this.mouseDownFlag = true;
         PrepareCamera();
     }
 }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        public RotationManipulater(SceneNodeBase rootNode, GLMouseButtons bindingMouseButtons = GLMouseButtons.Left)
        {
            this.rootNode = rootNode;

            this.HorizontalRotationFactor = 4;
            this.VerticalRotationFactor   = 4;
            this.BindingMouseButtons      = bindingMouseButtons;
            this.mouseDownEvent           = (((IMouseHandler)this).canvas_MouseDown);
            this.mouseMoveEvent           = (((IMouseHandler)this).canvas_MouseMove);
            this.mouseUpEvent             = (((IMouseHandler)this).canvas_MouseUp);
            this.mouseWheelEvent          = (((IMouseHandler)this).canvas_MouseWheel);
        }
コード例 #8
0
        void IMouseHandler.canvas_MouseDown(object sender, GLMouseEventArgs e)
        {
            this.lastBindingMouseButtons = this.BindingMouseButtons;
            if ((e.Button & this.lastBindingMouseButtons) != GLMouseButtons.None)
            {
                var control = sender as Control;
                this.SetBounds(control.Width, control.Height);

                if (!cameraState.IsSameState(this.camera))
                {
                    SetCamera(this.camera.Position, this.camera.Target, this.camera.UpVector);
                }

                this._lastPosition = new Point(e.X, this.canvas.Height - e.Y - 1);

                mouseDownFlag = true;
            }
        }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stepLength"></param>
        /// <param name="horizontalRotationSpeed"></param>
        /// <param name="verticalRotationSpeed"></param>
        /// <param name="bindingMouseButtons"></param>
        public FirstPerspectiveManipulater(
            float stepLength, float horizontalRotationSpeed,
            float verticalRotationSpeed, GLMouseButtons bindingMouseButtons)
        {
            this.FrontKey = 'w';
            this.BackKey  = 's';
            this.LeftKey  = 'a';
            this.RightKey = 'd';
            this.UpKey    = 'q';
            this.DownKey  = 'e';

            this.StepLength = stepLength;
            this.HorizontalRotationSpeed = horizontalRotationSpeed;
            this.VerticalRotationSpeed   = verticalRotationSpeed;
            this.BindingMouseButtons     = bindingMouseButtons;

            this.keyPressEvent   = (((IKeyboardHandler)this).canvas_KeyPress);
            this.mouseDownEvent  = (((IMouseHandler)this).canvas_MouseDown);
            this.mouseMoveEvent  = (((IMouseHandler)this).canvas_MouseMove);
            this.mouseUpEvent    = (((IMouseHandler)this).canvas_MouseUp);
            this.mouseWheelEvent = (((IMouseHandler)this).canvas_MouseWheel);
        }
コード例 #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="axis"></param>
 /// <param name="angleInDegree"></param>
 /// <param name="button">MouseButtons 值之一,它指示曾按下的是哪个鼠标按钮。</param>
 /// <param name="clicks">鼠标按钮曾被按下的次数。</param>
 /// <param name="x">鼠标单击的 x 坐标(以像素为单位,以left为0)。相对<see cref="CtrlRoot"/>而言。</param>
 /// <param name="y">鼠标单击的 y 坐标(以像素为单位,以bottom为0)。相对<see cref="CtrlRoot"/>而言。</param>
 /// <param name="delta">鼠标轮已转动的制动器数的有符号计数。</param>
 public Rotation(vec3 axis, float angleInDegree, GLMouseButtons button, int clicks, int x, int y, int delta)
     : base(button, clicks, x, y, delta)
 {
     this.axis          = axis;
     this.angleInDegree = angleInDegree;
 }
コード例 #11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="button">MouseButtons 值之一,它指示曾按下的是哪个鼠标按钮。</param>
 /// <param name="clicks">鼠标按钮曾被按下的次数。</param>
 /// <param name="x">鼠标单击的 x 坐标(以像素为单位,以left为0)。相对<see cref="CtrlRoot"/>而言。</param>
 /// <param name="y">鼠标单击的 y 坐标(以像素为单位,以bottom为0)。相对<see cref="CtrlRoot"/>而言。</param>
 /// <param name="delta">鼠标轮已转动的制动器数的有符号计数。</param>
 public GLMouseEventArgs(GLMouseButtons button, int clicks, int x, int y, int delta)
 {
     this.Button = button; this.Clicks = clicks; this.X = x; this.Y = y; this.Delta = delta;
 }