public void Start() { TaskUtils.SetGlobalMultithreading(false); var shaderContainerGO = FindObjectOfType <ComputeShaderContainerGameObject>(); var configuration = new FEConfiguration(new FilePathsConfiguration()); GlobalServicesProfileInfo servicesProfileInfo = new GlobalServicesProfileInfo(); var ultraUpdatableContainer = new UltraUpdatableContainer( configuration.SchedulerConfiguration, servicesProfileInfo, configuration.UpdatableContainerConfiguration); Dictionary <int, float> intensityPatternPixelsPerUnit = new Dictionary <int, float>() { { 1, 1 } }; int mipmapLevelToExtract = 2; Dictionary <int, float> plateStampPixelsPerUnit = new Dictionary <int, float>() { { 1, 5 } }; _updatableContainer = new UltraUpdatableContainer(new MyUtSchedulerConfiguration(), new GlobalServicesProfileInfo(), new UltraUpdatableContainerConfiguration()); _provider = ESurfaceProviderInitializationHelper.ConstructProvider( _updatableContainer, intensityPatternPixelsPerUnit, shaderContainerGO, mipmapLevelToExtract, plateStampPixelsPerUnit); _patchesCreatorProxy = new GRing2PatchesCreatorProxy(ESurfaceProviderInitializationHelper.CreateRing2PatchesCreator(_updatableContainer, intensityPatternPixelsPerUnit)); RegeneratePatch(); }
private ETerrainHeightPyramidFacade StartTerrainThings(MeshGeneratorUTProxy meshGeneratorUtProxy, UTTextureRendererProxy textureRendererProxy, ComputeShaderContainerGameObject containerGameObject, List <HeightPyramidLevel> startConfigurationHeightPyramidLevels) { var startConfiguration = ETerrainHeightPyramidFacadeStartConfiguration.DefaultConfiguration; //startConfiguration.HeightPyramidLevels = new List<HeightPyramidLevel>() {HeightPyramidLevel.Top}; startConfiguration.HeightPyramidLevels = startConfigurationHeightPyramidLevels; ETerrainHeightBuffersManager buffersManager = new ETerrainHeightBuffersManager(); var eTerrainHeightPyramidFacade = new ETerrainHeightPyramidFacade(buffersManager, meshGeneratorUtProxy, textureRendererProxy, startConfiguration); var perLevelTemplates = eTerrainHeightPyramidFacade.GenerateLevelTemplates(); var levels = startConfiguration.HeightPyramidLevels; 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 configuration = new FEConfiguration(new FilePathsConfiguration()); GlobalServicesProfileInfo servicesProfileInfo = new GlobalServicesProfileInfo(); var ultraUpdatableContainer = new UltraUpdatableContainer( configuration.SchedulerConfiguration, servicesProfileInfo, configuration.UpdatableContainerConfiguration); var updatableContainer = new UpdatableContainer(); var intensityPatternPixelsPerUnit = new Dictionary <int, float>() { { 1, 1 } }; int mipmapLevelToExtract = 2; var plateStampPixelsPerUnit = new Dictionary <int, float>() { { 1, 3 } }; var surfacePatchProvider = ESurfaceProviderInitializationHelper.ConstructProvider( ultraUpdatableContainer, intensityPatternPixelsPerUnit, containerGameObject, mipmapLevelToExtract, plateStampPixelsPerUnit); var surfaceTextureFormat = RenderTextureFormat.ARGB32; eTerrainHeightPyramidFacade.Start(perLevelTemplates, new Dictionary <EGroundTextureType, OneGroundTypeLevelTextureEntitiesGenerator>() { //{ // EGroundTextureType.SurfaceTexture, new OneGroundTypeLevelTextureEntitiesGenerator() // { // SegmentFillingListenerGeneratorFunc = (level) => // { // var floorTexture = EGroundTextureGenerator.GenerateEmptyGroundTexture(startConfiguration.CommonConfiguration.FloorTextureSize, // surfaceTextureFormat); // var segmentsPlacer = new ESurfaceSegmentPlacer(textureRendererProxy, floorTexture // , startConfiguration.CommonConfiguration.SlotMapSize, startConfiguration.CommonConfiguration.FloorTextureSize); // var pyramidLevelManager = new GroundLevelTexturesManager(startConfiguration.CommonConfiguration.SlotMapSize); // var segmentModificationManager = new SoleLevelGroundTextureSegmentModificationsManager(segmentsPlacer, pyramidLevelManager); // return new SegmentFillingListenerWithFloorTexture() // { // FloorTexture = floorTexture, // SegmentFillingListener = // new LambdaSegmentFillingListener( // (c) => // { // var segmentLength = startConfiguration.PerLevelConfigurations[level].BiggestShapeObjectInGroupLength; // var sap = c.SegmentAlignedPosition; // MyRectangle surfaceWorldSpaceRectangle = new MyRectangle(sap.X * segmentLength, sap.Y * segmentLength, // segmentLength, segmentLength); // var texturesPack = surfacePatchProvider.ProvideSurfaceDetailAsync(surfaceWorldSpaceRectangle, new FlatLod(1, 1)).Result; // if (texturesPack != null) // { // var mainTexture = texturesPack.MainTexture; // segmentModificationManager.AddSegmentAsync(mainTexture, c.SegmentAlignedPosition); // GameObject.Destroy(mainTexture); // } // //} // }, // (c) => { }, // (c) => { }) // }; // }, // } //} } ); Traveller.transform.position = new Vector3(startConfiguration.InitialTravellerPosition.x, 0, startConfiguration.InitialTravellerPosition.y); eTerrainHeightPyramidFacade.DisableLevelShapes(HeightPyramidLevel.Bottom); return(eTerrainHeightPyramidFacade); }