Fix crash when drawing minor foliage node with both children and instances

This commit is contained in:
2026-04-19 21:48:23 +02:00
parent b79335c920
commit 8553785397
+4 -10
View File
@@ -168,9 +168,6 @@ void Foliage::DrawCluster(DrawContext& context, FoliageCluster* cluster, DrawCal
// Draw visible children
if (cluster->Children[0])
{
// Don't store instances in non-leaf nodes
ASSERT_LOW_LAYER(cluster->Instances.IsEmpty());
BoundingBox box;
#define DRAW_CLUSTER(idx) \
box = cluster->Children[idx]->TotalBounds; \
@@ -184,7 +181,7 @@ void Foliage::DrawCluster(DrawContext& context, FoliageCluster* cluster, DrawCal
DRAW_CLUSTER(3);
#undef DRAW_CLUSTER
}
else
//else // Minor clusters can be subdivided and contain instances
{
// Draw visible instances
const auto frame = Engine::FrameCount;
@@ -311,9 +308,6 @@ void Foliage::DrawCluster(DrawContext& context, FoliageCluster* cluster, Mesh::D
// Draw visible children
if (cluster->Children[0])
{
// Don't store instances in non-leaf nodes
ASSERT_LOW_LAYER(cluster->Instances.IsEmpty());
BoundingBox box;
#define DRAW_CLUSTER(idx) \
box = cluster->Children[idx]->TotalBounds; \
@@ -327,7 +321,7 @@ void Foliage::DrawCluster(DrawContext& context, FoliageCluster* cluster, Mesh::D
DRAW_CLUSTER(3);
#undef DRAW_CLUSTER
}
else
//else // Minor clusters can be subdivided and contain instances
{
// Draw visible instances
const auto frame = Engine::FrameCount;
@@ -390,7 +384,7 @@ void Foliage::DrawClusterGlobalSDF(class GlobalSignDistanceFieldPass* globalSDF,
DRAW_CLUSTER(3);
#undef DRAW_CLUSTER
}
else
//else // Minor clusters can be subdivided and contain instances
{
// Draw visible instances
for (int32 i = 0; i < cluster->Instances.Count(); i++)
@@ -421,7 +415,7 @@ void Foliage::DrawClusterGlobalSA(GlobalSurfaceAtlasPass* globalSA, const Vector
DRAW_CLUSTER(3);
#undef DRAW_CLUSTER
}
else
//else // Minor clusters can be subdivided and contain instances
{
// Draw visible instances
for (int32 i = 0; i < cluster->Instances.Count(); i++)