From 329213aaa48189aebd9b70e8e5e042486a855397 Mon Sep 17 00:00:00 2001 From: John Mitchell <6656977+StarArawn@users.noreply.github.com> Date: Sat, 29 Apr 2023 21:21:23 -0400 Subject: [PATCH] Make sure shaders with opacity. --- examples/custom_shader.rs | 20 ++------------------ examples/modal.rs | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/examples/custom_shader.rs b/examples/custom_shader.rs index c2f68a92..288c09d0 100644 --- a/examples/custom_shader.rs +++ b/examples/custom_shader.rs @@ -28,40 +28,24 @@ fn startup( let my_material = MyUIMaterial {}; let my_material_handle = materials.add(my_material); - let my_material_handle1 = my_material_handle.clone(); - let my_material_handle2 = my_material_handle.clone(); let mut widget_context = KayakRootContext::new(camera_entity); widget_context.add_plugin(KayakWidgetsContextPlugin); let parent_id = None; rsx! { - bevy::render::render_resource::ShaderRef { + "rainbow_shader.wgsl".into() + } +} + #[derive(Component, Default, PartialEq, Clone)] struct MyWidget; @@ -33,9 +42,12 @@ fn my_widget_render( widget_context: Res, mut commands: Commands, query: Query<&MyWidgetState>, + mut materials: ResMut>, ) -> bool { let state_entity = widget_context.use_state(&mut commands, entity, MyWidgetState::default()); if let Ok(state) = query.get(state_entity) { + let my_material = MyUIMaterial {}; + let my_material_handle = materials.add(my_material); let parent_id = Some(entity); rsx! { @@ -76,8 +88,21 @@ fn my_widget_render( ..Default::default() }} > + , mut event: ResMut, @@ -135,6 +160,7 @@ fn main() { .add_plugins(DefaultPlugins) .add_plugin(KayakContextPlugin) .add_plugin(KayakWidgets) + .add_plugin(MaterialUIPlugin::::default()) .add_startup_system(startup) .run() }