Exemplo n.º 1
0
        private void pnlViewport_Load(object sender, EventArgs e)
        {
            Control             = new GLControl(new GraphicsMode(32, 24, 8, 4), 3, 0, GraphicsContextFlags.Default);
            Control.Name        = "glcViewport";
            Control.VSync       = true;
            Control.Width       = 100;
            Control.Height      = 100;
            Control.Dock        = DockStyle.Fill;
            Control.Top         = 3;
            Control.Left        = 3;
            Control.BackColor   = Color.Black;
            Control.Paint      += glcViewport_Paint;
            Control.Resize     += glcViewport_Resize;
            Control.MouseMove  += glcViewport_MouseMove;
            Control.MouseDown  += glcViewport_MouseDown;
            Control.MouseUp    += glcViewport_MouseUp;
            Control.MouseEnter += glcViewport_MouseEnter;
            Control.MouseLeave += glcViewport_MouseLeave;
            Control.MouseWheel += glcViewport_MouseWheel;
            Control.Click      += glcViewport_Click;
            this.paneViewport.Controls.Add(Control);

            GLControlInit();
            viewman = new ViewportManager();

            sw.Start();
            Application.Idle += new EventHandler(Application_Idle);

            viewman.Initialise();

            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraSelect, KeyBinding.KeysCameraSelect, SetModeSelect);
            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraPan, KeyBinding.KeysCameraPan, SetModePan);
            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraZoom, KeyBinding.KeysCameraZoom, SetModeZoom);
            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraRotate, KeyBinding.KeysCameraRotate, SetModeRotate);
        }
Exemplo n.º 2
0
        public ViewportManager()
        {
            var top = new Viewport { Name = "Top", Position = Viewport.Quadrant.TopLeft, ProjectionMode = ProjectionType.Orthographic, Axis = Vector3.UnitY };
            top.Camera.SetRotation(0, MathHelper.DegreesToRadians(-90), MathHelper.DegreesToRadians(180));

            var right = new Viewport { Name = "Side", Position = Viewport.Quadrant.TopRight, ProjectionMode = ProjectionType.Orthographic, Axis = Vector3.UnitX };
            right.Camera.SetRotation(MathHelper.DegreesToRadians(-90), 0, 0);

            var front = new Viewport { Name = "Front", Position = Viewport.Quadrant.BottomLeft, ProjectionMode = ProjectionType.Orthographic, Axis = Vector3.UnitZ };
            front.Camera.SetRotation(MathHelper.DegreesToRadians(180), 0, 0);

            var threedee = new Viewport { Name = "3D", Position = Viewport.Quadrant.BottomRight };
            threedee.Camera.SetRotation(0, MathHelper.DegreesToRadians(-135), MathHelper.DegreesToRadians(135));

            viewports.Add(top);
            viewports.Add(right);
            viewports.Add(front);
            viewports.Add(threedee);

            active = threedee;

            InputManager.Current.RegisterBinding('*', KeyBinding.KeysActionScaleUp, ActionScaleUp);
            InputManager.Current.RegisterBinding('/', KeyBinding.KeysActionScaleDown, ActionScaleDown);
            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraFrame, KeyBinding.KeysCameraFrame, Frame);

            Current = this;
        }
Exemplo n.º 3
0
        public ViewportManager()
        {
            var top = new Viewport {
                Name = "Top", Position = Viewport.Quadrant.TopLeft, ProjectionMode = ProjectionType.Orthographic, Axis = Vector3.UnitY
            };

            top.Camera.SetRotation(0, MathHelper.DegreesToRadians(-90), MathHelper.DegreesToRadians(180));

            var right = new Viewport {
                Name = "Side", Position = Viewport.Quadrant.TopRight, ProjectionMode = ProjectionType.Orthographic, Axis = Vector3.UnitX
            };

            right.Camera.SetRotation(MathHelper.DegreesToRadians(-90), 0, 0);

            var front = new Viewport {
                Name = "Front", Position = Viewport.Quadrant.BottomLeft, ProjectionMode = ProjectionType.Orthographic, Axis = Vector3.UnitZ
            };

            front.Camera.SetRotation(MathHelper.DegreesToRadians(180), 0, 0);

            var threedee = new Viewport {
                Name = "3D", Position = Viewport.Quadrant.BottomRight
            };

            threedee.Camera.SetRotation(0, MathHelper.DegreesToRadians(-135), MathHelper.DegreesToRadians(135));

            viewports.Add(top);
            viewports.Add(right);
            viewports.Add(front);
            viewports.Add(threedee);

            active = threedee;

            InputManager.Current.RegisterBinding('*', KeyBinding.KeysActionScaleUp, ActionScaleUp);
            InputManager.Current.RegisterBinding('/', KeyBinding.KeysActionScaleDown, ActionScaleDown);
            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraFrame, KeyBinding.KeysCameraFrame, Frame);

            Current = this;
        }
