Ejemplo n.º 1
0
        public static int GetBlock(int x, int y, int z)
        {
            int res = 0;

            float r = (float)Math.Round(HeightAt(x, z));

            if (y < r || y <= 0)
            {
                if (y == (int)r)
                {
                    float n = noise2.GetNoise2d(x, z);
                    res = (int)Math.Round((n + 1) / 2 + 1);
                }
                else
                {
                    res = 1;
                }
            }

/*
 *          float r = (noise.GetNoise3d(x * Stretch, y * Stretch, z * Stretch) + 1) / 2;
 *          int res = (int)Math.Round(r);
 *          if (y < 2 || y > 2 * Height - 2) res = 1;
 */
            return(res);
        }
Ejemplo n.º 2
0
        private void Generation(Chunk chunk)
        {
            for (int x = 0; x < Chunk.Size.x + 2; x++)
            {
                for (int z = 0; z < Chunk.Size.z + 2; z++)
                {
                    float height = Math.Abs(Noise.GetNoise2d(x + x * Chunk.Size.x, z + z * Chunk.Size.z) * 10 + 5);

                    for (int y = (int)height; y < Chunk.Size.y + 2; y++)
                    {
                        chunk.Blocks[x, y, z] = new Blocks.Block(1, 1);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static float HeightAt(int x, int y)
        {
            float r = (1 + noise.GetNoise2d(x * Stretch, y * Stretch)) / 2 * Height;

            return(r);
        }