private void ApplyPass(GenerationProgress progress, TerrainRemixerGenPassSpec passSpec)
        {
            var       config   = TerrainRemixerConfig.Instance;
            Rectangle tileArea = this.GetRegion(passSpec);

            var then = DateTime.UtcNow;

            if (config.DebugModeInfo)
            {
                LogLibraries.Log("Applying pass " + this.Name + " to " + tileArea.ToString());
            }

            (float[], float, float)map = TerrainRemixerGenPass.GetNoiseMap(
                Main.maxTilesX,
                tileArea.Height,
                passSpec.NoiseFrequency,
                (FastNoise.FractalType)passSpec.WormsMode,
                passSpec.Sharpness,
                //passSpec.IsPerturbed,
                out FastNoise _
                );

            float totalTiles = tileArea.Height * Main.maxTilesX;
            int   botY       = tileArea.Bottom;
            int   rightX     = tileArea.Right;

            for (int y = tileArea.Y; y < botY; y++)
            {
                for (int x = tileArea.X; x < rightX; x++)
                {
                    this.ApplyPassToTile(passSpec, tileArea, map, x, y);

                    // Update progress:
                    float currTile = x + ((y - tileArea.Y) * Main.maxTilesX);
                    progress.Set(currTile / totalTiles);
                }
            }

            var now = DateTime.UtcNow;

            if (config.DebugModeInfo)
            {
                LogLibraries.Log(" Applied pass " + this.Name + ": " + (now - then).TotalSeconds + "s");
            }
        }
示例#2
0
        ////////////////

        internal static bool ApplyTileRemixers(
            TerrainRemixerGenPassSpec passSpec,
            int tileX,
            int tileY,
            ref float noiseStrength,
            ref float randVal)
        {
            var api = ModContent.GetInstance <TerrainRemixerAPI>();

            foreach (TileRemixer remixer in api.TileRemixers)
            {
                if (remixer(passSpec, tileX, tileY, ref noiseStrength, ref randVal))
                {
                    return(true);
                }
            }

            return(false);
        }
 private void ApplyPassToTile(
     TerrainRemixerGenPassSpec passSpec,
     Rectangle tileArea,
     (float[] map, float minVal, float maxVal) noiseMap,