Skip to content

Commit

Permalink
added luisa::lerp(x,y,t)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiinamiyuki committed Apr 15, 2024
1 parent 32739a0 commit 4f4ca9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions luisa_compute/src/lang/ops/spread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ where
x.max_(y)
}

/// lerp(x, y, t) = x*(1-t) + y*t
/// the parameter order is the same as in GLSL/HLSL
pub fn lerp<A,B,T>(x: A, y: B, t: T) -> <A as FloatLerpExpr<B, T>>::Output
where
A: FloatLerpExpr<B, T>,
{
x.lerp(y, t)
}

impl<T: Value, S, U> ClampExpr<S, U> for Expr<T>
where
S: SpreadOps<Expr<T>, Join = T>,
Expand Down
2 changes: 1 addition & 1 deletion luisa_compute/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub mod resource;
pub mod rtx;
pub mod runtime;

pub use crate::lang::ops::{max, min};
pub use crate::lang::ops::{lerp, max, min};

pub mod prelude {
pub use half::f16;
Expand Down

0 comments on commit 4f4ca9e

Please sign in to comment.