M0.9–M0.10: egui frontend (AE-style panels, viewer, timeline, effect controls, dialogs), desktop app with control channel, host wiring; cargo fmt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e2ba01a11f
commit
3a59a8470d
@@ -33,7 +33,11 @@ fn tritone(ctx: &EffectCtx, mut b: Buf) -> Buf {
|
||||
let blend = 1.0 - ctx.params.f("blend") as f32 / 100.0;
|
||||
b.img.map_straight(|c| {
|
||||
let l = luminance(c[0], c[1], c[2]).clamp(0.0, 1.0);
|
||||
let t = if l < 0.5 { mix([sh[0], sh[1], sh[2]], [mid[0], mid[1], mid[2]], l * 2.0) } else { mix([mid[0], mid[1], mid[2]], [hi[0], hi[1], hi[2]], (l - 0.5) * 2.0) };
|
||||
let t = if l < 0.5 {
|
||||
mix([sh[0], sh[1], sh[2]], [mid[0], mid[1], mid[2]], l * 2.0)
|
||||
} else {
|
||||
mix([mid[0], mid[1], mid[2]], [hi[0], hi[1], hi[2]], (l - 0.5) * 2.0)
|
||||
};
|
||||
mix(c, t, blend)
|
||||
});
|
||||
b
|
||||
@@ -105,7 +109,8 @@ fn exposure(ctx: &EffectCtx, mut b: Buf) -> Buf {
|
||||
}
|
||||
|
||||
fn black_white(ctx: &EffectCtx, mut b: Buf) -> Buf {
|
||||
let w = [ctx.params.f("reds"), ctx.params.f("yellows"), ctx.params.f("greens"), ctx.params.f("cyans"), ctx.params.f("blues"), ctx.params.f("magentas")].map(|v| v as f32 / 100.0);
|
||||
let w = [ctx.params.f("reds"), ctx.params.f("yellows"), ctx.params.f("greens"), ctx.params.f("cyans"), ctx.params.f("blues"), ctx.params.f("magentas")]
|
||||
.map(|v| v as f32 / 100.0);
|
||||
let tint_on = ctx.params.b("tint");
|
||||
let tc = ctx.params.color("tintColor");
|
||||
b.img.map_straight(|c| {
|
||||
@@ -243,7 +248,8 @@ fn channel_mixer(ctx: &EffectCtx, mut b: Buf) -> Buf {
|
||||
}
|
||||
|
||||
fn gamma_pg(ctx: &EffectCtx, mut b: Buf) -> Buf {
|
||||
let ch = |n: &str| (ctx.params.f(&format!("{n}Gamma")).max(0.01) as f32, ctx.params.f(&format!("{n}Pedestal")) as f32, ctx.params.f(&format!("{n}Gain")) as f32);
|
||||
let ch =
|
||||
|n: &str| (ctx.params.f(&format!("{n}Gamma")).max(0.01) as f32, ctx.params.f(&format!("{n}Pedestal")) as f32, ctx.params.f(&format!("{n}Gain")) as f32);
|
||||
let r = ch("red");
|
||||
let g = ch("green");
|
||||
let bl = ch("blue");
|
||||
@@ -426,7 +432,17 @@ pub fn specs() -> Vec<EffectSpec> {
|
||||
{
|
||||
let ids = ["rr", "rg", "rb", "rc", "gr", "gg", "gb", "gc", "br", "bg", "bb", "bc"];
|
||||
let names = [
|
||||
"Red-Red", "Red-Green", "Red-Blue", "Red-Const", "Green-Red", "Green-Green", "Green-Blue", "Green-Const", "Blue-Red", "Blue-Green", "Blue-Blue",
|
||||
"Red-Red",
|
||||
"Red-Green",
|
||||
"Red-Blue",
|
||||
"Red-Const",
|
||||
"Green-Red",
|
||||
"Green-Green",
|
||||
"Green-Blue",
|
||||
"Green-Const",
|
||||
"Blue-Red",
|
||||
"Blue-Green",
|
||||
"Blue-Blue",
|
||||
"Blue-Const",
|
||||
];
|
||||
let mut v: Vec<_> = ids
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! Distort effects: inverse-mapped warps (each output pixel samples the source).
|
||||
|
||||
use effectcraft_geom::{Mat3, vec2};
|
||||
use rayon::prelude::*;
|
||||
use effectcraft_keyframe::Value;
|
||||
use effectcraft_project::ParamUi;
|
||||
use effectcraft_raster::Image;
|
||||
use rayon::prelude::*;
|
||||
|
||||
use crate::{Buf, EffectCtx, EffectSpec, num, p, popup, slider};
|
||||
|
||||
@@ -89,7 +89,13 @@ fn wave_warp(ctx: &EffectCtx, mut b: Buf) -> Buf {
|
||||
let wave = move |t: f64| -> f64 {
|
||||
let ph = t.rem_euclid(std::f64::consts::TAU) / std::f64::consts::TAU;
|
||||
match kind {
|
||||
1 => if ph < 0.5 { 1.0 } else { -1.0 },
|
||||
1 => {
|
||||
if ph < 0.5 {
|
||||
1.0
|
||||
} else {
|
||||
-1.0
|
||||
}
|
||||
}
|
||||
2 => 1.0 - 4.0 * (ph - 0.5).abs(),
|
||||
3 => 2.0 * ph - 1.0,
|
||||
_ => t.sin(),
|
||||
@@ -278,7 +284,12 @@ pub fn specs() -> Vec<EffectSpec> {
|
||||
],
|
||||
ripple,
|
||||
),
|
||||
spec("ec.distort.mirror", "Mirror", vec![p("center", "Reflection Center", pt(0.5, 0.5), ParamUi::Point), p("angle", "Reflection Angle", num(0.0), ParamUi::Angle)], mirror),
|
||||
spec(
|
||||
"ec.distort.mirror",
|
||||
"Mirror",
|
||||
vec![p("center", "Reflection Center", pt(0.5, 0.5), ParamUi::Point), p("angle", "Reflection Angle", num(0.0), ParamUi::Angle)],
|
||||
mirror,
|
||||
),
|
||||
spec(
|
||||
"ec.distort.offset",
|
||||
"Offset",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! Generate and Noise effects that synthesise images.
|
||||
|
||||
use rayon::prelude::*;
|
||||
use effectcraft_keyframe::Value;
|
||||
use effectcraft_project::ParamUi;
|
||||
use effectcraft_raster::Px;
|
||||
use rayon::prelude::*;
|
||||
|
||||
use crate::{Buf, EffectCtx, EffectSpec, col, num, p, popup, slider};
|
||||
|
||||
@@ -142,7 +142,8 @@ fn circle(ctx: &EffectCtx, mut b: Buf) -> Buf {
|
||||
|
||||
#[inline]
|
||||
fn lattice(ix: i32, iy: i32, iz: i32, seed: u32) -> f32 {
|
||||
let mut h = (ix as u32).wrapping_mul(0x27d4_eb2d) ^ (iy as u32).wrapping_mul(0x1656_67b1) ^ (iz as u32).wrapping_mul(0x9e37_79b9) ^ seed.wrapping_mul(0x85eb_ca6b);
|
||||
let mut h =
|
||||
(ix as u32).wrapping_mul(0x27d4_eb2d) ^ (iy as u32).wrapping_mul(0x1656_67b1) ^ (iz as u32).wrapping_mul(0x9e37_79b9) ^ seed.wrapping_mul(0x85eb_ca6b);
|
||||
h ^= h >> 15;
|
||||
h = h.wrapping_mul(0x2c1b_3c6d);
|
||||
h ^= h >> 12;
|
||||
|
||||
@@ -300,7 +300,12 @@ fn noise(ctx: &EffectCtx, mut b: Buf) -> Buf {
|
||||
continue;
|
||||
}
|
||||
let n = |k: u32| (hash_noise(x as u32 + k * w, y as u32, frame_seed) - 0.5) * amt;
|
||||
let (r, g, bl) = if color { (n(0), n(1), n(2)) } else { let v = n(0); (v, v, v) };
|
||||
let (r, g, bl) = if color {
|
||||
(n(0), n(1), n(2))
|
||||
} else {
|
||||
let v = n(0);
|
||||
(v, v, v)
|
||||
};
|
||||
px[0] = (px[0] + r * a).clamp(0.0, a);
|
||||
px[1] = (px[1] + g * a).clamp(0.0, a);
|
||||
px[2] = (px[2] + bl * a).clamp(0.0, a);
|
||||
@@ -494,7 +499,10 @@ pub fn specs() -> Vec<EffectSpec> {
|
||||
"ec.noise.noise",
|
||||
"Noise",
|
||||
"Noise & Grain",
|
||||
vec![p("amount", "Amount of Noise", num(0.0), slider(0.0, 100.0, 0.0, 100.0, 1)), p("color", "Use Color Noise", Value::Bool(true), ParamUi::Checkbox)],
|
||||
vec![
|
||||
p("amount", "Amount of Noise", num(0.0), slider(0.0, 100.0, 0.0, 100.0, 1)),
|
||||
p("color", "Use Color Noise", Value::Bool(true), ParamUi::Checkbox),
|
||||
],
|
||||
noise,
|
||||
),
|
||||
spec(
|
||||
|
||||
Reference in New Issue
Block a user