我想用 OpenSimplexNoise 生成一个随机地形。首先,我只想得到一个结果并将其绘制到一个窗口中。
我现在的问题是:如何获得 OpenSimplexNoise 的正确输出(因为有很多方法,我只是不知道哪个是正确的)以及如何绘制这个结果。
public double[][] generateMap(long seed, int width, int height) {
double[][] map = new double[width][height];
// start generating things here, just how?
OpenSimplexNoise simplex = new OpenSimplexNoise(seed);
return map;
}
public void drawMap(double[][] map, Graphics g) {
for(int x = 0; x < map.length; x++) {
for(int y = 0; y < map[0].length; y++) {
Color color = new Color(); // how to get the color here?
}
}
}
这是我得到的当前代码。
这是任何需要它的人的 OpenSimplexNoise 的链接: https ://gist.github.com/KdotJPG/b1270127455a94ac5d19