Skip to content

Instantly share code, notes, and snippets.

@dpogue
Created August 28, 2020 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpogue/53a1d2a8bfea47d007c699088de6f846 to your computer and use it in GitHub Desktop.
Save dpogue/53a1d2a8bfea47d007c699088de6f846 to your computer and use it in GitHub Desktop.

plFogEnvironment Transitions

Currently, there is a single default fog environment used for all rendering in all Ages, and its values are reset when loading an Age via console commands in the .fni files. There is also a Python API that can be used to change the values.

Support exists (but is not exposed or ever used) for per-object fog environments via plFogEnvironment objects and references in the DrawableSpans.

However, there is currently no way to animate fog changes or transitions between fog values without resorting to Python hacks.

Proposal

  • Wrap the 4 attributes (start, end, density, colour) of plFogEnvironment with hsTimedValue<T>. This effectively allows tweening between two values over a duration.

  • Add an Eval method to plFogEnvironment to evaluate the current value of those attributes (if animating and the timestamp does not match the last calculation).

  • In plPipeline, when getting the fog environment for an object, call its Eval before rendering.

  • Add a new message type that can be sent to a plFogEnvironment specifying new values for the attributes, and a transition duration. This message should be triggerable via responders, and maybe should replace the implementation of the current console commands? (Would need a way to address the global fog object)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment