Implement the Gaussian Blur node (#933)

This commit is contained in:
Dennis Kobert
2022-12-31 21:12:02 +01:00
committed by Keavon Chambers
parent 74bfd630a9
commit a9601ab164
11 changed files with 578 additions and 51 deletions

View File

@@ -31,7 +31,8 @@ where
{
type Output = Any<'n>;
fn eval(self, input: Any<'n>) -> Self::Output {
let input: Box<I> = dyn_any::downcast(input).expect("DynAnyNode Input");
let node = core::any::type_name::<N>();
let input: Box<I> = dyn_any::downcast(input).expect(format!("DynAnyNode Input in:\n{node}").as_str());
Box::new(self.0.eval(*input))
}
}
@@ -41,7 +42,8 @@ where
{
type Output = Any<'n>;
fn eval(self, input: Any<'n>) -> Self::Output {
let input: Box<I> = dyn_any::downcast(input).expect("DynAnyNode Input");
let node = core::any::type_name::<N>();
let input: Box<I> = dyn_any::downcast(input).expect(format!("DynAnyNode Input in:\n{node}").as_str());
Box::new((&self.0).eval_ref(*input))
}
}
@@ -161,6 +163,17 @@ where
*dyn_any::downcast(output).expect("DowncastBothNode Output")
}
}
impl<'n, N, I: 'n + StaticType, O: 'n + StaticType> Node<I> for &DowncastBothNode<N, I, O>
where
N: Node<Any<'n>, Output = Any<'n>> + Copy,
{
type Output = O;
fn eval(self, input: I) -> Self::Output {
let input = Box::new(input) as Box<dyn DynAny>;
let output = self.0.eval(input);
*dyn_any::downcast(output).expect("DowncastBothNode Output")
}
}
impl<'n, N, I: StaticType, O: StaticType> DowncastBothNode<N, I, O>
where
N: Node<Any<'n>>,