protected override void LoadContent() { if (_shouldExit) { return; } _camera.SetAspectRatio(GraphicsDevice.BackBuffer.Width / (float)GraphicsDevice.BackBuffer.Height); // create all needed components _terrainRenderer = ToDisposeContent(new TerrainRenderer(_graphicsDeviceManager, Content)); _samplingRenderer = ToDisposeContent(new SamplingRenderer(_graphicsDeviceManager, Content)); _residencyManager = ToDisposeContent(new ResidencyManager(_graphicsDeviceManager, Content)); // schedule the loading of the structures that needs to be used right now var createTexturesTask = _terrainRenderer.CreateTexturesAsync(); var loadStructuresTask = _residencyManager.LoadStructuresAsync(); // schedule the loading of other data var terrainRendererTask = _terrainRenderer.LoadStructuresAsync(); var samplingRendererTask = _samplingRenderer.LoadStructuresAsync(); // wait for loading of critical structures that will be used below Task.WaitAll(createTexturesTask, loadStructuresTask); // prepare the tiled textures _terrainRenderer.DiffuseResidencyMap = _residencyManager.ManageTexture(_terrainRenderer.DiffuseTexture, Path.Combine(SampleSettings.DataPath, SampleSettings.DiffuseTextureFile)); _terrainRenderer.NormalResidencyMap = _residencyManager.ManageTexture(_terrainRenderer.NormalTexture, Path.Combine(SampleSettings.DataPath, SampleSettings.NormalTextureFile)); var initializeManagedResourcesTask = _residencyManager.InitializeManagedResourcesAsync(); // wait for all content to load Task.WaitAll(terrainRendererTask, samplingRendererTask, initializeManagedResourcesTask); base.LoadContent(); }
protected override void LoadContent() { if (_shouldExit) return; _camera.SetAspectRatio(GraphicsDevice.BackBuffer.Width / (float)GraphicsDevice.BackBuffer.Height); // create all needed components _terrainRenderer = ToDisposeContent(new TerrainRenderer(_graphicsDeviceManager, Content)); _samplingRenderer = ToDisposeContent(new SamplingRenderer(_graphicsDeviceManager, Content)); _residencyManager = ToDisposeContent(new ResidencyManager(_graphicsDeviceManager, Content)); // schedule the loading of the structures that needs to be used right now var createTexturesTask = _terrainRenderer.CreateTexturesAsync(); var loadStructuresTask = _residencyManager.LoadStructuresAsync(); // schedule the loading of other data var terrainRendererTask = _terrainRenderer.LoadStructuresAsync(); var samplingRendererTask = _samplingRenderer.LoadStructuresAsync(); // wait for loading of critical structures that will be used below Task.WaitAll(createTexturesTask, loadStructuresTask); // prepare the tiled textures _terrainRenderer.DiffuseResidencyMap = _residencyManager.ManageTexture(_terrainRenderer.DiffuseTexture, Path.Combine(SampleSettings.DataPath, SampleSettings.DiffuseTextureFile)); _terrainRenderer.NormalResidencyMap = _residencyManager.ManageTexture(_terrainRenderer.NormalTexture, Path.Combine(SampleSettings.DataPath, SampleSettings.NormalTextureFile)); var initializeManagedResourcesTask = _residencyManager.InitializeManagedResourcesAsync(); // wait for all content to load Task.WaitAll(terrainRendererTask, samplingRendererTask, initializeManagedResourcesTask); base.LoadContent(); }