コード例 #1
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;
            }));
        }
コード例 #2
0
ファイル: ETerrainAsyncDEO.cs プロジェクト: defacto2k15/PwMgr
        private FEInitializingHelper InitializeETerrain(ETerrainHeightPyramidFacadeStartConfiguration startConfiguration)
        {
            startConfiguration.CommonConfiguration.YScale = _gameInitializationFields.Retrive <HeightDenormalizer>().DenormalizationMultiplier;
            startConfiguration.HeightPyramidLevels        = new List <HeightPyramidLevel>()
            {
                HeightPyramidLevel.Top, HeightPyramidLevel.Mid, HeightPyramidLevel.Bottom
            };

            var buffersManager = new ETerrainHeightBuffersManager();

            _eTerrainHeightPyramidFacade = new ETerrainHeightPyramidFacade(buffersManager,
                                                                           _gameInitializationFields.Retrive <MeshGeneratorUTProxy>(),
                                                                           _gameInitializationFields.Retrive <UTTextureRendererProxy>(), startConfiguration);

            var perLevelTemplates = _eTerrainHeightPyramidFacade.GenerateLevelTemplates();
            var levels            = startConfiguration.PerLevelConfigurations.Keys.Where(c => startConfiguration.HeightPyramidLevels.Contains(c));

            buffersManager.InitializeBuffers(levels.ToDictionary(c => c, c => new EPyramidShaderBuffersGeneratorPerRingInput()
            {
                FloorTextureResolution = startConfiguration.CommonConfiguration.FloorTextureSize.X, //TODO i use only X, - works only for squares
                HeightMergeRanges      = perLevelTemplates[c].PerRingTemplates.ToDictionary(k => k.Key, k => k.Value.HeightMergeRange),
                CeilSliceWorldSize     =
                    startConfiguration.PerLevelConfigurations[c].FloorTextureWorldSize.x, // TODO works only for square pyramids - i use width
                RingUvRanges = startConfiguration.CommonConfiguration.RingsUvRange
            }), startConfiguration.CommonConfiguration.MaxLevelsCount, startConfiguration.CommonConfiguration.MaxRingsPerLevelCount);

            var dbInitialization =
                new FETerrainShapeDbInitialization(_ultraUpdatableContainer, _gameInitializationFields, _feConfiguration, new FilePathsConfiguration());

            dbInitialization.Start();

            var initializingHelper = new FEInitializingHelper(_gameInitializationFields, _ultraUpdatableContainer, _feConfiguration);

            initializingHelper.InitializeGlobalInstancingContainer();


            _eTerrainHeightPyramidFacade.Start(perLevelTemplates,
                                               new Dictionary <EGroundTextureType, OneGroundTypeLevelTextureEntitiesGenerator>
            {
                [EGroundTextureType.HeightMap] = ETerrainInitializationHelper.CreateHeightTextureEntitiesGenerator(
                    startConfiguration, _gameInitializationFields, _ultraUpdatableContainer, _heightmapListenersContainer),
                [EGroundTextureType.SurfaceTexture] = ETerrainInitializationHelper.CreateSurfaceTextureEntitiesGenerator(
                    _feConfiguration, startConfiguration, _gameInitializationFields, _ultraUpdatableContainer)
            }
                                               );
            return(initializingHelper);
        }