1
0
Fork 0

Prefabs don't draw into chunk if they don't intersect.

This commit is contained in:
madmaxoft 2014-06-22 21:30:06 +02:00
parent fe95dfa758
commit 82dcc0b4db
1 changed files with 11 additions and 0 deletions

View File

@ -211,6 +211,17 @@ void cPrefab::Draw(cChunkDesc & a_Dest, const Vector3i & a_Placement, int a_NumR
int ChunkStartZ = a_Dest.GetChunkZ() * cChunkDef::Width;
Placement.Move(-ChunkStartX, 0, -ChunkStartZ);
const cBlockArea & Image = m_BlockArea[a_NumRotations];
// If the placement is outside this chunk, bail out:
if (
(Placement.x > cChunkDef::Width) || (Placement.x + Image.GetSizeX() < 0) ||
(Placement.z > cChunkDef::Width) || (Placement.z + Image.GetSizeZ() < 0)
)
{
return;
}
// Write the image:
a_Dest.WriteBlockArea(Image, Placement.x, Placement.y, Placement.z, m_MergeStrategy);
// If requested, draw the floor (from the bottom of the prefab down to the nearest non-air)