Пример #1
0
 public MTBScale(IMTBNoise input, float x, float y)
     : this(input)
 {
     this.X = x;
     this.Y = y;
     this.Z = 1;
 }
        public TerrainControlGenerator()
        {
            _biomeGenerator = new LayeredBiomeGenerator();

            this.maxSmoothDiameter = WorldConfig.Instance.GetMaxSmoothRadius() * 2 + 1;
            this.maxSmoothRadius   = WorldConfig.Instance.GetMaxSmoothRadius();

            this.nearBiomeWeightArray = new float[maxSmoothDiameter * maxSmoothDiameter];

            for (int x = -maxSmoothRadius; x <= maxSmoothRadius; x++)
            {
                for (int z = -maxSmoothRadius; z <= maxSmoothRadius; z++)
                {
                    float f1 = (float)(10.0f / Math.Sqrt(x * x + z * z + 0.2f));
                    this.nearBiomeWeightArray[(x + maxSmoothRadius) + maxSmoothDiameter * (z + maxSmoothRadius)] = f1;
                }
            }

            float xzScale = WorldConfig.Instance.fractureHorizontal;
            float yScale  = WorldConfig.Instance.fractureVertical;

            var perlinHeight = new MTBPerlin(WorldConfig.Instance.seed);

            perlinHeight.Frequency   = 0.1f;
            perlinHeight.OctaveCount = 10;
            var heightScale     = new MTBScale(perlinHeight, 0.1f, 0.1f);
            var heightScaleBias = new MTBScaleBias(heightScale, 0, 0.5f);

            _heightTerrainNoiseGen = heightScaleBias;

            var perlinFracture1 = new MTBPerlin(WorldConfig.Instance.seed + 100);

            perlinFracture1.OctaveCount = 10;
            perlinFracture1.Frequency   = 0.02f;
            var fracture1Scale = new MTBScale(perlinFracture1, xzScale, yScale, xzScale);

            _fractureNoiseGen1 = fracture1Scale;

            var perlinFracture2 = new MTBPerlin(WorldConfig.Instance.seed + 200);

            perlinFracture2.OctaveCount = 10;
            perlinFracture2.Frequency   = 0.03f;
            var fracture2Scale = new MTBScale(perlinFracture2, xzScale, yScale, xzScale);

            _fractureNoiseGen2 = fracture2Scale;

            var perlinFractureSelect = new MTBPerlin(WorldConfig.Instance.seed + 301);

            perlinFractureSelect.OctaveCount = 3;
            var fractureSelectScale = new MTBScale(perlinFractureSelect, xzScale, yScale, xzScale);

            _fractureNoiseSelect = fractureSelectScale;

            var perlinSurface = new MTBPerlin(WorldConfig.Instance.seed + 200);

            perlinSurface.OctaveCount = 6;
            var surfaceScale     = new MTBScale(perlinSurface, 0.02f, 0.02f);
            var surfaceScaleBias = new MTBScaleBias(surfaceScale, 2, 4);

            _surfaceNoiseGen = surfaceScaleBias;

            waterLevelRaw = new byte[NOISE_MAX_X * NOISE_MAX_Z];
            waterLevel    = new byte[Chunk.chunkWidth * Chunk.chunkDepth];

            heightCap = WorldConfig.Instance.heightCap;
            terrain   = new float[Chunk.chunkWidth * heightCap * Chunk.chunkDepth];
        }
Пример #3
0
 public MTBClamp(IMTBNoise input)
 {
     _clamp = new Clamp(input.ModuleBase);
 }
Пример #4
0
 public MTBAdd(IMTBNoise l, IMTBNoise r)
 {
     _add = new Add(l.ModuleBase, r.ModuleBase);
 }
Пример #5
0
 public MTBScale(IMTBNoise input, float x, float y, float z)
     : this(input, x, y)
 {
     this.Z = z;
 }
Пример #6
0
 public MTBScale(IMTBNoise input)
 {
     _scale = new Scale(input.ModuleBase);
 }
Пример #7
0
 public MTBBlend(IMTBNoise l, IMTBNoise r, IMTBNoise controller)
 {
     _blend = new Blend(l.ModuleBase, r.ModuleBase, controller.ModuleBase);
 }
Пример #8
0
 public MTBScaleBias(IMTBNoise input, float bias, float scale)
     : this(input)
 {
     this.Bias  = bias;
     this.Scale = scale;
 }
Пример #9
0
 public MTBScaleBias(IMTBNoise input)
 {
     _scaleBias = new ScaleBias(input.ModuleBase);
 }
Пример #10
0
 public MTBAbs(IMTBNoise input)
 {
     _abs = new Abs(input.ModuleBase);
 }
Пример #11
0
 public MTBSelect(IMTBNoise l, IMTBNoise r, IMTBNoise controller)
 {
     _select = new Select(l.ModuleBase, r.ModuleBase, controller.ModuleBase);
 }