{ "ver": "1.0.27", "uuid": "80e4a9c8-be05-48f0-bb5d-537db8a95eab", "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 float shinePosition;\nuniform float shineWidth;\nuniform float shineStrength;\nuniform float shineAngle;\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 float sweepAxis = v_uv0.x + (v_uv0.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 color.rgb += shineColor.rgb * 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 float shinePosition;\n float shineWidth;\n float shineStrength;\n float shineAngle;\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 float sweepAxis = v_uv0.x + (v_uv0.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 color.rgb += shineColor.rgb * 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": {} }