public void OnCameraAdded( HolographicSpace sender, HolographicSpaceCameraAddedEventArgs args ) { Deferral deferral = args.GetDeferral(); HolographicCamera holographicCamera = args.Camera; Task task1 = new Task(() => { // // TODO: Allocate resources for the new camera and load any content specific to // that camera. Note that the render target size (in pixels) is a property // of the HolographicCamera object, and can be used to create off-screen // render targets that match the resolution of the HolographicCamera. // // Create device-based resources for the holographic camera and add it to the list of // cameras used for updates and rendering. Notes: // * Since this function may be called at any time, the AddHolographicCamera function // waits until it can get a lock on the set of holographic camera resources before // adding the new camera. At 60 frames per second this wait should not take long. // * A subsequent Update will take the back buffer from the RenderingParameters of this // camera's CameraPose and use it to create the ID3D11RenderTargetView for this camera. // Content can then be rendered for the HolographicCamera. deviceResources.AddHolographicCamera(holographicCamera); // Holographic frame predictions will not include any information about this camera until // the deferral is completed. deferral.Complete(); }); task1.Start(); }
async void HolographicSpace_CameraAdded(HolographicSpace sender, HolographicSpaceCameraAddedEventArgs args) { if (!appInited) { await window.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { SpatialMappingManager = new SpatialMappingManager(); VoiceManager = new VoiceManager(); if (options == null) { options = new ApplicationOptions(); } //override some options: options.LimitFps = false; options.Width = (int)args.Camera.RenderTargetSize.Width; options.Height = (int)args.Camera.RenderTargetSize.Height; Game = (StereoApplication)Activator.CreateInstance(holoAppType, options); Game.Run(); GesturesManager = new GesturesManager(Game, ReferenceFrame); AppStarted?.Invoke(Game); appInited = true; }); } }
/// <summary> /// Camera added /// </summary> /// <param name="sender">The sender</param> /// <param name="args">The args</param> public void OnCameraAdded(HolographicSpace sender, HolographicSpaceCameraAddedEventArgs args) { Deferral deferral = args.GetDeferral(); HolographicCamera holographicCamera = args.Camera; Task task1 = new Task(() => { // Create device-based resources for the holographic camera and add it to the list of // cameras used for updates and rendering. Notes: // * Since this function may be called at any time, the AddHolographicCamera function // waits until it can get a lock on the set of holographic camera resources before // adding the new camera. At 60 frames per second this wait should not take long. // * A subsequent Update will take the back buffer from the RenderingParameters of this // camera's CameraPose and use it to create the ID3D11RenderTargetView for this camera. // Content can then be rendered for the HolographicCamera. deviceResources.AddHolographicCamera(holographicCamera); // Holographic frame predictions will not include any information about this camera until // the deferral is completed. deferral.Complete(); }); task1.Start(); }