mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-21 19:30:26 +00:00
Pr fxlayer viewport culling (#3123)
## Description: Reduce FX layer rendering cost by: - Updating the offscreen FX buffer only when needed (and clearing it once when FX ends). - Drawing only the visible portion of the FX buffer to the main canvas (viewport culling). - Reusing `TransformHandler.screenBoundingRect()` as the single source of truth for viewport bounds. - ## Changes - `FxLayer`: - Track buffered frames and skip work when there are no active FX. - Use `performance.now()` for refresh timing. - Draw only the visible map rect (clamp + small pad) instead of blitting the full map-sized FX canvas. - Compute the visible rect via `TransformHandler.screenBoundingRect()`. - `GameRenderer`: - Thread `TransformHandler` into `FxLayer` construction. ## Please complete the following: - [ ] I have added screenshots for all UI updates - [ ] I process any text displayed to the user through translateText() and I've added it to the en.json file - [ ] I have added relevant tests to the test directory - [ ] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: DISCORD_USERNAME
This commit is contained in:
@@ -269,7 +269,7 @@ export function createRenderer(
|
||||
structureLayer,
|
||||
samRadiusLayer,
|
||||
new UnitLayer(game, eventBus, transformHandler),
|
||||
new FxLayer(game),
|
||||
new FxLayer(game, transformHandler),
|
||||
new UILayer(game, eventBus, transformHandler),
|
||||
new NukeTrajectoryPreviewLayer(game, eventBus, transformHandler, uiState),
|
||||
new StructureIconsLayer(game, eventBus, uiState, transformHandler),
|
||||
|
||||
Reference in New Issue
Block a user