public SkyboxGeneratorContext(SkyboxAsset skybox, IDatabaseFileProviderService fileProviderService) { Skybox = skybox ?? throw new ArgumentNullException(nameof(skybox)); Services = new ServiceRegistry(); Services.AddService(fileProviderService); Content = new ContentManager(Services); Services.AddService <IContentManager>(Content); Services.AddService(Content); GraphicsDevice = GraphicsDevice.New(); GraphicsDeviceService = new GraphicsDeviceServiceLocal(Services, GraphicsDevice); Services.AddService(GraphicsDeviceService); var graphicsContext = new GraphicsContext(GraphicsDevice); Services.AddService(graphicsContext); EffectSystem = new EffectSystem(Services); EffectSystem.Compiler = EffectCompilerFactory.CreateEffectCompiler(Content.FileProvider, EffectSystem); Services.AddService(EffectSystem); EffectSystem.Initialize(); ((IContentable)EffectSystem).LoadContent(); ((EffectCompilerCache)EffectSystem.Compiler).CompileEffectAsynchronously = false; RenderContext = RenderContext.GetShared(Services); RenderDrawContext = new RenderDrawContext(Services, RenderContext, graphicsContext); }
public SkyboxGeneratorContext(SkyboxAsset skybox) { if (skybox == null) { throw new ArgumentNullException(nameof(skybox)); } Skybox = skybox; Services = new ServiceRegistry(); Content = new ContentManager(Services); GraphicsDevice = GraphicsDevice.New(); GraphicsDeviceService = new GraphicsDeviceServiceLocal(Services, GraphicsDevice); var graphicsContext = new GraphicsContext(GraphicsDevice); Services.AddService(typeof(GraphicsContext), graphicsContext); EffectSystem = new EffectSystem(Services); EffectSystem.Initialize(); ((IContentable)EffectSystem).LoadContent(); ((EffectCompilerCache)EffectSystem.Compiler).CompileEffectAsynchronously = false; RenderContext = RenderContext.GetShared(Services); RenderDrawContext = new RenderDrawContext(Services, RenderContext, graphicsContext); }
public SkyboxGeneratorContext() { Services = new ServiceRegistry(); Assets = new AssetManager(Services); GraphicsDevice = GraphicsDevice.New(); GraphicsDeviceService = new GraphicsDeviceServiceLocal(Services, GraphicsDevice); EffectSystem = new EffectSystem(Services); EffectSystem.Initialize(); ((IContentable)EffectSystem).LoadContent(); ((EffectCompilerCache)EffectSystem.Compiler).CompileEffectAsynchronously = false; DrawEffectContext = RenderContext.GetShared(Services); }
public ThumbnailGenerator(EffectCompilerBase effectCompiler) { // create base services Services = new ServiceRegistry(); Services.AddService(MicrothreadLocalDatabases.ProviderService); ContentManager = new ContentManager(Services); Services.AddService <IContentManager>(ContentManager); Services.AddService(ContentManager); GraphicsDevice = GraphicsDevice.New(); GraphicsContext = new GraphicsContext(GraphicsDevice); GraphicsCommandList = GraphicsContext.CommandList; Services.AddService(GraphicsContext); sceneSystem = new SceneSystem(Services); Services.AddService(sceneSystem); fontSystem = new GameFontSystem(Services); Services.AddService(fontSystem.FontSystem); Services.AddService <IFontFactory>(fontSystem.FontSystem); GraphicsDeviceService = new GraphicsDeviceServiceLocal(Services, GraphicsDevice); Services.AddService(GraphicsDeviceService); var uiSystem = new UISystem(Services); Services.AddService(uiSystem); var physicsSystem = new Bullet2PhysicsSystem(Services); Services.AddService <IPhysicsSystem>(physicsSystem); gameSystems = new GameSystemCollection(Services) { fontSystem, uiSystem, physicsSystem }; Services.AddService <IGameSystemCollection>(gameSystems); Simulation.DisableSimulation = true; //make sure we do not simulate physics within the editor // initialize base services gameSystems.Initialize(); // create remaining services EffectSystem = new EffectSystem(Services); Services.AddService(EffectSystem); gameSystems.Add(EffectSystem); gameSystems.Add(sceneSystem); EffectSystem.Initialize(); // Mount the same database for the cache EffectSystem.Compiler = EffectCompilerFactory.CreateEffectCompiler(effectCompiler.FileProvider, EffectSystem); // Deactivate the asynchronous effect compilation ((EffectCompilerCache)EffectSystem.Compiler).CompileEffectAsynchronously = false; // load game system content gameSystems.LoadContent(); // create the default fonts var fontItem = OfflineRasterizedSpriteFontFactory.Create(); fontItem.FontType.Size = 22; DefaultFont = OfflineRasterizedFontCompiler.Compile(fontSystem.FontSystem, fontItem, true); // create utility members nullGameTime = new GameTime(); SpriteBatch = new SpriteBatch(GraphicsDevice); UIBatch = new UIBatch(GraphicsDevice); // create the pipeline SetUpPipeline(); }