Esempio n. 1
0
        public void DiamondSquareWithFixedValueFuncCreates5X5Plane()
        {
            var map = DiamondSquare.CreateHeightMap(5, 1f);

            DiamondSquare.Apply(ref map, null, () => 0f);

            Assert.That(map, Has.All.EqualTo(1f));
        }
Esempio n. 2
0
        public override void UpdateComponent()
        {
            float[,] heightmap = base.GetTerrainHeight();
            int resolution = base.meshGenerator.resolution;

            if (useGPU)
            {
                diamondSquare = new DiamondSquareGPU(resolution, shader);
            }
            else
            {
                diamondSquare = new DiamondSquare(resolution);
            }

            TimeLogger.Start(diamondSquare.GetType().Name, diamondSquare.Resolution);

            diamondSquare.Apply(heightmap);

            TimeLogger.RecordSingleTimeInMilliseconds();

            base.UpdateTerrainHeight(heightmap);
        }