axmol/cocos/renderer/ccShader_Label_outline.frag

29 lines
635 B
GLSL
Raw Normal View History

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