/// <summary> /// init game engine /// call it one time during startup on the UI thread.</summary> public static void Init() { s_syncContext = SynchronizationContext.Current; s_invalidateCallback = new InvalidateViewsDlg(InvalidateViews); try { GUILayer.EngineDevice.SetDefaultWorkingDirectory(); s_engineDevice = new GUILayer.EngineDevice(); s_engineDevice.AttachDefaultCompilers(); s_retainedRenderResources = new GUILayer.RetainedRenderResources(s_engineDevice); s_underlyingScene = new GUILayer.EditorSceneManager(); Util3D.Init(); XLEBridgeUtils.Utils.GlobalSceneManager = s_underlyingScene; s_entityInterface = s_underlyingScene.GetEntityInterface(); CriticalError = ""; s_inist.PopulateEngineInfo( @"<EngineInfo> <SupportedResources> <ResourceDescriptor Type='Model' Name='Model' Description='Model' Ext='.dae' /> <ResourceDescriptor Type='ModelBookmark' Name='ModelBookmark' Description='ModelBookmark' Ext='.modelbookmark' /> <ResourceDescriptor Type='Texture' Name='Texture' Description='Texture' Ext='.dds,.tga,.bmp,.jpg,.jpeg,.png,.tif,.tiff,.gif,.hpd,.jxr,.wdp,.ico,.hdr,.exr' /> <ResourceDescriptor Type='Prefab' Name='Prefab' Description='Prefab' Ext='.prefab' /> </SupportedResources> </EngineInfo>"); XLEBridgeUtils.Utils.AttachLibrary(s_engineDevice); s_loggingRedirect = new XLEBridgeUtils.LoggingRedirect(); s_foregroundUpdateTimer = new System.Windows.Forms.Timer(); s_foregroundUpdateTimer.Tick += s_foregroundUpdateTimer_Elapsed; s_foregroundUpdateTimer.Interval = 32; s_foregroundUpdateTimer.Start(); } catch (Exception e) { CriticalError = "Error while initialising engine device: " + e.Message; } }