/// <summary> /// shutdown game engine. /// call it one time on application exit. /// </summary> public static void Shutdown() { foreach (var initializable in Globals.MEFContainer.GetExportedValues <XLEBridgeUtils.IShutdownWithEngine>()) { initializable.Shutdown(); } foreach (var keyValue in s_idToDomNode) { DestroyObject( keyValue.Key.Item1, keyValue.Key.Item2, keyValue.Value.TypeId); } s_idToDomNode.Clear(); s_foregroundUpdateTimer.Stop(); s_foregroundUpdateTimer.Dispose(); s_foregroundUpdateTimer = null; s_loggingRedirect.Dispose(); s_loggingRedirect = null; XLEBridgeUtils.Utils.DetachLibrary(); Util3D.Shutdown(); XLEBridgeUtils.Utils.GlobalSceneManager = null; s_entityInterface = null; s_underlyingScene.Dispose(); s_underlyingScene = null; s_retainedRenderResources.Dispose(); s_retainedRenderResources = null; s_engineDevice.Dispose(); s_engineDevice = null; GlobalSelection.Dispose(); GlobalSelection = null; CriticalError = s_notInitialized; }
/// <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; } }
/// <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' /> </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; } }
/// <summary> /// shutdown game engine. /// call it one time on application exit. /// </summary> public static void Shutdown() { foreach (var initializable in Globals.MEFContainer.GetExportedValues<XLEBridgeUtils.IShutdownWithEngine>()) initializable.Shutdown(); foreach (var keyValue in s_idToDomNode) { DestroyObject( keyValue.Key.Item1, keyValue.Key.Item2, keyValue.Value.TypeId); } s_idToDomNode.Clear(); s_foregroundUpdateTimer.Stop(); s_foregroundUpdateTimer.Dispose(); s_foregroundUpdateTimer = null; s_loggingRedirect.Dispose(); s_loggingRedirect = null; XLEBridgeUtils.Utils.DetachLibrary(); Util3D.Shutdown(); XLEBridgeUtils.Utils.GlobalSceneManager = null; s_entityInterface = null; s_underlyingScene.Dispose(); s_underlyingScene = null; s_retainedRenderResources.Dispose(); s_retainedRenderResources = null; s_engineDevice.Dispose(); s_engineDevice = null; GlobalSelection.Dispose(); GlobalSelection = null; CriticalError = s_notInitialized; }