代码拉取完成,页面将自动刷新
// Eazax-CCC 头像(圆形) 1.0.0.20200522
// https://gitee.com/ifaswind/eazax-ccc/blob/master/resources/effects/eazax-avatar-circle.effect
CCEffect %{
techniques:
- passes:
- vert: vs
frag: fs
blendState:
targets:
- blend: true
rasterizerState:
cullMode: none
properties:
feather: { value: 0.01, editor: { tooltip: '边缘虚化(百分比)' } }
}%
CCProgram vs %{
precision highp float;
#include <cc-global>
in vec3 a_position;
in vec2 a_uv0;
in vec4 a_color;
out vec2 v_uv0;
out vec4 v_color;
void main () {
gl_Position = cc_matViewProj * vec4(a_position, 1);
v_uv0 = a_uv0;
v_color = a_color;
}
}%
CCProgram fs %{
precision highp float;
in vec2 v_uv0;
in vec4 v_color;
uniform sampler2D texture;
uniform Properties {
float feather;
};
void main () {
vec4 color = v_color;
color *= texture(texture, v_uv0);
if (color.a == 0.0) discard;
float dis = distance(vec2(v_uv0.x, v_uv0.y), vec2(0.5, 0.5));
color.a = smoothstep(0.5, 0.5 - feather, dis);
color.a *= v_color.a;
gl_FragColor = color;
}
}%
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。