30 lines
699 B
Rust
30 lines
699 B
Rust
use crate::app::Ctx;
|
|
use crate::elements::*;
|
|
use std::sync::Arc;
|
|
macro_rules! elementvec {
|
|
($({$element: ident, $element_ty: ty, $element_mut: ident})+) => {
|
|
pub struct ElementVec {
|
|
$($element: Arc<$element_ty> ,)+
|
|
}
|
|
impl ElementVec {
|
|
pub fn init(ctx: &Ctx) -> Self {
|
|
// Compile the shaders, create the pipelines, etc.
|
|
Self {
|
|
$($element: Arc::new((<$element_ty>::new(ctx))) ,)+
|
|
}
|
|
}
|
|
|
|
$(pub fn $element(&self) -> &Arc< $element_ty> {
|
|
&self.$element
|
|
})+
|
|
|
|
|
|
}
|
|
};
|
|
() => {};
|
|
}
|
|
|
|
elementvec!({
|
|
ppi, PPI, ppi_mut
|
|
});
|