Exemplo n.º 1
0
        public void Initialize(NoiseGeneratorSettings settings)
        {
            this.settings = settings;

            random = new Random(settings.Seed);
            random1 = random.Next(1000, 10000);
            random2 = random.Next(100000, 1000000);
            random3 = random.Next(1000000000, 2000000000);
            offset = Int32.MaxValue / 2;
        }
Exemplo n.º 2
0
    public TerrainGenerator(float seed, NoiseGeneratorSettings surfaceGenerator, NoiseGeneratorSettings ironOreGenerator,
                            NoiseGeneratorSettings iceGenerator, NoiseGeneratorSettings heliumGenerator, NoiseGeneratorSettings regolithGenerator)
    {
        this.seed              = seed;
        this.surfaceGenerator  = surfaceGenerator;
        this.ironOreGenerator  = ironOreGenerator;
        this.iceGenerator      = iceGenerator;
        this.heliumGenerator   = heliumGenerator;
        this.regolithGenerator = regolithGenerator;

        rockGenerator = new NoiseGeneratorSettings(1, 1, 1, 1);
    }
Exemplo n.º 3
0
    private float OctavePerlinNoise(float x, float z, NoiseGeneratorSettings noiseGenerator)
    {
        float total     = 0.0f;
        float frequency = noiseGenerator.frequency;
        float amplitude = noiseGenerator.amplitude;
        float maxValue  = 0.0f;         // Used for normalizing result to 0.0 - 1.0

        for (int i = 0; i < noiseGenerator.octaves; i++)
        {
            total    += Mathf.PerlinNoise(BigAssOffset + 2 * i + seed + x * frequency, BigAssOffset + 2 * i + seed + z * frequency) * amplitude;
            maxValue += amplitude;

            amplitude *= noiseGenerator.persistence;
            frequency *= 2;
        }
        return(total / maxValue);
    }
Exemplo n.º 4
0
        private INoiseGenerator InitializeGrainy()
        {
            var generator = new NoiseGeneratorLibNoise();

            var settings = new NoiseGeneratorSettings
            {
                Seed = seed,
                Frequency = 0.25,
                Persistence = 0.3,
                Octaves = 1,
                Amplitude = 0.01,
                CloudCoverage = 0,
                CloudDensity = 1
            };

            generator.Initialize(settings);
            generator.SetOutputSize(width, height);

            return generator;
        }
Exemplo n.º 5
0
        private INoiseGenerator InitializeDefault()
        {
            var generator = new NoiseGeneratorDefault();

            var settings = new NoiseGeneratorSettings
                           {
                               Seed = seed,
                               Frequency = 0.008,
                               Persistence = 0.9,
                               Octaves = 8,
                               Amplitude = 2,
                               CloudCoverage = 6,
                               CloudDensity = 0.1
                           };

            generator.Initialize(settings);
            generator.SetOutputSize(width, height);

            return generator;
        }
        public void Initialize(NoiseGeneratorSettings settings)
        {
            this.settings = settings;

            offset = Int32.MaxValue / 2;

            lacunarity = 2.0f;
            Utils.m_quality = Utils.QualityMode.Low;
        }