Exemplo n.º 1
0
        BiomeData Generate2DBiomeData()
        {
            BiomeData        biomeData     = new BiomeData();
            BiomeSwitchGraph switchGraph   = new BiomeSwitchGraph();
            Sampler2D        terrainHeight = new Sampler2D(size, step);
            PerlinNoise2D    perlin        = new PerlinNoise2D(seed);

            perlin.UpdateParams(seed, step, octaves, persistance, lacunarity);

            perlin.ComputeSampler2D(terrainHeight);

            terrainHeight = NoiseFunctions.Map(terrainHeight, 0, maxTerrainHeight);

            biomeData.waterLevel  = waterLevel;
            biomeData.isWaterless = isWaterless;
            biomeData.UpdateSamplerValue(BiomeSamplerName.terrainHeight, terrainHeight);
            if (!isWaterless)
            {
                biomeData.UpdateSamplerValue(BiomeSamplerName.waterHeight, GenerateWaterHeight(terrainHeight));
            }

            switchGraph.BuildTestGraph(0);

            biomeData.biomeMap         = Generate2DBiomeMap(0);
            biomeData.biomeSwitchGraph = switchGraph;
            return(biomeData);
        }
        public override void OnNodeProcess()
        {
            //recalcul perlin noise values with new seed / position.
            output.ResizeIfNeeded(chunkSize, step);

            perlin2D.UpdateParams(GetSeed(), scale, octaves, persistence, lacunarity);

            perlin2D.ComputeSampler2D(output);
        }