Skip to content

Commit

Permalink
P O L Y G O N S
Browse files Browse the repository at this point in the history
  • Loading branch information
HoubkneghteS committed Apr 17, 2020
1 parent 965aa89 commit 3041084
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,19 @@ function poly(array, base = 0, slope = hilliness){
array[0][i] = incline(array[0][i - 1], slope);
}
//generates rest of the heightmap
for (var i = 1; i < resolution; i++) {
array[i][0] = incline(array[i - 1][0], slope);
for (var j = 1; j < resolution; j++) {
array[i][j] = incline((array[i][j - 1] * array[i - 1][j]) / 2, slope);
if(Math.floor(Math.random() * 2) == 0){
for (var i = 1; i < resolution; i++) {
array[i][0] = incline(array[i - 1][0], slope);
for (var j = 1; j < resolution; j++) {
array[i][j] = incline(array[i][j - 1] ^ array[i - 1][j] / (Math.random() * 100), slope);
}
}
}else{
for (var i = 1; i < resolution; i++) {
array[i][0] = incline(array[i - 1][0], slope);
for (var j = 1; j < resolution; j++) {
array[i][j] = incline(array[i][j - 1] * array[i - 1][j] / (Math.random() * 100), slope);
}
}
}
}
Expand Down

0 comments on commit 3041084

Please sign in to comment.