Improve the logic for auto adding the weather component to the terrain (#1238)

This commit is contained in:
Stanislav Denisov
2025-10-10 07:49:00 +02:00
committed by GitHub
parent e65daa94fe
commit 295b708a81
+12 -4
View File
@@ -474,12 +474,20 @@ namespace wi::terrain
modifier->Seed(seed);
}
// Add some nice weather and lighting:
if (!scene->weathers.Contains(terrainEntity))
// Add some nice weather and lighting if there are no weathers in the scene yet:
bool created_terrain_weather = false;
if (scene->weathers.GetCount() == 0)
{
scene->weathers.Create(terrainEntity);
if (!scene->weathers.Contains(terrainEntity))
{
scene->weathers.Create(terrainEntity);
created_terrain_weather = true;
}
}
if (created_terrain_weather)
{
*scene->weathers.GetComponent(terrainEntity) = weather;
}
*scene->weathers.GetComponent(terrainEntity) = weather;
if (!weather.IsOceanEnabled())
{
scene->ocean = {};