use crate::wavegen::{NUM_FREQ_SAMPLES, NUM_WAVE_INPUT};
#[derive(Clone, Debug)]
pub struct FrameInput {
pub time: f64,
pub fps: f32,
pub frame: u32,
pub progress: f32,
pub bass: f32,
pub mid: f32,
pub treb: f32,
pub bass_att: f32,
pub mid_att: f32,
pub treb_att: f32,
pub imm_abs: [f32; 3],
pub q: [f32; 32],
pub rand_frame: [f32; 4],
pub rand_preset: [f32; 4],
pub warp_uv: Option<Vec<[f32; 2]>>,
pub warp_gpu: Option<WarpGpu>,
pub post: PostParams,
pub blur: BlurParams,
pub borders: Borders,
pub mv: MotionVectors,
pub main_wave: MainWave,
pub shapes: Vec<ShapeInstance>,
pub waves: Vec<CustomWave>,
pub darken_center: bool,
pub warp_random: Option<PassRandom>,
pub comp_random: Option<PassRandom>,
pub hue_offsets: Option<[f32; 4]>,
pub md2_blend: Option<crate::blend::Md2Blend>,
}
#[derive(Clone, Debug)]
pub struct PostParams {
pub decay: f32,
pub gamma: f32,
pub echo_zoom: f32,
pub echo_alpha: f32,
pub echo_orient: i32,
pub brighten: bool,
pub darken: bool,
pub solarize: bool,
pub invert: bool,
pub wrap: bool,
pub fshader: f32,
}
#[derive(Clone, Debug)]
pub struct BlurParams {
pub min: [f32; 3],
pub max: [f32; 3],
pub edge_darken: f32,
}
#[derive(Clone, Debug)]
pub struct Borders {
pub ob_size: f32,
pub ob_rgba: [f32; 4],
pub ib_size: f32,
pub ib_rgba: [f32; 4],
}
#[derive(Clone, Debug)]
pub struct MotionVectors {
pub x: f32,
pub y: f32,
pub dx: f32,
pub dy: f32,
pub l: f32,
pub rgba: [f32; 4],
}
#[derive(Clone, Debug)]
pub struct MainWave {
pub mode: i32,
pub rgba: [f32; 4],
pub x: f32,
pub y: f32,
pub mystery: f32,
pub usedots: bool,
pub thick: bool,
pub additive: bool,
pub brighten: bool,
pub scale: f32,
pub smoothing: f32,
pub mod_alpha_by_volume: bool,
pub mod_alpha_start: f32,
pub mod_alpha_end: f32,
pub wave: [[f32; NUM_WAVE_INPUT]; 2],
pub spectrum: [[f32; NUM_FREQ_SAMPLES]; 2],
}
#[derive(Clone, Debug)]
pub struct ShapeInstance {
pub sides: i32,
pub x: f64,
pub y: f64,
pub rad: f32,
pub ang: f32,
pub rgba: [f32; 4],
pub rgba2: [f32; 4],
pub border_rgba: [f32; 4],
pub additive: bool,
pub thick: bool,
pub textured: bool,
pub tex_zoom: f32,
pub tex_ang: f32,
pub image: Option<ShapeImage>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ShapeImage {
pub name: String,
pub linear: bool,
pub wrap: bool,
}
impl Default for ShapeInstance {
fn default() -> Self {
Self {
sides: 4,
x: 0.5,
y: 0.5,
rad: 0.1,
ang: 0.0,
rgba: [1.0, 0.0, 0.0, 1.0],
rgba2: [0.0, 1.0, 0.0, 0.0],
border_rgba: [1.0, 1.0, 1.0, 0.1],
additive: false,
thick: false,
textured: false,
tex_zoom: 1.0,
tex_ang: 0.0,
image: None,
}
}
}
#[derive(Clone, Copy, Debug)]
pub struct WavePoint {
pub x: f64,
pub y: f64,
pub rgba: [f32; 4],
}
#[derive(Clone, Debug, Default)]
pub struct CustomWave {
pub points: Vec<WavePoint>,
pub use_dots: bool,
pub thick: bool,
pub additive: bool,
}
impl Default for BlurParams {
fn default() -> Self {
Self {
min: [0.0; 3],
max: [1.0; 3],
edge_darken: 0.25,
}
}
}
impl Default for PostParams {
fn default() -> Self {
Self {
decay: 0.98,
gamma: 2.0,
echo_zoom: 2.0,
echo_alpha: 0.0,
echo_orient: 0,
brighten: false,
darken: false,
solarize: false,
invert: false,
wrap: true,
fshader: 0.0,
}
}
}
impl Default for Borders {
fn default() -> Self {
Self {
ob_size: 0.01,
ob_rgba: [0.0; 4],
ib_size: 0.01,
ib_rgba: [0.25, 0.25, 0.25, 0.0],
}
}
}
impl Default for MotionVectors {
fn default() -> Self {
Self {
x: 12.0,
y: 9.0,
dx: 0.0,
dy: 0.0,
l: 0.9,
rgba: [1.0, 1.0, 1.0, 1.0],
}
}
}
impl Default for MainWave {
fn default() -> Self {
Self {
mode: 0,
rgba: [1.0, 1.0, 1.0, 0.8],
x: 0.5,
y: 0.5,
mystery: 0.0,
usedots: false,
thick: false,
additive: false,
brighten: true,
scale: 1.0,
smoothing: 0.75,
mod_alpha_by_volume: false,
mod_alpha_start: 0.75,
mod_alpha_end: 0.95,
wave: [[0.0; NUM_WAVE_INPUT]; 2],
spectrum: [[0.0; NUM_FREQ_SAMPLES]; 2],
}
}
}
#[derive(Clone, Debug)]
pub struct WarpGpu {
pub vars: Vec<crate::warp_mesh::VertexVars>,
pub anim: crate::warp_mesh::WarpAnim,
}
#[derive(Clone, Debug)]
pub struct PassRandom {
pub rand_frame: [f32; 4],
pub rand_preset: [f32; 4],
pub rot: Option<Box<[[[f32; 4]; 3]; lactea_abi::NUM_ROT]>>,
}
impl Default for FrameInput {
fn default() -> Self {
Self {
time: 0.0,
fps: 60.0,
frame: 0,
progress: 0.0,
bass: 1.0,
mid: 1.0,
treb: 1.0,
bass_att: 1.0,
mid_att: 1.0,
treb_att: 1.0,
imm_abs: [0.0; 3],
q: [0.0; 32],
rand_frame: [0.0; 4],
rand_preset: [0.0; 4],
warp_uv: None,
warp_gpu: None,
post: PostParams::default(),
blur: BlurParams::default(),
borders: Borders::default(),
mv: MotionVectors::default(),
main_wave: MainWave::default(),
shapes: Vec::new(),
waves: Vec::new(),
darken_center: false,
warp_random: None,
comp_random: None,
hue_offsets: None,
md2_blend: None,
}
}
}