Beispiel #1
0
 /// <summary>
 /// Prepares to allocate resources and adds resource views for a camera.
 /// Locks the set of holographic camera resources until the function exits.
 /// </summary>
 public void AddHolographicCamera(HolographicCamera camera)
 {
     UseHolographicCameraResources((Dictionary <uint, CameraResources> cameraResourcesDictionary) =>
     {
         cameraResourcesDictionary.Add(camera.Id, new CameraResources(camera));
     });
 }
        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();
        }
Beispiel #3
0
        // Deallocates resources for a camera and removes the camera from the set.
        // Locks the set of holographic camera resources until the function exits.
        public void RemoveHolographicCamera(HolographicCamera camera)
        {
            UseHolographicCameraResources(cameraResourcesDictionary => {
                var cameraResources = cameraResourcesDictionary[camera.Id];

                if (null != cameraResources)
                {
                    cameraResources.ReleaseResourcesForBackBuffer(this);
                    cameraResourcesDictionary.Remove(camera.Id);
                }
            });
        }
Beispiel #4
0
        public CameraResources(HolographicCamera holographicCamera)
        {
            this._holographicCamera = holographicCamera;
            IsRenderingStereoscopic = holographicCamera.IsStereo;
            _d3DRenderTargetSize    = holographicCamera.RenderTargetSize;

            _d3DViewport.Height   = (float)_d3DRenderTargetSize.Height;
            _d3DViewport.Width    = (float)_d3DRenderTargetSize.Width;
            _d3DViewport.X        = 0;
            _d3DViewport.Y        = 0;
            _d3DViewport.MinDepth = 0;
            _d3DViewport.MaxDepth = 1;
        }
        public CameraResources(HolographicCamera holographicCamera)
        {
            this.holographicCamera = holographicCamera;
            isStereo            = holographicCamera.IsStereo;
            d3dRenderTargetSize = holographicCamera.RenderTargetSize;

            d3dViewport.Height   = (float)d3dRenderTargetSize.Height;
            d3dViewport.Width    = (float)d3dRenderTargetSize.Width;
            d3dViewport.X        = 0;
            d3dViewport.Y        = 0;
            d3dViewport.MinDepth = 0;
            d3dViewport.MaxDepth = 1;
        }
        // Deallocates resources for a camera and removes the camera from the set.
        // Locks the set of holographic camera resources until the function exits.
        public void RemoveHolographicCamera(HolographicCamera camera)
        {
            this.UseHolographicCameraResources((Dictionary <uint, CameraResources> cameraResourcesDictionary) =>
            {
                CameraResources cameraResources = cameraResourcesDictionary[camera.Id];

                if (cameraResources != null)
                {
                    cameraResources.ReleaseResourcesForBackBuffer(this);
                    cameraResourcesDictionary.Remove(camera.Id);
                }
            });
        }
        public CameraResources(HolographicCamera holographicCamera)
        {
            this.holographicCamera = holographicCamera;
            isStereo = holographicCamera.IsStereo;
            d3dRenderTargetSize = holographicCamera.RenderTargetSize;

            d3dViewport.Height = (float)d3dRenderTargetSize.Height;
            d3dViewport.Width = (float)d3dRenderTargetSize.Width;
            d3dViewport.X = 0;
            d3dViewport.Y = 0;
            d3dViewport.MinDepth = 0;
            d3dViewport.MaxDepth = 1;
        }