Weather sim v2: make land & water heating speed differ
This commit is contained in:
parent
dd8781a1b2
commit
1044443e9b
1 changed files with 2 additions and 2 deletions
|
|
@ -274,7 +274,7 @@ struct solver
|
|||
math::point p{x + 0.5f, y + 0.5f};
|
||||
float advection = sample_bilinear(snapshot.temperature, p - snapshot.wind_velocity(x, y) * step_time);
|
||||
|
||||
float heating_speed = 0.001f;
|
||||
float heating_speed = (terrain(x, y) < 0.f) ? 0.001f : 0.0001f;
|
||||
float heating_delta = (expected_temperature(y) - snapshot.temperature(x, y)) * (- std::expm1(- heating_speed * step_time));
|
||||
|
||||
new_temperature(x, y) = heating_delta + advection;
|
||||
|
|
@ -396,7 +396,7 @@ struct weather_app
|
|||
simulation_box = {{{0.f, N}, {0.f, N}}};
|
||||
|
||||
terrain.resize({N, N}, 0.f);
|
||||
auto heightmap = gfx::read_image<std::uint8_t>(io::file_istream{std::filesystem::path{PSEMEK_EXAMPLES_DIR} / "heightmap_seed_3.png"});
|
||||
auto heightmap = gfx::read_image<std::uint8_t>(io::file_istream{std::filesystem::path{PSEMEK_EXAMPLES_DIR} / "heightmap_seed_1.png"});
|
||||
for (int y = 0; y < N; ++y)
|
||||
for (int x = 0; x < N; ++x)
|
||||
terrain(x, y) = ((heightmap(x, y) / 255.f) * 2048.f - 512.f) / 1024.f;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue