|
11 | 11 | ### For draw_satellite ###
|
12 | 12 | NOISE_RANGE = 15 # a random value between -NOISE_RANGE and NOISE_RANGE will be added to the rgb of each pixel
|
13 | 13 |
|
14 |
| -# These are arbitrarily-chosen elevation cutoffs for 4 different height levels. |
15 |
| -# Some color modifiers will be applied at each level |
16 |
| -HIGH_MOUNTAIN_ELEV = 215 |
17 |
| -MOUNTAIN_ELEV = 175 |
18 |
| -HIGH_HILL_ELEV = 160 |
19 |
| -HILL_ELEV = 145 |
20 |
| - |
21 | 14 | # These are rgb color values which will be added to the noise, if the elevation is greater than the height specified
|
22 | 15 | # These are not cumulative
|
23 | 16 | HIGH_MOUNTAIN_NOISE_MODIFIER = (10, 6, 10)
|
@@ -279,30 +272,29 @@ def get_biome_color_based_on_elevation(world, elev, x, y, rng):
|
279 | 272 | ## Generate some random noise to apply to this pixel
|
280 | 273 | # There is noise for each element of the rgb value
|
281 | 274 | # This noise will be further modified by the height of this tile
|
282 |
| - |
283 | 275 | noise = rng.randint(-NOISE_RANGE, NOISE_RANGE, size=3) # draw three random numbers at once
|
284 | 276 |
|
285 |
| - ####### Case 1 - elevation is very high ######## |
286 |
| - if elev > HIGH_MOUNTAIN_ELEV: |
287 |
| - # Modify the noise to make the area slightly brighter to simulate snow-topped mountains. |
288 |
| - noise = add_colors(noise, HIGH_MOUNTAIN_NOISE_MODIFIER) |
289 |
| - # Average the biome's color with the MOUNTAIN_COLOR to tint the terrain |
290 |
| - biome_color = average_colors(biome_color, MOUNTAIN_COLOR) |
291 |
| - |
292 |
| - ####### Case 2 - elevation is high ######## |
293 |
| - elif elev > MOUNTAIN_ELEV: |
294 |
| - # Modify the noise to make this tile slightly darker, especially draining the green |
295 |
| - noise = add_colors(noise, MOUNTAIN_NOISE_MODIFIER) |
296 |
| - # Average the biome's color with the MOUNTAIN_COLOR to tint the terrain |
297 |
| - biome_color = average_colors(biome_color, MOUNTAIN_COLOR) |
298 |
| - |
299 |
| - ####### Case 3 - elevation is somewhat high ######## |
300 |
| - elif elev > HIGH_HILL_ELEV: |
301 |
| - noise = add_colors(noise, HIGH_HILL_NOISE_MODIFIER) |
302 |
| - |
303 |
| - ####### Case 4 - elevation is a little bit high ######## |
304 |
| - elif elev > HILL_ELEV: |
305 |
| - noise = add_colors(noise, HILL_NOISE_MODIFIER) |
| 277 | + ####### Case 1 - elevation is very high ######## |
| 278 | + if world.is_high_mountain((x, y)): |
| 279 | + # Modify the noise to make the area slightly brighter to simulate snow-topped mountains. |
| 280 | + noise = add_colors(noise, HIGH_MOUNTAIN_NOISE_MODIFIER) |
| 281 | + # Average the biome's color with the MOUNTAIN_COLOR to tint the terrain |
| 282 | + biome_color = average_colors(biome_color, MOUNTAIN_COLOR) |
| 283 | + |
| 284 | + ####### Case 2 - elevation is high ######## |
| 285 | + elif world.is_medium_mountain((x, y)): |
| 286 | + # Modify the noise to make this tile slightly darker, especially draining the green |
| 287 | + noise = add_colors(noise, MOUNTAIN_NOISE_MODIFIER) |
| 288 | + # Average the biome's color with the MOUNTAIN_COLOR to tint the terrain |
| 289 | + biome_color = average_colors(biome_color, MOUNTAIN_COLOR) |
| 290 | + |
| 291 | + ####### Case 3 - elevation is somewhat high ######## |
| 292 | + elif world.is_low_mountain((x, y)): |
| 293 | + noise = add_colors(noise, HIGH_HILL_NOISE_MODIFIER) |
| 294 | + |
| 295 | + ####### Case 4 - elevation is a little bit high ######## |
| 296 | + elif world.is_hill((x, y)): |
| 297 | + noise = add_colors(noise, HILL_NOISE_MODIFIER) |
306 | 298 |
|
307 | 299 | # There is also a minor base modifier to the pixel's rgb value based on height
|
308 | 300 | modification_amount = int(elev / BASE_ELEVATION_INTENSITY_MODIFIER)
|
|
0 commit comments