|
|
|
|
@ -37,7 +37,7 @@ fn setup(
|
|
|
|
|
alpha_mode: AlphaMode::Mask(0.5),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
extension: MatExt { step: 3 },
|
|
|
|
|
extension: MatExt { cutoff: 0.5 },
|
|
|
|
|
}),
|
|
|
|
|
..default()
|
|
|
|
|
});
|
|
|
|
|
@ -60,7 +60,7 @@ fn setup(
|
|
|
|
|
#[derive(Asset, AsBindGroup, Reflect, Debug, Clone)]
|
|
|
|
|
struct MatExt {
|
|
|
|
|
#[uniform(100)]
|
|
|
|
|
step: u32,
|
|
|
|
|
cutoff: f32,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl MaterialExtension for MatExt {
|
|
|
|
|
@ -72,10 +72,14 @@ impl MaterialExtension for MatExt {
|
|
|
|
|
fn rotate(
|
|
|
|
|
mut query: Query<&mut Transform, With<Handle<Mesh>>>,
|
|
|
|
|
time: Res<Time>,
|
|
|
|
|
mut materials: ResMut<Assets<MyMat>>,
|
|
|
|
|
) {
|
|
|
|
|
query.iter_mut().for_each(|mut t| {
|
|
|
|
|
t.rotate_local_y(time.delta_seconds() / 2.0);
|
|
|
|
|
t.rotate_local_z(time.delta_seconds() / 2.0);
|
|
|
|
|
t.rotate_local_x(time.delta_seconds() / 2.0);
|
|
|
|
|
});
|
|
|
|
|
materials.iter_mut().for_each(|(_id, m)| {
|
|
|
|
|
m.extension.cutoff = time.elapsed_seconds().sin().abs();
|
|
|
|
|
})
|
|
|
|
|
}
|