MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / AdjustSubdivisionGrid

Method AdjustSubdivisionGrid

engine/Poseidon/World/WorldImpl.cpp:1050–1072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1048 GSoundScene->Reset();
1049}
1050
1051void World::AdjustSubdivisionGrid(float gridSize)
1052{
1053 const float invLog2 = 1 / log(2);
1054 float coefLog = log(LandGrid / gridSize) * invLog2;
1055 int coefLogInt = toInt(coefLog);
1056 saturate(coefLogInt, 0, 8);
1057 LOG_DEBUG(World, "Terrain subdivision wanted: {} ({:.3f})", coefLogInt, coefLog);
1058 int currentLog = TerrainRangeLog - LandRangeLog;
1059 int terrainChange = coefLogInt - currentLog;
1060
1061 if (terrainChange > 0)
1062 {
1063 if (!GLandscape->LoadSubdivCache(coefLogInt))
1064 {
1065 GLandscape->SubdivideTerrain(terrainChange);
1066 GLandscape->SaveSubdivCache(coefLogInt);
1067 }
1068 }
1069 else if (terrainChange < 0)
1070 {
1071 GLandscape->ResampleTerrain(-terrainChange);
1072 }
1073}
1074
1075void World::AdjustSubdivision(GameMode mode)

Callers 1

SetTerrainGridFunction · 0.80

Calls 7

logFunction · 0.85
saturateFunction · 0.85
LoadSubdivCacheMethod · 0.80
SubdivideTerrainMethod · 0.80
SaveSubdivCacheMethod · 0.80
ResampleTerrainMethod · 0.80
toIntFunction · 0.50

Tested by

no test coverage detected