Slightly tweak world gen and rendering

696b65f956979962f4c70a116efff4fd087b8d13
This commit is contained in:
Tobias Berger 2022-11-13 13:03:45 +01:00
parent 7d1566afd7
commit a58e7a2c2d
Signed by: toby
GPG key ID: 2D05EFAB764D6A88
2 changed files with 6 additions and 5 deletions

View file

@ -377,7 +377,7 @@ impl World {
let random_noise =
self.random_noise_from_polar_coordinates(alpha, beta, RADIUS, offset)?;
let latitude_factor = (alpha * 0.9) + (random_noise * 0.2 * PI) - 0.1;
let latitude_factor = alpha + (random_noise * 2.0 - 1.0) * PI * 0.1;
let latitude_modifier_1 = (1.5 * f32::sin(latitude_factor)) - 0.5;
let latitude_modifier_2 = f32::cos(latitude_factor);
@ -395,13 +395,14 @@ impl World {
let offset_altitude_2 = f32::max(0.0, offset_cell_2.altitude);
let cell = &mut self.terrain[y][x];
let altitude = f32::max(0.0, cell.altitude);
let altitude_value = f32::max(0.0, cell.altitude);
let altitude_modifier =
(altitude - (offset_altitude * 1.5) - (offset_altitude_2 * 1.5))
(altitude_value - (offset_altitude * 1.5) - (offset_altitude_2))
/ World::MAX_ALTITUDE;
let rainfall_value = mix_values(latitude_modifier_1, altitude_modifier, 0.63);
let rainfall_value = mix_values(rainfall_value.powi(2), rainfall_value, 0.85);
let rainfall = f32::min(
World::MAX_RAINFALL,
World::calculate_rainfall(rainfall_value),

View file

@ -151,9 +151,9 @@ fn coastline_color(world: &World, cell: &TerrainCell) -> Color {
} else if cell.altitude > 0.0 {
let slant = world.get_slant(cell);
let altitude_span = world.max_altitude - world.min_altitude;
let slant_factor = f32::min(1.0, -(500.0 * (slant / altitude_span)));
let slant_factor = f32::min(1.0, -(20.0 * (slant / altitude_span)));
if slant_factor > 0.9 {
if slant_factor > 0.1 {
COASTLINE_PALETTE[4] * slant_factor + COASTLINE_PALETTE[1] * (1.0 - slant_factor)
} else {
COASTLINE_PALETTE[1]