示例#1
0
        private ChunkBase GetChunkBase(Int2 position)
        {
            var wx = (float)position.X;
            var wz = (float)position.Y;

            var alt_base      = GenAltitudeBase(wx, wz);
            var chaos         = GenChaos(wx, wz);
            var humid_uniform = GenHumidityBase(wx, wz);
            var alt_pre       = GenAltitude(wx, wz);
            var alt_uniform   = GenAltitudeNoSeawater(wx, wz);
            var temp_uniform  = GenTemperatureBase(wx, wz);

            var humidity = IrwinHallProbabilityDensityFunction(new float[] { 1, 1 }, new float[] { humid_uniform, 1.0f - alt_uniform });
            var temp     = (IrwinHallProbabilityDensityFunction(new float[] { 2, 1 }, new float[] { temp_uniform, 1.0f - alt_uniform }) - 0.5f) * 2f;

            alt_base *= Configuration.MountainScale;

            var alt = Configuration.SeaLevel + alt_pre * Configuration.MountainScale;

            var cliff = Cliff.GetValue(wx / 2048f, wz / 2048f) + chaos * 0.2f;


            return(new ChunkBase
            {
                Chaos = chaos,
                AltBase = alt_base,
                Alt = alt,
                Temp = temp,
                Humidity = humidity,
                Rockiness = Mathf.Max(0, (Rock.GetValue(wx / 1024f, wz / 1024f) - 0.1f) * 0.3f),
                IsCliffs = cliff > 0.5f && alt > Configuration.SeaLevel + 5,
                NearCliffs = cliff > 0.2f
            });
        }
示例#2
0
 public override double Execute(double x, double y, double z, CallableNode flow)
 {
     return(noise.GetValue(x * frequency, y * frequency, z * frequency) * scale);
 }