Exemplo n.º 4
0
        private void pnlViewport_Load(object sender, EventArgs e)
        {
            Control = new GLControl(new GraphicsMode(32, 24, 8, 4), 3, 0, GraphicsContextFlags.Default)
            {
                Name      = "glcViewport",
                VSync     = true,
                Width     = 100,
                Height    = 100,
                Dock      = DockStyle.Fill,
                Top       = 3,
                Left      = 3,
                BackColor = Color.Black
            };

            Control.Paint      += glcViewport_Paint;
            Control.Resize     += glcViewport_Resize;
            Control.MouseMove  += glcViewport_MouseMove;
            Control.MouseDown  += glcViewport_MouseDown;
            Control.MouseUp    += glcViewport_MouseUp;
            Control.MouseEnter += glcViewport_MouseEnter;
            Control.MouseLeave += glcViewport_MouseLeave;
            Control.MouseWheel += glcViewport_MouseWheel;
            Control.Click      += glcViewport_Click;
            paneViewport.Controls.Add(Control);

            gLControlInit();
            viewman = new ViewportManager();

            sw.Start();
            Application.Idle += new EventHandler(application_Idle);

            viewman.Initialise(Control.Width, Control.Height);

            InputManager.Current.RegisterInputAction(SetModeSelect, "CameraModeSelect", "Activates the Camera Select mode", "Camera Controls");
            InputManager.Current.RegisterInputAction(SetModePan, "CameraModePan", "Activates the Camera Pan mode", "Camera Controls");
            InputManager.Current.RegisterInputAction(SetModeZoom, "CameraModeZoom", "Activates the Camera Zoom mode", "Camera Controls");
            InputManager.Current.RegisterInputAction(SetModeRotate, "CameraModeRotate", "Activates the Camera Rotate mode", "Camera Controls");
        }
Exemplo n.º 5
0
        private void pnlViewport_Load(object sender, EventArgs e)
        {
            Control = new GLControl(new GraphicsMode(32, 24, 8, 4), 3, 0, GraphicsContextFlags.Default);
            Control.Name = "glcViewport";
            Control.VSync = true;
            Control.Width = 100;
            Control.Height = 100;
            Control.Dock = DockStyle.Fill;
            Control.Top = 3;
            Control.Left = 3;
            Control.BackColor = Color.Black;
            Control.Paint += glcViewport_Paint;
            Control.Resize += glcViewport_Resize;
            Control.MouseMove += glcViewport_MouseMove;
            Control.MouseDown += glcViewport_MouseDown;
            Control.MouseUp += glcViewport_MouseUp;
            Control.MouseEnter += glcViewport_MouseEnter;
            Control.MouseLeave += glcViewport_MouseLeave;
            Control.MouseWheel += glcViewport_MouseWheel;
            Control.Click += glcViewport_Click;
            this.paneViewport.Controls.Add(Control);

            GLControlInit();
            viewman = new ViewportManager();

            sw.Start();
            Application.Idle += new EventHandler(Application_Idle);

            viewman.Initialise();

            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraSelect, KeyBinding.KeysCameraSelect, SetModeSelect);
            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraPan, KeyBinding.KeysCameraPan, SetModePan);
            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraZoom, KeyBinding.KeysCameraZoom, SetModeZoom);
            InputManager.Current.RegisterBinding(Properties.Settings.Default.KeysCameraRotate, KeyBinding.KeysCameraRotate, SetModeRotate);
        }