pub(crate) struct PresetSlot {
pub(crate) preset: Option<MilkPreset>,
pub(crate) evaluator: MilkEvaluator,
pub(crate) warp_executor: WarpExecutor,
pub(crate) state: RenderState,
pub(crate) preset_loaded_time: f32,
pub(crate) compiled_waves: Vec<CompiledWave>,
pub(crate) waves_need_init: Vec<bool>,
pub(crate) compiled_shapes: Vec<CompiledShape>,
pub(crate) shapes_need_init: Vec<bool>,
pub(crate) compiled_per_frame: CompiledBlock,
pub(crate) compiled_per_frame_init: CompiledBlock,
}Expand description
Everything a single preset needs to render itself: the parsed .milk
data, an evaluator context owning its variables, the per-vertex executor
pre-compiled against the preset’s per_pixel_equations, the per-wave /
per-shape compiled equation lists, and the render state the per-frame
loop writes into.
A PresetSlot::default() carries an empty evaluator + no preset, which
matches the pre-V.2 “no preset loaded” behaviour: per-frame and
per-vertex evaluation are no-ops but the renderer still receives a
valid (default) RenderState.
Fields§
§preset: Option<MilkPreset>§evaluator: MilkEvaluator§warp_executor: WarpExecutor§state: RenderState§preset_loaded_time: f32Global state.time captured at the moment this preset was
loaded — used to derive MD2’s progress ([0, 1] position
within the preset’s display window). Global state.time
itself carries across preset changes for continuity, so we
need a separate anchor to recover per-preset elapsed time.
compiled_waves: Vec<CompiledWave>§waves_need_init: Vec<bool>§compiled_shapes: Vec<CompiledShape>§shapes_need_init: Vec<bool>§compiled_per_frame: CompiledBlockPre-compiled main-preset per_frame equations. Populated at
load_preset so the per-frame loop in
super::tick_slot_evaluator skips the regex-based reparse
that the legacy MilkEvaluator::eval_per_frame path runs on
every call. When the bytecode VM lowers cleanly (the common
case), per_frame eval becomes a flat opcode loop too.
compiled_per_frame_init: CompiledBlockPre-compiled main-preset per_frame_init equations. Run once
at preset load (mirroring the wave/shape init semantics) and
then never again. Stored only so we can run them at the right
moment without re-parsing the source.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PresetSlot
impl !RefUnwindSafe for PresetSlot
impl Send for PresetSlot
impl Sync for PresetSlot
impl Unpin for PresetSlot
impl !UnwindSafe for PresetSlot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().