/// <summary> /// Updates the application state once per frame. /// </summary> public HolographicFrame Update() { if (MediaPlayer.IsEndOfStream) { ViewManagement.SwitchTo2DViewAsync(); } // Before doing the timer update, there is some work to do per-frame // to maintain holographic rendering. First, we will get information // about the current frame. // The HolographicFrame has information that the app needs in order // to update and render the current frame. The app begins each new // frame by calling CreateNextFrame. HolographicFrame holographicFrame = holographicSpace.CreateNextFrame(); // Get a prediction of where holographic cameras will be when this frame // is presented. HolographicFramePrediction prediction = holographicFrame.CurrentPrediction; // Back buffers can change from frame to frame. Validate each buffer, and recreate // resource views and depth buffers as needed. deviceResources.EnsureCameraResources(holographicFrame, prediction); // Next, we get a coordinate system from the attached frame of reference that is // associated with the current frame. Later, this coordinate system is used for // for creating the stereo view matrices when rendering the sample content. SpatialCoordinateSystem currentCoordinateSystem = referenceFrame.CoordinateSystem; var gestureStatus = spatialInputHandler.CheckGestureStatus(); switch (gestureStatus) { case SpatialGestureSettings.None: break; case SpatialGestureSettings.Tap: videoRenderer.Pause(); break; case SpatialGestureSettings.DoubleTap: videoRenderer.Stop(); ViewManagement.SwitchTo2DViewAsync(); break; case SpatialGestureSettings.Hold: videoRenderer.FastForward(spatialInputHandler.HoldTotalTime.TotalSeconds); break; case SpatialGestureSettings.ManipulationTranslate: break; case SpatialGestureSettings.NavigationX: break; case SpatialGestureSettings.NavigationY: break; case SpatialGestureSettings.NavigationZ: break; case SpatialGestureSettings.NavigationRailsX: break; case SpatialGestureSettings.NavigationRailsY: break; case SpatialGestureSettings.NavigationRailsZ: break; default: break; } timer.Tick(() => { // // TODO: Update scene objects. // // Put time-based updates here. By default this code will run once per frame, // but if you change the StepTimer to use a fixed time step this code will // run as many times as needed to get to the current step. // videoRenderer.Update(timer); }); // We complete the frame update by using information about our content positioning // to set the focus point. foreach (var cameraPose in prediction.CameraPoses) { // The HolographicCameraRenderingParameters class provides access to set // the image stabilization parameters. HolographicCameraRenderingParameters renderingParameters = holographicFrame.GetRenderingParameters(cameraPose); // SetFocusPoint informs the system about a specific point in your scene to // prioritize for image stabilization. The focus point is set independently // for each holographic camera. // You should set the focus point near the content that the user is looking at. // In this example, we put the focus point at the center of the sample hologram, // since that is the only hologram available for the user to focus on. // You can also set the relative velocity and facing of that content; the sample // hologram is at a fixed point so we only need to indicate its position. renderingParameters.SetFocusPoint( currentCoordinateSystem, videoRenderer.Position ); } // The holographic frame will be used to get up-to-date view and projection matrices and // to present the swap chain. return(holographicFrame); }