├── settings ├── services.json └── project.json ├── readme_pic ├── shader.png └── hetucuowu.png ├── assets ├── Resources │ ├── picture │ │ ├── card.png │ │ ├── doge.jpg │ │ ├── button.png │ │ ├── Lighting1.png │ │ ├── button.png.meta │ │ ├── doge.jpg.meta │ │ ├── Lighting1.png.meta │ │ └── card.png.meta │ ├── material │ │ ├── BlurGauss.mtl.meta │ │ ├── Disslove.mtl.meta │ │ ├── Fluxay.mtl.meta │ │ ├── Glowing.mtl.meta │ │ ├── Mosaic.mtl.meta │ │ ├── Water.mtl.meta │ │ ├── WaveLight.mtl.meta │ │ ├── BlurNormal.mtl.meta │ │ ├── RadialBlur.mtl.meta │ │ ├── WaveLight.mtl │ │ ├── Disslove.mtl │ │ ├── BlurGauss.mtl │ │ ├── BlurNormal.mtl │ │ ├── Fluxay.mtl │ │ ├── Water.mtl │ │ ├── Mosaic.mtl │ │ ├── RadialBlur.mtl │ │ └── Glowing.mtl │ ├── scene.meta │ ├── effect.meta │ ├── material.meta │ ├── picture.meta │ ├── script.meta │ ├── scene │ │ ├── main.fire.meta │ │ └── main.fire │ ├── script │ │ ├── ShaderController.ts.meta │ │ └── ShaderController.ts │ └── effect │ │ ├── Dissolve.effect │ │ ├── Mosaic.effect │ │ ├── BlurNormal.effect │ │ ├── RadialBlur.effect │ │ ├── Dissolve.effect.meta │ │ ├── Water.effect │ │ ├── Mosaic.effect.meta │ │ ├── Fluxay.effect │ │ ├── BlurGauss.effect │ │ ├── WaveLight.effect │ │ ├── RadialBlur.effect.meta │ │ ├── BlurNormal.effect.meta │ │ ├── Water.effect.meta │ │ ├── Fluxay.effect.meta │ │ ├── BlurGauss.effect.meta │ │ ├── WaveLight.effect.meta │ │ ├── Glowing.effect │ │ └── Glowing.effect.meta └── Resources.meta ├── project.json ├── jsconfig.json ├── .gitignore └── README.md /settings/services.json: -------------------------------------------------------------------------------- 1 | { 2 | "game": { 3 | "name": "未知游戏", 4 | "appid": "UNKNOW" 5 | } 6 | } -------------------------------------------------------------------------------- /readme_pic/shader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuDaFei/CocosCreator-2.2.X-shader-demo/HEAD/readme_pic/shader.png -------------------------------------------------------------------------------- /readme_pic/hetucuowu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuDaFei/CocosCreator-2.2.X-shader-demo/HEAD/readme_pic/hetucuowu.png -------------------------------------------------------------------------------- /assets/Resources/picture/card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuDaFei/CocosCreator-2.2.X-shader-demo/HEAD/assets/Resources/picture/card.png -------------------------------------------------------------------------------- /assets/Resources/picture/doge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuDaFei/CocosCreator-2.2.X-shader-demo/HEAD/assets/Resources/picture/doge.jpg -------------------------------------------------------------------------------- /assets/Resources/picture/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuDaFei/CocosCreator-2.2.X-shader-demo/HEAD/assets/Resources/picture/button.png -------------------------------------------------------------------------------- /assets/Resources/picture/Lighting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XuDaFei/CocosCreator-2.2.X-shader-demo/HEAD/assets/Resources/picture/Lighting1.png -------------------------------------------------------------------------------- /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine": "cocos-creator-js", 3 | "packages": "packages", 4 | "version": "2.2.1", 5 | "id": "a7b70274-07dd-4988-8f4d-fa47015832df" 6 | } -------------------------------------------------------------------------------- /assets/Resources/material/BlurGauss.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "b4bd1276-dc2b-4f11-84d3-50c9f68daaaa", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Resources/material/Disslove.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "9d0c46d2-2026-42ec-b3cf-d34b07471c6e", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Resources/material/Fluxay.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "1afce21c-91c0-4bf4-824a-1bf65c5ab976", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Resources/material/Glowing.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "af53adf5-e563-42b6-b383-d6e0c56638c1", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Resources/material/Mosaic.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "83e16eb7-e8bc-408d-9fe7-2a518e6803a0", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Resources/material/Water.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "e673829a-3372-4e5e-b3ad-45090fb7b4b1", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Resources/material/WaveLight.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "5105e692-6f15-42df-8b29-70646ea07be9", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Resources.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "c04aeca1-cbce-4add-9ff9-5dd17296b80b", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Resources/material/BlurNormal.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "cbf349e7-9626-443d-ae30-4572f81fad2f", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Resources/material/RadialBlur.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "8f0a0dc1-7084-4481-ba38-c404557dc52e", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Resources/scene.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "6949475a-8182-4735-af5d-ceebd726f82e", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Resources/effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "d0b017f7-a6cf-4ac2-a7bb-7f12651d3b10", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Resources/material.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "7ac67478-2a74-402e-971b-8e4aa8058cbf", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Resources/picture.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "0421f3da-2a3b-452f-b35b-96b2e6548c12", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Resources/script.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "da5ec520-7a5e-41c3-8388-b31a9e9840b1", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Resources/scene/main.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.5", 3 | "uuid": "740c9049-6f22-4fa2-abda-61ad9e1335eb", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Resources/script/ShaderController.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "ee8e4708-0626-4367-84ad-a44d4465fbb3", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Resources/material/WaveLight.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "ae91e5d2-7d0a-41f4-a4fa-ffe0037ff8a0" 8 | }, 9 | "_defines": {}, 10 | "_props": {} 11 | } -------------------------------------------------------------------------------- /assets/Resources/material/Disslove.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "ed4b64c1-0535-4ae5-9648-4acb0a4c0fd8" 8 | }, 9 | "_defines": {}, 10 | "_props": { 11 | "u_time": 0.5 12 | } 13 | } -------------------------------------------------------------------------------- /assets/Resources/material/BlurGauss.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "d64b960e-910a-4f6a-a413-b37932350ea6" 8 | }, 9 | "_defines": {}, 10 | "_props": { 11 | "u_degree": 0.02 12 | } 13 | } -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "experimentalDecorators": true 6 | }, 7 | "exclude": [ 8 | "node_modules", 9 | ".vscode", 10 | "library", 11 | "local", 12 | "settings", 13 | "temp" 14 | ] 15 | } -------------------------------------------------------------------------------- /assets/Resources/material/BlurNormal.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "14e64f7c-87c8-459a-ad37-6c773ceea4e6" 8 | }, 9 | "_defines": {}, 10 | "_props": { 11 | "u_resolution": { 12 | "__type__": "cc.Vec2", 13 | "x": 284, 14 | "y": 399 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /assets/Resources/material/Fluxay.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "d65ecfab-7310-4b95-8db8-371104329878" 8 | }, 9 | "_defines": {}, 10 | "_props": { 11 | "u_fluxayTexture": { 12 | "__uuid__": "ee84914d-bfad-4f0f-a92e-f88764d50828" 13 | }, 14 | "u_time": 0.7 15 | } 16 | } -------------------------------------------------------------------------------- /assets/Resources/material/Water.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "7d5495a0-26aa-4858-a9db-37507aff7ba4" 8 | }, 9 | "_defines": {}, 10 | "_props": { 11 | "u_resolution": { 12 | "__type__": "cc.Vec2", 13 | "x": 284, 14 | "y": 300 15 | }, 16 | "u_time": 0.3 17 | } 18 | } -------------------------------------------------------------------------------- /assets/Resources/material/Mosaic.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "8b12cd41-6673-45b2-8e81-f77078e331b4" 8 | }, 9 | "_defines": {}, 10 | "_props": { 11 | "u_resolution": { 12 | "__type__": "cc.Vec2", 13 | "x": 200, 14 | "y": 300 15 | }, 16 | "u_mosaicSize": 5 17 | } 18 | } -------------------------------------------------------------------------------- /assets/Resources/material/RadialBlur.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "9d24dc19-8d72-483a-903d-914ccf86f169" 8 | }, 9 | "_defines": {}, 10 | "_props": { 11 | "u_point": { 12 | "__type__": "cc.Vec2", 13 | "x": 0.5, 14 | "y": 0.5 15 | }, 16 | "u_resolution": { 17 | "__type__": "cc.Vec2", 18 | "x": 200, 19 | "y": 300 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /assets/Resources/material/Glowing.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "0f9457ac-e49b-4ec4-bd74-11b0eabbdb4d" 8 | }, 9 | "_defines": { 10 | "IS_Edge_Blur": false, 11 | "IS_EdgeGlowing": true, 12 | "USE_EDGE_COLOR": true 13 | }, 14 | "_props": { 15 | "u_edge": 0.5, 16 | "u_offset": 0.1, 17 | "u_edgeBlur": 0.1, 18 | "u_edgeColor": { 19 | "__type__": "cc.Color", 20 | "r": 245, 21 | "g": 220, 22 | "b": 41, 23 | "a": 255 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /settings/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "start-scene": "current", 3 | "group-list": [ 4 | "default" 5 | ], 6 | "collision-matrix": [ 7 | [ 8 | true 9 | ] 10 | ], 11 | "excluded-modules": [], 12 | "last-module-event-record-time": 0, 13 | "design-resolution-width": 960, 14 | "design-resolution-height": 640, 15 | "fit-width": false, 16 | "fit-height": true, 17 | "use-project-simulator-setting": false, 18 | "simulator-orientation": false, 19 | "use-customize-simulator": false, 20 | "simulator-resolution": { 21 | "width": 960, 22 | "height": 640 23 | }, 24 | "assets-sort-type": "name", 25 | "facebook": { 26 | "enable": false, 27 | "appID": "", 28 | "live": { 29 | "enable": false 30 | }, 31 | "audience": { 32 | "enable": false 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /assets/Resources/picture/button.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.3", 3 | "uuid": "ae28f27b-f641-4b35-855c-042c4edc9683", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "genMipmaps": false, 9 | "packable": true, 10 | "platformSettings": {}, 11 | "subMetas": { 12 | "button": { 13 | "ver": "1.0.4", 14 | "uuid": "7cec85b1-18b2-4ecc-aa8b-df936cedb4cc", 15 | "rawTextureUuid": "ae28f27b-f641-4b35-855c-042c4edc9683", 16 | "trimType": "auto", 17 | "trimThreshold": 1, 18 | "rotated": false, 19 | "offsetX": 0, 20 | "offsetY": 0, 21 | "trimX": 0, 22 | "trimY": 0, 23 | "width": 273, 24 | "height": 69, 25 | "rawWidth": 273, 26 | "rawHeight": 69, 27 | "borderTop": 0, 28 | "borderBottom": 0, 29 | "borderLeft": 0, 30 | "borderRight": 0, 31 | "subMetas": {} 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /assets/Resources/picture/doge.jpg.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.3", 3 | "uuid": "c8f25bc5-8fcc-4793-b7d2-e137572919b5", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "genMipmaps": false, 9 | "packable": false, 10 | "platformSettings": {}, 11 | "subMetas": { 12 | "doge": { 13 | "ver": "1.0.4", 14 | "uuid": "d65aa96e-b301-4247-a2b8-98542cff5287", 15 | "rawTextureUuid": "c8f25bc5-8fcc-4793-b7d2-e137572919b5", 16 | "trimType": "auto", 17 | "trimThreshold": 1, 18 | "rotated": false, 19 | "offsetX": 0, 20 | "offsetY": 0, 21 | "trimX": 0, 22 | "trimY": 0, 23 | "width": 259, 24 | "height": 251, 25 | "rawWidth": 259, 26 | "rawHeight": 251, 27 | "borderTop": 0, 28 | "borderBottom": 0, 29 | "borderLeft": 0, 30 | "borderRight": 0, 31 | "subMetas": {} 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /assets/Resources/picture/Lighting1.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.3", 3 | "uuid": "ee84914d-bfad-4f0f-a92e-f88764d50828", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "genMipmaps": false, 9 | "packable": true, 10 | "platformSettings": {}, 11 | "subMetas": { 12 | "Lighting1": { 13 | "ver": "1.0.4", 14 | "uuid": "1ee898d3-b293-4eb0-a9ea-dbd5f58a7877", 15 | "rawTextureUuid": "ee84914d-bfad-4f0f-a92e-f88764d50828", 16 | "trimType": "auto", 17 | "trimThreshold": 1, 18 | "rotated": false, 19 | "offsetX": 0, 20 | "offsetY": 0, 21 | "trimX": 0, 22 | "trimY": 0, 23 | "width": 130, 24 | "height": 50, 25 | "rawWidth": 130, 26 | "rawHeight": 50, 27 | "borderTop": 0, 28 | "borderBottom": 0, 29 | "borderLeft": 0, 30 | "borderRight": 0, 31 | "subMetas": {} 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /assets/Resources/picture/card.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.3", 3 | "uuid": "98b62bdd-03ee-41d7-832f-a0d0aeed4fee", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "genMipmaps": false, 9 | "packable": false, 10 | "platformSettings": {}, 11 | "subMetas": { 12 | "card": { 13 | "ver": "1.0.4", 14 | "uuid": "58b39b44-d165-415a-afc9-1655148ada22", 15 | "rawTextureUuid": "98b62bdd-03ee-41d7-832f-a0d0aeed4fee", 16 | "trimType": "auto", 17 | "trimThreshold": 1, 18 | "rotated": false, 19 | "offsetX": -8.5, 20 | "offsetY": -18, 21 | "trimX": 3, 22 | "trimY": 51, 23 | "width": 284, 24 | "height": 399, 25 | "rawWidth": 307, 26 | "rawHeight": 465, 27 | "borderTop": 0, 28 | "borderBottom": 0, 29 | "borderLeft": 0, 30 | "borderRight": 0, 31 | "subMetas": {} 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /assets/Resources/effect/Dissolve.effect: -------------------------------------------------------------------------------- 1 | //溶解特效 2 | 3 | CCEffect %{ 4 | techniques: 5 | - passes: 6 | - vert: vs 7 | frag: fs 8 | blendState: 9 | targets: 10 | - blend: true 11 | rasterizerState: 12 | cullMode: none 13 | properties: 14 | texture: { value: white } 15 | u_time: { value: 1.0 } 16 | }% 17 | 18 | CCProgram vs %{ 19 | #include 20 | precision highp float; 21 | in vec3 a_position; 22 | in vec2 a_uv0; 23 | out vec2 uv0; 24 | void main () { 25 | gl_Position = cc_matViewProj * vec4(a_position, 1); 26 | uv0 = a_uv0; 27 | } 28 | }% 29 | 30 | CCProgram fs %{ 31 | precision highp float; //定义高精度 32 | uniform sampler2D texture; //纹理 33 | uniform ARGS { 34 | //时间 根据时间计算需要丢弃的像素颜色值范围,也就是溶解的范围 35 | float u_time; 36 | } 37 | in vec2 uv0; 38 | 39 | void main() 40 | { 41 | float time = u_time; 42 | vec4 c = texture2D(texture,uv0); 43 | float height = c.g; 44 | if(height < time) 45 | { 46 | //丢弃像素,相当于溶解效果 47 | discard; 48 | } 49 | if(height < time + 0.1) { 50 | //这里可以对溶解边缘进行一些处理,比如透明度减少等 51 | c.a = c.a-0.1; 52 | } 53 | //给片元(像素)赋值 54 | gl_FragColor = c; 55 | } 56 | }% -------------------------------------------------------------------------------- /assets/Resources/effect/Mosaic.effect: -------------------------------------------------------------------------------- 1 | //马赛克 2 | 3 | CCEffect %{ 4 | techniques: 5 | - passes: 6 | - vert: vs 7 | frag: fs 8 | blendState: 9 | targets: 10 | - blend: true 11 | rasterizerState: 12 | cullMode: none 13 | properties: 14 | texture: { value: white } 15 | u_resolution: { value: [1280,720] } 16 | u_mosaicSize: { value: 12 } 17 | }% 18 | 19 | CCProgram vs %{ 20 | #include 21 | precision highp float; 22 | in vec3 a_position; 23 | in vec2 a_uv0; 24 | out vec2 uv0; 25 | void main () { 26 | gl_Position = cc_matViewProj * vec4(a_position, 1); 27 | uv0 = a_uv0; 28 | } 29 | }% 30 | 31 | CCProgram fs %{ 32 | precision highp float; 33 | in vec2 uv0; 34 | uniform sampler2D texture; 35 | uniform ARGS { 36 | vec2 u_resolution; 37 | float u_mosaicSize; 38 | } 39 | void main(void) 40 | { 41 | vec4 color; 42 | vec2 xy = vec2(uv0.x * u_resolution.x, uv0.y * u_resolution.y); 43 | vec2 xyMosaic = vec2(floor(xy.x / u_mosaicSize) * u_mosaicSize, floor(xy.y / u_mosaicSize) * u_mosaicSize); 44 | vec2 uvMosaic = vec2(xyMosaic.x / u_resolution.x, xyMosaic.y / u_resolution.y); 45 | color = texture2D( texture, uvMosaic); 46 | gl_FragColor = color; 47 | } 48 | }% 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #///////////////////////////////////////////////////////////////////////////// 2 | # Fireball Projects 3 | #///////////////////////////////////////////////////////////////////////////// 4 | 5 | /library/ 6 | /temp/ 7 | /local/ 8 | /build/ 9 | 10 | #///////////////////////////////////////////////////////////////////////////// 11 | # npm files 12 | #///////////////////////////////////////////////////////////////////////////// 13 | 14 | npm-debug.log 15 | node_modules/ 16 | 17 | #///////////////////////////////////////////////////////////////////////////// 18 | # Logs and databases 19 | #///////////////////////////////////////////////////////////////////////////// 20 | 21 | *.log 22 | *.sql 23 | *.sqlite 24 | 25 | #///////////////////////////////////////////////////////////////////////////// 26 | # files for debugger 27 | #///////////////////////////////////////////////////////////////////////////// 28 | 29 | *.sln 30 | *.csproj 31 | *.pidb 32 | *.unityproj 33 | *.suo 34 | 35 | #///////////////////////////////////////////////////////////////////////////// 36 | # OS generated files 37 | #///////////////////////////////////////////////////////////////////////////// 38 | 39 | .DS_Store 40 | ehthumbs.db 41 | Thumbs.db 42 | 43 | #///////////////////////////////////////////////////////////////////////////// 44 | # WebStorm files 45 | #///////////////////////////////////////////////////////////////////////////// 46 | 47 | .idea/ 48 | 49 | #////////////////////////// 50 | # VS Code files 51 | #////////////////////////// 52 | 53 | .vscode/ 54 | -------------------------------------------------------------------------------- /assets/Resources/effect/BlurNormal.effect: -------------------------------------------------------------------------------- 1 | //高斯模糊2 2 | 3 | CCEffect %{ 4 | techniques: 5 | - passes: 6 | - vert: vs 7 | frag: fs 8 | blendState: 9 | targets: 10 | - blend: true 11 | rasterizerState: 12 | cullMode: none 13 | properties: 14 | texture: { value: white } 15 | u_resolution: { value: [1280,720] } 16 | }% 17 | 18 | CCProgram vs %{ 19 | #include 20 | precision highp float; // 定义float高精度 21 | in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰; 22 | in vec2 a_uv0; // 纹理坐标; 23 | out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值 24 | void main () { 25 | vec4 pos = cc_matViewProj * vec4(a_position, 1); 26 | gl_Position = pos; 27 | uv0 = a_uv0; 28 | } 29 | }% 30 | 31 | CCProgram fs %{ 32 | precision mediump float; 33 | in vec2 uv0; 34 | uniform sampler2D texture; 35 | uniform ARGS { 36 | vec2 u_resolution; 37 | float strength; 38 | } 39 | const float blurRadius = 7.0; 40 | void main() 41 | { 42 | vec2 unit = 1.0 / u_resolution; //单位坐标 43 | vec3 sumColor = vec3(0.0, 0.0, 0.0); 44 | float count = 0.0; 45 | vec4 col = vec4(0.0); 46 | for(float fy = -blurRadius; fy <= blurRadius; ++fy) 47 | { 48 | for(float fx = -blurRadius; fx <= blurRadius; ++fx) 49 | { 50 | float weight = (blurRadius - abs(fx)) * (blurRadius - abs(fy)); //权重,p点的权重最高,向四周依次减少 51 | col += texture2D(texture, uv0 + vec2(fx * unit.x, fy * unit.y)) * weight; 52 | count += weight; 53 | } 54 | } 55 | col.a = texture2D(texture, uv0).a; 56 | gl_FragColor = vec4(col.rgb / count, col.a); 57 | } 58 | }% 59 | -------------------------------------------------------------------------------- /assets/Resources/effect/RadialBlur.effect: -------------------------------------------------------------------------------- 1 | //径向模糊 2 | 3 | CCEffect %{ 4 | techniques: 5 | - passes: 6 | - vert: vs 7 | frag: fs 8 | blendState: 9 | targets: 10 | - blend: true 11 | rasterizerState: 12 | cullMode: none 13 | properties: 14 | texture: { value: white } 15 | u_point: { value: [0.5, 0.5] } 16 | u_resolution: { value: [1280, 720] } 17 | u_Strength: { value: 0.125 } 18 | }% 19 | 20 | CCProgram vs %{ // 顶点Shader模块开始 21 | #include 22 | precision highp float; //定义float高精度 23 | in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰; 24 | in vec2 a_uv0; // 纹理坐标; 25 | out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值 26 | void main () { 27 | gl_Position = cc_matViewProj * vec4(a_position, 1); 28 | uv0 = a_uv0; 29 | } 30 | }% 31 | 32 | CCProgram fs %{ 33 | precision highp float; 34 | in vec2 uv0; 35 | uniform sampler2D texture; 36 | uniform ARGS{ 37 | vec2 u_resolution; 38 | vec2 u_point; 39 | float u_Strength; 40 | } 41 | void mainImage( out vec4 fragColor, in vec2 fragCoord ) 42 | { 43 | // const float u_Strength = 0.125; 44 | const int Samples = 64; //multiple of 2 45 | vec2 uv = fragCoord.xy; 46 | vec2 dir = (fragCoord.xy-u_point.xy); 47 | vec4 color = vec4(0.0,0.0,0.0,0.0); 48 | for (int i = 0; i < Samples; i += 2) //operating at 2 samples for better performance 49 | { 50 | color += texture2D(texture,uv+float(i)/float(Samples)*dir*u_Strength); 51 | color += texture2D(texture,uv+float(i+1)/float(Samples)*dir*u_Strength); 52 | } 53 | fragColor = color/float(Samples); 54 | } 55 | 56 | void main(void) 57 | { 58 | mainImage(gl_FragColor, uv0); 59 | } 60 | }% 61 | -------------------------------------------------------------------------------- /assets/Resources/effect/Dissolve.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.23", 3 | "uuid": "ed4b64c1-0535-4ae5-9648-4acb0a4c0fd8", 4 | "compiledShaders": [ 5 | { 6 | "glsl1": { 7 | "vert": "uniform mat4 cc_matViewProj;\n\nprecision highp float;\n attribute vec3 a_position;\n attribute vec2 a_uv0;\n varying vec2 uv0;\n void main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n }\n", 8 | "frag": "\nprecision highp float;\n\nuniform sampler2D texture;\n\nuniform float u_time;\nvarying vec2 uv0;\n\nvoid main()\n{\n float time = u_time;\n vec4 c = texture2D(texture,uv0);\n float height = c.g;\n if(height < time)\n {\n\n discard;\n }\n if(height < time + 0.1) {\n\n c.a = c.a-0.1;\n }\n\n gl_FragColor = c;\n}\n" 9 | }, 10 | "glsl3": { 11 | "vert": "uniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\nprecision highp float;\n in vec3 a_position;\n in vec2 a_uv0;\n out vec2 uv0;\n void main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n }\n", 12 | "frag": "\nprecision highp float;\n\nuniform sampler2D texture;\n\nuniform ARGS {\n\n float u_time;\n}\nin vec2 uv0;\n\nvoid main()\n{\n float time = u_time;\n vec4 c = texture2D(texture,uv0);\n float height = c.g;\n if(height < time)\n {\n\n discard;\n }\n if(height < time + 0.1) {\n\n c.a = c.a-0.1;\n }\n\n gl_FragColor = c;\n}\n" 13 | } 14 | } 15 | ], 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Resources/effect/Water.effect: -------------------------------------------------------------------------------- 1 | //水波纹效果 2 | CCEffect %{ 3 | techniques: 4 | - passes: 5 | - vert: vs 6 | frag: fs 7 | blendState: 8 | targets: 9 | - blend: true 10 | rasterizerState: 11 | cullMode: none 12 | properties: 13 | texture: { value: white } 14 | u_resolution: { value: [1280,720] } 15 | u_time: { value: 1.0 } 16 | }% 17 | 18 | CCProgram vs %{ // 顶点Shader模块开始 19 | #include 20 | precision highp float; //定义float高精度 21 | in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰; 22 | in vec2 a_uv0; // 纹理坐标; 23 | out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值 24 | void main () { 25 | gl_Position = cc_matViewProj * vec4(a_position, 1); 26 | uv0 = a_uv0; 27 | } 28 | }% 29 | 30 | CCProgram fs %{ 31 | precision highp float; 32 | in vec2 uv0; 33 | uniform sampler2D texture; 34 | uniform ARGS { 35 | vec4 UVoffset; 36 | vec2 u_resolution; 37 | float u_time; 38 | float rotated; 39 | } 40 | 41 | #define F cos(x-y)*cos(y),sin(x+y)*sin(y) 42 | 43 | vec2 s(vec2 p) 44 | { 45 | float d=u_time*0.2,x=8.*(p.x+d),y=8.*(p.y+d); 46 | return vec2(F); 47 | } 48 | void mainImage( out vec4 fragColor, in vec2 fragCoord ) 49 | { 50 | // 换成resolution 51 | vec2 rs = u_resolution.xy; 52 | // 换成纹理坐标v_texCoord.xy 53 | vec2 uv = fragCoord; 54 | vec2 q = uv+2./u_resolution.x*(s(uv)-s(uv+rs)); 55 | //反转y 56 | //q.y=1.-q.y; 57 | fragColor = texture2D(texture, q); 58 | } 59 | void main() 60 | { 61 | vec2 UVnormalize; 62 | UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x); 63 | UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y); 64 | if(rotated > 0.5) 65 | { 66 | float temp = UVnormalize.x; 67 | UVnormalize.x = UVnormalize.y; 68 | UVnormalize.y = 1.0 - temp; 69 | } 70 | mainImage(gl_FragColor, uv0.xy); 71 | } 72 | }% 73 | -------------------------------------------------------------------------------- /assets/Resources/script/ShaderController.ts: -------------------------------------------------------------------------------- 1 | const {ccclass,property} = cc._decorator; 2 | 3 | @ccclass 4 | export default class ShaderTime extends cc.Component 5 | { 6 | /**记录时间 */ 7 | private time: number; 8 | private sprite: cc.Sprite; 9 | /**精灵上的材质 */ 10 | private material: any; 11 | /**增加还是减少 */ 12 | private IsAdd: boolean; 13 | 14 | /**速度 */ 15 | @property({type: cc.Float,tooltip: "速度"}) 16 | speed = 1.0; 17 | 18 | /**是否循环 */ 19 | @property({tooltip: "是否循环"}) 20 | isLoop: boolean = false; 21 | 22 | /**是否设置UV到effect(解决动态合图的bug) */ 23 | @property({tooltip: "是否设置UV到effect(解决动态合图的bug)"}) 24 | isSetUv: boolean = false; 25 | 26 | start() 27 | { 28 | this.time = 0; 29 | this.IsAdd = true; 30 | this.sprite = this.node.getComponent(cc.Sprite); 31 | this.material = this.sprite.getMaterial(0); //获取材质 32 | } 33 | 34 | update(dt) 35 | { 36 | this.material.setProperty("u_time",this.time); //设置材质对应的属性 37 | (this.isLoop && !this.IsAdd) ? this.time -= dt * this.speed : this.time += dt * this.speed; 38 | if(this.isSetUv) 39 | { //传递UV 参数到 effect 40 | let frame = this.sprite.spriteFrame as any; 41 | let l = 0,r = 0,b = 1,t = 1; 42 | l = frame.uv[0]; 43 | t = frame.uv[5]; 44 | r = frame.uv[6]; 45 | b = frame.uv[3]; 46 | let u_UVoffset = new cc.Vec4(l,t,r,b); 47 | let u_rotated = frame.isRotated() ? 1.0 : 0.0; 48 | this.material.setProperty("u_UVoffset",u_UVoffset); 49 | this.material.setProperty("u_rotated",u_rotated); 50 | } 51 | cc.log(this.time); 52 | if(this.time > 1.5) 53 | { 54 | this.IsAdd = false; 55 | } 56 | else if(this.time < -0.5) 57 | { 58 | this.IsAdd = true; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /assets/Resources/effect/Mosaic.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.23", 3 | "uuid": "8b12cd41-6673-45b2-8e81-f77078e331b4", 4 | "compiledShaders": [ 5 | { 6 | "glsl1": { 7 | "vert": "uniform mat4 cc_matViewProj;\n\nprecision highp float;\nattribute vec3 a_position;\nattribute vec2 a_uv0;\nvarying vec2 uv0;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 8 | "frag": "\nprecision highp float;\nvarying vec2 uv0;\nuniform sampler2D texture;\nuniform vec2 u_resolution;\nuniform float u_mosaicSize;\nvoid main(void)\n{\n vec4 color;\n vec2 xy = vec2(uv0.x * u_resolution.x, uv0.y * u_resolution.y);\n vec2 xyMosaic = vec2(floor(xy.x / u_mosaicSize) * u_mosaicSize, floor(xy.y / u_mosaicSize) * u_mosaicSize);\n vec2 uvMosaic = vec2(xyMosaic.x / u_resolution.x, xyMosaic.y / u_resolution.y);\n color = texture2D( texture, uvMosaic);\n gl_FragColor = color; \n}\n" 9 | }, 10 | "glsl3": { 11 | "vert": "uniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\nprecision highp float;\nin vec3 a_position;\nin vec2 a_uv0;\nout vec2 uv0;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 12 | "frag": "\nprecision highp float;\nin vec2 uv0;\nuniform sampler2D texture;\nuniform ARGS {\n vec2 u_resolution;\n float u_mosaicSize;\n}\nvoid main(void)\n{\n vec4 color;\n vec2 xy = vec2(uv0.x * u_resolution.x, uv0.y * u_resolution.y);\n vec2 xyMosaic = vec2(floor(xy.x / u_mosaicSize) * u_mosaicSize, floor(xy.y / u_mosaicSize) * u_mosaicSize);\n vec2 uvMosaic = vec2(xyMosaic.x / u_resolution.x, xyMosaic.y / u_resolution.y);\n color = texture2D( texture, uvMosaic);\n gl_FragColor = color; \n}\n" 13 | } 14 | } 15 | ], 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Resources/effect/Fluxay.effect: -------------------------------------------------------------------------------- 1 | //流光shader 2 | CCEffect %{ 3 | techniques: 4 | - passes: 5 | - vert: vs 6 | frag: fs 7 | blendState: 8 | targets: 9 | - blend: true 10 | rasterizerState: 11 | cullMode: none 12 | properties: 13 | texture: { value: white } 14 | u_fluxayTexture: { value: white } 15 | u_fluxaySpeed: { value: 1.0 } 16 | u_startPos: { value: -0.6 } 17 | u_UVoffset: { value: [1,0,0,1] } 18 | u_rotated: { value: 0 } 19 | u_time: { value: 0 } 20 | }% 21 | 22 | CCProgram vs %{ 23 | #include 24 | precision highp float; 25 | in vec3 a_position; 26 | in vec2 a_uv0; 27 | out vec2 uv0; 28 | void main () { 29 | gl_Position = cc_matViewProj * vec4(a_position, 1); 30 | uv0 = a_uv0; 31 | } 32 | }% 33 | 34 | CCProgram fs %{ 35 | precision highp float; 36 | in vec2 uv0; 37 | uniform sampler2D texture; 38 | uniform ARGS { 39 | vec4 u_UVoffset; 40 | float u_startPos; //流动的时间 41 | float u_rotated; 42 | float u_time; 43 | float u_fluxaySpeed; 44 | sampler2D u_fluxayTexture; //流光图纹理 45 | } 46 | void main() 47 | { 48 | vec2 UVnormalize; 49 | UVnormalize.x = (uv0.x-u_UVoffset.x)/(u_UVoffset.z-u_UVoffset.x); 50 | UVnormalize.y = (uv0.y-u_UVoffset.y)/(u_UVoffset.w-u_UVoffset.y); 51 | if(u_rotated > 0.5) 52 | { 53 | float temp = UVnormalize.x; 54 | UVnormalize.x = UVnormalize.y; 55 | UVnormalize.y = 1.0 - temp; 56 | } 57 | 58 | vec4 src_color = texture2D(texture, uv0).rgba; 59 | //调整第二张图的UV,调整其x使其产生流动效果 60 | vec2 flow_uv = vec2(UVnormalize.x,UVnormalize.y); 61 | flow_uv.x -= (u_time*u_fluxaySpeed)+u_startPos; 62 | 63 | vec4 src_color1 = texture2D(u_fluxayTexture, flow_uv).rgba; 64 | //根据底图是否有颜色来判断是否显示流光 65 | if(src_color.a >= 1.0) { 66 | gl_FragColor = src_color+src_color1; 67 | } 68 | else { 69 | gl_FragColor = src_color; 70 | } 71 | } 72 | }% -------------------------------------------------------------------------------- /assets/Resources/effect/BlurGauss.effect: -------------------------------------------------------------------------------- 1 | //高斯模糊效果(在华为P6上不生效) 2 | 3 | CCEffect %{ 4 | techniques: 5 | - passes: 6 | - vert: vs 7 | frag: fs 8 | blendState: 9 | targets: 10 | - blend: true 11 | rasterizerState: 12 | cullMode: none 13 | properties: 14 | texture: { value: white } 15 | u_degree: { value: 0.03 } 16 | u_brightness: { value: 1.0 } 17 | }% 18 | 19 | CCProgram vs %{ // 顶点Shader模块开始 20 | #include 21 | precision highp float; //定义float高精度 22 | in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰; 23 | in vec2 a_uv0; // 纹理坐标; 24 | out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值 25 | void main () { 26 | gl_Position = cc_matViewProj * vec4(a_position, 1); 27 | uv0 = a_uv0; 28 | } 29 | }% 30 | 31 | CCProgram fs %{ 32 | #define repeats 5. //重复次数,值越大模糊质量越高,但性能越低 33 | precision highp float; 34 | in vec2 uv0; 35 | uniform sampler2D texture; 36 | uniform ARGS{ 37 | float u_degree; //模糊度,外界属性 38 | float u_brightness; //亮度,外界属性 39 | } 40 | 41 | // 应用贴图UV 42 | vec4 draw(vec2 uv) { 43 | return texture2D(texture,uv).rgba; 44 | } 45 | 46 | float grid(float var, float size) { 47 | return floor(var*size)/size; 48 | } 49 | 50 | // 降低亮度 51 | vec4 dim(vec4 col, float factor) { 52 | return vec4(col.r * factor, col.g * factor, col.b * factor, col.a); 53 | } 54 | 55 | // 随机值 56 | float rand(vec2 co){ 57 | return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); 58 | } 59 | 60 | void main() 61 | { 62 | // 模糊贴图 63 | vec4 blurred_image = vec4(0.); 64 | // 重复采样 65 | for (float i = 0.; i < repeats; i++) { 66 | // 第一采样点 67 | vec2 q = vec2(cos(degrees((i/repeats)*360.)),sin(degrees((i/repeats)*360.))) * (rand(vec2(i,uv0.x+uv0.y))+u_degree); 68 | vec2 uv2 = uv0+(q*u_degree); 69 | blurred_image += draw(uv2)/2.; 70 | // 第二采样点 71 | q = vec2(cos(degrees((i/repeats)*360.)),sin(degrees((i/repeats)*360.))) * (rand(vec2(i+2.,uv0.x+uv0.y+24.))+u_degree); 72 | uv2 = uv0+(q*u_degree); 73 | blurred_image += draw(uv2)/2.; 74 | } 75 | // 中和 76 | blurred_image /= repeats; 77 | // 降低亮度 78 | blurred_image = dim(blurred_image, u_brightness); 79 | // 导出颜色 80 | gl_FragColor = vec4(blurred_image); 81 | } 82 | }% 83 | -------------------------------------------------------------------------------- /assets/Resources/effect/WaveLight.effect: -------------------------------------------------------------------------------- 1 | //波纹流光 2 | CCEffect %{ 3 | techniques: 4 | - passes: 5 | - vert: vs 6 | frag: fs 7 | blendState: 8 | targets: 9 | - blend: true 10 | rasterizerState: 11 | cullMode: none 12 | properties: 13 | texture: { value: white } 14 | u_time: { value: 0.5 } 15 | }% 16 | 17 | CCProgram vs %{ // 顶点Shader模块开始 18 | #include 19 | precision highp float; //定义float高精度 20 | in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰; 21 | in vec2 a_uv0; // 纹理坐标; 22 | out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值 23 | void main () { 24 | gl_Position = cc_matViewProj * vec4(a_position, 1); 25 | uv0 = a_uv0; 26 | } 27 | }% 28 | 29 | CCProgram fs %{ 30 | #define TAU 6.12 31 | #define MAX_ITER 5 32 | precision highp float; 33 | 34 | in vec2 uv0; 35 | uniform sampler2D texture; 36 | uniform ARGS { 37 | vec4 UVoffset; 38 | float u_time; 39 | float rotated; 40 | } 41 | 42 | void main() 43 | { 44 | float u_time = u_time * .5+5.; 45 | vec2 UVnormalize; 46 | UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x); 47 | UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y); 48 | if(rotated > 0.5) 49 | { 50 | float temp = UVnormalize.x; 51 | UVnormalize.x = UVnormalize.y; 52 | UVnormalize.y = 1.0 - temp; 53 | } 54 | 55 | vec2 uv = uv0.xy;//fragCoord.xy / iResolution.xy; 56 | 57 | vec2 p = mod(uv*TAU, TAU)-250.0; 58 | 59 | vec2 i = vec2(p); 60 | float c = 1.0; 61 | float inten = .0065; 62 | 63 | for (int n = 0; n < MAX_ITER; n++) 64 | { 65 | float t = u_time * (1.0 - (3.5 / float(n+1))); 66 | i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(1.5*t + i.x)); 67 | c += 1.0/length(vec2(p.x / (cos(i.x+t)/inten),p.y / (cos(i.y+t)/inten))); 68 | } 69 | c /= float(MAX_ITER); 70 | c = 1.17-pow(c, 1.4); 71 | vec4 tex = texture2D(texture,uv0); 72 | vec3 colour = vec3(pow(abs(c), 20.0)); 73 | colour = clamp(colour + vec3(0.0, 0.0, .0), 0.0, tex.a); 74 | 75 | // 混合波光 76 | float alpha = c*tex[3]; 77 | tex[0] = tex[0] + colour[0]*alpha; 78 | tex[1] = tex[1] + colour[1]*alpha; 79 | tex[2] = tex[2] + colour[2]*alpha; 80 | gl_FragColor = vec4(1,1,1,1) * tex; 81 | } 82 | }% 83 | -------------------------------------------------------------------------------- /assets/Resources/effect/RadialBlur.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.23", 3 | "uuid": "9d24dc19-8d72-483a-903d-914ccf86f169", 4 | "compiledShaders": [ 5 | { 6 | "glsl1": { 7 | "vert": "uniform mat4 cc_matViewProj;\n\nprecision highp float;\n\nattribute vec3 a_position;\n\nattribute vec2 a_uv0;\n\nvarying vec2 uv0;\n\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 8 | "frag": "\nprecision highp float;\nvarying vec2 uv0;\nuniform sampler2D texture;\nuniform vec2 u_point;\nuniform float u_Strength;\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n\n const int Samples = 64;\n\n vec2 uv = fragCoord.xy;\n vec2 dir = (fragCoord.xy-u_point.xy);\n vec4 color = vec4(0.0,0.0,0.0,0.0);\n for (int i = 0; i < Samples; i += 2)\n\n {\n color += texture2D(texture,uv+float(i)/float(Samples)*dir*u_Strength);\n color += texture2D(texture,uv+float(i+1)/float(Samples)*dir*u_Strength);\n } \n fragColor = color/float(Samples);\n}\n \nvoid main(void)\n{\n mainImage(gl_FragColor, uv0);\n}\n" 9 | }, 10 | "glsl3": { 11 | "vert": "uniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\nprecision highp float;\n\nin vec3 a_position;\n\nin vec2 a_uv0;\n\nout vec2 uv0;\n\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 12 | "frag": "\nprecision highp float;\nin vec2 uv0;\nuniform sampler2D texture;\nuniform ARGS{\n vec2 u_resolution;\n vec2 u_point;\n float u_Strength;\n}\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n\n const int Samples = 64;\n\n vec2 uv = fragCoord.xy;\n vec2 dir = (fragCoord.xy-u_point.xy);\n vec4 color = vec4(0.0,0.0,0.0,0.0);\n for (int i = 0; i < Samples; i += 2)\n\n {\n color += texture2D(texture,uv+float(i)/float(Samples)*dir*u_Strength);\n color += texture2D(texture,uv+float(i+1)/float(Samples)*dir*u_Strength);\n } \n fragColor = color/float(Samples);\n}\n \nvoid main(void)\n{\n mainImage(gl_FragColor, uv0);\n}\n" 13 | } 14 | } 15 | ], 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Resources/effect/BlurNormal.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.23", 3 | "uuid": "14e64f7c-87c8-459a-ad37-6c773ceea4e6", 4 | "compiledShaders": [ 5 | { 6 | "glsl1": { 7 | "vert": "uniform mat4 cc_matViewProj;\n\nprecision highp float;\n\nattribute vec3 a_position;\n\nattribute vec2 a_uv0;\n\nvarying vec2 uv0;\n\nvoid main () {\n vec4 pos = cc_matViewProj * vec4(a_position, 1);\n gl_Position = pos;\n uv0 = a_uv0;\n}\n", 8 | "frag": "\nprecision mediump float;\nvarying vec2 uv0;\nuniform sampler2D texture;\nuniform vec2 u_resolution;\nconst float blurRadius = 7.0;\nvoid main()\n{\n vec2 unit = 1.0 / u_resolution;\n\n vec3 sumColor = vec3(0.0, 0.0, 0.0);\n float count = 0.0;\n vec4 col = vec4(0.0);\n for(float fy = -blurRadius; fy <= blurRadius; ++fy)\n {\n for(float fx = -blurRadius; fx <= blurRadius; ++fx)\n { \n float weight = (blurRadius - abs(fx)) * (blurRadius - abs(fy));\n\n col += texture2D(texture, uv0 + vec2(fx * unit.x, fy * unit.y)) * weight;\n count += weight;\n }\n }\n col.a = texture2D(texture, uv0).a;\n gl_FragColor = vec4(col.rgb / count, col.a);\n}\n" 9 | }, 10 | "glsl3": { 11 | "vert": "uniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\nprecision highp float;\n\nin vec3 a_position;\n\nin vec2 a_uv0;\n\nout vec2 uv0;\n\nvoid main () {\n vec4 pos = cc_matViewProj * vec4(a_position, 1);\n gl_Position = pos;\n uv0 = a_uv0;\n}\n", 12 | "frag": "\nprecision mediump float;\nin vec2 uv0;\nuniform sampler2D texture;\nuniform ARGS {\n vec2 u_resolution;\n float strength;\n}\nconst float blurRadius = 7.0;\nvoid main()\n{\n vec2 unit = 1.0 / u_resolution;\n\n vec3 sumColor = vec3(0.0, 0.0, 0.0);\n float count = 0.0;\n vec4 col = vec4(0.0);\n for(float fy = -blurRadius; fy <= blurRadius; ++fy)\n {\n for(float fx = -blurRadius; fx <= blurRadius; ++fx)\n { \n float weight = (blurRadius - abs(fx)) * (blurRadius - abs(fy));\n\n col += texture2D(texture, uv0 + vec2(fx * unit.x, fy * unit.y)) * weight;\n count += weight;\n }\n }\n col.a = texture2D(texture, uv0).a;\n gl_FragColor = vec4(col.rgb / count, col.a);\n}\n" 13 | } 14 | } 15 | ], 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Resources/effect/Water.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.23", 3 | "uuid": "7d5495a0-26aa-4858-a9db-37507aff7ba4", 4 | "compiledShaders": [ 5 | { 6 | "glsl1": { 7 | "vert": "uniform mat4 cc_matViewProj;\n\nprecision highp float;\n\nattribute vec3 a_position;\n\nattribute vec2 a_uv0;\n\nvarying vec2 uv0;\n\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 8 | "frag": "\nprecision highp float;\nvarying vec2 uv0;\nuniform sampler2D texture;\nuniform vec4 UVoffset;\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform float rotated;\nvec2 s(vec2 p)\n{\n float d=u_time*0.2,x=8.*(p.x+d),y=8.*(p.y+d);\n return vec2(cos(x-y)*cos(y),sin(x+y)*sin(y));\n}\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n\n vec2 rs = u_resolution.xy;\n\n vec2 uv = fragCoord;\n vec2 q = uv+2./u_resolution.x*(s(uv)-s(uv+rs));\n\n fragColor = texture2D(texture, q);\n}\nvoid main()\n{\n vec2 UVnormalize;\n UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x);\n UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y);\n if(rotated > 0.5)\n {\n float temp = UVnormalize.x;\n UVnormalize.x = UVnormalize.y;\n UVnormalize.y = 1.0 - temp;\n }\n mainImage(gl_FragColor, uv0.xy);\n}\n" 9 | }, 10 | "glsl3": { 11 | "vert": "uniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\nprecision highp float;\n\nin vec3 a_position;\n\nin vec2 a_uv0;\n\nout vec2 uv0;\n\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 12 | "frag": "\nprecision highp float;\nin vec2 uv0;\nuniform sampler2D texture;\nuniform ARGS {\n vec4 UVoffset;\n vec2 u_resolution;\n float u_time;\n float rotated;\n}\n\nvec2 s(vec2 p)\n{\n float d=u_time*0.2,x=8.*(p.x+d),y=8.*(p.y+d);\n return vec2(cos(x-y)*cos(y),sin(x+y)*sin(y));\n}\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n\n vec2 rs = u_resolution.xy;\n\n vec2 uv = fragCoord;\n vec2 q = uv+2./u_resolution.x*(s(uv)-s(uv+rs));\n\n fragColor = texture2D(texture, q);\n}\nvoid main()\n{\n vec2 UVnormalize;\n UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x);\n UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y);\n if(rotated > 0.5)\n {\n float temp = UVnormalize.x;\n UVnormalize.x = UVnormalize.y;\n UVnormalize.y = 1.0 - temp;\n }\n mainImage(gl_FragColor, uv0.xy);\n}\n" 13 | } 14 | } 15 | ], 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Resources/effect/Fluxay.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.23", 3 | "uuid": "d65ecfab-7310-4b95-8db8-371104329878", 4 | "compiledShaders": [ 5 | { 6 | "glsl1": { 7 | "vert": "uniform mat4 cc_matViewProj;\n\nprecision highp float;\nattribute vec3 a_position;\nattribute vec2 a_uv0;\nvarying vec2 uv0;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 8 | "frag": "\nprecision highp float;\n varying vec2 uv0;\nuniform sampler2D texture;\n uniform vec4 u_UVoffset;\nuniform float u_startPos;\nuniform float u_rotated;\nuniform float u_time;\nuniform float u_fluxaySpeed;\nuniform sampler2D u_fluxayTexture;\nvoid main()\n {\n vec2 UVnormalize;\n UVnormalize.x = (uv0.x-u_UVoffset.x)/(u_UVoffset.z-u_UVoffset.x);\n UVnormalize.y = (uv0.y-u_UVoffset.y)/(u_UVoffset.w-u_UVoffset.y);\n if(u_rotated > 0.5)\n {\n float temp = UVnormalize.x;\n UVnormalize.x = UVnormalize.y;\n UVnormalize.y = 1.0 - temp;\n }\n\n vec4 src_color = texture2D(texture, uv0).rgba;\n\n vec2 flow_uv = vec2(UVnormalize.x,UVnormalize.y);\n flow_uv.x -= (u_time*u_fluxaySpeed)+u_startPos;\n\n vec4 src_color1 = texture2D(u_fluxayTexture, flow_uv).rgba;\n\n if(src_color.a >= 1.0) {\n gl_FragColor = src_color+src_color1;\n }\n else {\n gl_FragColor = src_color;\n }\n }\n" 9 | }, 10 | "glsl3": { 11 | "vert": "uniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\nprecision highp float;\nin vec3 a_position;\nin vec2 a_uv0;\nout vec2 uv0;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 12 | "frag": "\nprecision highp float;\n in vec2 uv0;\nuniform sampler2D texture;\n uniform ARGS {\n vec4 u_UVoffset;\n float u_startPos;\n\n float u_rotated;\n float u_time;\n float u_fluxaySpeed;\n sampler2D u_fluxayTexture;\n\n }\n void main()\n {\n vec2 UVnormalize;\n UVnormalize.x = (uv0.x-u_UVoffset.x)/(u_UVoffset.z-u_UVoffset.x);\n UVnormalize.y = (uv0.y-u_UVoffset.y)/(u_UVoffset.w-u_UVoffset.y);\n if(u_rotated > 0.5)\n {\n float temp = UVnormalize.x;\n UVnormalize.x = UVnormalize.y;\n UVnormalize.y = 1.0 - temp;\n }\n\n vec4 src_color = texture2D(texture, uv0).rgba;\n\n vec2 flow_uv = vec2(UVnormalize.x,UVnormalize.y);\n flow_uv.x -= (u_time*u_fluxaySpeed)+u_startPos;\n\n vec4 src_color1 = texture2D(u_fluxayTexture, flow_uv).rgba;\n\n if(src_color.a >= 1.0) {\n gl_FragColor = src_color+src_color1;\n }\n else {\n gl_FragColor = src_color;\n }\n }\n" 13 | } 14 | } 15 | ], 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Resources/effect/BlurGauss.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.23", 3 | "uuid": "d64b960e-910a-4f6a-a413-b37932350ea6", 4 | "compiledShaders": [ 5 | { 6 | "glsl1": { 7 | "vert": "uniform mat4 cc_matViewProj;\n\nprecision highp float;\n\nattribute vec3 a_position;\n\nattribute vec2 a_uv0;\n\nvarying vec2 uv0;\n\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 8 | "frag": "\nprecision highp float;\nvarying vec2 uv0;\nuniform sampler2D texture;\nuniform float u_degree;\nuniform float u_brightness;\nvec4 draw(vec2 uv) {\n return texture2D(texture,uv).rgba; \n}\n\nfloat grid(float var, float size) {\n return floor(var*size)/size;\n}\n\nvec4 dim(vec4 col, float factor) {\n return vec4(col.r * factor, col.g * factor, col.b * factor, col.a);\n}\n\nfloat rand(vec2 co){\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n\n vec4 blurred_image = vec4(0.);\n\n for (float i = 0.; i < 5.; i++) {\n\n vec2 q = vec2(cos(degrees((i/5.)*360.)),sin(degrees((i/5.)*360.))) * (rand(vec2(i,uv0.x+uv0.y))+u_degree); \n vec2 uv2 = uv0+(q*u_degree);\n blurred_image += draw(uv2)/2.;\n\n q = vec2(cos(degrees((i/5.)*360.)),sin(degrees((i/5.)*360.))) * (rand(vec2(i+2.,uv0.x+uv0.y+24.))+u_degree); \n uv2 = uv0+(q*u_degree);\n blurred_image += draw(uv2)/2.;\n }\n\n blurred_image /= 5.;\n\n blurred_image = dim(blurred_image, u_brightness);\n\n gl_FragColor = vec4(blurred_image);\n}\n" 9 | }, 10 | "glsl3": { 11 | "vert": "uniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\nprecision highp float;\n\nin vec3 a_position;\n\nin vec2 a_uv0;\n\nout vec2 uv0;\n\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 12 | "frag": "\nprecision highp float;\nin vec2 uv0;\nuniform sampler2D texture;\nuniform ARGS{\n float u_degree;\n\n float u_brightness;\n\n}\n\nvec4 draw(vec2 uv) {\n return texture2D(texture,uv).rgba; \n}\n\nfloat grid(float var, float size) {\n return floor(var*size)/size;\n}\n\nvec4 dim(vec4 col, float factor) {\n return vec4(col.r * factor, col.g * factor, col.b * factor, col.a);\n}\n\nfloat rand(vec2 co){\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n\n vec4 blurred_image = vec4(0.);\n\n for (float i = 0.; i < 5.; i++) {\n\n vec2 q = vec2(cos(degrees((i/5.)*360.)),sin(degrees((i/5.)*360.))) * (rand(vec2(i,uv0.x+uv0.y))+u_degree); \n vec2 uv2 = uv0+(q*u_degree);\n blurred_image += draw(uv2)/2.;\n\n q = vec2(cos(degrees((i/5.)*360.)),sin(degrees((i/5.)*360.))) * (rand(vec2(i+2.,uv0.x+uv0.y+24.))+u_degree); \n uv2 = uv0+(q*u_degree);\n blurred_image += draw(uv2)/2.;\n }\n\n blurred_image /= 5.;\n\n blurred_image = dim(blurred_image, u_brightness);\n\n gl_FragColor = vec4(blurred_image);\n}\n" 13 | } 14 | } 15 | ], 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Resources/effect/WaveLight.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.23", 3 | "uuid": "ae91e5d2-7d0a-41f4-a4fa-ffe0037ff8a0", 4 | "compiledShaders": [ 5 | { 6 | "glsl1": { 7 | "vert": "uniform mat4 cc_matViewProj;\n\nprecision highp float;\n\nattribute vec3 a_position;\n\nattribute vec2 a_uv0;\n\nvarying vec2 uv0;\n\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 8 | "frag": "\nprecision highp float;\n\nvarying vec2 uv0;\nuniform sampler2D texture;\nuniform vec4 UVoffset;\nuniform float u_time;\nuniform float rotated;\nvoid main()\n{\n float u_time = u_time * .5+5.;\n vec2 UVnormalize;\n UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x);\n UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y);\n if(rotated > 0.5)\n {\n float temp = UVnormalize.x;\n UVnormalize.x = UVnormalize.y;\n UVnormalize.y = 1.0 - temp;\n }\n\n vec2 uv = uv0.xy;\n\n vec2 p = mod(uv*6.12, 6.12)-250.0;\n\n vec2 i = vec2(p);\n float c = 1.0;\n float inten = .0065;\n\n for (int n = 0; n < 5; n++) \n {\n float t = u_time * (1.0 - (3.5 / float(n+1)));\n i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(1.5*t + i.x));\n c += 1.0/length(vec2(p.x / (cos(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));\n }\n c /= float(5);\n c = 1.17-pow(c, 1.4);\n vec4 tex = texture2D(texture,uv0);\n vec3 colour = vec3(pow(abs(c), 20.0));\n colour = clamp(colour + vec3(0.0, 0.0, .0), 0.0, tex.a);\n\n float alpha = c*tex[3]; \n tex[0] = tex[0] + colour[0]*alpha; \n tex[1] = tex[1] + colour[1]*alpha; \n tex[2] = tex[2] + colour[2]*alpha; \n gl_FragColor = vec4(1,1,1,1) * tex;\n}\n" 9 | }, 10 | "glsl3": { 11 | "vert": "uniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\nprecision highp float;\n\nin vec3 a_position;\n\nin vec2 a_uv0;\n\nout vec2 uv0;\n\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n uv0 = a_uv0;\n}\n", 12 | "frag": "\nprecision highp float;\n\nin vec2 uv0;\nuniform sampler2D texture;\nuniform ARGS {\n vec4 UVoffset;\n float u_time;\n float rotated;\n}\n\nvoid main()\n{\n float u_time = u_time * .5+5.;\n vec2 UVnormalize;\n UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x);\n UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y);\n if(rotated > 0.5)\n {\n float temp = UVnormalize.x;\n UVnormalize.x = UVnormalize.y;\n UVnormalize.y = 1.0 - temp;\n }\n\n vec2 uv = uv0.xy;\n\n vec2 p = mod(uv*6.12, 6.12)-250.0;\n\n vec2 i = vec2(p);\n float c = 1.0;\n float inten = .0065;\n\n for (int n = 0; n < 5; n++) \n {\n float t = u_time * (1.0 - (3.5 / float(n+1)));\n i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(1.5*t + i.x));\n c += 1.0/length(vec2(p.x / (cos(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));\n }\n c /= float(5);\n c = 1.17-pow(c, 1.4);\n vec4 tex = texture2D(texture,uv0);\n vec3 colour = vec3(pow(abs(c), 20.0));\n colour = clamp(colour + vec3(0.0, 0.0, .0), 0.0, tex.a);\n\n float alpha = c*tex[3]; \n tex[0] = tex[0] + colour[0]*alpha; \n tex[1] = tex[1] + colour[1]*alpha; \n tex[2] = tex[2] + colour[2]*alpha; \n gl_FragColor = vec4(1,1,1,1) * tex;\n}\n" 13 | } 14 | } 15 | ], 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Resources/effect/Glowing.effect: -------------------------------------------------------------------------------- 1 | //外发光效果 2 | 3 | CCEffect %{ 4 | techniques: 5 | - passes: 6 | - vert: vs 7 | frag: fs 8 | blendState: 9 | targets: 10 | - blend: true 11 | rasterizerState: 12 | cullMode: none 13 | properties: 14 | texture: { value: white } 15 | u_edge: { value: 0.5 } 16 | u_offset: { value: 0.01 } 17 | u_edgeBlur: { value: 0.01 } 18 | u_mixColor: { value: [1, 1, 1, 1], inspector: { type: color } } 19 | u_edgeColor: { value: [1, 1, 1, 0], inspector: { type: color } } 20 | }% 21 | 22 | CCProgram vs %{ 23 | #include 24 | precision highp float; 25 | in vec4 a_position; 26 | in vec2 a_uv0; 27 | out vec2 uv0; 28 | void main() 29 | { 30 | gl_Position = cc_matViewProj * a_position; 31 | uv0 = a_uv0; 32 | } 33 | }% 34 | 35 | CCProgram fs %{ 36 | precision highp float; 37 | in vec2 uv0; 38 | uniform sampler2D texture; 39 | uniform ARGS{ 40 | vec4 u_mixColor; 41 | float u_edge; 42 | } 43 | 44 | // 是否边缘羽化 45 | #if IS_Edge_Blur 46 | uniform ARGS1{ 47 | float u_edgeBlur; 48 | } 49 | #endif 50 | 51 | // 是否边缘发光(不要和羽化一起使用,会有边) 52 | #if IS_EdgeGlowing 53 | uniform ARGS2{ 54 | float u_offset; 55 | } 56 | #endif 57 | 58 | // 是否使用边缘颜色 59 | #if USE_EDGE_COLOR 60 | uniform ARGS3{ 61 | vec4 u_edgeColor; 62 | } 63 | #endif 64 | 65 | 66 | // 应用贴图颜色 画圆 67 | vec4 drawCircle() { 68 | float edge = u_edge; 69 | float dis = 0.0; 70 | 71 | float offset = 0.0; 72 | vec2 uv = uv0; 73 | 74 | // 是否边缘发光 75 | #if IS_EdgeGlowing 76 | offset = u_offset; 77 | uv = vec2(0.5 + (uv0.x - 0.5) * ((offset*2.0) + 1.0), 0.5 + (uv0.y - 0.5) * ((offset*2.0) + 1.0)); 78 | #endif 79 | 80 | if ( uv.x < edge ) 81 | { 82 | if ( uv.y < edge ) 83 | { 84 | dis = distance( uv, vec2(edge, edge) ); 85 | } 86 | if ( uv.y > (1.0 - edge) ) 87 | { 88 | dis = distance( uv, vec2(edge, (1.0 - edge)) ); 89 | } 90 | } 91 | else if ( uv.x > (1.0 - edge) ) 92 | { 93 | if ( uv.y < edge ) 94 | { 95 | dis = distance( uv, vec2((1.0 - edge), edge ) ); 96 | } 97 | if ( uv.y > (1.0 - edge) ) 98 | { 99 | dis = distance( uv, vec2((1.0 - edge), (1.0 - edge) ) ); 100 | } 101 | } 102 | 103 | // 混合外边颜色 104 | vec4 color = u_mixColor * texture2D(texture,uv); 105 | // 边缘颜色 106 | vec4 edge_color = color; 107 | // 边缘羽化,默认0.01,减少抗锯齿 108 | float blur = 0.0; 109 | // 是否边缘羽化 110 | #if IS_Edge_Blur 111 | blur = u_edgeBlur; 112 | #endif 113 | 114 | // 如果有外部颜色,重新定义 边缘颜色 115 | #if USE_EDGE_COLOR 116 | // 如果应用贴图颜色混合 117 | #if USER_TEXTURE_COLOR 118 | edge_color = u_edgeColor * texture2D(texture,uv); 119 | #else 120 | edge_color = u_edgeColor; 121 | #endif 122 | #endif 123 | 124 | if(dis > 0.001) 125 | { 126 | // 外圈沟 127 | float gap = edge * blur; 128 | if(dis <= edge - gap) 129 | { 130 | color = color; 131 | } 132 | else if(dis <= edge) 133 | { 134 | // 平滑过渡: ret smoothstep(a, b, x) 可以用来生成0到1的平滑过渡. 135 | float t = smoothstep(0.,gap,edge-dis); 136 | 137 | // 边缘颜色和透明度 138 | color = vec4(edge_color.rgb,t * edge_color.a); 139 | }else{ 140 | // 隐藏不要的部分 141 | 142 | // 是否边缘发光 143 | #if IS_EdgeGlowing 144 | color = vec4(edge_color.rgb, (offset - (dis - edge))/offset); 145 | #else 146 | color = vec4(edge_color.rgb,0.); 147 | #endif 148 | } 149 | } 150 | else 151 | { 152 | // 是否边缘发光 153 | #if IS_EdgeGlowing 154 | float absX = abs(uv.x - 0.5); 155 | if(absX > 0.5) 156 | { 157 | color = vec4( edge_color.rgb, (offset - (absX - 0.5))/offset); 158 | } 159 | else 160 | { 161 | float absY = abs(uv.y - 0.5); 162 | if (absY > 0.5){ 163 | color = vec4( edge_color.rgb, (offset - (absX - 0.5))/offset); 164 | } 165 | else{ 166 | color = color; 167 | } 168 | } 169 | #else 170 | color = color; 171 | #endif 172 | } 173 | return color; 174 | } 175 | 176 | 177 | void main() 178 | { 179 | vec4 color = drawCircle(); 180 | gl_FragColor = color; 181 | } 182 | }% 183 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cosos Creator 2.2.X shader 教程 2 | ## 前言 3 | 自己之前要做shader的一些效果,发现cocos相关文档很少,后面在论坛看帖子慢慢摸索了几周,也踩了几个坑耽误了一些功夫 4 | 现在把自己总结的一些笔记和大家分享讨论一下,有什么错误或者不足的欢迎提建议,自己也还是个刚入门的,希望可以帮到一些想着手的童鞋,也算是回馈社区 5 | ## 几个简单的效果 6 | 7 | [查看demo代码](https://github.com/XuDaFei/CocosCreator-2.2.X-shader-demo) 8 | 9 | ![shader使用流程](/readme_pic/shader.png) 10 | ## 新建 shader 资源 11 | ### 编辑器中: 12 | 在 Creator 中新建所需的 matrial、effect, 并且在 material 中设置对应的 effct 资源 13 | 14 | ### 代码中: 15 | 你需要在creator.d.ts 中添加几个接口来防止 ts 报错(不加只是爆红,不影响使用) 16 | ```typescript 17 | export class Material extends Asset { 18 | effectAsset: Asset; //材质对应的effect资源 19 | define(name: string, val: any): void; //设置宏定义 20 | setProperty(name:string, val: any); //设置变量 21 | static getBuiltinMaterial(materialUrl: string): Material //获取系统的材质 22 | { 23 | } 24 | } 25 | export class EffectAsset extends Asset 26 | { 27 | } 28 | ``` 29 | 设置材质的接口 30 | ```typescript 31 | /** !#en 32 | Base class for components which supports rendering features. 33 | !#zh 34 | 所有支持渲染的组件的基类 */ 35 | export class RenderComponent extends Component 36 | { 37 | /** !#en The materials used by this render component. 38 | !#zh 渲染组件使用的材质。 */ 39 | sharedMaterials: Material[]; 40 | /** 41 | !#en Get the material by index. 42 | !#zh 根据指定索引获取材质 43 | @param index index 44 | */ 45 | getMaterial(index: number): Material; 46 | /** 47 | !#en Set the material by index. 48 | !#zh 根据指定索引设置材质 49 | @param index index 50 | @param material material 51 | */ 52 | setMaterial(index: number,material: Material): void; 53 | } 54 | ``` 55 | 你可以用上面的几个接口来加载对应 effect 和 material,设置属性,设置对应的材质到对应的组件上 56 | 只要是继承了 RenderComponent 的组件,比如是Sprite, Label, Spine等,都可以设置和获取材质 57 | 58 | ## Effect 资源和 Matrial 资源 59 | EffectAsset 就是保存我们自己编写的 shader 程序, 在引擎中对应着 EffectAsset 资源, 引擎读取渲染组件中的 effect 配置,并设置 60 | 对应渲染数据后调用WebGL的API进行渲染。 61 | Creator 2.2 版本已经更新了 effect 文件的格式,关于 Matrial 和 Effect 的可以参考 [Cocos Creator 3D文档](https://docs.cocos.com/creator3d/manual/zh/material-system/overview.html) 62 | 这里用一个最简单的栗子来介绍一下 63 | ```yaml 64 | CCEffect %{ 65 | techniques: 66 | - passes: 67 | - vert: vs //指向vert shader 68 | frag: fs //指向frag shader 69 | blendState: //渲染参数 70 | targets: 71 | - blend: true 72 | rasterizerState: 73 | cullMode: none 74 | properties: //变量,会显示在 material 面板 上 75 | texture: { value: white } 76 | u_time: { value: 1.0 } 77 | }% 78 | 79 | CCProgram vs %{ //顶点着色器(GLSL 300 es格式) 80 | #include //引用头文件,cc_matViewProj 变换矩阵就是在里面的变量 81 | precision highp float; //定义精度 82 | in vec3 a_position; //顶点位置 83 | in vec2 a_uv0; //uv 坐标 84 | out vec2 uv0; //插值输出到片元的uv 坐标 85 | void main () { 86 | gl_Position = cc_matViewProj * vec4(a_position, 1); 87 | uv0 = a_uv0; 88 | } 89 | }% 90 | 91 | CCProgram fs %{ //片元着色器 92 | precision highp float; //定义精度 93 | uniform sampler2D texture; //纹理 94 | uniform ARGS { //除了系统的uniform ,其他uniform 变量都要定义在UBO(统一变量块)内 95 | //时间 根据时间计算需要丢弃的像素颜色值范围,也就是溶解的范围 96 | float u_time; 97 | } 98 | in vec2 uv0; 99 | 100 | void main() 101 | { 102 | float time = u_time; 103 | vec4 c = texture2D(texture,uv0); //用纹理和uv坐标采样到对应片元的颜色 104 | float height = c.g; 105 | if(height < time) 106 | { 107 | //丢弃像素,相当于溶解效果 108 | discard; 109 | } 110 | if(height < time + 0.1) { 111 | //这里可以对溶解边缘进行一些处理,比如透明度减少等 112 | c.a = c.a-0.1; 113 | } 114 | //给片元(像素)赋值 115 | gl_FragColor = c; 116 | } 117 | }% 118 | ``` 119 | Material 只需要在编辑器或者代码中设置对应的effect。在初始化和运行的时候设置对应的变量 120 | 121 | ## 运行 122 | 像溶解和流光等效果都需要在运行的代码中更新对应的时间参数,下面也举个小栗子 123 | ```typescript 124 | const {ccclass,property} = cc._decorator; 125 | 126 | @ccclass 127 | export default class ShaderTime extends cc.Component 128 | { 129 | /**记录时间 */ 130 | private time: number; 131 | /**精灵上的材质 */ 132 | private material: any; 133 | private IsAdd: boolean; 134 | 135 | /**时间参数 */ 136 | @property(cc.Float) 137 | speed: number = 1.0; 138 | 139 | start() 140 | { 141 | this.time = 0; 142 | this.IsAdd = true; 143 | this.material = this.node.getComponent(cc.Sprite).getMaterial(0); //获取材质 144 | } 145 | 146 | update(dt) 147 | { 148 | this.material.setProperty("u_time",this.time); //设置材质对应的属性 149 | this.IsAdd ? this.time += dt * this.speed : this.time -= dt * this.speed; 150 | if(this.time > 1.5) 151 | { 152 | this.IsAdd = false; 153 | } 154 | else if(this.time < -0.5) 155 | { 156 | this.IsAdd = true; 157 | } 158 | } 159 | } 160 | ``` 161 | ## 关于合图导致web和模拟器显示不一致的BUG 162 | ![合图错误](/readme_pic/hetucuowu.png) 163 | 原因: Cocos 会把小于512*512的碎图自动合图以减少DrawCall,而effect中接收到的uv 坐标是整个合图的uv, 导致需要用到uv坐标的effect在自动合图下显示不正确。 164 | 解决办法: 165 | - 关闭自动合图 166 | ps: 在Cocos Creator 2.1.3和2.2.0 以上都支持单独取消某个纹理的合图 167 | - 手动获取当前sprite 的纹理uv坐标传入到effect(无需取消自动合图) 168 | ```typescript 169 | //获取UV位置到Effect 170 | let frame = sprite.spriteFrame as any; 171 | let l = 0,r = 0,b = 1,t = 1; 172 | l = frame.uv[0]; 173 | t = frame.uv[5]; 174 | r = frame.uv[6]; 175 | b = frame.uv[3]; 176 | let u_UVoffset = new cc.Vec4(l,t,r,b); 177 | let u_rotated = frame.isRotated() ? 1.0 : 0.0; 178 | this._material.setProperty("u_UVoffset",u_UVoffset); 179 | this._material.setProperty("u_rotated",u_rotated); 180 | //在Effect 中接受u_UVoffset u_rotated 后重新设置UV 181 | vec2 UVnormalize; 182 | UVnormalize.x = (uv0.x-u_UVoffset.x)/(u_UVoffset.z-u_UVoffset.x); 183 | UVnormalize.y = (uv0.y-u_UVoffset.y)/(u_UVoffset.w-u_UVoffset.y); 184 | if(u_rotated > 0.5) 185 | { 186 | float temp = UVnormalize.x; 187 | UVnormalize.x = UVnormalize.y; 188 | UVnormalize.y = 1.0 - temp; 189 | } 190 | ``` 191 | 192 | ## 总结 193 | 有了材质和Effect以后,cocos使用shader 更加直观了。 194 | 移植一个需要shader 效果其实也只是在effect文件中设置好变量,修改一下shader 的代码片段语法,最后在代码或面板中设置参数即可 195 | 当然里面可能会有一些不兼容的属性或者一些细节的问题 196 | 197 | ## 学习Shader 198 | - [OpenGL 教程](https://learnopengl-cn.github.io/intro/) 手把手教学,我自己之前也是看这个,良心教程! 199 | - [WebGL 教程](https://webglfundamentals.org/webgl/lessons/zh_cn/) 200 | - [GLSL语法](https://thebookofshaders.com/02/?lan=ch) 201 | -------------------------------------------------------------------------------- /assets/Resources/effect/Glowing.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.23", 3 | "uuid": "0f9457ac-e49b-4ec4-bd74-11b0eabbdb4d", 4 | "compiledShaders": [ 5 | { 6 | "glsl1": { 7 | "vert": "uniform mat4 cc_matViewProj;\n\nprecision highp float;\nattribute vec4 a_position;\nattribute vec2 a_uv0;\nvarying vec2 uv0;\nvoid main()\n{\n gl_Position = cc_matViewProj * a_position;\n uv0 = a_uv0;\n}\n", 8 | "frag": "\n precision highp float;\n varying vec2 uv0;\n uniform sampler2D texture;\n uniform vec4 u_mixColor;\nuniform float u_edge;\n#if IS_Edge_Blur\n uniform float u_edgeBlur;\n#endif\n\n#if IS_EdgeGlowing\n uniform float u_offset;\n#endif\n\n#if USE_EDGE_COLOR\n uniform vec4 u_edgeColor;\n#endif\n\nvec4 drawCircle() {\n float edge = u_edge;\n float dis = 0.0;\n\n float offset = 0.0;\n vec2 uv = uv0;\n\n#if IS_EdgeGlowing\n offset = u_offset; \n uv = vec2(0.5 + (uv0.x - 0.5) * ((offset*2.0) + 1.0), 0.5 + (uv0.y - 0.5) * ((offset*2.0) + 1.0)); \n#endif\n \n if ( uv.x < edge )\n {\n if ( uv.y < edge )\n {\n dis = distance( uv, vec2(edge, edge) );\n }\n if ( uv.y > (1.0 - edge) )\n {\n dis = distance( uv, vec2(edge, (1.0 - edge)) );\n }\n }\n else if ( uv.x > (1.0 - edge) )\n {\n if ( uv.y < edge )\n {\n dis = distance( uv, vec2((1.0 - edge), edge ) );\n }\n if ( uv.y > (1.0 - edge) )\n {\n dis = distance( uv, vec2((1.0 - edge), (1.0 - edge) ) );\n }\n }\n\n vec4 color = u_mixColor * texture2D(texture,uv);\n\n vec4 edge_color = color;\n\n float blur = 0.0;\n\n #if IS_Edge_Blur\n blur = u_edgeBlur;\n #endif\n\n #if USE_EDGE_COLOR\n\n #if USER_TEXTURE_COLOR\n edge_color = u_edgeColor * texture2D(texture,uv);\n #else\n edge_color = u_edgeColor;\n #endif\n #endif\n \n if(dis > 0.001)\n {\n\n float gap = edge * blur;\n if(dis <= edge - gap)\n {\n color = color;\n }\n else if(dis <= edge)\n {\n\n float t = smoothstep(0.,gap,edge-dis);\n\n color = vec4(edge_color.rgb,t * edge_color.a);\n }else{\n\n #if IS_EdgeGlowing\n color = vec4(edge_color.rgb, (offset - (dis - edge))/offset); \n #else\n color = vec4(edge_color.rgb,0.); \n #endif\n }\n }\n else\n {\n\n #if IS_EdgeGlowing\n float absX = abs(uv.x - 0.5);\n if(absX > 0.5)\n {\n color = vec4( edge_color.rgb, (offset - (absX - 0.5))/offset);\n }\n else \n {\n float absY = abs(uv.y - 0.5);\n if (absY > 0.5){\n color = vec4( edge_color.rgb, (offset - (absX - 0.5))/offset);\n }\n else{\n color = color;\n }\n }\n #else\n color = color;\n #endif\n }\n return color; \n}\n\n void main()\n {\n vec4 color = drawCircle();\n gl_FragColor = color;\n }\n" 9 | }, 10 | "glsl3": { 11 | "vert": "uniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\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\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\n\nprecision highp float;\nin vec4 a_position;\nin vec2 a_uv0;\nout vec2 uv0;\nvoid main()\n{\n gl_Position = cc_matViewProj * a_position;\n uv0 = a_uv0;\n}\n", 12 | "frag": "\n precision highp float;\n in vec2 uv0;\n uniform sampler2D texture;\n uniform ARGS{\n vec4 u_mixColor; \n float u_edge;\n }\n\n#if IS_Edge_Blur\n uniform ARGS1{\n float u_edgeBlur; \n }\n#endif\n\n#if IS_EdgeGlowing\n uniform ARGS2{\n float u_offset; \n }\n#endif\n\n#if USE_EDGE_COLOR\n uniform ARGS3{\n vec4 u_edgeColor; \n }\n#endif\n\nvec4 drawCircle() {\n float edge = u_edge;\n float dis = 0.0;\n\n float offset = 0.0;\n vec2 uv = uv0;\n\n#if IS_EdgeGlowing\n offset = u_offset; \n uv = vec2(0.5 + (uv0.x - 0.5) * ((offset*2.0) + 1.0), 0.5 + (uv0.y - 0.5) * ((offset*2.0) + 1.0)); \n#endif\n \n if ( uv.x < edge )\n {\n if ( uv.y < edge )\n {\n dis = distance( uv, vec2(edge, edge) );\n }\n if ( uv.y > (1.0 - edge) )\n {\n dis = distance( uv, vec2(edge, (1.0 - edge)) );\n }\n }\n else if ( uv.x > (1.0 - edge) )\n {\n if ( uv.y < edge )\n {\n dis = distance( uv, vec2((1.0 - edge), edge ) );\n }\n if ( uv.y > (1.0 - edge) )\n {\n dis = distance( uv, vec2((1.0 - edge), (1.0 - edge) ) );\n }\n }\n\n vec4 color = u_mixColor * texture2D(texture,uv);\n\n vec4 edge_color = color;\n\n float blur = 0.0;\n\n #if IS_Edge_Blur\n blur = u_edgeBlur;\n #endif\n\n #if USE_EDGE_COLOR\n\n #if USER_TEXTURE_COLOR\n edge_color = u_edgeColor * texture2D(texture,uv);\n #else\n edge_color = u_edgeColor;\n #endif\n #endif\n \n if(dis > 0.001)\n {\n\n float gap = edge * blur;\n if(dis <= edge - gap)\n {\n color = color;\n }\n else if(dis <= edge)\n {\n\n float t = smoothstep(0.,gap,edge-dis);\n\n color = vec4(edge_color.rgb,t * edge_color.a);\n }else{\n\n #if IS_EdgeGlowing\n color = vec4(edge_color.rgb, (offset - (dis - edge))/offset); \n #else\n color = vec4(edge_color.rgb,0.); \n #endif\n }\n }\n else\n {\n\n #if IS_EdgeGlowing\n float absX = abs(uv.x - 0.5);\n if(absX > 0.5)\n {\n color = vec4( edge_color.rgb, (offset - (absX - 0.5))/offset);\n }\n else \n {\n float absY = abs(uv.y - 0.5);\n if (absY > 0.5){\n color = vec4( edge_color.rgb, (offset - (absX - 0.5))/offset);\n }\n else{\n color = color;\n }\n }\n #else\n color = color;\n #endif\n }\n return color; \n}\n\n void main()\n {\n vec4 color = drawCircle();\n gl_FragColor = color;\n }\n" 13 | } 14 | } 15 | ], 16 | "subMetas": {} 17 | } -------------------------------------------------------------------------------- /assets/Resources/scene/main.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | } 19 | ], 20 | "_active": true, 21 | "_components": [], 22 | "_prefab": null, 23 | "_opacity": 255, 24 | "_color": { 25 | "__type__": "cc.Color", 26 | "r": 255, 27 | "g": 255, 28 | "b": 255, 29 | "a": 255 30 | }, 31 | "_contentSize": { 32 | "__type__": "cc.Size", 33 | "width": 0, 34 | "height": 0 35 | }, 36 | "_anchorPoint": { 37 | "__type__": "cc.Vec2", 38 | "x": 0, 39 | "y": 0 40 | }, 41 | "_trs": { 42 | "__type__": "TypedArray", 43 | "ctor": "Float64Array", 44 | "array": [ 45 | 0, 46 | 0, 47 | 0, 48 | 0, 49 | 0, 50 | 0, 51 | 1, 52 | 1, 53 | 1, 54 | 1 55 | ] 56 | }, 57 | "_is3DNode": true, 58 | "_groupIndex": 0, 59 | "groupIndex": 0, 60 | "autoReleaseAssets": false, 61 | "_id": "740c9049-6f22-4fa2-abda-61ad9e1335eb" 62 | }, 63 | { 64 | "__type__": "cc.Node", 65 | "_name": "Canvas", 66 | "_objFlags": 0, 67 | "_parent": { 68 | "__id__": 1 69 | }, 70 | "_children": [ 71 | { 72 | "__id__": 3 73 | }, 74 | { 75 | "__id__": 5 76 | }, 77 | { 78 | "__id__": 7 79 | }, 80 | { 81 | "__id__": 9 82 | }, 83 | { 84 | "__id__": 11 85 | }, 86 | { 87 | "__id__": 13 88 | }, 89 | { 90 | "__id__": 16 91 | }, 92 | { 93 | "__id__": 19 94 | }, 95 | { 96 | "__id__": 22 97 | }, 98 | { 99 | "__id__": 24 100 | } 101 | ], 102 | "_active": true, 103 | "_components": [ 104 | { 105 | "__id__": 27 106 | } 107 | ], 108 | "_prefab": null, 109 | "_opacity": 255, 110 | "_color": { 111 | "__type__": "cc.Color", 112 | "r": 255, 113 | "g": 255, 114 | "b": 255, 115 | "a": 255 116 | }, 117 | "_contentSize": { 118 | "__type__": "cc.Size", 119 | "width": 1920, 120 | "height": 1080 121 | }, 122 | "_anchorPoint": { 123 | "__type__": "cc.Vec2", 124 | "x": 0.5, 125 | "y": 0.5 126 | }, 127 | "_trs": { 128 | "__type__": "TypedArray", 129 | "ctor": "Float64Array", 130 | "array": [ 131 | 960, 132 | 540, 133 | 0, 134 | 0, 135 | 0, 136 | 0, 137 | 1, 138 | 1, 139 | 1, 140 | 1 141 | ] 142 | }, 143 | "_eulerAngles": { 144 | "__type__": "cc.Vec3", 145 | "x": 0, 146 | "y": 0, 147 | "z": 0 148 | }, 149 | "_skewX": 0, 150 | "_skewY": 0, 151 | "_is3DNode": false, 152 | "_groupIndex": 0, 153 | "groupIndex": 0, 154 | "_id": "18EsaeYIdFAoD3J01xbKl3" 155 | }, 156 | { 157 | "__type__": "cc.Node", 158 | "_name": "Main Camera", 159 | "_objFlags": 0, 160 | "_parent": { 161 | "__id__": 2 162 | }, 163 | "_children": [], 164 | "_active": true, 165 | "_components": [ 166 | { 167 | "__id__": 4 168 | } 169 | ], 170 | "_prefab": null, 171 | "_opacity": 255, 172 | "_color": { 173 | "__type__": "cc.Color", 174 | "r": 255, 175 | "g": 255, 176 | "b": 255, 177 | "a": 255 178 | }, 179 | "_contentSize": { 180 | "__type__": "cc.Size", 181 | "width": 0, 182 | "height": 0 183 | }, 184 | "_anchorPoint": { 185 | "__type__": "cc.Vec2", 186 | "x": 0.5, 187 | "y": 0.5 188 | }, 189 | "_trs": { 190 | "__type__": "TypedArray", 191 | "ctor": "Float64Array", 192 | "array": [ 193 | 0, 194 | 0, 195 | 511.82101363660325, 196 | 0, 197 | 0, 198 | 0, 199 | 1, 200 | 1, 201 | 1, 202 | 1 203 | ] 204 | }, 205 | "_eulerAngles": { 206 | "__type__": "cc.Vec3", 207 | "x": 0, 208 | "y": 0, 209 | "z": 0 210 | }, 211 | "_skewX": 0, 212 | "_skewY": 0, 213 | "_is3DNode": false, 214 | "_groupIndex": 0, 215 | "groupIndex": 0, 216 | "_id": "55IpSgfI9E2Yaw/4LOZJBR" 217 | }, 218 | { 219 | "__type__": "cc.Camera", 220 | "_name": "", 221 | "_objFlags": 0, 222 | "node": { 223 | "__id__": 3 224 | }, 225 | "_enabled": true, 226 | "_cullingMask": 4294967295, 227 | "_clearFlags": 7, 228 | "_backgroundColor": { 229 | "__type__": "cc.Color", 230 | "r": 0, 231 | "g": 0, 232 | "b": 0, 233 | "a": 255 234 | }, 235 | "_depth": -1, 236 | "_zoomRatio": 1, 237 | "_targetTexture": null, 238 | "_fov": 60, 239 | "_orthoSize": 10, 240 | "_nearClip": 1, 241 | "_farClip": 4096, 242 | "_ortho": true, 243 | "_rect": { 244 | "__type__": "cc.Rect", 245 | "x": 0, 246 | "y": 0, 247 | "width": 1, 248 | "height": 1 249 | }, 250 | "_renderStages": 1, 251 | "_alignWithScreen": true, 252 | "_id": "3azn513otGnb5pXfq73bXb" 253 | }, 254 | { 255 | "__type__": "cc.Node", 256 | "_name": "BlurGauss", 257 | "_objFlags": 0, 258 | "_parent": { 259 | "__id__": 2 260 | }, 261 | "_children": [], 262 | "_active": true, 263 | "_components": [ 264 | { 265 | "__id__": 6 266 | } 267 | ], 268 | "_prefab": null, 269 | "_opacity": 255, 270 | "_color": { 271 | "__type__": "cc.Color", 272 | "r": 255, 273 | "g": 255, 274 | "b": 255, 275 | "a": 255 276 | }, 277 | "_contentSize": { 278 | "__type__": "cc.Size", 279 | "width": 284, 280 | "height": 399 281 | }, 282 | "_anchorPoint": { 283 | "__type__": "cc.Vec2", 284 | "x": 0.5, 285 | "y": 0.5 286 | }, 287 | "_trs": { 288 | "__type__": "TypedArray", 289 | "ctor": "Float64Array", 290 | "array": [ 291 | -494.844, 292 | 209.014, 293 | 0, 294 | 0, 295 | 0, 296 | 0, 297 | 1, 298 | 1, 299 | 1, 300 | 1 301 | ] 302 | }, 303 | "_eulerAngles": { 304 | "__type__": "cc.Vec3", 305 | "x": 0, 306 | "y": 0, 307 | "z": 0 308 | }, 309 | "_skewX": 0, 310 | "_skewY": 0, 311 | "_is3DNode": false, 312 | "_groupIndex": 0, 313 | "groupIndex": 0, 314 | "_id": "37Shf1jPFE55fhsqqgh0rG" 315 | }, 316 | { 317 | "__type__": "cc.Sprite", 318 | "_name": "", 319 | "_objFlags": 0, 320 | "node": { 321 | "__id__": 5 322 | }, 323 | "_enabled": true, 324 | "_materials": [ 325 | { 326 | "__uuid__": "b4bd1276-dc2b-4f11-84d3-50c9f68daaaa" 327 | } 328 | ], 329 | "_srcBlendFactor": 770, 330 | "_dstBlendFactor": 771, 331 | "_spriteFrame": { 332 | "__uuid__": "58b39b44-d165-415a-afc9-1655148ada22" 333 | }, 334 | "_type": 0, 335 | "_sizeMode": 1, 336 | "_fillType": 0, 337 | "_fillCenter": { 338 | "__type__": "cc.Vec2", 339 | "x": 0, 340 | "y": 0 341 | }, 342 | "_fillStart": 0, 343 | "_fillRange": 0, 344 | "_isTrimmedMode": true, 345 | "_atlas": null, 346 | "_id": "d5BHplFihGK6fixtu/zMZ0" 347 | }, 348 | { 349 | "__type__": "cc.Node", 350 | "_name": "BlurNormal", 351 | "_objFlags": 0, 352 | "_parent": { 353 | "__id__": 2 354 | }, 355 | "_children": [], 356 | "_active": true, 357 | "_components": [ 358 | { 359 | "__id__": 8 360 | } 361 | ], 362 | "_prefab": null, 363 | "_opacity": 255, 364 | "_color": { 365 | "__type__": "cc.Color", 366 | "r": 255, 367 | "g": 255, 368 | "b": 255, 369 | "a": 255 370 | }, 371 | "_contentSize": { 372 | "__type__": "cc.Size", 373 | "width": 284, 374 | "height": 399 375 | }, 376 | "_anchorPoint": { 377 | "__type__": "cc.Vec2", 378 | "x": 0.5, 379 | "y": 0.5 380 | }, 381 | "_trs": { 382 | "__type__": "TypedArray", 383 | "ctor": "Float64Array", 384 | "array": [ 385 | -156.83, 386 | 209.014, 387 | 0, 388 | 0, 389 | 0, 390 | 0, 391 | 1, 392 | 1, 393 | 1, 394 | 1 395 | ] 396 | }, 397 | "_eulerAngles": { 398 | "__type__": "cc.Vec3", 399 | "x": 0, 400 | "y": 0, 401 | "z": 0 402 | }, 403 | "_skewX": 0, 404 | "_skewY": 0, 405 | "_is3DNode": false, 406 | "_groupIndex": 0, 407 | "groupIndex": 0, 408 | "_id": "4afmTNfkRDjYP5zaG7Qei1" 409 | }, 410 | { 411 | "__type__": "cc.Sprite", 412 | "_name": "", 413 | "_objFlags": 0, 414 | "node": { 415 | "__id__": 7 416 | }, 417 | "_enabled": true, 418 | "_materials": [ 419 | { 420 | "__uuid__": "cbf349e7-9626-443d-ae30-4572f81fad2f" 421 | } 422 | ], 423 | "_srcBlendFactor": 770, 424 | "_dstBlendFactor": 771, 425 | "_spriteFrame": { 426 | "__uuid__": "58b39b44-d165-415a-afc9-1655148ada22" 427 | }, 428 | "_type": 0, 429 | "_sizeMode": 1, 430 | "_fillType": 0, 431 | "_fillCenter": { 432 | "__type__": "cc.Vec2", 433 | "x": 0, 434 | "y": 0 435 | }, 436 | "_fillStart": 0, 437 | "_fillRange": 0, 438 | "_isTrimmedMode": true, 439 | "_atlas": null, 440 | "_id": "951G+rO1ZF0a3S9auwLWaG" 441 | }, 442 | { 443 | "__type__": "cc.Node", 444 | "_name": "RadialBlur", 445 | "_objFlags": 0, 446 | "_parent": { 447 | "__id__": 2 448 | }, 449 | "_children": [], 450 | "_active": true, 451 | "_components": [ 452 | { 453 | "__id__": 10 454 | } 455 | ], 456 | "_prefab": null, 457 | "_opacity": 255, 458 | "_color": { 459 | "__type__": "cc.Color", 460 | "r": 255, 461 | "g": 255, 462 | "b": 255, 463 | "a": 255 464 | }, 465 | "_contentSize": { 466 | "__type__": "cc.Size", 467 | "width": 284, 468 | "height": 399 469 | }, 470 | "_anchorPoint": { 471 | "__type__": "cc.Vec2", 472 | "x": 0.5, 473 | "y": 0.5 474 | }, 475 | "_trs": { 476 | "__type__": "TypedArray", 477 | "ctor": "Float64Array", 478 | "array": [ 479 | 181.7, 480 | 209.014, 481 | 0, 482 | 0, 483 | 0, 484 | 0, 485 | 1, 486 | 1, 487 | 1, 488 | 1 489 | ] 490 | }, 491 | "_eulerAngles": { 492 | "__type__": "cc.Vec3", 493 | "x": 0, 494 | "y": 0, 495 | "z": 0 496 | }, 497 | "_skewX": 0, 498 | "_skewY": 0, 499 | "_is3DNode": false, 500 | "_groupIndex": 0, 501 | "groupIndex": 0, 502 | "_id": "4bth19xmBAEL4VY5ajYJwo" 503 | }, 504 | { 505 | "__type__": "cc.Sprite", 506 | "_name": "", 507 | "_objFlags": 0, 508 | "node": { 509 | "__id__": 9 510 | }, 511 | "_enabled": true, 512 | "_materials": [ 513 | { 514 | "__uuid__": "8f0a0dc1-7084-4481-ba38-c404557dc52e" 515 | } 516 | ], 517 | "_srcBlendFactor": 770, 518 | "_dstBlendFactor": 771, 519 | "_spriteFrame": { 520 | "__uuid__": "58b39b44-d165-415a-afc9-1655148ada22" 521 | }, 522 | "_type": 0, 523 | "_sizeMode": 1, 524 | "_fillType": 0, 525 | "_fillCenter": { 526 | "__type__": "cc.Vec2", 527 | "x": 0, 528 | "y": 0 529 | }, 530 | "_fillStart": 0, 531 | "_fillRange": 0, 532 | "_isTrimmedMode": true, 533 | "_atlas": null, 534 | "_id": "d5NK6qEvpCToMs80vFHugE" 535 | }, 536 | { 537 | "__type__": "cc.Node", 538 | "_name": "Mosaic", 539 | "_objFlags": 0, 540 | "_parent": { 541 | "__id__": 2 542 | }, 543 | "_children": [], 544 | "_active": true, 545 | "_components": [ 546 | { 547 | "__id__": 12 548 | } 549 | ], 550 | "_prefab": null, 551 | "_opacity": 255, 552 | "_color": { 553 | "__type__": "cc.Color", 554 | "r": 255, 555 | "g": 255, 556 | "b": 255, 557 | "a": 255 558 | }, 559 | "_contentSize": { 560 | "__type__": "cc.Size", 561 | "width": 284, 562 | "height": 399 563 | }, 564 | "_anchorPoint": { 565 | "__type__": "cc.Vec2", 566 | "x": 0.5, 567 | "y": 0.5 568 | }, 569 | "_trs": { 570 | "__type__": "TypedArray", 571 | "ctor": "Float64Array", 572 | "array": [ 573 | 506.704, 574 | 206.346, 575 | 0, 576 | 0, 577 | 0, 578 | 0, 579 | 1, 580 | 1, 581 | 1, 582 | 1 583 | ] 584 | }, 585 | "_eulerAngles": { 586 | "__type__": "cc.Vec3", 587 | "x": 0, 588 | "y": 0, 589 | "z": 0 590 | }, 591 | "_skewX": 0, 592 | "_skewY": 0, 593 | "_is3DNode": false, 594 | "_groupIndex": 0, 595 | "groupIndex": 0, 596 | "_id": "9eM1c0rm9FSLHN8efo8iQl" 597 | }, 598 | { 599 | "__type__": "cc.Sprite", 600 | "_name": "", 601 | "_objFlags": 0, 602 | "node": { 603 | "__id__": 11 604 | }, 605 | "_enabled": true, 606 | "_materials": [ 607 | { 608 | "__uuid__": "83e16eb7-e8bc-408d-9fe7-2a518e6803a0" 609 | } 610 | ], 611 | "_srcBlendFactor": 770, 612 | "_dstBlendFactor": 771, 613 | "_spriteFrame": { 614 | "__uuid__": "58b39b44-d165-415a-afc9-1655148ada22" 615 | }, 616 | "_type": 0, 617 | "_sizeMode": 1, 618 | "_fillType": 0, 619 | "_fillCenter": { 620 | "__type__": "cc.Vec2", 621 | "x": 0, 622 | "y": 0 623 | }, 624 | "_fillStart": 0, 625 | "_fillRange": 0, 626 | "_isTrimmedMode": true, 627 | "_atlas": null, 628 | "_id": "feGEzkzxhIXaUa0O74tJ6n" 629 | }, 630 | { 631 | "__type__": "cc.Node", 632 | "_name": "Disslove", 633 | "_objFlags": 0, 634 | "_parent": { 635 | "__id__": 2 636 | }, 637 | "_children": [], 638 | "_active": true, 639 | "_components": [ 640 | { 641 | "__id__": 14 642 | }, 643 | { 644 | "__id__": 15 645 | } 646 | ], 647 | "_prefab": null, 648 | "_opacity": 255, 649 | "_color": { 650 | "__type__": "cc.Color", 651 | "r": 255, 652 | "g": 255, 653 | "b": 255, 654 | "a": 255 655 | }, 656 | "_contentSize": { 657 | "__type__": "cc.Size", 658 | "width": 284, 659 | "height": 399 660 | }, 661 | "_anchorPoint": { 662 | "__type__": "cc.Vec2", 663 | "x": 0.5, 664 | "y": 0.5 665 | }, 666 | "_trs": { 667 | "__type__": "TypedArray", 668 | "ctor": "Float64Array", 669 | "array": [ 670 | -497.447, 671 | -231.285, 672 | 0, 673 | 0, 674 | 0, 675 | 0, 676 | 1, 677 | 1, 678 | 1, 679 | 1 680 | ] 681 | }, 682 | "_eulerAngles": { 683 | "__type__": "cc.Vec3", 684 | "x": 0, 685 | "y": 0, 686 | "z": 0 687 | }, 688 | "_skewX": 0, 689 | "_skewY": 0, 690 | "_is3DNode": false, 691 | "_groupIndex": 0, 692 | "groupIndex": 0, 693 | "_id": "c2bFuJHXZM/5frzP1lQtYW" 694 | }, 695 | { 696 | "__type__": "cc.Sprite", 697 | "_name": "", 698 | "_objFlags": 0, 699 | "node": { 700 | "__id__": 13 701 | }, 702 | "_enabled": true, 703 | "_materials": [ 704 | { 705 | "__uuid__": "9d0c46d2-2026-42ec-b3cf-d34b07471c6e" 706 | } 707 | ], 708 | "_srcBlendFactor": 770, 709 | "_dstBlendFactor": 771, 710 | "_spriteFrame": { 711 | "__uuid__": "58b39b44-d165-415a-afc9-1655148ada22" 712 | }, 713 | "_type": 0, 714 | "_sizeMode": 1, 715 | "_fillType": 0, 716 | "_fillCenter": { 717 | "__type__": "cc.Vec2", 718 | "x": 0, 719 | "y": 0 720 | }, 721 | "_fillStart": 0, 722 | "_fillRange": 0, 723 | "_isTrimmedMode": true, 724 | "_atlas": null, 725 | "_id": "e3laT0gPZD+r0myJ18HezE" 726 | }, 727 | { 728 | "__type__": "ee8e4cIBiZDZ4StpE1EZfuz", 729 | "_name": "", 730 | "_objFlags": 0, 731 | "node": { 732 | "__id__": 13 733 | }, 734 | "_enabled": true, 735 | "speed": 1, 736 | "isLoop": true, 737 | "isSetUv": false, 738 | "_id": "67/otYQLFHrYpRQMSyIX7/" 739 | }, 740 | { 741 | "__type__": "cc.Node", 742 | "_name": "Water", 743 | "_objFlags": 0, 744 | "_parent": { 745 | "__id__": 2 746 | }, 747 | "_children": [], 748 | "_active": true, 749 | "_components": [ 750 | { 751 | "__id__": 17 752 | }, 753 | { 754 | "__id__": 18 755 | } 756 | ], 757 | "_prefab": null, 758 | "_opacity": 255, 759 | "_color": { 760 | "__type__": "cc.Color", 761 | "r": 255, 762 | "g": 255, 763 | "b": 255, 764 | "a": 255 765 | }, 766 | "_contentSize": { 767 | "__type__": "cc.Size", 768 | "width": 284, 769 | "height": 399 770 | }, 771 | "_anchorPoint": { 772 | "__type__": "cc.Vec2", 773 | "x": 0.5, 774 | "y": 0.5 775 | }, 776 | "_trs": { 777 | "__type__": "TypedArray", 778 | "ctor": "Float64Array", 779 | "array": [ 780 | -164.868, 781 | -231.285, 782 | 0, 783 | 0, 784 | 0, 785 | 0, 786 | 1, 787 | 1, 788 | 1, 789 | 1 790 | ] 791 | }, 792 | "_eulerAngles": { 793 | "__type__": "cc.Vec3", 794 | "x": 0, 795 | "y": 0, 796 | "z": 0 797 | }, 798 | "_skewX": 0, 799 | "_skewY": 0, 800 | "_is3DNode": false, 801 | "_groupIndex": 0, 802 | "groupIndex": 0, 803 | "_id": "bc6Gv0IStC/pOZ+AkUdiG5" 804 | }, 805 | { 806 | "__type__": "cc.Sprite", 807 | "_name": "", 808 | "_objFlags": 0, 809 | "node": { 810 | "__id__": 16 811 | }, 812 | "_enabled": true, 813 | "_materials": [ 814 | { 815 | "__uuid__": "e673829a-3372-4e5e-b3ad-45090fb7b4b1" 816 | } 817 | ], 818 | "_srcBlendFactor": 770, 819 | "_dstBlendFactor": 771, 820 | "_spriteFrame": { 821 | "__uuid__": "58b39b44-d165-415a-afc9-1655148ada22" 822 | }, 823 | "_type": 0, 824 | "_sizeMode": 1, 825 | "_fillType": 0, 826 | "_fillCenter": { 827 | "__type__": "cc.Vec2", 828 | "x": 0, 829 | "y": 0 830 | }, 831 | "_fillStart": 0, 832 | "_fillRange": 0, 833 | "_isTrimmedMode": true, 834 | "_atlas": null, 835 | "_id": "e6UFp+uvxNL7G9Jx0AgCmh" 836 | }, 837 | { 838 | "__type__": "ee8e4cIBiZDZ4StpE1EZfuz", 839 | "_name": "", 840 | "_objFlags": 0, 841 | "node": { 842 | "__id__": 16 843 | }, 844 | "_enabled": true, 845 | "speed": 1, 846 | "isLoop": false, 847 | "isSetUv": false, 848 | "_id": "6dXbh/96xNYKc01xFqAyZ5" 849 | }, 850 | { 851 | "__type__": "cc.Node", 852 | "_name": "WaveLight", 853 | "_objFlags": 0, 854 | "_parent": { 855 | "__id__": 2 856 | }, 857 | "_children": [], 858 | "_active": true, 859 | "_components": [ 860 | { 861 | "__id__": 20 862 | }, 863 | { 864 | "__id__": 21 865 | } 866 | ], 867 | "_prefab": null, 868 | "_opacity": 255, 869 | "_color": { 870 | "__type__": "cc.Color", 871 | "r": 255, 872 | "g": 255, 873 | "b": 255, 874 | "a": 255 875 | }, 876 | "_contentSize": { 877 | "__type__": "cc.Size", 878 | "width": 284, 879 | "height": 399 880 | }, 881 | "_anchorPoint": { 882 | "__type__": "cc.Vec2", 883 | "x": 0.5, 884 | "y": 0.5 885 | }, 886 | "_trs": { 887 | "__type__": "TypedArray", 888 | "ctor": "Float64Array", 889 | "array": [ 890 | 176.77, 891 | -231.285, 892 | 0, 893 | 0, 894 | 0, 895 | 0, 896 | 1, 897 | 1, 898 | 1, 899 | 1 900 | ] 901 | }, 902 | "_eulerAngles": { 903 | "__type__": "cc.Vec3", 904 | "x": 0, 905 | "y": 0, 906 | "z": 0 907 | }, 908 | "_skewX": 0, 909 | "_skewY": 0, 910 | "_is3DNode": false, 911 | "_groupIndex": 0, 912 | "groupIndex": 0, 913 | "_id": "c74nHsbqVJuIS8+P8ukKJ+" 914 | }, 915 | { 916 | "__type__": "cc.Sprite", 917 | "_name": "", 918 | "_objFlags": 0, 919 | "node": { 920 | "__id__": 19 921 | }, 922 | "_enabled": true, 923 | "_materials": [ 924 | { 925 | "__uuid__": "5105e692-6f15-42df-8b29-70646ea07be9" 926 | } 927 | ], 928 | "_srcBlendFactor": 770, 929 | "_dstBlendFactor": 771, 930 | "_spriteFrame": { 931 | "__uuid__": "58b39b44-d165-415a-afc9-1655148ada22" 932 | }, 933 | "_type": 0, 934 | "_sizeMode": 1, 935 | "_fillType": 0, 936 | "_fillCenter": { 937 | "__type__": "cc.Vec2", 938 | "x": 0, 939 | "y": 0 940 | }, 941 | "_fillStart": 0, 942 | "_fillRange": 0, 943 | "_isTrimmedMode": true, 944 | "_atlas": null, 945 | "_id": "53w3QLcGdN75VrJZtTzpN/" 946 | }, 947 | { 948 | "__type__": "ee8e4cIBiZDZ4StpE1EZfuz", 949 | "_name": "", 950 | "_objFlags": 0, 951 | "node": { 952 | "__id__": 19 953 | }, 954 | "_enabled": true, 955 | "speed": 1, 956 | "isLoop": false, 957 | "isSetUv": false, 958 | "_id": "b1eGV8+mhKGIjD+aokfKrt" 959 | }, 960 | { 961 | "__type__": "cc.Node", 962 | "_name": "doge", 963 | "_objFlags": 0, 964 | "_parent": { 965 | "__id__": 2 966 | }, 967 | "_children": [], 968 | "_active": true, 969 | "_components": [ 970 | { 971 | "__id__": 23 972 | } 973 | ], 974 | "_prefab": null, 975 | "_opacity": 255, 976 | "_color": { 977 | "__type__": "cc.Color", 978 | "r": 255, 979 | "g": 255, 980 | "b": 255, 981 | "a": 255 982 | }, 983 | "_contentSize": { 984 | "__type__": "cc.Size", 985 | "width": 259, 986 | "height": 251 987 | }, 988 | "_anchorPoint": { 989 | "__type__": "cc.Vec2", 990 | "x": 0.5, 991 | "y": 0.5 992 | }, 993 | "_trs": { 994 | "__type__": "TypedArray", 995 | "ctor": "Float64Array", 996 | "array": [ 997 | 537.286, 998 | -292.5, 999 | 0, 1000 | 0, 1001 | 0, 1002 | 0, 1003 | 1, 1004 | 1, 1005 | 1, 1006 | 1 1007 | ] 1008 | }, 1009 | "_eulerAngles": { 1010 | "__type__": "cc.Vec3", 1011 | "x": 0, 1012 | "y": 0, 1013 | "z": 0 1014 | }, 1015 | "_skewX": 0, 1016 | "_skewY": 0, 1017 | "_is3DNode": false, 1018 | "_groupIndex": 0, 1019 | "groupIndex": 0, 1020 | "_id": "f972MEgl5JHrVgiNquHp3k" 1021 | }, 1022 | { 1023 | "__type__": "cc.Sprite", 1024 | "_name": "", 1025 | "_objFlags": 0, 1026 | "node": { 1027 | "__id__": 22 1028 | }, 1029 | "_enabled": true, 1030 | "_materials": [ 1031 | { 1032 | "__uuid__": "af53adf5-e563-42b6-b383-d6e0c56638c1" 1033 | } 1034 | ], 1035 | "_srcBlendFactor": 770, 1036 | "_dstBlendFactor": 771, 1037 | "_spriteFrame": { 1038 | "__uuid__": "d65aa96e-b301-4247-a2b8-98542cff5287" 1039 | }, 1040 | "_type": 0, 1041 | "_sizeMode": 1, 1042 | "_fillType": 0, 1043 | "_fillCenter": { 1044 | "__type__": "cc.Vec2", 1045 | "x": 0, 1046 | "y": 0 1047 | }, 1048 | "_fillStart": 0, 1049 | "_fillRange": 0, 1050 | "_isTrimmedMode": true, 1051 | "_atlas": null, 1052 | "_id": "c3wWD6BHJG6JBZBj7DziVz" 1053 | }, 1054 | { 1055 | "__type__": "cc.Node", 1056 | "_name": "Fluxay", 1057 | "_objFlags": 0, 1058 | "_parent": { 1059 | "__id__": 2 1060 | }, 1061 | "_children": [], 1062 | "_active": true, 1063 | "_components": [ 1064 | { 1065 | "__id__": 25 1066 | }, 1067 | { 1068 | "__id__": 26 1069 | } 1070 | ], 1071 | "_prefab": null, 1072 | "_opacity": 255, 1073 | "_color": { 1074 | "__type__": "cc.Color", 1075 | "r": 255, 1076 | "g": 255, 1077 | "b": 255, 1078 | "a": 255 1079 | }, 1080 | "_contentSize": { 1081 | "__type__": "cc.Size", 1082 | "width": 273, 1083 | "height": 69 1084 | }, 1085 | "_anchorPoint": { 1086 | "__type__": "cc.Vec2", 1087 | "x": 0.5, 1088 | "y": 0.5 1089 | }, 1090 | "_trs": { 1091 | "__type__": "TypedArray", 1092 | "ctor": "Float64Array", 1093 | "array": [ 1094 | 523.844, 1095 | -113.594, 1096 | 0, 1097 | 0, 1098 | 0, 1099 | 0, 1100 | 1, 1101 | 1, 1102 | 1, 1103 | 1 1104 | ] 1105 | }, 1106 | "_eulerAngles": { 1107 | "__type__": "cc.Vec3", 1108 | "x": 0, 1109 | "y": 0, 1110 | "z": 0 1111 | }, 1112 | "_skewX": 0, 1113 | "_skewY": 0, 1114 | "_is3DNode": false, 1115 | "_groupIndex": 0, 1116 | "groupIndex": 0, 1117 | "_id": "d3UijO2e1IPaEIL3MYfPRk" 1118 | }, 1119 | { 1120 | "__type__": "cc.Sprite", 1121 | "_name": "", 1122 | "_objFlags": 0, 1123 | "node": { 1124 | "__id__": 24 1125 | }, 1126 | "_enabled": true, 1127 | "_materials": [ 1128 | { 1129 | "__uuid__": "1afce21c-91c0-4bf4-824a-1bf65c5ab976" 1130 | } 1131 | ], 1132 | "_srcBlendFactor": 770, 1133 | "_dstBlendFactor": 771, 1134 | "_spriteFrame": { 1135 | "__uuid__": "7cec85b1-18b2-4ecc-aa8b-df936cedb4cc" 1136 | }, 1137 | "_type": 0, 1138 | "_sizeMode": 1, 1139 | "_fillType": 0, 1140 | "_fillCenter": { 1141 | "__type__": "cc.Vec2", 1142 | "x": 0, 1143 | "y": 0 1144 | }, 1145 | "_fillStart": 0, 1146 | "_fillRange": 0, 1147 | "_isTrimmedMode": true, 1148 | "_atlas": null, 1149 | "_id": "cbA7bMJmtNuoj/+k8FIP9G" 1150 | }, 1151 | { 1152 | "__type__": "ee8e4cIBiZDZ4StpE1EZfuz", 1153 | "_name": "", 1154 | "_objFlags": 0, 1155 | "node": { 1156 | "__id__": 24 1157 | }, 1158 | "_enabled": true, 1159 | "speed": 1, 1160 | "isLoop": true, 1161 | "isSetUv": true, 1162 | "_id": "bbVkM40mtKUL+Epf0lHmj4" 1163 | }, 1164 | { 1165 | "__type__": "cc.Canvas", 1166 | "_name": "", 1167 | "_objFlags": 0, 1168 | "node": { 1169 | "__id__": 2 1170 | }, 1171 | "_enabled": true, 1172 | "_designResolution": { 1173 | "__type__": "cc.Size", 1174 | "width": 1920, 1175 | "height": 1080 1176 | }, 1177 | "_fitWidth": false, 1178 | "_fitHeight": true, 1179 | "_id": "89rcotl5ZAp5787O8rt3m5" 1180 | } 1181 | ] --------------------------------------------------------------------------------