public override void ModifyWorldGenTasks(List <GenPass> tasks, ref float totalWeight) { TerrainRemixerGenPass pass; for (int i = 0; i < tasks.Count; i++) { string currPassName = tasks[i].Name; pass = TerrainRemixerGenPass.CreatePass( currPassName, "Adding Noise (before '" + currPassName + "')" ); if (pass != null) { tasks.Insert(i, pass); totalWeight += pass.Weight; i++; } } pass = TerrainRemixerGenPass.CreatePass( "Post Generation", // denotes end of vanilla list "Adding Noise (final)" ); if (pass != null) { tasks.Add(pass); totalWeight += pass.Weight; } }
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"); } }