implement Bsp::N

This commit is contained in:
🪞👃🪞 2024-12-17 11:59:22 +01:00
parent a352141dde
commit c685621788

View file

@ -52,6 +52,11 @@ impl<E: Engine, X: Render<E>, Y: Render<E>> Render<E> for Bsp<E, X, Y> {
let b = b.min_size(to)?.unwrap_or([0.into(), 0.into()].into());
[a.w() + b.w(), a.h().max(b.h())].into()
},
Self::N(a, b) => {
let a = a.min_size(to)?.unwrap_or([0.into(), 0.into()].into());
let b = b.min_size(to)?.unwrap_or([0.into(), 0.into()].into());
[a.w().max(b.w()), a.h() + b.h()].into()
},
_ => todo!()
}))
}
@ -85,6 +90,15 @@ impl<E: Engine, X: Render<E>, Y: Render<E>> Render<E> for Bsp<E, X, Y> {
to.render_in(to.area().push_x(s_x).into(), a)?;
to.render_in(to.area().shrink_x(s_x).into(), b)?;
},
Self::N(a, b) => {
let n = [0.into(), 0.into()].into();
let s = to.area().wh().into();
let s_a = a.min_size(s)?.unwrap_or(n);
let s_b = b.min_size(s)?.unwrap_or(n);
let s_y = (to.area().h() - s_a.h()).into();
to.render_in(to.area().push_y(s_y).into(), a)?;
to.render_in(to.area().shrink_y(s_y).into(), b)?;
},
_ => todo!()
})
}