aether_ndk/param.rs
1//! Parameter utilities for node authors.
2
3use aether_core::param::ParamBlock;
4use crate::ParamDef;
5
6/// Initialize a `ParamBlock` from a slice of `ParamDef`s.
7/// Called automatically by the engine when a node is added to the graph.
8pub fn init_params(block: &mut ParamBlock, defs: &[ParamDef]) {
9 for def in defs {
10 block.add(def.default);
11 }
12}
13
14/// Clamp a param value to its defined range.
15pub fn clamp_param(value: f32, def: &ParamDef) -> f32 {
16 value.clamp(def.min, def.max)
17}