Improved performance of basic chunk sky-light population

No need to recalculate this 256 times
This commit is contained in:
Dylan K. Taylor 2017-07-08 13:30:13 +01:00
parent 2726f2a011
commit 728851594b

View File

@ -427,13 +427,12 @@ class Chunk{
* TODO: fast adjacent light spread
*/
public function populateSkyLight(){
$maxY = ($this->getHighestSubChunkIndex() + 1) << 4;
for($x = 0; $x < 16; ++$x){
for($z = 0; $z < 16; ++$z){
$heightMap = $this->getHeightMap($x, $z);
$y = ($this->getHighestSubChunkIndex() + 1) << 4;
for(; $y >= $heightMap; --$y){
for($y = $maxY; $y >= $heightMap; --$y){
$this->setBlockSkyLight($x, $y, $z, 15);
}