Skip to main content

concinnity_render/
overlay_maps.rs

1//! The side tables the overlay builders take alongside the components they
2//! draw.
3//!
4//! A text label and a sprite are both authored as a component plus per-asset
5//! state the component does not carry: the scissor rectangle a screen imposes
6//! on it, the layer it draws in, the atlas slot its texture streamed into. The
7//! engine assembles these once per frame and hands the same tables to every
8//! builder, so they are named once here.
9
10use crate::ecs::TextureHandle;
11use crate::ecs::asset_id::AssetId;
12use hashbrown::HashMap;
13
14/// Scissor rectangle per overlay asset, `[x, y, width, height]` in the
15/// reference canvas the sprite was authored in. An asset absent from the table
16/// is unclipped.
17pub type ClipRects = HashMap<AssetId, [f32; 4]>;
18
19/// Draw layer per overlay asset. An asset absent from the table is layer 0.
20pub type OverlayLayers = HashMap<AssetId, i32>;
21
22/// Slot in the backend's atlas pool per streamed texture. A textured sprite
23/// whose texture is absent falls back to a solid fill.
24pub type TextureSlots = HashMap<TextureHandle, usize>;