Skip to content

Commit

Permalink
Add sqrt and pow functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nanoqsh committed Aug 17, 2024
1 parent 5b6bc85 commit bc65935
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dunge_shader/src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ where
Ret::new(Math::new((x,), MathFunction::Floor))
}

pub const fn pow<B, X, E>(base: B, exp: X) -> Ret<Math<(B, X), E>, f32>
where
B: Eval<E, Out = f32>,
X: Eval<E, Out = f32>,
{
Ret::new(Math::new((base, exp), MathFunction::Pow))
}

pub const fn sin<X, E>(x: X) -> Ret<Math<(X,), E>, f32>
where
X: Eval<E, Out = f32>,
Expand All @@ -133,6 +141,13 @@ where
Ret::new(Math::new((x,), MathFunction::Sinh))
}

pub const fn sqrt<X, E>(x: X) -> Ret<Math<(X,), E>, f32>
where
X: Eval<E, Out = f32>,
{
Ret::new(Math::new((x,), MathFunction::Sqrt))
}

pub const fn tan<X, E>(x: X) -> Ret<Math<(X,), E>, f32>
where
X: Eval<E, Out = f32>,
Expand Down

0 comments on commit bc65935

Please sign in to comment.