Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
One smoothstep for the systems: raea_core_ease::smoothstep (raea-sys-damage's copied raea-sys-foliage's)
shinyobjectz02051ee99262
diff --git a/Cargo.lock b/Cargo.lockindex 523c5fee..d0d8e49a 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -15808,6 +15808,7 @@ name = "raea-sys-damage"version = "0.1.0"dependencies = ["parry3d",+ "raea-core-ease","raea-sys-touch","rayon",]@@ -15909,6 +15910,7 @@ version = "0.1.0"dependencies = ["image","parry3d",+ "raea-core-ease","raea-sys-glb","serde_json",]diff --git a/core/ease/src/lib.rs b/core/ease/src/lib.rsindex 6815ce12..9e9282bb 100644--- a/core/ease/src/lib.rs+++ b/core/ease/src/lib.rs@@ -7,3 +7,10 @@ pub mod color;pub mod easing;pub mod interpolate;pub mod spring;++/// 0 below `a`, 1 above `b`, and between them the cubic Hermite ease (WGSL's smoothstep), for a value that fades in+/// over a range rather than a key's time.+pub fn smoothstep(a: f32, b: f32, x: f32) -> f32 {+ let t = ((x - a) / (b - a)).clamp(0.0, 1.0);+ t * t * (3.0 - 2.0 * t)+}diff --git a/systems/damage/Cargo.toml b/systems/damage/Cargo.tomlindex 314c6f0b..bcc2b0db 100644--- a/systems/damage/Cargo.toml+++ b/systems/damage/Cargo.toml@@ -10,3 +10,5 @@ description = "Where a building breaks: cracks from the corners of its openings,parry3d = "0.31"rayon = "1"raea-sys-touch = { path = "../touch" }+# smoothstep, shared with raea-sys-foliage+raea-core-ease = { path = "../../core/ease" }diff --git a/systems/damage/src/lib.rs b/systems/damage/src/lib.rsindex 82d115d0..bae2cfdb 100644--- a/systems/damage/src/lib.rs+++ b/systems/damage/src/lib.rs@@ -17,6 +17,7 @@ use parry3d::glamx::Vec3;use parry3d::query::{Ray, RayCast};use rayon::prelude::*;+use raea_core_ease::smoothstep as smooth;use raea_sys_touch::{Mat, Point, Spot, Surface};/// A cache key's part: a change to the rules changes every bake that used them.@@ -53,11 +54,6 @@ const DROP: f32 = 0.5;/// walk from itconst OUTDOORS: f32 = 0.02;-fn smooth(a: f32, b: f32, x: f32) -> f32 {- let t = ((x - a) / (b - a)).clamp(0.0, 1.0);- t * t * (3.0 - 2.0 * t)-}-/// How readily the coat at `q` comes off (0-1), with `crack` its distance to the nearest crack (metres).pub fn loss(q: &Point, crack: f32) -> f32 {let l = &LOSS;diff --git a/systems/foliage/Cargo.toml b/systems/foliage/Cargo.tomlindex 5bcaf265..cc1795ed 100644--- a/systems/foliage/Cargo.toml+++ b/systems/foliage/Cargo.toml@@ -11,3 +11,5 @@ parry3d = "0.31"serde_json = "1"image = { version = "0.25", default-features = false, features = ["png"] }raea-sys-glb = { path = "../glb" }+# smoothstep, shared with raea-sys-damage+raea-core-ease = { path = "../../core/ease" }diff --git a/systems/foliage/src/leaves.rs b/systems/foliage/src/leaves.rsindex 25f9935c..ccd11d32 100644--- a/systems/foliage/src/leaves.rs+++ b/systems/foliage/src/leaves.rs@@ -130,10 +130,7 @@ pub(crate) fn leaves(sp: &Species, req: &Request, nodes: &[Node], env: &Envelope}/// 0 below `a`, 1 above `b`, smoothly between (a leaf's gaps, its teeth's roots in atlas.rs).-pub(crate) fn smooth(a: f32, b: f32, x: f32) -> f32 {- let t = ((x - a) / (b - a)).clamp(0.0, 1.0);- t * t * (3.0 - 2.0 * t)-}+pub(crate) use raea_core_ease::smoothstep as smooth;/// Value noise in 3D, 0 to 1, from a seed.fn noise3(p: Vec3, seed: u64) -> f32 {