/// <inheritdoc />
        protected override void InputOnMouseDown(object sender, IMouseEventArgs args)
        {
            base.InputOnMouseDown(sender, args);

            if (args.Buttons != MouseButtons.Middle || args.ClickCount > 1)
            {
                return;
            }

            MouseDownCameraInfo = RenderHost.CameraInfo.Cloned();
            MouseDownView       = MouseDownCameraInfo.GetTransformationMatrix(Space.Screen, Space.View).Transform(args.Position.ToPoint3D());
            OrbitOrigin         = GetOrbitOrigin(MouseDownCameraInfo);
        }
Ejemplo n.º 2
0
        protected override void InputOnMouseDown(object sender, IMouseEventArgs args)
        {
            base.InputOnMouseDown(sender, args);

            if (args.Buttons != MouseButtons.Right)
            {
                return;
            }

            MouseDownCameraInfo = RenderHost.CameraInfo.Cloned();

            var panOrigin = GetPanOrigin(MouseDownCameraInfo);

            MouseDownPlane = new Plane(panOrigin, MouseDownCameraInfo.GetEyeDirection());

            var mouseRay = MouseDownCameraInfo.GetMouseRay(Space.Screen, args.Position.ToPoint3D());

            MouseDownOnPlane = MouseDownPlane.Value.IntersectionWith(mouseRay);
        }
Ejemplo n.º 3
0
        protected override void InputOnMouseMove(object sender, IMouseEventArgs args)
        {
            base.InputOnMouseMove(sender, args);

            if (MouseDownCameraInfo is null || !MouseDownPlane.HasValue || !MouseDownOnPlane.HasValue)
            {
                return;
            }

            var mouseRay         = MouseDownCameraInfo.GetMouseRay(Space.Screen, args.Position.ToPoint3D());
            var mouseMoveOnPlane = MouseDownPlane.Value.IntersectionWith(mouseRay);

            var offset   = mouseMoveOnPlane - MouseDownOnPlane.Value;
            var target   = MouseDownCameraInfo.Target - offset;
            var position = MouseDownCameraInfo.Position - offset;

            var cameraInfo = RenderHost.CameraInfo;

            RenderHost.CameraInfo = new CameraInfo(position, target, cameraInfo.UpVector, cameraInfo.Projection.Cloned(), cameraInfo.Viewport);
        }