MatchMaster/assets/shop/effect/svip_title_shine.effect.meta

18 lines
5.0 KiB
Plaintext

{
"ver": "1.0.27",
"uuid": "8c5713b7-6dd4-4974-9660-02ca571ddf78",
"importer": "effect",
"compiledShaders": [
{
"glsl1": {
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nattribute vec2 a_uv0;\nvarying vec4 v_color;\nvarying vec2 v_uv0;\nvoid main () {\n vec4 pos = vec4(a_position, 1.0);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n gl_Position = pos;\n v_color = a_color;\n v_uv0 = a_uv0;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\nvarying vec2 v_uv0;\nuniform sampler2D texture;\nuniform vec4 shineColor;\nuniform vec4 uvRect;\nuniform float shinePosition;\nuniform float shineWidth;\nuniform float shineStrength;\nuniform float shineAngle;\nuniform float rainbow;\nuniform float uvRotated;\nvoid main () {\n vec4 color = vec4(1.0);\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 color *= v_color;\n vec2 localUV = (v_uv0 - uvRect.xy) / max(uvRect.zw, vec2(0.00001));\n if (uvRotated > 0.5) localUV = vec2(localUV.y, 1.0 - localUV.x);\n float sweepAxis = localUV.x + (localUV.y - 0.5) * shineAngle;\n float bandIn = smoothstep(\n shinePosition - shineWidth,\n shinePosition,\n sweepAxis\n );\n float bandOut = 1.0 - smoothstep(\n shinePosition,\n shinePosition + shineWidth,\n sweepAxis\n );\n float shine = pow(clamp(bandIn * bandOut, 0.0, 1.0), 1.35);\n vec3 glowColor = shineColor.rgb;\n if (rainbow > 0.5) {\n float hue = (sweepAxis - shinePosition) / (2.0 * shineWidth) + 0.5;\n glowColor = 0.5 + 0.5 * cos(6.2831853 * (hue + vec3(0.0, 0.666667, 0.333333)));\n }\n color.rgb += glowColor * shine * shineStrength * color.a;\n ALPHA_TEST(color);\n #if USE_BGRA\n gl_FragColor = color.bgra;\n #else\n gl_FragColor = color.rgba;\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;\nin vec2 a_uv0;\nout vec4 v_color;\nout vec2 v_uv0;\nvoid main () {\n vec4 pos = vec4(a_position, 1.0);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n gl_Position = pos;\n v_color = a_color;\n v_uv0 = a_uv0;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\nin vec2 v_uv0;\nuniform sampler2D texture;\nuniform ShineProperties {\n vec4 shineColor;\n vec4 uvRect;\n float shinePosition;\n float shineWidth;\n float shineStrength;\n float shineAngle;\n float rainbow;\n float uvRotated;\n};\nvoid main () {\n vec4 color = vec4(1.0);\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 color *= v_color;\n vec2 localUV = (v_uv0 - uvRect.xy) / max(uvRect.zw, vec2(0.00001));\n if (uvRotated > 0.5) localUV = vec2(localUV.y, 1.0 - localUV.x);\n float sweepAxis = localUV.x + (localUV.y - 0.5) * shineAngle;\n float bandIn = smoothstep(\n shinePosition - shineWidth,\n shinePosition,\n sweepAxis\n );\n float bandOut = 1.0 - smoothstep(\n shinePosition,\n shinePosition + shineWidth,\n sweepAxis\n );\n float shine = pow(clamp(bandIn * bandOut, 0.0, 1.0), 1.35);\n vec3 glowColor = shineColor.rgb;\n if (rainbow > 0.5) {\n float hue = (sweepAxis - shinePosition) / (2.0 * shineWidth) + 0.5;\n glowColor = 0.5 + 0.5 * cos(6.2831853 * (hue + vec3(0.0, 0.666667, 0.333333)));\n }\n color.rgb += glowColor * shine * shineStrength * color.a;\n ALPHA_TEST(color);\n #if USE_BGRA\n gl_FragColor = color.bgra;\n #else\n gl_FragColor = color.rgba;\n #endif\n}"
}
}
],
"subMetas": {}
}