XNAでノイズを生成するためのライブラリを見てきました。Libnoise は、最も論理的な選択のように思えました。ライブラリは非常に使いやすく、素晴らしい結果をもたらします。ただし、追加のセクションを生成するのに問題があります。C++ のドキュメントには、このための非常に優れた機能があります。
utils::NoiseMap heightMap;
utils::NoiseMapBuilderPlane heightMapBuilder;
heightMapBuilder.SetSourceModule (myModule);
heightMapBuilder.SetDestNoiseMap (heightMap);
heightMapBuilder.SetDestSize (256, 256);
heightMapBuilder.SetBounds (6.0, 10.0, 1.0, 5.0); //this one!
heightMapBuilder.Build ();
//http://libnoise.sourceforge.net/tutorials/tutorial3.html
XNA バージョンはこのようには機能せず、代わりに変換関数を使用して、生成された高さマップを "移動" します。
Translate.cs
/// <summary>
/// Initializes a new instance of Translate.
/// </summary>
/// <param name="x">The translation on the x-axis.</param>
/// <param name="y">The translation on the y-axis.</param>
/// <param name="z">The translation on the z-axis.</param>
/// <param name="input">The input module.</param>
public Translate(double x, double y, double z, ModuleBase input)
: base(1)
{
this.m_modules[0] = input;
this.X = x;
this.Y = y;
this.Z = z;
}
使用法
perlin = new Perlin(zoom, 4, 0.2, 4, 1, QualityMode.Medium);
Translate translate = new Translate(location.X, location.Y, 0, perlin);
this.m_noiseMap = new Noise2D(200, 200, translate);
this.m_noiseMap.GeneratePlanar(-1 * zoom, 1 * zoom, -1 * zoom, 1 * zoom, true);
ここで問題が発生します。ハイトマップは変換されますが、歪みも生じます。パーリンは変更されていないため、これは奇妙に思えます。Z を変更すると高さマップが変更されると想像できましたが、変更しているのは X 軸だけです。
これについて何か考えはありますか?