cocos-awesome/assets/Scene/SwitchScene__DoomScreen/Materials/DoomScreen.effect.meta
2024-09-24 23:42:42 +08:00

17 lines
4.0 KiB
Plaintext

{
"ver": "1.0.25",
"uuid": "921642d4-e655-42a1-ab60-63753338243d",
"compiledShaders": [
{
"glsl1": {
"vert": "\nprecision highp float;\nuniform mediump mat4 cc_matViewProj;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * pos;\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform float bars;\nuniform float amplitude;\nuniform float noise;\nuniform float frequency;\nuniform float dripScale;\nuniform float time;\nfloat progress = time;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture2D(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture2D(texture2, uv);\n}\nfloat rand(int num) {\n return fract(mod(float(num) * 67123.313, 12.0) * sin(float(num) * 10.3) * cos(float(num)));\n}\nfloat wave(int num) {\n float fn = float(num) * frequency * 0.1 * float(bars);\n return cos(fn * 0.5) * cos(fn * 0.13) * sin((fn + 10.0) * 0.3) / 2.0 + 0.5;\n}\nfloat drip(int num) {\n return sin(float(num) / float(bars - 1.0) * 3.141592) * dripScale;\n}\nfloat pos(int num) {\n return (noise == 0.0 ? wave(num) : mix(wave(num), rand(num), noise)) + (dripScale == 0.0 ? 0.0 : drip(num));\n}\nvec4 transition(vec2 uv) {\n int bar = int(uv.x * (float(bars)));\n float scale = 1.0 + pos(bar) * amplitude;\n float phase = progress * scale;\n float posY = uv.y / vec2(1.0).y;\n vec2 p;\n vec4 c;\n if (phase + posY < 1.0) {\n p = vec2(uv.x, uv.y + mix(0.0, vec2(1.0).y, phase)) / vec2(1.0).xy;\n c = getFromColor(p);\n } else {\n p = uv.xy / vec2(1.0).xy;\n c = getToColor(p);\n }\n return c;\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}"
},
"glsl3": {
"vert": "\nprecision highp float;\nuniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_nativeSize;\n highp mat4 cc_matView;\n mediump mat4 cc_matViewInv;\n mediump mat4 cc_matProj;\n mediump mat4 cc_matProjInv;\n mediump mat4 cc_matViewProj;\n mediump mat4 cc_matViewProjInv;\n mediump vec4 cc_cameraPos;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\nin vec2 a_uv0;\nout vec2 v_uv0;\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * pos;\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform DoomScreen {\n float bars;\n float amplitude;\n float noise;\n float frequency;\n float dripScale;\n float time;\n};\nfloat progress = time;\nin mediump vec2 v_uv0;\nin vec4 v_color;\nvec4 getFromColor(vec2 uv) {\n return texture(texture, uv);\n}\nvec4 getToColor(vec2 uv) {\n return texture(texture2, uv);\n}\nfloat rand(int num) {\n return fract(mod(float(num) * 67123.313, 12.0) * sin(float(num) * 10.3) * cos(float(num)));\n}\nfloat wave(int num) {\n float fn = float(num) * frequency * 0.1 * float(bars);\n return cos(fn * 0.5) * cos(fn * 0.13) * sin((fn + 10.0) * 0.3) / 2.0 + 0.5;\n}\nfloat drip(int num) {\n return sin(float(num) / float(bars - 1.0) * 3.141592) * dripScale;\n}\nfloat pos(int num) {\n return (noise == 0.0 ? wave(num) : mix(wave(num), rand(num), noise)) + (dripScale == 0.0 ? 0.0 : drip(num));\n}\nvec4 transition(vec2 uv) {\n int bar = int(uv.x * (float(bars)));\n float scale = 1.0 + pos(bar) * amplitude;\n float phase = progress * scale;\n float posY = uv.y / vec2(1.0).y;\n vec2 p;\n vec4 c;\n if (phase + posY < 1.0) {\n p = vec2(uv.x, uv.y + mix(0.0, vec2(1.0).y, phase)) / vec2(1.0).xy;\n c = getFromColor(p);\n } else {\n p = uv.xy / vec2(1.0).xy;\n c = getToColor(p);\n }\n return c;\n}\nvoid main () {\n gl_FragColor = v_color * transition(v_uv0);\n}"
}
}
],
"subMetas": {}
}