Ejemplo n.º 1
0
        private void InitializeTerrainDb(bool useTerrainDetailFileCache = false)
        {
            var ultraUpdatableContainer = new UltraUpdatableContainer(new MyUtSchedulerConfiguration(),
                                                                      new GlobalServicesProfileInfo(), new UltraUpdatableContainerConfiguration());

            var feConfiguration      = new FEConfiguration(new FilePathsConfiguration());
            var feGRingConfiguration = new FeGRingConfiguration();

            feGRingConfiguration.FeConfiguration = feConfiguration;

            feConfiguration.TerrainShapeDbConfiguration.UseTextureSavingToDisk    = useTerrainDetailFileCache;
            feConfiguration.TerrainShapeDbConfiguration.UseTextureLoadingFromDisk = useTerrainDetailFileCache;
            feConfiguration.EngraveRoadsInTerrain = false;

            TaskUtils.SetGlobalMultithreading(feConfiguration.Multithreading);
            TaskUtils.SetMultithreadingOverride(true);

            _gameInitializationFields.SetField(feConfiguration.Repositioner);
            _gameInitializationFields.SetField(feConfiguration.HeightDenormalizer);

            var initializingHelper =
                new FEInitializingHelper(_gameInitializationFields, ultraUpdatableContainer, feConfiguration);

            initializingHelper.InitializeUTService(new TextureConcieverUTProxy());
            initializingHelper.InitializeUTService(new UnityThreadComputeShaderExecutorObject());
            initializingHelper.InitializeUTService(new CommonExecutorUTProxy());

            initializingHelper.InitializeUTRendererProxy();


            var finalTerrainShapeDb = new FETerrainShapeDbInitialization(ultraUpdatableContainer,
                                                                         _gameInitializationFields, feConfiguration, _filePathsConfiguration);

            finalTerrainShapeDb.Start();
        }
Ejemplo n.º 2
0
        public static UltraUpdatableContainer InitializeFinalElements(FEConfiguration configuration, ComputeShaderContainerGameObject containerGameObject,
                                                                      GameInitializationFields gameInitializationFields, Dictionary <int, Ring2RegionsDbGeneratorConfiguration> ring2RegionsDatabasesConfiguration = null
                                                                      , bool initializeLegacyDesignBodySpotUpdater = false)
        {
            TaskUtils.SetGlobalMultithreading(configuration.Multithreading);
            return(TaskUtils.ExecuteFunctionWithOverridenMultithreading(true, () =>
            {
                var servicesProfileInfo = new GlobalServicesProfileInfo();
                gameInitializationFields.SetField(servicesProfileInfo);
                var ultraUpdatableContainer = new UltraUpdatableContainer(
                    configuration.SchedulerConfiguration,
                    servicesProfileInfo,
                    configuration.UpdatableContainerConfiguration);

                configuration.TerrainShapeDbConfiguration.UseTextureSavingToDisk = true;

                gameInitializationFields.SetField(containerGameObject);
                gameInitializationFields.SetField(configuration.Repositioner);
                gameInitializationFields.SetField(configuration.HeightDenormalizer);

                var initializingHelper =
                    new FEInitializingHelper(gameInitializationFields, ultraUpdatableContainer, configuration);
                initializingHelper.InitializeUTService(new TextureConcieverUTProxy());
                initializingHelper.InitializeUTService(new UnityThreadComputeShaderExecutorObject());
                initializingHelper.InitializeUTService(new CommonExecutorUTProxy());
                initializingHelper.CreatePathProximityTextureDb();

                if (initializeLegacyDesignBodySpotUpdater)
                {
                    initializingHelper.InitializeDesignBodySpotUpdater();
                }

                initializingHelper.InitializeUTRendererProxy();
                initializingHelper.InitializeUTService(new MeshGeneratorUTProxy(new MeshGeneratorService()));
                if (ring2RegionsDatabasesConfiguration != null)
                {
                    initializingHelper.InitializeComplexRing2RegionsDatabase(ring2RegionsDatabasesConfiguration);
                }
                else
                {
                    initializingHelper.InitializeMonoliticRing2RegionsDatabase();
                }

                //var finalTerrainInitialization = new FinalTerrainInitialization(_ultraUpdatableContainer, _gameInitializationFields, _configuration, FeGRingConfiguration);
                //finalTerrainInitialization.Start();

                initializingHelper.InitializeGlobalInstancingContainer();
                //var finalVegetation = new FinalVegetation(_gameInitializationFields, _ultraUpdatableContainer, VegetationConfiguration);
                //finalVegetation.Start();
                return ultraUpdatableContainer;
            }));
        }