/// <summary>
        /// Creates a texture map for the current content of the noise map.
        /// </summary>
        /// <param name="device">The graphics device to use.</param>
        /// <param name="gradient">The gradient to color the texture map with.</param>
        /// <returns>The created texture map.</returns>
        public Texture2D GetTexture(ref NGradient gradient)
        {
            Texture2D result = new Texture2D(this.m_width, this.m_height);

            Color[] data = new Color[this.m_width * this.m_height];
            int     id   = 0;

            for (int y = 0; y < this.m_height; y++)
            {
                for (int x = 0; x < this.m_width; x++, id++)
                {
                    float d = 0.0f;
                    if (!float.IsNaN(this.m_borderValue) && (x == 0 || x == this.m_width - 1 || y == 0 || y == this.m_height - 1))
                    {
                        d = this.m_borderValue;
                    }
                    else
                    {
                        d = this.m_data[x, y];
                    }
                    data[id] = gradient[d];
                }
            }
            //result.SetData<Color>(data);
            //Debug.Log("Setting pixels");
            result.SetPixels(data);
            return(result);
        }
 /// <summary>
 /// Creates a texture map for the current content of the noise map.
 /// </summary>
 /// <param name="device">The graphics device to use.</param>
 /// <param name="gradient">The gradient to color the texture map with.</param>
 /// <returns>The created texture map.</returns>
 public Texture2D GetTexture(NGradient gradient)
 {
     return(this.GetTexture(ref gradient));
 }