-
Notifications
You must be signed in to change notification settings - Fork 263
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
Factor out more rendering logic into separate renderers #4538
Factor out more rendering logic into separate renderers #4538
Conversation
9d555fe
to
aa8202b
Compare
The `RenderHelper` can be used by renderers to create a new graphics context transformed according to the current zoom and pan. It can optionally also create a buffer to render as a layer before composing with the background.
`LightOverlayClipStyle` is rmeoved since only `CLIP_TO_VISIBLE_AREA` is ever used. Instead, can check `PlayerView.isGMView()`.
Commonalities in the case work for these methods were pulled out, and the remaining case work was refactored to be easier to follow. With this done, the logic for fog rendering fits naturally in a single linear method.
This change involves a few subtleties: 1. The check for `showVisionAndHalo` was moved to the top of the logic so we can avoid expensive geometry manipulation when we aren't even going to use it. This also makes the condition more visible to the reader. 2. The clipping logic in `renderPlayerVisionOverlay()` was removed. This clip was broken due to the mixing of world space (`ExposedAreaMetaData`) and screen space (`exposedFogArea`). But that didn't really matter since the clip is overwritten anyways with a correct version in `renderVisionOverlay()`. 3. Getting the exposed area can be simplified by using ZoneView instead of enumerating the `PlayerView` ourselves. This has the nice perk of automatically caching the results.
aa8202b
to
17e71aa
Compare
Personal preference, when defining colours, include alpha. That way it's more universally applicable and a little bit future-proofed. From |
Sure, makes sense, made the change. Though I'll point out |
fc0dd5a
to
27e509e
Compare
This could be refined, but for now is sufficient to render the two shapes supported by ZoneRenderer. It also renders using a transformed graphics context rather than transforming the shapes when they are set. Some liberties were taken with the renderer vs the existing behaviour: 1. The renderer supports any number of shapes and just cycles through a palette. 2. The shapes are rendered with an opaque border but a translucent fill so they don't complete obscure what is behind them.
27e509e
to
a91e9e6
Compare
Identify the Bug or Feature request
Progresses #3691
Fixes #4429
Description of the Change
Rendering of lights, auras, player darkness, fog of war, vision, and debug shapes are now handled by separate renderer classes. For the most part, logic was simply copied over, but some simplifications and alterations were made.
Points of interest:
RenderHelper
takes care of setting upGraphics2D
with initial clips and transforms. It can optionally use a temporary buffer as a render target. Each of the new renderers uses theRenderHelper
.Possible Drawbacks
Should be none.
Documentation Notes
N/A
Release Notes
This change is