private void RefreshComponents() { int dWidth = Size.Width - MinimumSize.Width; int dHeight = Size.Height - MinimumSize.Height; pb_render.Size = new Size(875 + dWidth, 255 + dHeight); b_operate.Location = new Point(614, 355 + dHeight); b_add.Location = new Point(294, 390 + dHeight); cb_objpath.Location = new Point(295, 321 + dHeight); cb_object.Location = new Point(612, 321 + dHeight); tb_name.Location = new Point(294, 364 + dHeight); l_path.Location = new Point(292, 305 + dHeight); l_name.Location = new Point(295, 348 + dHeight); l_object.Location = new Point(609, 305 + dHeight); cb_scnpath.Location = new Point(12, 321 + dHeight); b_open.Location = new Point(12, 355 + dHeight); b_save.Location = new Point(135, 355 + dHeight); b_create.Location = new Point(12, 390 + dHeight); b_close.Location = new Point(135, 390 + dHeight); l_scnPath.Location = new Point(12, 305 + dHeight); b_cam_settings.Location = new Point(790 + dWidth, 10); this.b_exit.Location = new Point(614, 390 + dHeight); mainCamera.Screen = new Bitmap(pb_render.Width, pb_render.Height); pb_render.Image = mainCamera.Screen; mainCamera.Redraw(); }
private void Element_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { camera.Pos.Orientation.Rotation += ((double)(e.X - xMouse)) / 2000 * RotationVelocity * (AroundCentre ? -1:1); camera.Pos.Orientation.Incline += ((double)(e.Y - yMouse)) / 2000 * RotationVelocity * (AroundCentre ? -1 : 1); } else if (e.Button == MouseButtons.Middle) { if (!AroundCentre) { camera.Pos.Location = new Model.Vertex((double)(xMouse - e.X) / 1000 * MovementVelocity, 0, (double)(e.Y - yMouse) / 1000 * MovementVelocity).FromPosition(camera.Pos); } } else if (e.Button == MouseButtons.Left && !camera.Orthogonal) { if (AroundCentre) { Distance += (double)(e.Y - yMouse) / 1000 * MovementVelocity; } else { camera.Pos.Location = new Model.Vertex(0, (double)(yMouse - e.Y) / 1000 * MovementVelocity, 0).FromPosition(camera.Pos); } } if (AroundCentre) { camera.Pos.Location.X = Math.Cos(-camera.Pos.Orientation.Incline) * Distance; camera.Pos.Location.Z = (RotationCentre?.Pos.Location.Z ?? 0) + Distance * Math.Sin(-camera.Pos.Orientation.Incline); camera.Pos.Location.Y = (RotationCentre?.Pos.Location.Y ?? 0) + camera.Pos.Location.X * Math.Sin(camera.Pos.Orientation.Rotation - Math.PI / 2); camera.Pos.Location.X = (RotationCentre?.Pos.Location.X ?? 0) + camera.Pos.Location.X * Math.Cos(camera.Pos.Orientation.Rotation - Math.PI / 2); } if (e.Button != MouseButtons.None) { camera.Redraw(); } xMouse = e.X; yMouse = e.Y; }
private void RefreshCamera() { camera.Redraw(); //cameraCtrl.ThrowChanged(); }