namespace Mibo.Elmish.Graphics2D
open Microsoft.Xna.Framework.Graphics
open Mibo.Elmish
///
/// Context handed to a action each frame.
/// The renderer has already rendered the scene to Source and set the destination render
/// target (a pooled ping-pong RT, or the back-buffer for the last pass). The action binds its own
/// effect, sets model-derived parameters, binds Source to the effect's sampler, and calls
/// Quad.Draw(effect).
///
[]
type PostProcessContext2D = {
/// Current ping-pong source (the scene RT on the first pass).
Source: RenderTarget2D
Width: int
Height: int
/// Accumulated frame time in seconds, for animated effects.
Time: float32
/// The graphics device — needed to apply an Effect and bind textures.
Device: GraphicsDevice
/// Fullscreen quad primitive; call Draw(effect) once the effect is applied.
Quad: Mibo.Elmish.Graphics3D.FullScreenQuad
///
/// The active 2D light context (ValueNone when no lit sprites were drawn this frame).
/// Read Lights.Value.PointLights, Lights.Value.DirLights, Lights.Value.Ambient
/// to drive light-aware effects (bloom on lit areas, light-tinted color grading).
///
Lights: Lighting.LightContext2D voption
///
/// The last active camera during the scene render (ValueNone when no
/// BeginCamera block was used). Useful for anchoring post-process effects in world space
/// (world-aligned fog, distortion). When multiple camera blocks exist in the same frame this is
/// the last one — the scene RT contains all of them composited, so a single camera
/// reference can't reconstruct per-camera regions. Commands within a layer are executed in
/// insertion order (deterministic stable sort), so "last" is well-defined.
///
Camera: Camera2D voption
///
/// Game services — e.g. tryGetService<IAssets> to resolve a compiled effect lazily
/// (defers resolution to first frame, where the device/assets exist).
///
Context: GameContext
}