From bc65935e599ae4b3095c38cbe1bac8d41bd0d073 Mon Sep 17 00:00:00 2001 From: nanoqsh Date: Sat, 17 Aug 2024 22:17:50 +0500 Subject: [PATCH] Add `sqrt` and `pow` functions --- dunge_shader/src/math.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dunge_shader/src/math.rs b/dunge_shader/src/math.rs index 34ce780..d48d8f6 100644 --- a/dunge_shader/src/math.rs +++ b/dunge_shader/src/math.rs @@ -119,6 +119,14 @@ where Ret::new(Math::new((x,), MathFunction::Floor)) } +pub const fn pow(base: B, exp: X) -> Ret, f32> +where + B: Eval, + X: Eval, +{ + Ret::new(Math::new((base, exp), MathFunction::Pow)) +} + pub const fn sin(x: X) -> Ret, f32> where X: Eval, @@ -133,6 +141,13 @@ where Ret::new(Math::new((x,), MathFunction::Sinh)) } +pub const fn sqrt(x: X) -> Ret, f32> +where + X: Eval, +{ + Ret::new(Math::new((x,), MathFunction::Sqrt)) +} + pub const fn tan(x: X) -> Ret, f32> where X: Eval,