void SetRootPosition() { /*double angleOfDashboard = 35f; * double distanceFromDashboard = _distance + 1f; * * double yOpp = Math.Tan(angleOfDashboard) * distanceFromDashboard; * double zHyp = yOpp / Math.Sin(angleOfDashboard);*/ //InternalOverlay.SetAttachment(AttachmentType.Absolute, new OpenTK.Vector3(0f, 1f, _distance), new OpenTK.Vector3(0, 180, 0)); if (_screenIndex > 0) { return; } if (ConfigUtility.Get <string>("desktop.position", "Opposite Dashboard") == "Opposite Dashboard") { InternalOverlay.SetAttachment(AttachmentType.AbsoluteRelative, new OpenTK.Vector3(0f, 0.5f, 2f + _distance), new OpenTK.Vector3(0, 180, 0), "vrub.anchor.dashboard"); } else { InternalOverlay.SetAttachment(AttachmentType.Absolute, new OpenTK.Vector3(0, 1f, _distance), new OpenTK.Vector3(0, 180, 0)); } InternalOverlay.Width = _width; InternalOverlay.Alpha = 0.95f; }
void SetupConfig() { try { _enabled = ConfigUtility.Get <bool>("addons." + DerivedKey, !DefaultToDisabled); } catch (KeyNotFoundException) { ConfigUtility.Set("addons." + DerivedKey, !DefaultToDisabled); _enabled = true; } }
public DesktopMirror(int screenIndex, Screen screenObject) { _width = ConfigUtility.Get <float>("desktop.width"); _distance = ConfigUtility.Get <float>("desktop.distance", 2f); ConfigUtility.Listen("desktop.width", DesktopWidthChanged); ConfigUtility.Listen("desktop.distance", DesktopDistanceChanged); ConfigUtility.Listen("desktop.position", DesktopPositionChanged); ConfigUtility.Listen("desktop.show_without_dashboard", DesktopAppearanceChanged); ConfigUtility.Listen("desktop.use_touch", (key, v) => { useTouch = (bool)v; }); useTouch = ConfigUtility.Get <bool>("desktop.use_touch", true); SteamVR_Event.Listen("DashboardActivated", (d) => { if (_screenIndex > 0) { return; } SetRootPosition(); InternalOverlay.Show(); }); SteamVR_Event.Listen("DashboardDeactivated", (d) => { if (_screenIndex > 0) { return; } if (!ConfigUtility.Get <bool>("desktop.show_without_dashboard", false)) { InternalOverlay.Hide(); } }); _screenIndex = screenIndex; _screenObject = screenObject; Logger.Debug("[DESKTOP] Found Screen: " + screenObject.DeviceName + " with bounds of " + screenObject.Bounds.ToString() + " and working area " + screenObject.WorkingArea.ToString()); Setup(); }
public void Init() { Instance = this; SteamVR_WebKit.SteamVR_WebKit.UseExperimentalOGL = true; SteamVR_WebKit.SteamVR_WebKit.DefaultFragmentShaderPath = Path.Combine(PathUtilities.Constants.GlobalShadersPath, "fragShader.frag"); SteamVR_WebKit.SteamVR_WebKit.PrefixOverlayType = false; SteamVR_WebKit.SteamVR_WebKit.FPS = 30; SteamVR_WebKit.SteamVR_WebKit.LogEvent += SteamVR_WebKit_LogEvent; SteamVR_WebKit.SteamVR_WebKit.PreUpdateCallback += PreUpdate; SteamVR_WebKit.SteamVR_WebKit.PreDrawCallback += PreDraw; SteamVR_WebKit.SteamVR_WebKit.PostUpdateCallback += PostUpdate; SteamVR_WebKit.SteamVR_WebKit.PostDrawCallback += PostDraw; CefSettings cefSettings = new CefSettings() { CachePath = PathUtilities.Constants.GlobalCachePath, FocusedNodeChangedEnabled = true, }; cefSettings.RegisterScheme(new CefCustomScheme() { SchemeName = "addon", SchemeHandlerFactory = new RestrictedPathSchemeHandler("addon", null), IsSecure = true, IsLocal = false, IsStandard = false, IsCorsEnabled = false, IsDisplayIsolated = false, }); cefSettings.RegisterScheme(new CefCustomScheme() { SchemeName = "vrub", SchemeHandlerFactory = new RestrictedPathSchemeHandler("vrub", PathUtilities.Constants.GlobalStaticResourcesPath), IsSecure = true, IsLocal = false, IsStandard = false, IsCorsEnabled = false, IsDisplayIsolated = false, }); cefSettings.RegisterScheme(new CefCustomScheme() { SchemeName = "plugin", SchemeHandlerFactory = new PluginSchemeHandler(), IsSecure = true, IsLocal = false, IsStandard = false, IsCorsEnabled = false, IsDisplayIsolated = false, }); cefSettings.CefCommandLineArgs.Add("enable-widevine-cdm", "1"); // Will experiment with this at some point. //cefSettings.CefCommandLineArgs.Add("touch-events", "1"); SteamVR_WebKit.SteamVR_WebKit.Init(cefSettings); if (Directory.Exists(Path.Combine(Environment.CurrentDirectory, "WidevineCdm"))) { Cef.RegisterWidevineCdm(@".\WidevineCdm", new DRM.WidevineCallback()); } if (!Cef.IsInitialized) { SteamVR_WebKit.SteamVR_WebKit.Log("Failed to Init Cef!"); } if (!_isRunning) { return; } CefSharp.Cef.GetGlobalCookieManager().SetStoragePath(PathUtilities.Constants.GlobalCookiePath, false); RegisterCallbacks(); RegisterGlobalEventListeners(); SetupAnchorOverlays(); PopulateAddons(); GetWorkshopAddons(); SetupPluginsAndStart(); Permissions.PermissionManager.Load(); _displayMirrorManager = new DesktopMirrorManager(); if (ConfigUtility.Get <bool>("desktop.enabled", false)) { _displayMirrorManager.SetupMirrors(); } HasInit = true; SteamVR_WebKit.SteamVR_WebKit.RunOverlays(); }