0
我想用OpenSimplexNoise生成隨機地形。開始我只想得到一個結果並將其繪製到窗口中。繪製並獲取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