Esempio n. 1
0
        private void OnRequestScreenshot(VREvent_t vrEvent)
        {
            var screenshotHandle = vrEvent.data.screenshot.handle;
            var screenshotType   = (EVRScreenshotType)vrEvent.data.screenshot.type;

            if (screenshotType == EVRScreenshotType.StereoPanorama)
            {
                string previewFilename =
                    GetScreenshotFilename(screenshotHandle, EVRScreenshotPropertyFilenames.Preview);
                string VRFilename = GetScreenshotFilename(screenshotHandle, EVRScreenshotPropertyFilenames.VR);

                if (previewFilename == null || VRFilename == null)
                {
                    return;
                }

                // Do the stereo panorama screenshot
                // Figure out where the view is
                GameObject screenshotPosition = new GameObject("screenshotPosition");
                screenshotPosition.transform.position   = SteamVR_Render.Top().transform.position;
                screenshotPosition.transform.rotation   = SteamVR_Render.Top().transform.rotation;
                screenshotPosition.transform.localScale = SteamVR_Render.Top().transform.lossyScale;
                SteamVR_Utils.TakeStereoScreenshot(screenshotHandle, screenshotPosition, 32, 0.064f,
                                                   ref previewFilename, ref VRFilename);

                // and submit it
                OpenVR.Screenshots.SubmitScreenshot(screenshotHandle, screenshotType, previewFilename, VRFilename);
            }
        }
Esempio n. 2
0
        private void OnRequestScreenshot(VREvent_t vrEvent)
        {
            uint handle            = vrEvent.data.screenshot.handle;
            EVRScreenshotType type = (EVRScreenshotType)vrEvent.data.screenshot.type;

            if (type == EVRScreenshotType.StereoPanorama)
            {
                string screenshotFilename  = this.GetScreenshotFilename(handle, EVRScreenshotPropertyFilenames.Preview);
                string screenshotFilename2 = this.GetScreenshotFilename(handle, EVRScreenshotPropertyFilenames.VR);
                if (screenshotFilename == null || screenshotFilename2 == null)
                {
                    return;
                }
                SteamVR_Utils.TakeStereoScreenshot(handle, new GameObject("screenshotPosition")
                {
                    transform =
                    {
                        position   = SteamVR_Render.Top().transform.position,
                        rotation   = SteamVR_Render.Top().transform.rotation,
                        localScale = SteamVR_Render.Top().transform.lossyScale
                    }
                }, 32, 0.064f, ref screenshotFilename, ref screenshotFilename2);
                OpenVR.Screenshots.SubmitScreenshot(handle, type, screenshotFilename, screenshotFilename2);
            }
        }