16 Commits

Author SHA1 Message Date
Dylan K. Taylor
5b1fa25dff LightPopulationTask: remove useless @var 2020-12-03 20:29:41 +00:00
Dylan K. Taylor
4549522289 Rename Chunk::getSubChunkChecked() -> getSubChunk() 2020-10-31 23:12:03 +00:00
Dylan K. Taylor
b270029161 Rename Chunk::getWritableSubChunk() -> Chunk::getSubChunkChecked()
this is not specific to 'writable', it's just an opt-in to checked bounds so that an EmptySubChunk will never be received.
2020-10-31 22:46:33 +00:00
Dylan K. Taylor
1859dac789 Implemented self-contained (pass 1) chunk relighting
this doesn't handle propagating light across chunk borders yet, since that's much more complex to implement.
2020-10-27 18:29:32 +00:00
Dylan K. Taylor
89cce4c749 performance: only calculate light for chunks inside ticking areas
this produces a major performance improvement for large render distances, and reduces the impact of lighting calculation to zero on servers which have random blockupdates turned off.
2020-09-26 13:13:12 +01:00
Dylan K. Taylor
ae9e931849 LightPopulationTask: Simplify check for chunk loading in onCompletion()
we have no business loading chunks here either, although the isChunkLoaded() check should prevent that from happening.
2020-09-20 13:44:02 +01:00
Dylan K. Taylor
5096741b29 World::getChunk() behaviour now matches that of a regular ChunkManager
Various bugs existed for a while with stuff using chunk managers instead of worlds when interacting with terrain due to a behavioural inconsistency between World::getChunk() (return from cache or load from disk), and SimpleChunkManager::getChunk() (return from cache only). This change brings the two in line.
World::getOrLoadChunk() has been added as a replacement, which has the same behaviour as the old getChunk() and also makes it more obvious that there is an issue with code using it during refactoring.
2020-09-20 13:29:09 +01:00
Dylan K. Taylor
03de2bcc67 Chunk: simplify heightmap calculation 2020-09-08 23:03:52 +01:00
Dylan K. Taylor
c7070788f9 Rename and repurpose Block->diffusesSkyLight to blocksDirectSkyLight
this new form allows skipping some useless checks during sky light calculation and also allows getting rid of the last hard dependency on core Block classes.
We're getting real close to native light now.
2020-09-08 22:40:05 +01:00
Dylan K. Taylor
01f8116cdd Fix some of the implicit immutability issues of EmptySubChunk
it's useful to have an immutable stub around for the sake of feeding back dummy read values, but for write values it has to barf instead of being quiet.
There's still some issues with LightArray which I don't currently have a solution for, but I'm thinking about separating light storage from chunks anyway.
2020-09-07 14:43:26 +01:00
Dylan K. Taylor
13d784cd0c Convert BlockFactory to singleton 2020-04-23 23:45:13 +01:00
Dylan K. Taylor
accc0da0cb Chunk no longer depends on BlockFactory
really this light population crap shouldn't be in the chunk to begin with, but that's a bit more complicated.
2020-04-23 21:31:28 +01:00
Dylan K. Taylor
aba71762e9 master-specific @var annotations 2020-01-09 17:50:01 +00:00
Dylan K. Taylor
02ff8d671b Mostly phase out EmptySubChunk
copy-on-write and zero-layer SubChunk objects are much easier to manage and have less cognitive overhead.

obviously, the goal is to get rid of EmptySubChunk completely, but right now it does still serve a purpose (filling in dummy values for reading out-of-bounds on chunks), and that's a problem that takes a little more work to fix.
2019-10-22 23:00:49 +01:00
Dylan K. Taylor
e1352668d1 LightPopulationTask: Don't overwrite the whole chunk on completion
this is more efficient (less data copied for ITC), fixes #2873, and also fixes terrain changes during task run getting overwritten.

This still leaves the problem that the light information provided may be out of date by the time the task completes, but this is nonetheless a step forward.
2019-10-22 23:00:21 +01:00
Dylan K. Taylor
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00