lordmauve / wasabi2d

Cutting-edge 2D game framework for Python
https://wasabi2d.readthedocs.io/
GNU Lesser General Public License v3.0
154 stars 24 forks source link

Refactor: global dirty list #30

Open lordmauve opened 4 years ago

lordmauve commented 4 years ago

Various objects track their own dirty state. Then before drawing the engine crawls a reference tree to update all the things that need to be updated.

This is inefficient and also adds complexity. We could just maintain a global(ish) "dirty list" - probably actually a WeakSet - that objects add themselves to when they are dirty.

There needs to be some ordering involved in this: objects that are dirty in system memory need to get updated before buffers that are dirty get copied to the GPU.