135 lines
5.7 KiB
JSON
135 lines
5.7 KiB
JSON
{
|
|
"__type__": "cc.EffectAsset",
|
|
"_name": "fntOutline",
|
|
"_objFlags": 0,
|
|
"_native": "",
|
|
"properties": null,
|
|
"techniques": [
|
|
{
|
|
"passes": [
|
|
{
|
|
"blendState": {
|
|
"targets": [
|
|
{
|
|
"blend": true
|
|
}
|
|
]
|
|
},
|
|
"rasterizerState": {
|
|
"cullMode": 0
|
|
},
|
|
"properties": {
|
|
"texture": {
|
|
"value": "white",
|
|
"type": 29
|
|
},
|
|
"outlineColor": {
|
|
"value": [
|
|
1,
|
|
0,
|
|
0,
|
|
1
|
|
],
|
|
"editor": {
|
|
"type": "color",
|
|
"tooltip": "描边颜色"
|
|
},
|
|
"type": 16
|
|
},
|
|
"fntColor": {
|
|
"value": [
|
|
1,
|
|
0,
|
|
0,
|
|
1
|
|
],
|
|
"editor": {
|
|
"type": "color",
|
|
"tooltip": "字体颜色"
|
|
},
|
|
"type": 16
|
|
}
|
|
},
|
|
"program": "fntOutline|vs|fs"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"shaders": [
|
|
{
|
|
"hash": 928547144,
|
|
"glsl3": {
|
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nin vec3 a_position;\nin mediump vec2 a_uv0;\nout mediump vec2 v_uv0;\nin vec4 a_color;\nout vec4 v_color;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n v_uv0 = a_uv0;\n v_color = a_color;\n}",
|
|
"frag": "\nprecision highp float;\nuniform sampler2D texture;\nin mediump vec2 v_uv0;\nin vec4 v_color;\n#if SHOW_OUT_LINE\n uniform Outline {\n vec4 outlineColor;\n vec4 fntColor;\n };\n#endif\nvoid main () {\n vec4 color = v_color;\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n color.a *= texture_tmp.a;\n #else\n color *= texture_tmp;\n #endif\n float temp = 1.0;\n if(color.a == 0.0)\n {\n }\n if(color.r ==1.0 && color.g ==1.0 && color.b == 1.0 )\n {\n color = vec4(fntColor.r*temp, fntColor.g*temp, fntColor.b*temp, color.a);\n }\n else if(color.r ==0.0 && color.g ==0.0 && color.b == 0.0)\n {\n color = vec4(outlineColor.r*temp, outlineColor.g*temp, outlineColor.b*temp, color.a);\n }\n else\n {\n temp = 1.0-(color.r /1.0 + color.g / 1.0 + color.b /1.0)/3.0;\n color = vec4(outlineColor.r*temp+(fntColor.r)*(1.0-temp), outlineColor.g*temp+(fntColor.g)*(1.0-temp), outlineColor.b*temp+(fntColor.b)*(1.0-temp), color.a);\n }\n gl_FragColor =color;\n}"
|
|
},
|
|
"glsl1": {
|
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nattribute vec3 a_position;\nattribute mediump vec2 a_uv0;\nvarying mediump vec2 v_uv0;\nattribute vec4 a_color;\nvarying vec4 v_color;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n v_uv0 = a_uv0;\n v_color = a_color;\n}",
|
|
"frag": "\nprecision highp float;\nuniform sampler2D texture;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\n#if SHOW_OUT_LINE\n uniform vec4 outlineColor;\nuniform vec4 fntColor;\n#endif\nvoid main () {\n vec4 color = v_color;\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n color.a *= texture_tmp.a;\n #else\n color *= texture_tmp;\n #endif\n float temp = 1.0;\n if(color.a == 0.0)\n {\n }\n if(color.r ==1.0 && color.g ==1.0 && color.b == 1.0 )\n {\n color = vec4(fntColor.r*temp, fntColor.g*temp, fntColor.b*temp, color.a);\n }\n else if(color.r ==0.0 && color.g ==0.0 && color.b == 0.0)\n {\n color = vec4(outlineColor.r*temp, outlineColor.g*temp, outlineColor.b*temp, color.a);\n }\n else\n {\n temp = 1.0-(color.r /1.0 + color.g / 1.0 + color.b /1.0)/3.0;\n color = vec4(outlineColor.r*temp+(fntColor.r)*(1.0-temp), outlineColor.g*temp+(fntColor.g)*(1.0-temp), outlineColor.b*temp+(fntColor.b)*(1.0-temp), color.a);\n }\n gl_FragColor =color;\n}"
|
|
},
|
|
"builtins": {
|
|
"globals": {
|
|
"blocks": [
|
|
{
|
|
"name": "CCGlobal",
|
|
"defines": []
|
|
}
|
|
],
|
|
"samplers": []
|
|
},
|
|
"locals": {
|
|
"blocks": [],
|
|
"samplers": []
|
|
}
|
|
},
|
|
"defines": [
|
|
{
|
|
"name": "SHOW_OUT_LINE",
|
|
"type": "boolean",
|
|
"defines": []
|
|
},
|
|
{
|
|
"name": "CC_USE_ALPHA_ATLAS_texture",
|
|
"type": "boolean",
|
|
"defines": []
|
|
},
|
|
{
|
|
"name": "INPUT_IS_GAMMA",
|
|
"type": "boolean",
|
|
"defines": []
|
|
}
|
|
],
|
|
"blocks": [
|
|
{
|
|
"name": "Outline",
|
|
"members": [
|
|
{
|
|
"name": "outlineColor",
|
|
"type": 16,
|
|
"count": 1
|
|
},
|
|
{
|
|
"name": "fntColor",
|
|
"type": 16,
|
|
"count": 1
|
|
}
|
|
],
|
|
"defines": [
|
|
"SHOW_OUT_LINE"
|
|
],
|
|
"binding": 0
|
|
}
|
|
],
|
|
"samplers": [
|
|
{
|
|
"name": "texture",
|
|
"type": 29,
|
|
"count": 1,
|
|
"defines": [],
|
|
"binding": 30
|
|
}
|
|
],
|
|
"record": null,
|
|
"name": "fntOutline|vs|fs"
|
|
}
|
|
]
|
|
} |