public override void Enable(GraphicsDevice device, GraphicsDeviceManager graphicsDeviceManager, bool requireMirror) { ActualRenderFrameSize = OptimalRenderFrameSize; needsMirror = requireMirror; leftHandController = new OpenVRTouchController(TouchControllerHand.Left); rightHandController = new OpenVRTouchController(TouchControllerHand.Right); leftHandController.HostDevice = this; rightHandController.HostDevice = this; trackedDevices = new OpenVRTrackedDevice[Valve.VR.OpenVR.k_unMaxTrackedDeviceCount]; for (int i = 0; i < trackedDevices.Length; i++) { trackedDevices[i] = new OpenVRTrackedDevice(i); if (trackedDevices[i].Class == DeviceClass.HMD) { HMDindex = i; } } #if XENKO_GRAPHICS_API_VULKAN OpenVR.InitVulkan(mainGame); #endif }
public override void Enable(GraphicsDevice device, GraphicsDeviceManager graphicsDeviceManager, bool requireMirror, int mirrorWidth, int mirrorHeight) { Size2 renderSize = OptimalRenderFrameSize; var width = (int)(renderSize.Width * RenderFrameScaling); width += width % 2; var height = (int)(renderSize.Height * RenderFrameScaling); height += height % 2; ActualRenderFrameSize = new Size2(width, height); #if XENKO_GRAPHICS_API_VULKAN needsMirror = false; // Vulkan doesn't support mirrors :/ #else needsMirror = requireMirror; #endif if (needsMirror) { bothEyesMirror = Texture.New2D(device, width, height, PixelFormat.R8G8B8A8_UNorm_SRgb, TextureFlags.RenderTarget | TextureFlags.ShaderResource); } leftEyeMirror = OpenVR.GetMirrorTexture(device, 0); rightEyeMirror = OpenVR.GetMirrorTexture(device, 1); MirrorTexture = bothEyesMirror; leftHandController = new OpenVRTouchController(TouchControllerHand.Left); rightHandController = new OpenVRTouchController(TouchControllerHand.Right); trackedDevices = new OpenVRTrackedDevice[Valve.VR.OpenVR.k_unMaxTrackedDeviceCount]; for (int i = 0; i < trackedDevices.Length; i++) { trackedDevices[i] = new OpenVRTrackedDevice(i); if (trackedDevices[i].Class == DeviceClass.HMD) { HMDindex = i; } } #if XENKO_GRAPHICS_API_VULKAN OpenVR.InitVulkan(mainGame); #endif }