fiddling around, trying to get the additive to work

master
mitchellhansen 5 years ago
parent 5dde94cdf9
commit 1419f85455

@ -9,12 +9,14 @@ layout(location = 0) out vec4 f_color;
void main() { void main() {
if (out_color.w >= 1.004) {
if (int(out_color.w) % 2 == 0) {
f_color = out_color; f_color = out_color;
f_color.w = 255.0; //f_color.w = 1.0;
} else {
f_color = f_color;
f_color.w = 0.0;
} }
//f_color = out_color;
} }

@ -106,11 +106,11 @@ impl CompiledShader for TextShader {
let blend = AttachmentBlend { let blend = AttachmentBlend {
enabled: true, enabled: true,
color_op: BlendOp::Add, color_op: BlendOp::Add,
color_source: BlendFactor::SrcAlpha, color_source: BlendFactor::One,
color_destination: BlendFactor::OneMinusSrcAlpha, color_destination: BlendFactor::One,
alpha_op: BlendOp::Add, alpha_op: BlendOp::Add,
alpha_source: BlendFactor::SrcAlpha, alpha_source: BlendFactor::One,
alpha_destination: BlendFactor::OneMinusSrcAlpha, alpha_destination: BlendFactor::One,
mask_red: true, mask_red: true,
mask_green: true, mask_green: true,
mask_blue: true, mask_blue: true,
@ -142,7 +142,7 @@ impl CompiledShader for TextShader {
.depth_stencil_simple_depth() .depth_stencil_simple_depth()
.blend_collective(blend) .blend_collective(blend)
.blend_logic_op(LogicOp::And) //.blend_logic_op(LogicOp::Noop)
// We have to indicate which subpass of which render pass this pipeline is going to be used // We have to indicate which subpass of which render pass this pipeline is going to be used
// in. The pipeline will only be usable from this particular subpass. // in. The pipeline will only be usable from this particular subpass.
.render_pass(Subpass::from(render_pass.clone(), 0).unwrap()) .render_pass(Subpass::from(render_pass.clone(), 0).unwrap())

@ -22,99 +22,99 @@ impl Text {
vec![ vec![
ColorVertex3D { ColorVertex3D {
v_position: [-0.5, -0.5, normalized_depth], v_position: [-0.5, -0.5, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-1.0, 1.0, normalized_depth], v_position: [-1.0, 1.0, normalized_depth],
color: [1.0, 0.8, 1.0, 1.0], color: [1.0, 0.8, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-0.25, 0.0, normalized_depth], v_position: [-0.25, 0.0, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-0.25, 0.0, normalized_depth], v_position: [-0.25, 0.0, normalized_depth],
color: [0.8, 1.0, 1.0, 1.0], color: [0.8, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-1.0, 1.0, normalized_depth], v_position: [-1.0, 1.0, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.0, 0.5, normalized_depth], v_position: [0.0, 0.5, normalized_depth],
color: [1.0, 1.0, 0.8, 1.0], color: [1.0, 1.0, 0.8, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.25, 0.0, normalized_depth], v_position: [0.25, 0.0, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-1.0, 1.0, normalized_depth], v_position: [-1.0, 1.0, normalized_depth],
color: [1.0, 0.8, 1.0, 1.0], color: [1.0, 0.8, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.0, 0.5, normalized_depth], v_position: [0.0, 0.5, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.5, -0.5, normalized_depth], v_position: [0.5, -0.5, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-1.0, 1.0, normalized_depth], v_position: [-1.0, 1.0, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.25, 0.0, normalized_depth], v_position: [0.25, 0.0, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.25, -0.5, normalized_depth], v_position: [0.25, -0.5, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-1.0, 1.0, normalized_depth], v_position: [-1.0, 1.0, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.5, -0.5, normalized_depth], v_position: [0.5, -0.5, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.25, -0.5, normalized_depth], v_position: [0.25, -0.5, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-1.0, 1.0, normalized_depth], v_position: [-1.0, 1.0, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.0, -0.1, normalized_depth], v_position: [0.0, -0.1, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-0.25, -0.5, normalized_depth], v_position: [-0.25, -0.5, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-1.0, 1.0, normalized_depth], v_position: [-1.0, 1.0, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [0.0, -0.1, normalized_depth], v_position: [0.0, -0.1, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-0.5, -0.5, normalized_depth], v_position: [-0.5, -0.5, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-1.0, 1.0, normalized_depth], v_position: [-1.0, 1.0, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}, },
ColorVertex3D { ColorVertex3D {
v_position: [-0.25, -0.5, normalized_depth], v_position: [-0.25, -0.5, normalized_depth],
color: [1.0, 1.0, 1.0, 1.0], color: [1.0, 1.0, 1.0, 1.0/255.0],
}] }]
}; };

Loading…
Cancel
Save