diff --git a/gazebo/rendering/Heightmap.cc b/gazebo/rendering/Heightmap.cc index dc1b913e8e..4ef300709a 100644 --- a/gazebo/rendering/Heightmap.cc +++ b/gazebo/rendering/Heightmap.cc @@ -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 { @@ -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); diff --git a/test/integration/heightmap.cc b/test/integration/heightmap.cc index f5bbca7a53..202478550f 100644 --- a/test/integration/heightmap.cc +++ b/test/integration/heightmap.cc @@ -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";