mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-01 14:08:38 -06:00
230 lines
15 KiB
Rust
230 lines
15 KiB
Rust
use super::common::{pct, pt, spec};
|
|
use super::engine::{PARTICLE_TYPES, PW_ANIMS};
|
|
use super::particle_fx::{PW_FOV, mr_mercury, particle_systems2, particle_systems2_plan, particle_world, particle_world_plan};
|
|
use super::sprites::SpritePlan;
|
|
use super::weather::{bubbles, drizzle, rainfall, rainfall_plan, snowfall, snowfall_plan, star_burst, star_burst_plan};
|
|
use super::{Buf, EffectCtx, EffectSpec, ParamUi, Value, col, num, p, popup, slider};
|
|
|
|
/// The sprite plan of a sprite-drawing simulation effect for buffer geometry `b` (its pixels
|
|
/// are not read), `None` for other effects or settings drawn otherwise (the GPU compositor's
|
|
/// render pass).
|
|
pub fn sprite_plan(id: &str, ctx: &EffectCtx, b: &Buf) -> Option<SpritePlan> {
|
|
match id {
|
|
"ec.sim.ccrainfall" => Some(rainfall_plan(ctx, b)),
|
|
"ec.sim.ccsnowfall" => Some(snowfall_plan(ctx, b)),
|
|
"ec.sim.ccstarburst" => Some(star_burst_plan(ctx, b)),
|
|
"ec.sim.cchair" => crate::sim3::hair_plan(ctx, b),
|
|
"ec.sim.waveworld" => crate::sim2::wave_world_plan(ctx, b).and_then(|p| match p {
|
|
crate::sim2::WavePlan::Wire(sp) => Some(sp),
|
|
crate::sim2::WavePlan::Height { .. } => None,
|
|
}),
|
|
"ec.sim.foam" => crate::sim2::foam_plan(ctx, b),
|
|
"ec.sim.ccparticleworld" => particle_world_plan(ctx, b),
|
|
"ec.sim.ccparticlesystems2" => Some(particle_systems2_plan(ctx, b)),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
// ------------------------------------------------------------------ specs
|
|
|
|
pub fn specs() -> Vec<EffectSpec> {
|
|
let transfer = || popup(&["Composite", "Lighten"]);
|
|
vec![
|
|
spec(
|
|
"ec.sim.ccrainfall",
|
|
"CC Rainfall",
|
|
vec![
|
|
p("drops", "Drops", num(5000.0), slider(0.0, 100_000.0, 0.0, 20_000.0, 0)),
|
|
p("size", "Size", num(1.0), slider(0.0, 50.0, 0.0, 10.0, 2)),
|
|
p("sceneDepth", "Scene Depth", num(5000.0), slider(0.0, 20_000.0, 0.0, 10_000.0, 0)),
|
|
p("speed", "Speed", num(4000.0), slider(0.0, 20_000.0, 0.0, 10_000.0, 0)),
|
|
p("wind", "Wind", num(0.0), slider(-10_000.0, 10_000.0, -2000.0, 2000.0, 1)),
|
|
p("windVariation", "Variation % (Wind)", num(0.0), pct()),
|
|
p("spread", "Spread", num(0.0), slider(0.0, 1000.0, 0.0, 100.0, 1)),
|
|
p("color", "Color", col(0.8, 0.8, 0.8), ParamUi::Color),
|
|
p("opacity", "Opacity", num(25.0), pct()),
|
|
p("transferMode", "Transfer Mode", Value::Enum(1), transfer()),
|
|
p("compositeWithOriginal", "Composite With Original", Value::Bool(true), ParamUi::Checkbox),
|
|
p("extras/appearance", "Appearance", Value::Enum(0), popup(&["Refracting", "Soft Solid"])),
|
|
p("extras/offset", "Offset", pt(0.5, 0.5), ParamUi::Point),
|
|
p("extras/randomSeed", "Random Seed", num(0.0), slider(0.0, 10_000.0, 0.0, 1000.0, 0)),
|
|
],
|
|
rainfall,
|
|
),
|
|
spec(
|
|
"ec.sim.ccsnowfall",
|
|
"CC Snowfall",
|
|
vec![
|
|
p("flakes", "Flakes", num(10_000.0), slider(0.0, 200_000.0, 0.0, 50_000.0, 0)),
|
|
p("size", "Size", num(3.0), slider(0.0, 50.0, 0.0, 20.0, 2)),
|
|
p("sizeVariation", "Variation % (Size)", num(50.0), pct()),
|
|
p("sceneDepth", "Scene Depth", num(5000.0), slider(0.0, 20_000.0, 0.0, 10_000.0, 0)),
|
|
p("speed", "Speed", num(100.0), slider(0.0, 5000.0, 0.0, 1000.0, 1)),
|
|
p("speedVariation", "Variation % (Speed)", num(50.0), pct()),
|
|
p("wind", "Wind", num(25.0), slider(-5000.0, 5000.0, -500.0, 500.0, 1)),
|
|
p("windVariation", "Variation % (Wind)", num(50.0), pct()),
|
|
p("spread", "Spread", num(0.0), slider(0.0, 1000.0, 0.0, 100.0, 1)),
|
|
p("wiggle/wiggleAmount", "Amount", num(2.0), slider(0.0, 100.0, 0.0, 20.0, 2)),
|
|
p("wiggle/wiggleAmountVariation", "Variation % (Amount)", num(50.0), pct()),
|
|
p("wiggle/wiggleFrequency", "Frequency", num(1.0), slider(0.0, 20.0, 0.0, 5.0, 2)),
|
|
p("wiggle/wiggleFrequencyVariation", "Variation % (Frequency)", num(50.0), pct()),
|
|
p("color", "Color", col(1.0, 1.0, 1.0), ParamUi::Color),
|
|
p("opacity", "Opacity", num(100.0), pct()),
|
|
p("transferMode", "Transfer Mode", Value::Enum(0), transfer()),
|
|
p("compositeWithOriginal", "Composite With Original", Value::Bool(true), ParamUi::Checkbox),
|
|
p("extras/offset", "Offset", pt(0.5, 0.5), ParamUi::Point),
|
|
p("extras/randomSeed", "Random Seed", num(0.0), slider(0.0, 10_000.0, 0.0, 1000.0, 0)),
|
|
],
|
|
snowfall,
|
|
),
|
|
spec(
|
|
"ec.sim.ccbubbles",
|
|
"CC Bubbles",
|
|
vec![
|
|
p("bubbleAmount", "Bubble Amount", num(100.0), slider(0.0, 10_000.0, 0.0, 1000.0, 0)),
|
|
p("bubbleSpeed", "Bubble Speed", num(0.5), slider(-10.0, 10.0, -2.0, 2.0, 2)),
|
|
p("wobbleAmplitude", "Wobble Amplitude", num(5.0), slider(0.0, 500.0, 0.0, 100.0, 1)),
|
|
p("wobbleFrequency", "Wobble Frequency", num(1.0), slider(0.0, 50.0, 0.0, 10.0, 2)),
|
|
p("bubbleSize", "Bubble Size", num(1.0), slider(0.0, 20.0, 0.0, 5.0, 2)),
|
|
p("reflectionType", "Reflection Type", Value::Enum(0), popup(&["Liquid", "Metal"])),
|
|
p("shadingType", "Shading Type", Value::Enum(0), popup(&["None", "Lighten", "Darken", "Fade Inwards", "Fade Outwards"])),
|
|
],
|
|
bubbles,
|
|
),
|
|
spec(
|
|
"ec.sim.ccdrizzle",
|
|
"CC Drizzle",
|
|
vec![
|
|
p("dripRate", "Drip Rate", num(10.0), slider(0.0, 200.0, 0.0, 50.0, 2)),
|
|
p("longevity", "Longevity (sec)", num(1.0), slider(0.0, 30.0, 0.0, 5.0, 2)),
|
|
p("rippling", "Rippling", num(360.0), ParamUi::Angle),
|
|
p("displacement", "Displacement", num(5.0), slider(0.0, 100.0, 0.0, 30.0, 2)),
|
|
p("rippleHeight", "Ripple Height", num(30.0), slider(0.0, 200.0, 0.0, 100.0, 1)),
|
|
p("spreading", "Spreading", num(100.0), slider(0.0, 1000.0, 0.0, 300.0, 1)),
|
|
p("light/lightIntensity", "Light Intensity", num(100.0), slider(0.0, 400.0, 0.0, 200.0, 1)),
|
|
p("light/lightColor", "Light Color", col(1.0, 1.0, 1.0), ParamUi::Color),
|
|
p("light/lightHeight", "Light Height", num(25.0), slider(-100.0, 100.0, -100.0, 100.0, 1)),
|
|
p("light/lightDirection", "Light Direction", num(-45.0), ParamUi::Angle),
|
|
p("shading/ambient", "Ambient", num(0.0), slider(-200.0, 200.0, -100.0, 100.0, 1)),
|
|
p("shading/diffuse", "Diffuse", num(0.0), slider(0.0, 200.0, 0.0, 100.0, 1)),
|
|
p("shading/specular", "Specular", num(20.0), slider(0.0, 200.0, 0.0, 100.0, 1)),
|
|
p("shading/roughness", "Roughness", num(0.05), slider(0.001, 1.0, 0.001, 0.5, 3)),
|
|
],
|
|
drizzle,
|
|
),
|
|
spec(
|
|
"ec.sim.ccstarburst",
|
|
"CC Star Burst",
|
|
vec![
|
|
p("scatter", "Scatter", num(100.0), slider(0.0, 1000.0, 0.0, 300.0, 1)),
|
|
p("speed", "Speed", num(1.0), slider(-10.0, 10.0, -4.0, 4.0, 2)),
|
|
p("phase", "Phase", num(0.0), ParamUi::Angle),
|
|
p("gridSpacing", "Grid Spacing", num(2.0), slider(1.0, 100.0, 1.0, 20.0, 0)),
|
|
p("size", "Size", num(100.0), slider(0.0, 1000.0, 0.0, 300.0, 1)),
|
|
p("blendWithOriginal", "Blend w. Original", num(0.0), pct()),
|
|
],
|
|
star_burst,
|
|
),
|
|
spec(
|
|
"ec.sim.ccparticleworld",
|
|
"CC Particle World",
|
|
vec![
|
|
p("birthRate", "Birth Rate", num(0.5), slider(0.0, 100.0, 0.0, 10.0, 2)),
|
|
p("longevity", "Longevity (sec)", num(1.0), slider(0.0, 100.0, 0.0, 10.0, 2)),
|
|
p("producer/producerX", "Position X", num(0.0), slider(-10.0, 10.0, -1.0, 1.0, 2)),
|
|
p("producer/producerY", "Position Y", num(0.0), slider(-10.0, 10.0, -1.0, 1.0, 2)),
|
|
p("producer/producerZ", "Position Z", num(0.0), slider(-10.0, 10.0, -1.0, 1.0, 2)),
|
|
p("producer/radiusX", "Radius X", num(0.025), slider(0.0, 10.0, 0.0, 1.0, 3)),
|
|
p("producer/radiusY", "Radius Y", num(0.025), slider(0.0, 10.0, 0.0, 1.0, 3)),
|
|
p("producer/radiusZ", "Radius Z", num(0.025), slider(0.0, 10.0, 0.0, 1.0, 3)),
|
|
p("physics/animation", "Animation", Value::Enum(0), popup(PW_ANIMS)),
|
|
p("physics/velocity", "Velocity", num(1.0), slider(-10.0, 10.0, 0.0, 5.0, 2)),
|
|
p("physics/inheritVelocity", "Inherit Velocity %", num(0.0), slider(-100.0, 100.0, -100.0, 100.0, 1)),
|
|
p("physics/gravity", "Gravity", num(0.5), slider(-10.0, 10.0, -2.0, 2.0, 3)),
|
|
p("physics/resistance", "Resistance", num(0.0), slider(0.0, 20.0, 0.0, 5.0, 2)),
|
|
p("physics/extra", "Extra", num(1.0), slider(0.0, 10.0, 0.0, 2.0, 2)),
|
|
p("physics/extraAngle", "Extra Angle", num(360.0), ParamUi::Angle),
|
|
p("physics/directionAxis/axisX", "Axis X", num(0.0), slider(-1.0, 1.0, -1.0, 1.0, 2)),
|
|
p("physics/directionAxis/axisY", "Axis Y", num(-1.0), slider(-1.0, 1.0, -1.0, 1.0, 2)),
|
|
p("physics/directionAxis/axisZ", "Axis Z", num(0.0), slider(-1.0, 1.0, -1.0, 1.0, 2)),
|
|
p("physics/gravityVector/gravityX", "Gravity X", num(0.0), slider(-1.0, 1.0, -1.0, 1.0, 2)),
|
|
p("physics/gravityVector/gravityY", "Gravity Y", num(1.0), slider(-1.0, 1.0, -1.0, 1.0, 2)),
|
|
p("physics/gravityVector/gravityZ", "Gravity Z", num(0.0), slider(-1.0, 1.0, -1.0, 1.0, 2)),
|
|
p("particle/particleType", "Particle Type", Value::Enum(0), popup(PARTICLE_TYPES)),
|
|
p("particle/birthSize", "Birth Size", num(0.2), slider(0.0, 10.0, 0.0, 1.0, 3)),
|
|
p("particle/deathSize", "Death Size", num(0.2), slider(0.0, 10.0, 0.0, 1.0, 3)),
|
|
p("particle/sizeVariation", "Size Variation", num(0.0), pct()),
|
|
p("particle/maxOpacity", "Max Opacity", num(75.0), pct()),
|
|
p("particle/birthColor", "Birth Color", col(1.0, 1.0, 0.0), ParamUi::Color),
|
|
p("particle/deathColor", "Death Color", col(0.6, 0.0, 0.0), ParamUi::Color),
|
|
p("particle/transferMode", "Transfer Mode", Value::Enum(0), popup(&["Composite", "Screen", "Add", "Black Matte"])),
|
|
p("extras/effectCamera/distance", "Distance", num(2.0), slider(0.0, 100.0, 0.0, 10.0, 2)),
|
|
p("extras/effectCamera/rotationX", "Rotation X", num(0.0), ParamUi::Angle),
|
|
p("extras/effectCamera/rotationY", "Rotation Y", num(0.0), ParamUi::Angle),
|
|
p("extras/effectCamera/rotationZ", "Rotation Z", num(0.0), ParamUi::Angle),
|
|
p("extras/effectCamera/fov", "FOV", num(PW_FOV), slider(1.0, 179.0, 10.0, 120.0, 1)),
|
|
p("extras/randomSeed", "Random Seed", num(0.0), slider(0.0, 10_000.0, 0.0, 1000.0, 0)),
|
|
],
|
|
particle_world,
|
|
),
|
|
spec(
|
|
"ec.sim.ccparticlesystems2",
|
|
"CC Particle Systems II",
|
|
vec![
|
|
p("birthRate", "Birth Rate", num(2.0), slider(0.0, 100.0, 0.0, 20.0, 2)),
|
|
p("longevity", "Longevity (sec)", num(1.0), slider(0.0, 100.0, 0.0, 10.0, 2)),
|
|
p("producer/position", "Position", pt(0.5, 0.5), ParamUi::Point),
|
|
p("producer/radiusX", "Radius X", num(0.0), slider(0.0, 2000.0, 0.0, 200.0, 1)),
|
|
p("producer/radiusY", "Radius Y", num(0.0), slider(0.0, 2000.0, 0.0, 200.0, 1)),
|
|
p("physics/animation", "Animation", Value::Enum(0), popup(PW_ANIMS)),
|
|
p("physics/velocity", "Velocity", num(2.0), slider(-20.0, 20.0, 0.0, 10.0, 2)),
|
|
p("physics/inheritVelocity", "Inherit Velocity %", num(0.0), slider(-100.0, 100.0, -100.0, 100.0, 1)),
|
|
p("physics/gravity", "Gravity", num(1.0), slider(-20.0, 20.0, -5.0, 5.0, 2)),
|
|
p("physics/resistance", "Resistance", num(0.0), slider(0.0, 20.0, 0.0, 5.0, 2)),
|
|
p("physics/direction", "Direction", num(0.0), ParamUi::Angle),
|
|
p("physics/extra", "Extra", num(1.0), slider(0.0, 10.0, 0.0, 2.0, 2)),
|
|
p("particle/particleType", "Particle Type", Value::Enum(0), popup(PARTICLE_TYPES)),
|
|
p("particle/birthSize", "Birth Size", num(0.5), slider(0.0, 20.0, 0.0, 5.0, 2)),
|
|
p("particle/deathSize", "Death Size", num(1.5), slider(0.0, 20.0, 0.0, 5.0, 2)),
|
|
p("particle/sizeVariation", "Size Variation", num(0.0), pct()),
|
|
p("particle/maxOpacity", "Max Opacity", num(75.0), pct()),
|
|
p("particle/birthColor", "Birth Color", col(1.0, 1.0, 0.0), ParamUi::Color),
|
|
p("particle/deathColor", "Death Color", col(0.6, 0.0, 0.0), ParamUi::Color),
|
|
p("particle/transferMode", "Transfer Mode", Value::Enum(0), popup(&["Composite", "Screen", "Add", "Black Matte"])),
|
|
p("randomSeed", "Random Seed", num(0.0), slider(0.0, 10_000.0, 0.0, 1000.0, 0)),
|
|
],
|
|
particle_systems2,
|
|
),
|
|
spec(
|
|
"ec.sim.ccmrmercury",
|
|
"CC Mr. Mercury",
|
|
vec![
|
|
p("radiusX", "Radius X", num(50.0), slider(0.0, 2000.0, 0.0, 300.0, 1)),
|
|
p("radiusY", "Radius Y", num(50.0), slider(0.0, 2000.0, 0.0, 300.0, 1)),
|
|
p("producer", "Producer", pt(0.5, 0.5), ParamUi::Point),
|
|
p("direction", "Direction", num(0.0), ParamUi::Angle),
|
|
p("velocity", "Velocity", num(1.0), slider(-20.0, 20.0, 0.0, 5.0, 2)),
|
|
p("birthRate", "Birth Rate", num(1.0), slider(0.0, 20.0, 0.0, 5.0, 2)),
|
|
p("longevity", "Longevity (sec)", num(2.0), slider(0.0, 100.0, 0.0, 10.0, 2)),
|
|
p("gravity", "Gravity", num(0.5), slider(-20.0, 20.0, -5.0, 5.0, 2)),
|
|
p("resistance", "Resistance", num(0.0), slider(0.0, 20.0, 0.0, 5.0, 2)),
|
|
p("extra", "Extra", num(1.0), slider(0.0, 10.0, 0.0, 2.0, 2)),
|
|
p("animation", "Animation", Value::Enum(0), popup(PW_ANIMS)),
|
|
p("blobInfluence", "Blob Influence", num(100.0), slider(0.0, 400.0, 0.0, 200.0, 1)),
|
|
p("blobBirthSize", "Blob Birth Size", num(0.5), slider(0.0, 10.0, 0.0, 2.0, 2)),
|
|
p("blobDeathSize", "Blob Death Size", num(0.25), slider(0.0, 10.0, 0.0, 2.0, 2)),
|
|
p("light/lightIntensity", "Light Intensity", num(100.0), slider(0.0, 400.0, 0.0, 200.0, 1)),
|
|
p("light/lightColor", "Light Color", col(1.0, 1.0, 1.0), ParamUi::Color),
|
|
p("light/lightHeight", "Light Height", num(50.0), slider(-100.0, 100.0, -100.0, 100.0, 1)),
|
|
p("light/lightDirection", "Light Direction", num(-45.0), ParamUi::Angle),
|
|
p("shading/ambient", "Ambient", num(0.0), slider(-200.0, 200.0, -100.0, 100.0, 1)),
|
|
p("shading/diffuse", "Diffuse", num(75.0), slider(0.0, 200.0, 0.0, 100.0, 1)),
|
|
p("shading/specular", "Specular", num(50.0), slider(0.0, 200.0, 0.0, 100.0, 1)),
|
|
p("shading/roughness", "Roughness", num(0.05), slider(0.001, 1.0, 0.001, 0.5, 3)),
|
|
p("shading/metal", "Metal", num(100.0), pct()),
|
|
],
|
|
mr_mercury,
|
|
),
|
|
]
|
|
}
|