#![warn(missing_docs)]
mod callbacks;
mod control;
mod engine;
mod idle;
mod playlist;
mod rng;
mod runtime;
mod teacher;
mod textures;
mod vars;
pub use callbacks::{Hook, SwitchFailure};
pub use control::{HARD_CUT_MIN_FRAMES, PresetControl, SwitchRequest};
pub use engine::{DebugImage, Engine, TouchType};
pub use idle::{IDLE_PRESET, IDLE_PRESET_NAME};
pub use lactea_abi::PassKind;
pub use lactea_abi::dump::Stage;
pub use lactea_audio::AudioFrame;
pub use lactea_render::TransitionKind;
pub use lactea_render::{Compat, Renderer};
pub use playlist::{
DEFAULT_RETRY_COUNT, FailedFn, Filter, INSERT_AT_END, LoadRequest, MAX_HISTORY, Playlist,
SortOrder, SortPredicate, SwitchedFn,
};
pub use teacher::ForcedFrame;
pub use textures::{Image, TextureProvider};
#[derive(Clone, Debug)]
pub struct EngineConfig {
pub width: u32,
pub height: u32,
pub mesh: [u32; 2],
pub seed: u64,
pub compat: Compat,
pub texel_offset: [f32; 2],
pub output_format: wgpu::TextureFormat,
pub sample_rate: u32,
pub fps: u32,
pub preset_duration: f64,
pub start_clean: bool,
}
impl Default for EngineConfig {
fn default() -> Self {
Self {
width: 640,
height: 360,
mesh: [48, 36],
seed: 1,
compat: Compat::ProjectM,
texel_offset: [0.0, 0.0],
output_format: wgpu::TextureFormat::Rgba8Unorm,
sample_rate: 44_100,
fps: 60,
preset_duration: 1e9,
start_clean: false,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct FrameClock {
pub time: f64,
pub frame: u32,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Transition {
Cut,
Soft {
seconds: f64,
},
}
#[derive(Clone, Copy, Debug, PartialEq)]
#[non_exhaustive]
pub struct TransitionInfo {
pub kind: TransitionKind,
pub rand_static: [i32; 4],
pub start_time: f64,
pub duration: f64,
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum EngineError {
#[error("preset parse error: {0}")]
Parse(#[from] lactea_preset::ParseError),
#[error("{what}: {error}")]
Compile {
what: String,
error: lactea_eel::CompileError,
},
#[error("render error: {0}")]
Render(#[from] lactea_render::RenderError),
}
impl EngineError {
pub(crate) fn compile(what: &str, error: lactea_eel::CompileError) -> Self {
EngineError::Compile {
what: what.to_string(),
error,
}
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[non_exhaustive]
pub enum ShaderOutcome {
#[default]
NotUsed,
User,
Default,
Fallback,
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct ShaderFallback {
pub pass: PassKind,
pub reason: String,
pub fallback: String,
}
#[derive(Clone, Debug, Default)]
#[non_exhaustive]
pub struct PresetReport {
pub name: String,
pub preset_version: i32,
pub warp: ShaderOutcome,
pub comp: ShaderOutcome,
pub warnings: Vec<String>,
pub shader_fallbacks: Vec<ShaderFallback>,
pub unresolved_textures: Vec<String>,
pub resolved_textures: Vec<(String, String)>,
}