add alpha to ui pipeline

This commit is contained in:
Carter Anderson 2020-01-13 01:32:04 -08:00
parent 5d9bb88d1b
commit a798cf3346
2 changed files with 22 additions and 3 deletions

View file

@ -175,4 +175,15 @@ fn setup(world: &mut World) {
Parent(parent),
)],
);
// alpha test
world.insert(
(),
vec![(Node::new(
math::vec2(200.0, 200.0),
Anchors::new(0.5, 0.5, 0.5, 0.5),
Margins::new(0.0, 100.0, 0.0, 100.0),
math::vec4(1.0, 0.7, 0.7, 0.2),
),)],
);
}

View file

@ -196,9 +196,17 @@ impl Pipeline for UiPipeline {
}),
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
color_states: &[wgpu::ColorStateDescriptor {
format: render_graph.swap_chain_descriptor.format,
color_blend: wgpu::BlendDescriptor::REPLACE,
alpha_blend: wgpu::BlendDescriptor::REPLACE,
format: wgpu::TextureFormat::Bgra8UnormSrgb,
color_blend: wgpu::BlendDescriptor {
src_factor: wgpu::BlendFactor::SrcAlpha,
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
operation: wgpu::BlendOperation::Add,
},
alpha_blend: wgpu::BlendDescriptor {
src_factor: wgpu::BlendFactor::One,
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
operation: wgpu::BlendOperation::Add,
},
write_mask: wgpu::ColorWrite::ALL,
}],
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {