/// <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(GraphicsDevice device, Gradient gradient)
		{
			return this.GetTexture(device, ref gradient);
		}
		/// <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(GraphicsDevice device, ref Gradient gradient)
		{
			Texture2D result = new Texture2D(device, 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);
			return result;
		}
Example #3
0
 /// <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(GraphicsDevice device, Gradient gradient)
 {
     return(this.GetTexture(device, ref gradient));
 }