Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ZoneView to keep lighting consistent #3952

Merged

Commits on Apr 17, 2023

  1. Refactor ZoneView to keep lighting consistent

    `ZoneView.illuminators` and `ZoneView.contributedLightsByToken` have been moved into a new `IlluminationModel` that
    tracks a single `Illuminator` and set of token contributions. `ZoneView.getIlluminationModel(IlluminationKey)` returns
    such a model and ensures that it is up-to-date and contains all necessary light sources. This replaces
    `ZoneView.getUpToDateIlluminator()` which has subtle interactions with the state of token contributions.
    
    We no longer have `ZoneView.illuminationCache` as it just caches a relatively lightweight intermediate result. We still
    cache full illumination results via `ZoneView.illuminationsPerView`.
    
    `ZoneRenderer` no longer caches drawable lights and auras because it's possible for it to get out-of-sync with the
    underlying `ZoneView`. Instead, `ZoneView` caches `DrawableLight` on a per-view basis, and `DrawableAuras`
    generally. These are kept in sync by invalidating them at the same time as the caches from which they are calculated.
    
    Since `ZoneView`'s flushing methods can be called off the Swing thread, we now delegate the flushing to the Swing
    thread. The rest of the ZoneView still expects to run on the Swing thread. We can do this now that we have
    `IlluminationModel` to keep the contributions and illuminators in-sync, and now that `DrawableLight`s and
    `DrawableAura`s are cached in ZoneView and we don't have to worry about any potentially delays in `ZoneView` flushing
    relative to the `ZoneRenderer`.
    kwvanderlinde committed Apr 17, 2023
    Configuration menu
    Copy the full SHA
    8f3246e View commit details
    Browse the repository at this point in the history