Пример #1
0
        public void Start()
        {
            TaskUtils.SetGlobalMultithreading(false);
            TextureRendererServiceConfiguration textureRendererServiceConfiguration = new TextureRendererServiceConfiguration();

            textureRendererServiceConfiguration.StepSize = new Vector2(10, 10);

            UTTextureRendererProxy utTextureRenderer = new UTTextureRendererProxy(new TextureRendererService(
                                                                                      new MultistepTextureRenderer(Object.FindObjectOfType <ComputeShaderContainerGameObject>()), textureRendererServiceConfiguration));

            TextureConcieverUTProxy utTextureConciever = new TextureConcieverUTProxy();

            LateAssignFactory <BaseTerrainDetailProvider> terrainDetailProviderFactory = new LateAssignFactory <BaseTerrainDetailProvider>(() => _mockProvider);

            _merger = new TerrainDetailCornerMerger(terrainDetailProviderFactory, new TerrainDetailAlignmentCalculator(240), utTextureRenderer, utTextureConciever, new CommonExecutorUTProxy(), new TerrainDetailCornerMergerConfiguration());

            //TaskUtils.DebuggerAwareWait(Test1());
            //TaskUtils.DebuggerAwareWait(Test2());
            //TaskUtils.DebuggerAwareWait(Test3());
            //TaskUtils.DebuggerAwareWait(Test4());
            //TaskUtils.DebuggerAwareWait(Test5());
            //TaskUtils.DebuggerAwareWait(Test6());
            //TaskUtils.DebuggerAwareWait(Test7());
            TaskUtils.DebuggerAwareWait(Test8());
        }
 public TerrainDetailCornerMerger(LateAssignFactory <BaseTerrainDetailProvider> terrainDetailProviderFactory,
                                  TerrainDetailAlignmentCalculator alignmentCalculator, UTTextureRendererProxy renderer, TextureConcieverUTProxy textureConciever,
                                  CommonExecutorUTProxy commonExecutor, TerrainDetailCornerMergerConfiguration configuration)
 {
     _terrainDetailProviderFactory = terrainDetailProviderFactory;
     _alignmentCalculator          = alignmentCalculator;
     _renderer            = renderer;
     _textureConciever    = textureConciever;
     this._commonExecutor = commonExecutor;
     _configuration       = configuration;
 }
Пример #3
0
        public TerrainShapeDbUnderTest(bool useTextureSavingToDisk  = false, bool useCornerMerging = false,
                                       string terrainDetailFilePath = "C:\\unityCache\\", bool useTextureLoadingFromDisk = false)
        {
            CommonExecutorUTProxy            commonExecutorUtProxy = new CommonExecutorUTProxy();
            ComputeShaderContainerGameObject containerGameObject   = GameObject.FindObjectOfType <ComputeShaderContainerGameObject>();

            var globalHeightTexture = CreateGlobalHeightTexture(commonExecutorUtProxy);

            UTTextureRendererProxy textureRendererProxy = new UTTextureRendererProxy(new TextureRendererService(
                                                                                         new MultistepTextureRenderer(containerGameObject), new TextureRendererServiceConfiguration()
            {
                StepSize = new Vector2(400, 400)
            }));

            UnityThreadComputeShaderExecutorObject computeShaderExecutorObject = new UnityThreadComputeShaderExecutorObject();
            var terrainDetailGenerator = Ring1DebugObjectV2.CreateTerrainDetailGenerator(
                globalHeightTexture, textureRendererProxy, commonExecutorUtProxy, computeShaderExecutorObject,
                containerGameObject);

            TerrainDetailCornerMerger merger = null;
            LateAssignFactory <BaseTerrainDetailProvider> detailProviderFactory = new LateAssignFactory <BaseTerrainDetailProvider>();

            if (useCornerMerging)
            {
                merger = new TerrainDetailCornerMerger(detailProviderFactory, new TerrainDetailAlignmentCalculator(240), textureRendererProxy, new TextureConcieverUTProxy(),
                                                       new CommonExecutorUTProxy(), new TerrainDetailCornerMergerConfiguration());
            }

            var terrainDetailProvider = Ring1DebugObjectV2.CreateTerrainDetailProvider(terrainDetailGenerator, merger);

            _shapeDb = FETerrainShapeDbInitialization.CreateTerrainShapeDb(terrainDetailProvider, commonExecutorUtProxy
                                                                           , new TerrainDetailAlignmentCalculator(240), useCornerMerging, useTextureSavingToDisk, useTextureLoadingFromDisk
                                                                           , new TerrainDetailFileManager(terrainDetailFilePath, commonExecutorUtProxy));

            var baseProvider = new FromTerrainDbBaseTerrainDetailProvider(_shapeDb);

            detailProviderFactory.Assign(baseProvider);
            terrainDetailGenerator.SetBaseTerrainDetailProvider(baseProvider);
        }