diff --git a/resources/shaders/simple_text.frag b/resources/shaders/simple_text.frag index 298485ea..a2eeabc6 100644 --- a/resources/shaders/simple_text.frag +++ b/resources/shaders/simple_text.frag @@ -8,13 +8,15 @@ layout(location = 0) in vec4 out_color; layout(location = 0) out vec4 f_color; void main() { - - - if (int(out_color.w) % 2 == 0) { + + if (out_color.w >= 1.004) { 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; + } diff --git a/src/canvas/managed/shader/text_shader.rs b/src/canvas/managed/shader/text_shader.rs index 85e54451..f5abd60f 100644 --- a/src/canvas/managed/shader/text_shader.rs +++ b/src/canvas/managed/shader/text_shader.rs @@ -106,11 +106,11 @@ impl CompiledShader for TextShader { let blend = AttachmentBlend { enabled: true, color_op: BlendOp::Add, - color_source: BlendFactor::SrcAlpha, - color_destination: BlendFactor::OneMinusSrcAlpha, + color_source: BlendFactor::One, + color_destination: BlendFactor::One, alpha_op: BlendOp::Add, - alpha_source: BlendFactor::SrcAlpha, - alpha_destination: BlendFactor::OneMinusSrcAlpha, + alpha_source: BlendFactor::One, + alpha_destination: BlendFactor::One, mask_red: true, mask_green: true, mask_blue: true, @@ -142,7 +142,7 @@ impl CompiledShader for TextShader { .depth_stencil_simple_depth() .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 // in. The pipeline will only be usable from this particular subpass. .render_pass(Subpass::from(render_pass.clone(), 0).unwrap()) diff --git a/src/drawables/text.rs b/src/drawables/text.rs index 02b1c04f..7db11134 100644 --- a/src/drawables/text.rs +++ b/src/drawables/text.rs @@ -22,99 +22,99 @@ impl Text { vec![ ColorVertex3D { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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], }] };