コード例 #1
0
        public override float[, ] GetHeightMap(int width, int height, UnityEngine.Vector2 offset)
        {
            var map       = input.GetHeightMap(width, height, offset);
            var origin    = new Vector2(4, 3);
            var target    = new Vector2(5, 10);
            var steepness = .01f;

            float prev = map[5, 5];

            for (int x = 2; x < 4; x++)
            {
                for (int y = 0; y < 10; y++)
                {
                    var val = map[x, y];

                    map[x, y] = Mathf.Abs(val - prev) < steepness ?
                                val :
                                prev;

                    prev = val;
                }
            }

            return(map);
        }
コード例 #2
0
        public void UpdateTexture(Texture2D texture, int?width = null, int?height = null)
        {
            var w = width ?? this.width;
            var h = height ?? this.height;

            texture.SetPixels(function.GetHeightMap(w, h, offset).ToHeightMapTexture());
            texture.Apply();
        }
コード例 #3
0
        public override float[,] GetHeightMap(int width, int height, UnityEngine.Vector2 offset)
        {
            var map    = input.GetHeightMap(width, height, offset);
            var _curve = new AnimationCurve(curve.keys);

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    map[x, y] = _curve.Evaluate(map[x, y]);
                }
            }

            return(map);
        }