public void TestShutterCommandCanExecute(bool canExecute) { var x = 0; var camera = new CameraView { ShutterCommand = new Command(ShutterCommand, CanExecute) }; if (camera.ShutterCommand.CanExecute(null)) { camera.ShutterCommand.Execute(null); } var expected = canExecute ? 1 : 0; Assert.Equal(expected, x); void ShutterCommand() { x++; } bool CanExecute() { return(canExecute); } }
public void SetCamera(CameraView view) { if (mainCamera != null) { cameraView = view; _cameraView = view; switch (view) { case CameraView.FREE: flyCamEnabled = true; EnableFlyCamera(true); break; case CameraView.OVERVIEW: mainCamera.transform.Copy(sceneOverview); EnableFlyCamera(false); break; case CameraView.OVERHEAD: mainCamera.transform.Copy(sceneOverhead); EnableFlyCamera(false); break; } } }
void ReleaseDesignerOutlets() { if (CameraView != null) { CameraView.Dispose(); CameraView = null; } if (GrayCardButton != null) { GrayCardButton.Dispose(); GrayCardButton = null; } if (NoCamera != null) { NoCamera.Dispose(); NoCamera = null; } if (Segments != null) { Segments.Dispose(); Segments = null; } if (Temperature != null) { Temperature.Dispose(); Temperature = null; } if (Tint != null) { Tint.Dispose(); Tint = null; } }
/** * Moves the camera to a previously stored camera view over a period of time. */ public void PanToStoredView(string viewName, float duration, Action arriveAction) { if (!storedViews.ContainsKey(viewName)) { // View has not previously been stored if (arriveAction != null) { arriveAction(); } return; } CameraView cameraView = storedViews[viewName]; if (duration == 0f) { // Move immediately Camera.main.transform.position = cameraView.cameraPos; Camera.main.orthographicSize = cameraView.cameraSize; SetCameraZ(); if (arriveAction != null) { arriveAction(); } } else { StartCoroutine(PanInternal(cameraView.cameraPos, cameraView.cameraSize, duration, arriveAction)); } }
void m_Camera_setView(CameraView cv) { switch (cv) { case CameraView.view1: { float V_fov = m_Camera.fieldOfView; float target_camera_bottom_Y = -(float)m_WheelModel.rim_d; // - 0.20f; float V_dist = Mathf.Tan(V_fov * Mathf.Deg2Rad / 2.0f) * target_camera_bottom_Y; float cam_angle = -45 * Mathf.Deg2Rad; m_Camera.transform.position = m_WheelModel.get_hub_pos().toVector3() - new Vector3(Mathf.Cos(cam_angle) * (float)m_WheelModel.rim_d / 2, -Mathf.Sin(cam_angle) * (float)m_WheelModel.rim_d / 2, 0) + new Vector3(0, 0, 0.05f); m_Camera.transform.rotation = Quaternion.Euler(45 / 2, 90, 0); break; } case CameraView.view2: { m_Camera.transform.position = m_WheelModel.get_hub_pos().toVector3() + new Vector3(-0.040f, -(float)m_WheelModel.rim_d / 2 - m_rim_profile_height * 1.5f, m_rim_profile_width); m_Camera.transform.rotation = Quaternion.Euler(0, 90, 0); break; } } }
public void Draw() { graphicsDevice.BlendState = BlendState.Opaque; graphicsDevice.DepthStencilState = DepthStencilState.Default; // Projection を更新します。 projection.AspectRatio = graphicsDevice.Viewport.AspectRatio; projection.Update(); // CameraView を更新します。 CameraView.Update(); // DirectionalLightModel.View を更新します。 DirectionalLightModel0.View.Update(); DirectionalLightModel1.View.Update(); DirectionalLightModel2.View.Update(); // GridBlockMesh を描画します。 if (GridVisible) { DrawGridBlockMesh(); } // Block を描画します。 DrawBlock(); }
private void Camera_Clicked(object sender, EventArgs e) { var camera = new CameraView(); camera.buttonCallback = takePicture; Navigation.PushAsync(camera); }
public void Initialize(IQiConnectionServiceProxy connectionService) { _connectionService = connectionService; GuiContent = new CameraView { DataContext = this }; }
private void Form1_SizeChanged(object sender, EventArgs e) { if (Environment.ActiveCamera != null) { CameraView.SetActiveCamera(Environment.ActiveCamera); } }
public void ConnectCameraView(CameraView cameraView) { this.cameraView = cameraView; if (this.cameraView.Camera == null) { return; } try { this.tbrGain.Minimum = this.cameraView.Camera.GainMin; this.tbrGain.Maximum = this.cameraView.Camera.GainMax; this.tbrExposure.Minimum = this.cameraView.Camera.ExposureTimeMin; this.tbrExposure.Maximum = this.cameraView.Camera.ExposureTimeMax; this.tbrExposure.Value = MathUtils.Limit(cameraView.Camera.Prm.Exposure, tbrExposure.Minimum, tbrExposure.Maximum); this.tbrGain.Value = MathUtils.Limit(cameraView.Camera.Prm.Gain, tbrGain.Minimum, tbrGain.Maximum); this.lblExpo.Text = this.tbrExposure.Value.ToString(); this.lblGain.Text = this.tbrGain.Value.ToString(); //this.cbxLight.SelectedIndex = (int)this.camera.Prm.LightType; this.cameraView.UpdateShape(this.lastShape); this.cameraView.UpdateROI((double)this.nudRaduis.Value); } catch (Exception ex) { } }
private void OpenCameraButton_Click(object sender, RoutedEventArgs e) { //ScenesListView.SelectedItem var view = new CameraView() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch }; var viewModel = (view.DataContext as CameraViewModel); //将控件嵌入窗口之中 var window = new Window(); window.MinWidth = view.MinWidth + 50; window.MinHeight = view.MinHeight + 50; window.MaxWidth = view.MaxWidth; window.MaxHeight = view.MaxHeight; window.Width = view.MinWidth + 50; window.Height = view.MinHeight + 50; window.Content = view; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; window.Owner = Window.GetWindow(this); window.Title = "相机窗口"; window.ShowDialog(); }
// Whenever any camera will render us, add a command buffer to do the work on it public void OnWillRenderObject() { if (renderingMode != RenderingMode.SVFDraw) { return; } if (isInitialized) { var cam = Camera.current; if (cam == null) { return; } CameraView camView = cameraViews.Find(cam, targetDevice, flipHandedness); if (null != camView && null != pluginInterop) { pluginInterop.SetCommandBufferOnCamera(cam, camView.cameraId); } // This is the right time to give SVF the camera info for this frame. UpdateCamera(); } }
private void SetDifficulty() { switch (difficulty) { case Difficulty.BEGINNER: numOfMines = 10; width = 10; height = 10; break; case Difficulty.INTERMEDIATE: numOfMines = 40; width = 15; height = 15; break; case Difficulty.EXPERT: numOfMines = 99; width = 20; height = 20; break; } CameraView.AdjustCameraPosition(width, height); }
public void ShowQuickDistantView() { transform.parent = null; transform.rotation = Quaternion.Euler(Vector3.zero); previousView = CameraViews.ActiveView; CameraViews.SetActive(CameraView.CameraViewType.QuickDistant); }
public void OnPointerUp(PointerEventData data) { RaycastHit hit; if (cancelArea != null && cancelArea.CheckScreenPoint(data)) { cancelHandler(); } else { if (CameraView.RaycastScreen(data.position, out hit, mask)) { //NavMeshHit nmHit; //if (NavMesh.SamplePosition (hit.point, out nmHit, 0.1f, NavMesh.AllAreas)) v3upHandler(hit.point); //else // v3upHandler (MyExtensions.v3Inf); } } if (cancelArea != null) { cancelArea.gameObject.SetActive(false); } Done(); }
// Start is called before the first frame update void Start() { cstPan = GameObject.Find("CustomizationPanel").GetComponent <CustomizationPanel>(); cameraScript = GameObject.Find("CustomizationPanel").GetComponent <CameraView>(); tableDrawer = GameObject.Find("Table").GetComponent <Animator>(); drawerAnimator = GameObject.Find("Chest of drawers").GetComponent <Animator>(); }
void Start() { chF = Jugador.GetComponent <CharacterFootsteps>(); camS = Jugador.GetComponent <CameraView>(); fpC = Jugador.GetComponent <FirstPersonController>(); inH = Jugador.GetComponentInChildren <InputHandler>(); }
private void setBackgroundAlpha() /* Set the transparency of the background that covers the whole canvas (keeping the * same RGB color it already was). */ { CameraView currentView = interfightCameraView.currentView; float alpha; if (currentView == CameraView.Right) { alpha = viewedAlpha; } else if (currentView == CameraView.Start && isHovered) { alpha = hoveredAlpha; } else { alpha = 0; } Color color = backgroundImage.color; color.a = alpha; backgroundImage.color = color; }
void Start() { Player = GameObject.FindGameObjectWithTag("Player"); player_Controller = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); CameraObj = GameObject.FindGameObjectWithTag("MainCamera"); cameraView = GameObject.Find("ViewTriggers").GetComponent <CameraView>(); }
public void MoveTo(Transform trans) { NetworkIdentity netId = trans.GetComponent <NetworkIdentity> (); if (netId != null) { if (isServer) { Debug.Log("follow by server"); ActualMoveToTrans(netId.netId.Value); } else { Debug.Log("follow by client"); CmdMoveToTrans(netId.netId.Value); } } else { Debug.Log("No net id " + trans.name); } if (selected) { CameraView.SetTarget(trans); } }
public static System.Drawing.Rectangle ToScreenCoordinates(Rectangle rectangle, System.Drawing.Size layerSize) { float x = (float)rectangle.X; float y = (float)rectangle.Y; float width = (float)rectangle.Width; float height = (float)rectangle.Height; CameraView view = Woofer.Controller.ActiveScene.CurrentViewport; if (!new Rectangle(x, y, width, height) .IntersectsWith( new Rectangle(view.X - LevelRenderingLayer.LevelScreenSize.Width / 2, view.Y - LevelRenderingLayer.LevelScreenSize.Height / 2, LevelRenderingLayer.LevelScreenSize.Width, LevelRenderingLayer.LevelScreenSize.Height))) { return(new System.Drawing.Rectangle(0, 0, 0, 0)); } x -= (int)Math.Floor(view.X); y -= (int)Math.Floor(view.Y); y *= -1; y -= height; x += LevelRenderingLayer.LevelScreenSize.Width / 2; y += LevelRenderingLayer.LevelScreenSize.Height / 2; float scaleX = layerSize.Width / LevelRenderingLayer.LevelScreenSize.Width; float scaleY = layerSize.Height / LevelRenderingLayer.LevelScreenSize.Height; return(new System.Drawing.Rectangle((int)Math.Floor(x * scaleX), (int)Math.Floor(y * scaleY), (int)(width * scaleX), (int)(height * scaleY))); }
public void OnPointerUp(PointerEventData data) { if (dragDelta.y / Screen.height > dragDelta.x * 2 / Screen.width && !enter) { panel.ctrl.Dash(); } else { if (holdTime > 0.3f) { if (new Vector2(dragDelta.x / Screen.width * 2, dragDelta.y * 2 / Screen.height).sqrMagnitude <= 0.00001f) { panel.ctrl.Stop(); } } else { CameraView.ShowTapAlly(panel.ctrl.transform.position); panel.SetSelection(timeSinceLastClick < 0.3f); } } timeSinceLastClick = 0; holdTime = -1; enter = false; }
void Update() { //debug if (Input.GetKeyDown("space")) { //ToggleCurrentPlayerPanels(); cameraIsMoving = true; if (cameraView == CameraView.DICE) { cameraView = CameraView.MAIN; } else { cameraView = cameraView = CameraView.DICE; } } if (cameraIsMoving) { switch (cameraView) { case CameraView.MAIN: MoveCameraToMain(); break; case CameraView.DICE: MoveCameraToDice(); break; } } }
void CameraMove() { if (Input.GetKey(KeyCode.Alpha1)) { cameraView = CameraView.FullView; } else if (Input.GetKey(KeyCode.Alpha2)) { cameraView = CameraView.PartialView; } switch (cameraView) { case CameraView.FullView: Fullview.SetActive(true); PartialView.SetActive(false); break; case CameraView.PartialView: Fullview.SetActive(false); PartialView.SetActive(true); break; default: break; } }
public void OnDrag(PointerEventData data) { if (Input.touchCount <= 1) { Vector2 drag = new Vector2(data.delta.x * -20 / Screen.width, data.delta.y * -20 / Screen.height); /*if (zoom >= 0) * CameraView.Move (drag / (1 + zoom)); * else * CameraView.Move (drag * (1 - zoom));*/ CameraView.Move(drag * zoomCoef); dragDelta += data.delta.magnitude / Screen.dpi; } else { Vector2 a = Input.GetTouch(0).position; Vector2 b = Input.GetTouch(1).position; float z = new Vector2((a.x - b.x) * 12 / Screen.width, (a.y - b.y) * 12 / Screen.height).magnitude; if (prevDist != 0) { Zoom((z - prevDist) * 2); } prevDist = z; } }
/// <summary> /// Handles the orientation change. /// </summary> /// <param name="sender">Sender.</param> /// <param name="arg">Argument.</param> public void HandleOrientationChange(object sender, Orientation arg) { FocusView.Orientation = CameraView.Orientation = OrientationPage.PageOrientation = _model.PageOrientation = arg; // bindings will not work with column width properties so we have to perform this manually switch (PageOrientation) { case Orientation.LandscapeLeft: case Orientation.LandscapeRight: MainLayout.ColumnDefinitions[5].Width = new GridLength(CAMERA_BUTTON_CONTAINER_WIDTH, GridUnitType.Absolute); break; case Orientation.Portrait: MainLayout.ColumnDefinitions[4].Width = new GridLength(CAMERA_BUTTON_CONTAINER_WIDTH, GridUnitType.Absolute); break; } if (_model.CanCapture) { FocusView.Reset(); } CameraView.NotifyOrientationChange(arg); }
void Zoom(float d) { float prev = zoomCoef; zoom = zoom + d; CameraView.Move(d * prev); }
/// <summary> /// Handles the focus change. /// </summary> /// <param name="sender">Sender.</param> /// <param name="arg">Argument.</param> public void HandleFocusChange(object sender, Point arg) { if (_model.CanCapture) { CameraView.NotifyFocus(arg); } }
public override void Render <TSurface, TSource>(ScreenRenderer <TSurface, TSource> r) { var back = r.GetLayerGraphics("parallax_back"); var front = r.GetLayerGraphics("parallax_front"); CameraView view = Owner.CurrentViewport; foreach (Parallax parallax in WatchedComponents) { if (!parallax.Owner.Active) { continue; } var layer = parallax.Speed.X >= 1 ? front : back; Spatial sp = parallax.Owner.Components.Get <Spatial>(); Vector2D center = (sp.Position - view.Location); center.X *= parallax.Speed.X; center.Y *= parallax.Speed.Y; double width = parallax.SourceBounds.Width * parallax.Scale; double height = parallax.SourceBounds.Height * parallax.Scale; Rectangle destination = new Rectangle(center.X, center.Y, width, height); destination.X -= width / 2; destination.Y -= height / 2; destination.X += layer.GetSize().Width / 2; destination.Y += layer.GetSize().Height / 2; destination.Y *= -1; layer.Draw(r.SpriteManager[parallax.Texture], destination.ToDrawing(), parallax.SourceBounds.ToDrawing()); } }
public void SetSelection(MyController ctrl) { if (selectedType == 1) { selected.GetComponent <MyController> ().selected = false; } ctrl.selected = true; selected = ctrl.transform; selectedType = 1; CameraView.SetSelf(selected); if (ctrl.target == null) { if (ctrl.nma.hasPath) { CameraView.SetTarget(ctrl.nma.pathEndPosition); } else { CameraView.SetTarget(null); } } else { CameraView.SetTarget(ctrl.target); } }
public void Draw(CameraView view) { GL.PushMatrix(); view.Execute(); DrawGrid(); foreach (KeyValuePair<int, Cluster> cluster in Map) { ClusterRenderer r = (cluster.Value.RenderTag as ClusterRenderer); if (r != null) r.Draw(); } GL.PopMatrix(); }
/** * Stores the current camera view using a name. */ public virtual void StoreView(Camera camera, string viewName) { if (camera != null) { Debug.LogWarning("Camera is null"); return; } CameraView currentView = new CameraView(); currentView.cameraPos = camera.transform.position; currentView.cameraRot = camera.transform.rotation; currentView.cameraSize = camera.orthographicSize; storedViews[viewName] = currentView; }
public KinectCameraEventArgs(BitmapSource image, CameraView type) { Image = image; CameraType = type; }
// Use this for initialization void Start() { cameraView = (CameraView)GetComponent("CameraView"); }
/** * Stores the current camera view using a name. */ public void StoreView(string viewName) { CameraView currentView = new CameraView(); currentView.cameraPos = Camera.main.transform.position; currentView.cameraRot = Camera.main.transform.rotation; currentView.cameraSize = Camera.main.orthographicSize; storedViews[viewName] = currentView; }
// TT Dec-2006 - Copied from Sim Tutorial 2 in V1.0 private void SetupCamera() { // Set up initial view CameraView view = new CameraView(); // view.EyePosition = new Vector3(0.0f, 6.41f, -5.41f); // view.LookAtPoint = new Vector3(0.0f, 5.88f, -4.81f); // TT Jul-2007 - Move back a little to see more of the field // Note that these values angle the camera down at 45 degrees // looking along the Z axis view.EyePosition = new Vector3(0.0f, 7.0f, -7.0f); view.LookAtPoint = new Vector3(0.0f, 5.0f, -5.0f); SimulationEngine.GlobalInstancePort.Update(view); }
private void SetCommands() { KeyPress = new RelayCommand<KeyEventArgs>(e => { if (e.Key == Key.S) { DebugInformation = "Kinect starting..."; SetupKinect(); } else if (e.Key == Key.Q) { CloseKinect(); } else if (e.Key == Key.Y) { PongGame.AddPaddle(Paddle.Side.Left, true, -1); } else if (e.Key == Key.U) { PongGame.AddPaddle(Paddle.Side.Right, true, -1); } else if (e.Key == Key.I) { PongGame.Reset(); } else if (e.Key == Key.K) { CloseKinect(); } else if (e.Key == Key.B) { PongGame.AddBall(); } else if (e.Key == Key.P) { PongGame.AddBall(); PongGame.Start(); } else if (e.Key == Key.C) { SetCameraView(); switch (_imageType) { case Core.CameraView.None: _imageType = Core.CameraView.ColoredDepth; DebugInformation = "Colored Depth"; break; case Core.CameraView.ColoredDepth: _imageType = Core.CameraView.Color; DebugInformation = "Color"; break; case Core.CameraView.Color: _imageType = Core.CameraView.Depth; DebugInformation = "Depth"; break; case Core.CameraView.Depth: _imageType = Core.CameraView.None; DebugInformation = ""; break; default: break; } } }); Closing = new RelayCommand<CancelEventArgs>(e => { CloseKinect(); Application.Current.Shutdown(); }); SizeChanged = new RelayCommand<SizeChangedEventArgs>( e => { PongGame.Boundry = new Rectangle(0, 0, Convert.ToInt32(e.NewSize.Width), Convert.ToInt32(e.NewSize.Height)); }); }
public BitmapSource GetCameraView(CameraView view) { //return this._camera.GetView(view); return null; }
private void SetupCamera() { // Set up initial view CameraView view = new CameraView(); view.EyePosition = new Vector3(0f, 6f, 4f); view.LookAtPoint = new Vector3(0f, -8f, -4.5f); SimulationEngine.GlobalInstancePort.Update(view); }
private void SetCommands() { KeyPress = new RelayCommand<KeyEventArgs>(e => { if (e.Key == Key.S) { DebugInformation = "Kinect starting..."; SetupKinect(); } else if (e.Key == Key.Q) { CloseKinect(); } else if (e.Key == Key.T) { } else if (e.Key == Key.C) { SetCameraView(); switch (_imageType) { case Core.CameraView.Depth: _imageType = Core.CameraView.ColoredDepth; DebugInformation = "Colored Depth"; break; case Core.CameraView.ColoredDepth: _imageType = Core.CameraView.Color; DebugInformation = "Color"; break; case Core.CameraView.Color: _imageType = Core.CameraView.Depth; DebugInformation = "Depth"; break; default: break; } } }); Closing = new RelayCommand<CancelEventArgs>(e => { CloseKinect(); Application.Current.Shutdown(); }); }
/// <summary> /// Cycle the camera view on the player. Set up defaults for follow cam placement depending on the view. /// </summary> private void DoSwitchCameraView() { _cameraView = (CameraView)((((int)_cameraView) + 1) % ((int)CameraView.COUNT)); switch (_cameraView) { case CameraView.FIRST: _followScript.distance = 0.1f; _followScript.height = 0f; _followScript.heightDamping = 100f; _followScript.rotationDamping = 100f; _followScript.target = _fpsCameraMount.transform; _followScript.lookAt = _fpsAim.transform; _playerRender.materials = new Material[] { }; break; case CameraView.THIRD: _followScript.distance = 0.1f; _followScript.height = 0f; _followScript.heightDamping = 100f; _followScript.rotationDamping = 100f; _followScript.target = _tpsCameraMount.transform; _followScript.lookAt = _tpsAim.transform; _playerRender.materials = _playerMaterials; break; } }
protected virtual bool CameraCommand(KeyEventArgs e) { if (e.Key == Key.C) { switch (_imageType) { case Core.CameraView.Depth: _imageType = Core.CameraView.ColoredDepth; break; case Core.CameraView.ColoredDepth: _imageType = Core.CameraView.Color; break; case Core.CameraView.Color: _imageType = Core.CameraView.None; break; case Core.CameraView.None: _imageType = Core.CameraView.Depth; break; default: break; } if (_imageType == Core.CameraView.None) { DissableCamera(); } else { EnableCamera(); } SetDebugMessage(string.Format("{0} Camera", _imageType)); } return e.Key == Key.C || e.Key == Key.Up || e.Key == Key.Down; }
// Set up initial view private void SetupCamera() { var view = new CameraView(); view.EyePosition = new Vector3(0.52f, 0.25f, 0.36f); view.LookAtPoint = new Vector3(-2.1f, 0.15f, -1.06f); SimulationEngine.GlobalInstancePort.Update(view); }
/** * Stores the current camera view using a name. */ public virtual void StoreView(string viewName) { Camera camera = GetCamera(); if (camera != null) { CameraView currentView = new CameraView(); currentView.cameraPos = camera.transform.position; currentView.cameraRot = camera.transform.rotation; currentView.cameraSize = camera.orthographicSize; storedViews[viewName] = currentView; } }
/// <summary> /// Called when the correct camera image is updated /// </summary> protected virtual void OnCameraUpdated(BitmapSource source, CameraView view) { EventHandler<KinectCameraEventArgs> handler = CameraUpdated; if (handler != null) { handler(this, new KinectCameraEventArgs(source, view)); } }
private void UpdateCameraView(CameraView view) { DispatcherHelper.CheckBeginInvokeOnUI(() => { if (KinectManager.Kinect != null) { CameraView = KinectManager.Kinect.GetCameraView(view); } }); }
public void SetupCamera(WorldDimensions WD) { float maxDim; if (WD.xdim > WD.zdim) { maxDim = WD.xdim * 1.25f; } else { maxDim = WD.zdim * 1.25f; } // Set up initial view CameraView view = new CameraView(); view.EyePosition = new Vector3(WD.xdim / 2f, maxDim, -(WD.zdim / 2f)); view.LookAtPoint = new Vector3(WD.xdim / 2f, maxDim - 2f, -(WD.zdim / 2f)); //view.EyePosition = new Vector3(-1.65f, 1.63f, -0.29f); //view.LookAtPoint = new Vector3(-0.68f, 1.38f, -0.18f); SimulationEngine.GlobalInstancePort.Update(view); }