macro_rules! asset_plugin {
($(#[$doc:meta])* $name:ident, $gpu_ty:ty) => {
$(#[$doc])*
#[derive(Default)]
pub struct $name;
impl $name {
pub fn new() -> Self {
Self
}
}
impl crate::ecs::plugin::Plugin for $name {
fn build(&self, app: &mut crate::app::App) {
app.add_plugin(crate::assets::plugin::AssetPlugin::<
crate::wgpu::backend::WGPUBackend,
$gpu_ty,
>::new());
}
}
};
}
macro_rules! mipmap_asset_plugin {
($(#[$doc:meta])* $name:ident, $gpu_ty:ty) => {
$(#[$doc])*
#[derive(Default)]
pub struct $name;
impl $name {
pub fn new() -> Self {
Self
}
}
impl crate::ecs::plugin::Plugin for $name {
fn build(&self, app: &mut crate::app::App) {
{
use crate::ecs::system_condition::{ResourceExists, RunIfExt};
app.add_system(
crate::app::SystemStage::Startup,
crate::wgpu::mipmap::init_mipmap_generator
.run_if::<ResourceExists<crate::wgpu::backend::WGPUBackend>>(),
);
}
app.add_plugin(crate::assets::plugin::AssetPlugin::<
crate::wgpu::backend::WGPUBackend,
$gpu_ty,
>::new());
}
}
};
}
pub(crate) use asset_plugin;
pub(crate) use mipmap_asset_plugin;