Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate cache files for each heightmap LOD #3200

Merged
merged 3 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions gazebo/rendering/Heightmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,20 @@ void Heightmap::Load()
}
}

std::string terrainNameSuffix = "";
if (this->LOD() == 0)
{
terrainNameSuffix = "_LOD0";
}

// If the paging is enabled we modify the number of subterrains
if (this->dataPtr->useTerrainPaging)
{
this->dataPtr->splitTerrain = true;
nTerrains = this->dataPtr->numTerrainSubdivisions;
prefix = terrainDirPath / "gazebo_terrain_cache";
std::string terrainName = "gazebo_terrain_cache" +
terrainNameSuffix;
prefix = terrainDirPath / terrainName.c_str();
}
else
{
Expand All @@ -542,7 +550,8 @@ void Heightmap::Load()
gzmsg << "Large heightmap used with LOD. It will be subdivided into " <<
this->dataPtr->numTerrainSubdivisions << " terrains." << std::endl;
}
prefix = terrainDirPath / "gazebo_terrain";
std::string terrainName = "gazebo_terrain" + terrainNameSuffix;
prefix = terrainDirPath / terrainName.c_str();
}

double sqrtN = sqrt(nTerrains);
Expand Down
2 changes: 1 addition & 1 deletion test/integration/heightmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ void HeightmapTest::HeightmapCache()
+ "/paging");
std::string shaPath = heightmapDir + "/" + heightmapName + "/gzterrain.SHA1";
std::string cachePath = heightmapDir +
"/" + heightmapName + "/gazebo_terrain_00000000.dat";
"/" + heightmapName + "/gazebo_terrain_LOD0_00000000.dat";

// temporary backup files for testing if cache files exist.
std::string shaPathBk = shaPath + ".bk";
Expand Down