Another small speed improvement?
This commit is contained in:
parent
ffce8d6907
commit
acbd4e6503
@ -378,24 +378,14 @@ void cChunk::SetLight(
|
|||||||
// TODO: We might get cases of wrong lighting when a chunk changes in the middle of a lighting calculation.
|
// TODO: We might get cases of wrong lighting when a chunk changes in the middle of a lighting calculation.
|
||||||
// Postponing until we see how bad it is :)
|
// Postponing until we see how bad it is :)
|
||||||
|
|
||||||
int IdxWhereNonEmptyStarts = 0;
|
|
||||||
{ // Compress blocklight
|
{ // Compress blocklight
|
||||||
m_BlockLight.clear();
|
m_BlockLight.clear();
|
||||||
|
m_BlockLight.insert(m_BlockLight.end(), &a_BlockLight[0], &a_BlockLight[m_BlockTypes.size()]);
|
||||||
for (int Idx = (NumBlocks / 2) - 1; Idx >= 0; Idx--)
|
|
||||||
{
|
|
||||||
if (a_BlockLight[Idx] != 0)
|
|
||||||
{
|
|
||||||
IdxWhereNonEmptyStarts = Idx;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_BlockLight.insert(m_BlockLight.end(), &a_BlockLight[0], &a_BlockLight[IdxWhereNonEmptyStarts + 1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Compress skylight
|
{ // Compress skylight
|
||||||
m_BlockSkyLight.clear();
|
m_BlockSkyLight.clear();
|
||||||
m_BlockSkyLight.insert(m_BlockSkyLight.end(), &a_SkyLight[0], &a_SkyLight[IdxWhereNonEmptyStarts + 1]);
|
m_BlockSkyLight.insert(m_BlockSkyLight.end(), &a_SkyLight[0], &a_SkyLight[m_BlockTypes.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_IsLightValid = true;
|
m_IsLightValid = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user