The FogExploration document which applies to this canvas view
A status flag for whether the layer initialization workflow has succeeded
Track whether we have pending fog updates which have not yet been saved to the database
A pool of RenderTexture objects which can be cycled through to save fog exploration progress.
A debounced function to save fog of war exploration once a continuous stream of updates has concluded.
Define the number of positions that are explored before a set of fog updates are pushed to the server.
The maximum allowable fog of war texture size.
Vision containers for explored positions which have not yet been committed to the saved texture.
The container of previously revealed exploration.
A sprite containing the saved fog exploration texture.
The configured resolution used for the saved fog-of-war texture
Does the currently viewed Scene support Token field of vision?
Does the currently viewed Scene support fog of war exploration?
Initialize fog of war - resetting it when switching scenes or re-drawing the canvas
Clear the fog and reinitialize properties (commit and save in non reset mode)
Once a new Fog of War location is explored, composite the explored container with the current staging sprite Save that staging Sprite as the rendered fog exploration and swap it out for a fresh staging texture Do all this asynchronously, so it doesn't block token movement animation since this takes some extra time
Load existing fog of war data from local storage and populate the initial exploration sprite
Dispatch a request to reset the fog of war exploration status for all users within this Scene. Once the server has deleted existing FogExploration documents, the _onReset handler will re-draw the canvas.
Save Fog of War exploration data to a base64 string to the FogExploration document in the database. Assumes that the fog exploration has already been rendered as fog.rendered.texture.
Update the fog layer when a player token reaches a board position which was not previously explored
The vision source for which the fog layer should update
Force fog to be updated even if the location is already explored
Whether the source position represents a new fog exploration point
If fog of war data is reset from the server, re-draw the canvas
Choose an adaptive fog rendering resolution which downscales the saved fog textures for larger dimension Scenes. It is important that the width and height of the fog texture is evenly divisible by the downscaling resolution.
Deactivate fog of war. Clear all shared containers by unlinking them from their parent. Destroy all stored textures and graphics.
Get a usable RenderTexture from the textures pool
A fog of war management class which is the singleton canvas.fog instance.