CocosCreator-Shader-Effect-.../assets/effects/loading-style-1.effect.meta

17 lines
5.9 KiB
Plaintext
Raw Normal View History

{
"ver": "1.0.25",
"uuid": "aa3b729c-fb16-4293-8789-8b7f36e017f1",
"compiledShaders": [
{
"glsl1": {
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\nuniform vec4 cc_time;\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_ANTI_ALIAS\n#endif\n#if USE_LOADING_STYLE\nuniform vec4 u_arc_color;\nuniform vec4 u_ball_color;\nuniform float u_arc_line_width;\nuniform float u_arc_radius;\nuniform float u_ball_angle;\nuniform float u_ball_angle_range;\nuniform float u_ball_radius;\nvec2 getUv0Shadow() {\n vec2 uv0 = v_uv0 - vec2(0.5, 0.5);\n float rotation_angle = u_ball_angle + cc_time.x * 200.0;\n float rotation_radians = radians(rotation_angle);\n vec2 uv0_after_rotation = vec2(\n uv0.x * cos(rotation_radians) - uv0.y * sin(rotation_radians),\n uv0.x * sin(rotation_radians) + uv0.y * cos(rotation_radians)\n );\n return uv0_after_rotation;\n}\nvec4 getArcColor() {\n vec2 uv0 = getUv0Shadow();\n float len = length(uv0);\n float min_radius = u_arc_radius - u_arc_line_width * 0.5;\n float max_radius = u_arc_radius + u_arc_line_width * 0.5;\n if (len >= min_radius && len <= max_radius) {\n float radian = acos(uv0.x / len);\n float radian_range = radians(u_ball_angle_range * 0.5);\n if (radian >= radian_range) {\n float alpha = 1.0;\n #if USE_ANTI_ALIAS\n alpha = smoothstep(0.0, 0.05, 1.0 - abs(len - u_arc_radius) / (u_arc_line_width * 0.5));\n #endif\n return u_arc_color * alpha;\n }\n }\n return vec4(0.0, 0.0, 0.0, 0.0);\n}\nvec4 getBallColor() {\n vec2 uv0 = getUv0Shadow();\n vec2 ball_center_point = vec2(u_arc_radius, 0);\n float ball_radius = u_ball_radius + u_ball_radius * 0.3 * cos(radians(cc_time.x * 200.0));\n float dis = distance(uv0, ball_center_point);\n if (dis <= ball_radius) {\n float alpha = 1.0;\n #if USE_ANTI_ALIAS\n alpha = smoothstep(0.0, 0.01, ball_radius - dis);\n #endif\n return u_ball_color * alpha;\n } else{\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n gl_FragColor = o;\n #if USE_LOADING_STYLE\n vec4 arc_color = getArcColor();\n vec4 ball_color = getBallColor();\n gl_FragColor = ball_color * ball_color.a + arc_color;\n #endif\n}"
},
"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};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\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 vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_ANTI_ALIAS\n#endif\n#if USE_LOADING_STYLE\nuniform style{\n vec4 u_arc_color;\n vec4 u_ball_color;\n float u_arc_line_width;\n float u_arc_radius;\n float u_ball_angle;\n float u_ball_angle_range;\n float u_ball_radius;\n};\nvec2 getUv0Shadow() {\n vec2 uv0 = v_uv0 - vec2(0.5, 0.5);\n float rotation_angle = u_ball_angle + cc_time.x * 200.0;\n float rotation_radians = radians(rotation_angle);\n vec2 uv0_after_rotation = vec2(\n uv0.x * cos(rotation_radians) - uv0.y * sin(rotation_radians),\n uv0.x * sin(rotation_radians) + uv0.y * cos(rotation_radians)\n );\n return uv0_after_rotation;\n}\nvec4 getArcColor() {\n vec2 uv0 = getUv0Shadow();\n float len = length(uv0);\n float min_radius = u_arc_radius - u_arc_line_width * 0.5;\n float max_radius = u_arc_radius + u_arc_line_width * 0.5;\n if (len >= min_radius && len <= max_radius) {\n float radian = acos(uv0.x / len);\n float radian_range = radians(u_ball_angle_range * 0.5);\n if (radian >= radian_range) {\n float alpha = 1.0;\n #if USE_ANTI_ALIAS\n alpha = smoothstep(0.0, 0.05, 1.0 - abs(len - u_arc_radius) / (u_arc_line_width * 0.5));\n #endif\n return u_arc_color * alpha;\n }\n }\n return vec4(0.0, 0.0, 0.0, 0.0);\n}\nvec4 getBallColor() {\n vec2 uv0 = getUv0Shadow();\n vec2 ball_center_point = vec2(u_arc_radius, 0);\n float ball_radius = u_ball_radius + u_ball_radius * 0.3 * cos(radians(cc_time.x * 200.0));\n float dis = distance(uv0, ball_center_point);\n if (dis <= ball_radius) {\n float alpha = 1.0;\n #if USE_ANTI_ALIAS\n alpha = smoothstep(0.0, 0.01, ball_radius - dis);\n #endif\n return u_ball_color * alpha;\n } else{\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n gl_FragColor = o;\n #if USE_LOADING_STYLE\n vec4 arc_color = getArcColor();\n vec4 ball_color = getBallColor();\n gl_FragColor = ball_color * ball_color.a + arc_color;\n #endif\n}"
}
}
],
"subMetas": {}
}