Skip to content

Commit d546bef

Browse files
MarcelPiNacy-CVCBlyron
authored andcommitted
Address PR review.
1 parent ab9c4d1 commit d546bef

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/BlueprintLibary/MeshToLandscape.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,18 @@ void UMeshToLandscapeUtil::FilterInvalidStaticMeshComponents(
106106
}
107107
else
108108
{
109-
// @TODO: ADD WARNING
109+
UE_LOG(
110+
LogCarla, Warning,
111+
TEXT("Skipping static mesh asset %s due to invalid RenderData or invalid Nanite data."),
112+
*SM->GetName());
110113
}
111114
}
112115
else
113116
{
114-
// @TODO: ADD WARNING
117+
UE_LOG(
118+
LogCarla, Warning,
119+
TEXT("Skipping static mesh asset %s due to missing static mesh data (GetStaticMesh returned nullptr)."),
120+
*SM->GetName());
115121
}
116122
Components.RemoveAtSwap(i, EAllowShrinking::No);
117123
}
@@ -253,7 +259,11 @@ ALandscape* UMeshToLandscapeUtil::ConvertMeshesToLandscape(
253259

254260
if (ComponentSizeQuads == 0)
255261
{
256-
// @TODO: Add Warning.
262+
UE_LOG(
263+
LogCarla, Warning,
264+
TEXT("Skipping landscape generation, SubsectionSizeQuads=%i NumSubsections=%i"),
265+
SubsectionSizeQuads,
266+
NumSubsections);
257267
return nullptr;
258268
}
259269

@@ -300,17 +310,6 @@ ALandscape* UMeshToLandscapeUtil::ConvertMeshesToLandscape(
300310
RequiredQuadCount +
301311
FIntPoint(1);
302312

303-
auto EncodeZ = [/* This will be invoked in a ParallelFor! */ &](double Z)
304-
{
305-
const uint16 U16Max = TNumericLimits<uint16>::Max();
306-
Z -= Min.Z;
307-
Z *= UE_CM_TO_M;
308-
Z += 256.0;
309-
Z /= 512.0;
310-
Z = std::clamp(Z, 0.0, 1.0);
311-
return (uint16)std::lround(Z * U16Max);
312-
};
313-
314313
TArray<uint16_t> HeightmapData;
315314
HeightmapData.SetNumZeroed(HeightmapExtent.X * HeightmapExtent.Y);
316315

@@ -406,7 +405,13 @@ ALandscape* UMeshToLandscapeUtil::ConvertMeshesToLandscape(
406405
CQParams.AddIgnoredComponent(Hit.GetComponent());
407406
}
408407

409-
HeightmapData[Index] = EncodeZ(HitZ);
408+
HitZ -= Min.Z;
409+
HitZ *= UE_CM_TO_M;
410+
HitZ += 256.0;
411+
HitZ /= 512.0;
412+
HitZ = std::clamp(HitZ, 0.0, 1.0);
413+
HeightmapData[Index] = (uint16)std::lround(
414+
HitZ * TNumericLimits<uint16>::Max());
410415

411416
if (Retry == MaxRetries)
412417
{

0 commit comments

Comments
 (0)