Exemple #1
0
        public OverworldTerrain(OverworldTerrainSettings ots, bool isUnitTest = false)
        {
            settings = ots;

            ocean     = new OceanTerrain(ots);
            plains    = new PlainsTerrain(ots);
            hills     = new HillsTerrain(ots);
            badlands  = new BadlandsTerrain(ots);
            mountains = new MountainsTerrain(ots);
            rivers    = new RiverTerrain(ots);

            humidity    = new HumidityNoise(ots);
            temperature = new TemperatureNoise(ots);
            terrain     = new TerrainNoise(ots);

            cave = new CavesCarver(ots);

            // Scale Point multiplies input values by the scaling factors.
            // Used to stretch or shrink the terrain horizontally.
            var scaled = GetScaledModuleOutput(MergedLandOceanRivers());
            //var scaled = GetScaledModuleOutput(LandOceanSelector());
            //var scaled = GetScaledModuleOutput(temperature.RiverSelector);

            // Scale bias scales the verical output (usually -1.0 to +1.0) to
            // Minecraft values. If MinElev is 40 (leaving room for caves under oceans)
            // and MaxElev is 168, a value of -1 becomes 40, and a value of 1 becomes 168.
            var biased = new ScaleBias
            {
                Scale   = (settings.MaxElev - settings.MinElev) / 2.0,
                Bias    = settings.MinElev + ((settings.MaxElev - settings.MinElev) / 2.0) - 44,
                Source0 = scaled
            };

            Result = isUnitTest ? scaled : biased;
        }