private CoherentNoise.Generator GetNoise(int seed) { BillowNoise noise = new BillowNoise(seed); Turbulence b = new Turbulence(noise, seed); return(b); }
/// <summary> /// Updates the <see cref="Generator"/> assigned to this instance based on the /// set <see cref="MapGeneratorType"/> and returns it. /// </summary> /// <returns>Generator if set, null if <see cref="MapGeneratorType.Custom"/> /// is set and no <see cref="CustomGenerator"/> is specified</returns> public void UpdateGenerator() { int seed = TerraConfig.GenerationSeed; Generator gen; switch (MapType) { case MapGeneratorType.Perlin: gen = new GradientNoise(seed).ScaleShift(0.5f, 0.5f); break; case MapGeneratorType.Fractal: gen = new PinkNoise(seed).ScaleShift(0.5f, 0.5f); break; case MapGeneratorType.Billow: gen = new BillowNoise(seed).ScaleShift(0.5f, 0.5f); break; case MapGeneratorType.Custom: if (Graph == null) { return; } gen = Graph.GetEndGenerator(); break; default: return; } _generator = gen; }
public override Generator GetGenerator() { BillowNoise noise = new BillowNoise(TerraConfig.Instance.Seed); noise.Frequency = Frequency; noise.Lacunarity = Lacunarity; noise.OctaveCount = OctaveCount; noise.Persistence = Persistence; return(noise); }
public override Generator GetGenerator() { BillowNoise noise = new BillowNoise(TerraSettings.GenerationSeed); noise.Frequency = Frequency; noise.Lacunarity = Lacunarity; noise.OctaveCount = OctaveCount; noise.Persistence = Persistence; return(noise); }
private Generator GetTestGenerator() { RidgeNoise rn = new RidgeNoise(1337); rn.Frequency = 2; PinkNoise n = new PinkNoise(234); Add added = new Add(rn, n); BillowNoise bn = new BillowNoise(534); return(bn - added); }
void BillowFillMap() { if (useRandomSeed) { seed = Time.time.ToString() + transform.position.ToString(); } System.Random pseudoRandom = new System.Random(seed.GetHashCode()); BillowNoise billow = new BillowNoise(pseudoRandom.Next(0, 100)); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { for (int z = 0; z < depth; z++) { if (x == 0 || x == width - 1 || y == 0 || y == height - 1 || z == 0 || z == depth - 1) { map[x, y, z] = 1; } else { Debug.Log(billow.GetValue(x, y, z)); if (billow.GetValue(x, y, z) > billowFillCutoff) { map[x, y, z] = 1; } else { map[x, y, z] = 0; } } } } } }