axmol/cocos/renderer/ccShader_Label_outline.frag

26 lines
630 B
GLSL
Raw Normal View History

2014-05-10 07:45:42 +08:00
const char* ccLabelOutline_frag = STRINGIFY(
2014-05-10 10:07:22 +08:00
#ifdef GL_ES\n
2014-05-10 07:45:42 +08:00
precision lowp float;
2014-05-10 10:07:22 +08:00
#endif\n
2014-05-10 07:45:42 +08:00
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
uniform sampler2D CC_Texture0;
uniform vec4 v_effectColor;
uniform vec4 v_textColor;
void main()
{
vec4 sample = texture2D(CC_Texture0, v_texCoord);
float fontAlpha = sample.a;
float outlineAlpha = sample.r;
if (outlineAlpha > 0.0){
vec4 color = v_textColor * fontAlpha + v_effectColor * (1.0 - fontAlpha);
gl_FragColor = v_fragmentColor * vec4( color.rgb,max(fontAlpha,outlineAlpha)*color.a);
}
else {
discard;
}
}
);