Fix crash when drawing terrain without cached neighbor chunks

#2087
This commit is contained in:
Wojtek Figat
2023-12-16 16:38:16 +01:00
parent 2bef880e21
commit 6d5d615894

View File

@@ -84,6 +84,8 @@ void TerrainChunk::Draw(const RenderContext& renderContext) const
DrawCall drawCall;
if (TerrainManager::GetChunkGeometry(drawCall, chunkSize, lod))
return;
if (!_neighbors[0])
const_cast<TerrainChunk*>(this)->CacheNeighbors();
drawCall.InstanceCount = 1;
drawCall.Material = _cachedDrawMaterial;
renderContext.View.GetWorldMatrix(_transform, drawCall.World);