Exemplo n.º 1
0
        private async Task <TerrainDetailElement> GenerateTerrainDetailElementAsync(
            MyRectangle queryArea, TerrainCardinalResolution cardinalResolution, CornersMergeStatus requiredMerge,
            Func <MyRectangle, TerrainCardinalResolution, TextureWithSize, Task <TextureWithSize> > cornerMergingFunc,
            Func <MyRectangle, TerrainCardinalResolution, RequiredCornersMergeStatus, Task <TextureWithSize> > generateElementFunc
            )
        {
            var newTerrainArea = _alignmentCalculator.ComputeAlignedTerrainArea(queryArea, cardinalResolution);
            RetrivedTerrainDetailTexture texture = null;
            CornersMergeStatus           outCornersMergeStatus;

            TextureWithSize outTexture = null;

            var baseTexture = await generateElementFunc(newTerrainArea, cardinalResolution, RequiredCornersMergeStatus.NOT_MERGED);

            if (requiredMerge == CornersMergeStatus.NOT_MERGED)
            {
                outTexture            = baseTexture;
                outCornersMergeStatus = CornersMergeStatus.NOT_MERGED;
            }
            else
            {
                outTexture = await cornerMergingFunc(queryArea, cardinalResolution, baseTexture);

                outCornersMergeStatus = CornersMergeStatus.MERGED;
            }


            return(new TerrainDetailElement()
            {
                DetailArea = newTerrainArea,
                Resolution = cardinalResolution,
                Texture = outTexture,
                CornersMergeStatus = outCornersMergeStatus
            });
        }
Exemplo n.º 2
0
 private async Task<TerrainDetailElementOutput> RetriveHeightArrayAsync(MyRectangle queryArea, TerrainCardinalResolution resolution, RequiredCornersMergeStatus requiredMerge)
 {
     var alignedArea = _alignmentCalculator.ComputeAlignedTerrainArea(queryArea, resolution);
     return GenerateOutput( await _cachedTerrainDetailProvider.GenerateHeightDetailElementAsync(alignedArea, resolution, requiredMerge), queryArea);
 }