Exemplo n.º 1
0
        private float[,] GetInterpolatedData(Int2 position, int iterations)
        {
            var interpolator = new BicubicInterpolator(ServiceLocator.I.TerrainData.PickSeedData(Origin.X + position.X, Origin.Z + position.Z));
            var data         = new float[2 + iterations, 2 + iterations];

            for (int i = 0; i < 2 + iterations; i++)
            {
                for (int j = 0; j < 2 + iterations; j++)
                {
                    data[i, j] = interpolator.GetValue((float)i / (1 + iterations), (float)j / (1 + iterations));
                }
            }
            return(data);
        }
Exemplo n.º 2
0
    private float[,] InterpolateSeedData(float[,] seed, int iterations)
    {
        var interpolator = new BicubicInterpolator(seed);
        var data         = new float[2 + iterations, 2 + iterations];

        for (int i = 0; i < 2 + iterations; i++)
        {
            for (int j = 0; j < 2 + iterations; j++)
            {
                data[i, j] = interpolator.GetValue((float)i / (float)(1 + iterations), (float)j / (float)(1 + iterations));
            }
        }

        return(data);
    }
Exemplo n.º 3
0
    private float[,] GetInterpolatedData(Int2 position, int iterations)
    {
        //Todo fix "7" WTF?!
        var interpolator = new BicubicInterpolator(_meshBuilder.PickSeedData(_origin.X + position.X - 7, _origin.Z + position.Z));
        var data         = new float[2 + iterations, 2 + iterations];

        for (int i = 0; i < 2 + iterations; i++)
        {
            for (int j = 0; j < 2 + iterations; j++)
            {
                data[i, j] = interpolator.GetValue((float)i / (float)(1 + iterations), (float)j / (float)(1 + iterations));
            }
        }

        return(data);
    }