Example #1
0
        public void ErodeOneStep()
        {
            var currentHeightArray = SimpleHeightArray.FromHeightmap(_currentHeightmap);
            var eroder             = new ThermalEroder();

            var extremes = new ArrayExtremes(1517, 6161);
            var tParam   = CalculateFromHillFactor(1, extremes, 24);

            Debug.Log("TPAN IS " + tParam);

            eroder.Erode(currentHeightArray, new ThermalErosionConfiguration()
            {
                StepCount = 5,
                CParam    = 0.3f,
                TParam    = tParam
            });

            var doneTexture =
                HeightmapUtils.CreateTextureFromHeightmap(
                    SimpleHeightArray.ToHeightmap(currentHeightArray));

            //_go.GetComponent<MeshRenderer>().material.SetTexture("_HeightmapTex0", _oldDoneTexture);
            _go.GetComponent <MeshRenderer>().material.SetTexture("_HeightmapTex1", doneTexture);
            _oldDoneTexture = doneTexture;
        }
Example #2
0
        public List <HeightmapArray> GenerateErodedArrays(HeightmapArray baseArray,
                                                          List <ThermalErosionConfiguration> configurations)
        {
            var msw = new MyStopWatch();
            List <HeightmapArray> outArray = new List <HeightmapArray>();
            int i = 0;

            foreach (var aConfiguration in configurations)
            {
                var copyArray          = MyArrayUtils.DeepClone(baseArray.HeightmapAsArray);
                var currentHeightArray = new SimpleHeightArray(copyArray);
                msw.StartSegment("eroding-" + i);
                var eroder = new ThermalEroder();
                //var eroder = new TweakedThermalEroder();
                eroder.Erode(currentHeightArray, aConfiguration);
                msw.StopSegment();

                outArray.Add(SimpleHeightArray.ToHeightmap(currentHeightArray));
                i++;
            }
            Debug.Log("T22: " + msw.CollectResults());
            return(outArray);
        }