/// <summary> /// Perform engine setup. /// </summary> /// <param name="configurator">An optional engine configuration - will be passed to the light setup.</param> public static void Setup(Configurator configurator = null) { // Call light setup if needed. if (Status < EngineStatus.LightSetup) { LightSetup(configurator); } if (Status >= EngineStatus.Setup) { return; } // Mount default assets. The platform should add it's own specific sources and stores. AssetLoader = LoadDefaultAssetLoader(); // Create the platform, window, audio, and graphics context. Host = PlatformBase.GetInstanceOfDetected(configurator); if (Host == null) { SubmitError(new Exception("Platform couldn't initialize.")); return; } InputManager = Host; Audio = Host.Audio; // Errors in host initialization can cause this. if (Status == EngineStatus.Stopped) { return; } // Now that the context is created, the renderer can be created. GLThread.BindThread(); Renderer = new RenderComposer(); Renderer.Setup(); // Now "game-mode" modules can be created. SceneManager = new SceneManager(); // Setup plugins. foreach (IPlugin p in Configuration.Plugins) { p.Initialize(); } if (Status == EngineStatus.Stopped) { return; } Status = EngineStatus.Setup; }