[add] First
This commit is contained in:
12
assets/Resources/effect.meta
Normal file
12
assets/Resources/effect.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "d0b017f7-a6cf-4ac2-a7bb-7f12651d3b10",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
82
assets/Resources/effect/BlurGauss.effect
Normal file
82
assets/Resources/effect/BlurGauss.effect
Normal file
@@ -0,0 +1,82 @@
|
||||
//高斯模糊效果(在华为P6上不生效)
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_degree: { value: 0.03 }
|
||||
u_brightness: { value: 1.0 }
|
||||
}%
|
||||
|
||||
CCProgram vs %{ // 顶点Shader模块开始
|
||||
#include <cc-global>
|
||||
precision highp float; //定义float高精度
|
||||
in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰;
|
||||
in vec2 a_uv0; // 纹理坐标;
|
||||
out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值
|
||||
void main () {
|
||||
gl_Position = cc_matViewProj * vec4(a_position, 1);
|
||||
uv0 = a_uv0;
|
||||
}
|
||||
}%
|
||||
|
||||
CCProgram fs %{
|
||||
#define repeats 5. //重复次数,值越大模糊质量越高,但性能越低
|
||||
precision highp float;
|
||||
in vec2 uv0;
|
||||
uniform sampler2D texture;
|
||||
uniform ARGS{
|
||||
float u_degree; //模糊度,外界属性
|
||||
float u_brightness; //亮度,外界属性
|
||||
};
|
||||
|
||||
// 应用贴图UV
|
||||
vec4 draw(vec2 uv) {
|
||||
return texture2D(texture,uv).rgba;
|
||||
}
|
||||
|
||||
float grid(float var, float size) {
|
||||
return floor(var*size)/size;
|
||||
}
|
||||
|
||||
// 降低亮度
|
||||
vec4 dim(vec4 col, float factor) {
|
||||
return vec4(col.r * factor, col.g * factor, col.b * factor, col.a);
|
||||
}
|
||||
|
||||
// 随机值
|
||||
float rand(vec2 co){
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// 模糊贴图
|
||||
vec4 blurred_image = vec4(0.);
|
||||
// 重复采样
|
||||
for (float i = 0.; i < repeats; i++) {
|
||||
// 第一采样点
|
||||
vec2 q = vec2(cos(degrees((i/repeats)*360.)),sin(degrees((i/repeats)*360.))) * (rand(vec2(i,uv0.x+uv0.y))+u_degree);
|
||||
vec2 uv2 = uv0+(q*u_degree);
|
||||
blurred_image += draw(uv2)/2.;
|
||||
// 第二采样点
|
||||
q = vec2(cos(degrees((i/repeats)*360.)),sin(degrees((i/repeats)*360.))) * (rand(vec2(i+2.,uv0.x+uv0.y+24.))+u_degree);
|
||||
uv2 = uv0+(q*u_degree);
|
||||
blurred_image += draw(uv2)/2.;
|
||||
}
|
||||
// 中和
|
||||
blurred_image /= repeats;
|
||||
// 降低亮度
|
||||
blurred_image = dim(blurred_image, u_brightness);
|
||||
// 导出颜色
|
||||
gl_FragColor = vec4(blurred_image);
|
||||
}
|
||||
}%
|
17
assets/Resources/effect/BlurGauss.effect.meta
Normal file
17
assets/Resources/effect/BlurGauss.effect.meta
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ver": "1.0.25",
|
||||
"uuid": "d64b960e-910a-4f6a-a413-b37932350ea6",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "uniform mat4 cc_matViewProj;\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}",
|
||||
"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}\nvec4 dim(vec4 col, float factor) {\n return vec4(col.r * factor, col.g * factor, col.b * factor, col.a);\n}\nfloat rand(vec2 co){\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\nvoid main()\n{\n vec4 blurred_image = vec4(0.);\n for (float i = 0.; i < 5.; i++) {\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 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 blurred_image /= 5.;\n blurred_image = dim(blurred_image, u_brightness);\n gl_FragColor = vec4(blurred_image);\n}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "uniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\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}",
|
||||
"frag": "\nprecision highp float;\nin vec2 uv0;\nuniform sampler2D texture;\nuniform ARGS{\n float u_degree;\n float u_brightness;\n};\nvec4 draw(vec2 uv) {\n return texture2D(texture,uv).rgba;\n}\nvec4 dim(vec4 col, float factor) {\n return vec4(col.r * factor, col.g * factor, col.b * factor, col.a);\n}\nfloat rand(vec2 co){\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\nvoid main()\n{\n vec4 blurred_image = vec4(0.);\n for (float i = 0.; i < 5.; i++) {\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 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 blurred_image /= 5.;\n blurred_image = dim(blurred_image, u_brightness);\n gl_FragColor = vec4(blurred_image);\n}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
58
assets/Resources/effect/BlurNormal.effect
Normal file
58
assets/Resources/effect/BlurNormal.effect
Normal file
@@ -0,0 +1,58 @@
|
||||
//高斯模糊2
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_resolution: { value: [1280,720] }
|
||||
}%
|
||||
|
||||
CCProgram vs %{
|
||||
#include <cc-global>
|
||||
precision highp float; // 定义float高精度
|
||||
in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰;
|
||||
in vec2 a_uv0; // 纹理坐标;
|
||||
out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值
|
||||
void main () {
|
||||
vec4 pos = cc_matViewProj * vec4(a_position, 1);
|
||||
gl_Position = pos;
|
||||
uv0 = a_uv0;
|
||||
}
|
||||
}%
|
||||
|
||||
CCProgram fs %{
|
||||
precision mediump float;
|
||||
in vec2 uv0;
|
||||
uniform sampler2D texture;
|
||||
uniform ARGS {
|
||||
vec2 u_resolution;
|
||||
float strength;
|
||||
};
|
||||
const float blurRadius = 7.0;
|
||||
void main()
|
||||
{
|
||||
vec2 unit = 1.0 / u_resolution; //单位坐标
|
||||
vec3 sumColor = vec3(0.0, 0.0, 0.0);
|
||||
float count = 0.0;
|
||||
vec4 col = vec4(0.0);
|
||||
for(float fy = -blurRadius; fy <= blurRadius; ++fy)
|
||||
{
|
||||
for(float fx = -blurRadius; fx <= blurRadius; ++fx)
|
||||
{
|
||||
float weight = (blurRadius - abs(fx)) * (blurRadius - abs(fy)); //权重,p点的权重最高,向四周依次减少
|
||||
col += texture2D(texture, uv0 + vec2(fx * unit.x, fy * unit.y)) * weight;
|
||||
count += weight;
|
||||
}
|
||||
}
|
||||
col.a = texture2D(texture, uv0).a;
|
||||
gl_FragColor = vec4(col.rgb / count, col.a);
|
||||
}
|
||||
}%
|
17
assets/Resources/effect/BlurNormal.effect.meta
Normal file
17
assets/Resources/effect/BlurNormal.effect.meta
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ver": "1.0.25",
|
||||
"uuid": "14e64f7c-87c8-459a-ad37-6c773ceea4e6",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "uniform mat4 cc_matViewProj;\nprecision highp float;\nattribute vec3 a_position;\nattribute vec2 a_uv0;\nvarying vec2 uv0;\nvoid main () {\n vec4 pos = cc_matViewProj * vec4(a_position, 1);\n gl_Position = pos;\n uv0 = a_uv0;\n}",
|
||||
"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 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 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}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "uniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nprecision highp float;\nin vec3 a_position;\nin vec2 a_uv0;\nout vec2 uv0;\nvoid main () {\n vec4 pos = cc_matViewProj * vec4(a_position, 1);\n gl_Position = pos;\n uv0 = a_uv0;\n}",
|
||||
"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 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 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}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
56
assets/Resources/effect/Dissolve.effect
Normal file
56
assets/Resources/effect/Dissolve.effect
Normal file
@@ -0,0 +1,56 @@
|
||||
//溶解特效
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_time: { value: 1.0 }
|
||||
}%
|
||||
|
||||
CCProgram vs %{
|
||||
#include <cc-global>
|
||||
precision highp float;
|
||||
in vec3 a_position;
|
||||
in vec2 a_uv0;
|
||||
out vec2 uv0;
|
||||
void main () {
|
||||
gl_Position = cc_matViewProj * vec4(a_position, 1);
|
||||
uv0 = a_uv0;
|
||||
}
|
||||
}%
|
||||
|
||||
CCProgram fs %{
|
||||
precision highp float; //定义高精度
|
||||
uniform sampler2D texture; //纹理
|
||||
uniform ARGS {
|
||||
//时间 根据时间计算需要丢弃的像素颜色值范围,也就是溶解的范围
|
||||
float u_time;
|
||||
};
|
||||
in vec2 uv0;
|
||||
|
||||
void main()
|
||||
{
|
||||
float time = u_time;
|
||||
vec4 c = texture2D(texture,uv0);
|
||||
float height = c.g;
|
||||
if(height < time)
|
||||
{
|
||||
//丢弃像素,相当于溶解效果
|
||||
discard;
|
||||
}
|
||||
if(height < time + 0.1) {
|
||||
//这里可以对溶解边缘进行一些处理,比如透明度减少等
|
||||
c.a = c.a-0.1;
|
||||
}
|
||||
//给片元(像素)赋值
|
||||
gl_FragColor = c;
|
||||
}
|
||||
}%
|
17
assets/Resources/effect/Dissolve.effect.meta
Normal file
17
assets/Resources/effect/Dissolve.effect.meta
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ver": "1.0.25",
|
||||
"uuid": "ed4b64c1-0535-4ae5-9648-4acb0a4c0fd8",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "uniform mat4 cc_matViewProj;\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 }",
|
||||
"frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform float u_time;\nvarying vec2 uv0;\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 discard;\n }\n if(height < time + 0.1) {\n c.a = c.a-0.1;\n }\n gl_FragColor = c;\n}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "uniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\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 }",
|
||||
"frag": "\nprecision highp float;\nuniform sampler2D texture;\nuniform ARGS {\n float u_time;\n};\nin vec2 uv0;\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 discard;\n }\n if(height < time + 0.1) {\n c.a = c.a-0.1;\n }\n gl_FragColor = c;\n}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
182
assets/Resources/effect/Glowing.effect
Normal file
182
assets/Resources/effect/Glowing.effect
Normal file
@@ -0,0 +1,182 @@
|
||||
//外发光效果
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_edge: { value: 0.5 }
|
||||
u_offset: { value: 0.01 }
|
||||
u_edgeBlur: { value: 0.01 }
|
||||
u_mixColor: { value: [1, 1, 1, 1], inspector: { type: color } }
|
||||
u_edgeColor: { value: [1, 1, 1, 0], inspector: { type: color } }
|
||||
}%
|
||||
|
||||
CCProgram vs %{
|
||||
#include <cc-global>
|
||||
precision highp float;
|
||||
in vec4 a_position;
|
||||
in vec2 a_uv0;
|
||||
out vec2 uv0;
|
||||
void main()
|
||||
{
|
||||
gl_Position = cc_matViewProj * a_position;
|
||||
uv0 = a_uv0;
|
||||
}
|
||||
}%
|
||||
|
||||
CCProgram fs %{
|
||||
precision highp float;
|
||||
in vec2 uv0;
|
||||
uniform sampler2D texture;
|
||||
uniform ARGS{
|
||||
vec4 u_mixColor;
|
||||
float u_edge;
|
||||
};
|
||||
|
||||
// 是否边缘羽化
|
||||
#if IS_Edge_Blur
|
||||
uniform ARGS1{
|
||||
float u_edgeBlur;
|
||||
};
|
||||
#endif
|
||||
|
||||
// 是否边缘发光(不要和羽化一起使用,会有边)
|
||||
#if IS_EdgeGlowing
|
||||
uniform ARGS2{
|
||||
float u_offset;
|
||||
};
|
||||
#endif
|
||||
|
||||
// 是否使用边缘颜色
|
||||
#if USE_EDGE_COLOR
|
||||
uniform ARGS3{
|
||||
vec4 u_edgeColor;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
// 应用贴图颜色 画圆
|
||||
vec4 drawCircle() {
|
||||
float edge = u_edge;
|
||||
float dis = 0.0;
|
||||
|
||||
float offset = 0.0;
|
||||
vec2 uv = uv0;
|
||||
|
||||
// 是否边缘发光
|
||||
#if IS_EdgeGlowing
|
||||
offset = u_offset;
|
||||
uv = vec2(0.5 + (uv0.x - 0.5) * ((offset*2.0) + 1.0), 0.5 + (uv0.y - 0.5) * ((offset*2.0) + 1.0));
|
||||
#endif
|
||||
|
||||
if ( uv.x < edge )
|
||||
{
|
||||
if ( uv.y < edge )
|
||||
{
|
||||
dis = distance( uv, vec2(edge, edge) );
|
||||
}
|
||||
if ( uv.y > (1.0 - edge) )
|
||||
{
|
||||
dis = distance( uv, vec2(edge, (1.0 - edge)) );
|
||||
}
|
||||
}
|
||||
else if ( uv.x > (1.0 - edge) )
|
||||
{
|
||||
if ( uv.y < edge )
|
||||
{
|
||||
dis = distance( uv, vec2((1.0 - edge), edge ) );
|
||||
}
|
||||
if ( uv.y > (1.0 - edge) )
|
||||
{
|
||||
dis = distance( uv, vec2((1.0 - edge), (1.0 - edge) ) );
|
||||
}
|
||||
}
|
||||
|
||||
// 混合外边颜色
|
||||
vec4 color = u_mixColor * texture2D(texture,uv);
|
||||
// 边缘颜色
|
||||
vec4 edge_color = color;
|
||||
// 边缘羽化,默认0.01,减少抗锯齿
|
||||
float blur = 0.0;
|
||||
// 是否边缘羽化
|
||||
#if IS_Edge_Blur
|
||||
blur = u_edgeBlur;
|
||||
#endif
|
||||
|
||||
// 如果有外部颜色,重新定义 边缘颜色
|
||||
#if USE_EDGE_COLOR
|
||||
// 如果应用贴图颜色混合
|
||||
#if USER_TEXTURE_COLOR
|
||||
edge_color = u_edgeColor * texture2D(texture,uv);
|
||||
#else
|
||||
edge_color = u_edgeColor;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(dis > 0.001)
|
||||
{
|
||||
// 外圈沟
|
||||
float gap = edge * blur;
|
||||
if(dis <= edge - gap)
|
||||
{
|
||||
color = color;
|
||||
}
|
||||
else if(dis <= edge)
|
||||
{
|
||||
// 平滑过渡: ret smoothstep(a, b, x) 可以用来生成0到1的平滑过渡.
|
||||
float t = smoothstep(0.,gap,edge-dis);
|
||||
|
||||
// 边缘颜色和透明度
|
||||
color = vec4(edge_color.rgb,t * edge_color.a);
|
||||
}else{
|
||||
// 隐藏不要的部分
|
||||
|
||||
// 是否边缘发光
|
||||
#if IS_EdgeGlowing
|
||||
color = vec4(edge_color.rgb, (offset - (dis - edge))/offset);
|
||||
#else
|
||||
color = vec4(edge_color.rgb,0.);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 是否边缘发光
|
||||
#if IS_EdgeGlowing
|
||||
float absX = abs(uv.x - 0.5);
|
||||
if(absX > 0.5)
|
||||
{
|
||||
color = vec4( edge_color.rgb, (offset - (absX - 0.5))/offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
float absY = abs(uv.y - 0.5);
|
||||
if (absY > 0.5){
|
||||
color = vec4( edge_color.rgb, (offset - (absX - 0.5))/offset);
|
||||
}
|
||||
else{
|
||||
color = color;
|
||||
}
|
||||
}
|
||||
#else
|
||||
color = color;
|
||||
#endif
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = drawCircle();
|
||||
gl_FragColor = color;
|
||||
}
|
||||
}%
|
17
assets/Resources/effect/Glowing.effect.meta
Normal file
17
assets/Resources/effect/Glowing.effect.meta
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ver": "1.0.25",
|
||||
"uuid": "0f9457ac-e49b-4ec4-bd74-11b0eabbdb4d",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "uniform mat4 cc_matViewProj;\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}",
|
||||
"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#if IS_EdgeGlowing\n uniform float u_offset;\n#endif\n#if USE_EDGE_COLOR\n uniform vec4 u_edgeColor;\n#endif\nvec4 drawCircle() {\n float edge = u_edge;\n float dis = 0.0;\n float offset = 0.0;\n vec2 uv = uv0;\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 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 vec4 color = u_mixColor * texture2D(texture,uv);\n vec4 edge_color = color;\n float blur = 0.0;\n #if IS_Edge_Blur\n blur = u_edgeBlur;\n #endif\n #if USE_EDGE_COLOR\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 if(dis > 0.001)\n {\n float gap = edge * blur;\n if(dis <= edge - gap)\n {\n color = color;\n }\n else if(dis <= edge)\n {\n float t = smoothstep(0.,gap,edge-dis);\n color = vec4(edge_color.rgb,t * edge_color.a);\n }else{\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 #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 void main()\n {\n vec4 color = drawCircle();\n gl_FragColor = color;\n }"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "uniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\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}",
|
||||
"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#if IS_Edge_Blur\n uniform ARGS1{\n float u_edgeBlur;\n };\n#endif\n#if IS_EdgeGlowing\n uniform ARGS2{\n float u_offset;\n };\n#endif\n#if USE_EDGE_COLOR\n uniform ARGS3{\n vec4 u_edgeColor;\n };\n#endif\nvec4 drawCircle() {\n float edge = u_edge;\n float dis = 0.0;\n float offset = 0.0;\n vec2 uv = uv0;\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 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 vec4 color = u_mixColor * texture2D(texture,uv);\n vec4 edge_color = color;\n float blur = 0.0;\n #if IS_Edge_Blur\n blur = u_edgeBlur;\n #endif\n #if USE_EDGE_COLOR\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 if(dis > 0.001)\n {\n float gap = edge * blur;\n if(dis <= edge - gap)\n {\n color = color;\n }\n else if(dis <= edge)\n {\n float t = smoothstep(0.,gap,edge-dis);\n color = vec4(edge_color.rgb,t * edge_color.a);\n }else{\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 #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 void main()\n {\n vec4 color = drawCircle();\n gl_FragColor = color;\n }"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
48
assets/Resources/effect/Mosaic.effect
Normal file
48
assets/Resources/effect/Mosaic.effect
Normal file
@@ -0,0 +1,48 @@
|
||||
//马赛克
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_resolution: { value: [1280,720] }
|
||||
u_mosaicSize: { value: 12 }
|
||||
}%
|
||||
|
||||
CCProgram vs %{
|
||||
#include <cc-global>
|
||||
precision highp float;
|
||||
in vec3 a_position;
|
||||
in vec2 a_uv0;
|
||||
out vec2 uv0;
|
||||
void main () {
|
||||
gl_Position = cc_matViewProj * vec4(a_position, 1);
|
||||
uv0 = a_uv0;
|
||||
}
|
||||
}%
|
||||
|
||||
CCProgram fs %{
|
||||
precision highp float;
|
||||
in vec2 uv0;
|
||||
uniform sampler2D texture;
|
||||
uniform ARGS {
|
||||
vec2 u_resolution;
|
||||
float u_mosaicSize;
|
||||
};
|
||||
void main(void)
|
||||
{
|
||||
vec4 color;
|
||||
vec2 xy = vec2(uv0.x * u_resolution.x, uv0.y * u_resolution.y);
|
||||
vec2 xyMosaic = vec2(floor(xy.x / u_mosaicSize) * u_mosaicSize, floor(xy.y / u_mosaicSize) * u_mosaicSize);
|
||||
vec2 uvMosaic = vec2(xyMosaic.x / u_resolution.x, xyMosaic.y / u_resolution.y);
|
||||
color = texture2D( texture, uvMosaic);
|
||||
gl_FragColor = color;
|
||||
}
|
||||
}%
|
17
assets/Resources/effect/Mosaic.effect.meta
Normal file
17
assets/Resources/effect/Mosaic.effect.meta
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ver": "1.0.25",
|
||||
"uuid": "8b12cd41-6673-45b2-8e81-f77078e331b4",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "uniform mat4 cc_matViewProj;\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}",
|
||||
"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}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "uniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\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}",
|
||||
"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}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
60
assets/Resources/effect/RadialBlur.effect
Normal file
60
assets/Resources/effect/RadialBlur.effect
Normal file
@@ -0,0 +1,60 @@
|
||||
//径向模糊
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_point: { value: [0.5, 0.5] }
|
||||
u_resolution: { value: [1280, 720] }
|
||||
u_Strength: { value: 0.125 }
|
||||
}%
|
||||
|
||||
CCProgram vs %{ // 顶点Shader模块开始
|
||||
#include <cc-global>
|
||||
precision highp float; //定义float高精度
|
||||
in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰;
|
||||
in vec2 a_uv0; // 纹理坐标;
|
||||
out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值
|
||||
void main () {
|
||||
gl_Position = cc_matViewProj * vec4(a_position, 1);
|
||||
uv0 = a_uv0;
|
||||
}
|
||||
}%
|
||||
|
||||
CCProgram fs %{
|
||||
precision highp float;
|
||||
in vec2 uv0;
|
||||
uniform sampler2D texture;
|
||||
uniform ARGS{
|
||||
vec2 u_resolution;
|
||||
vec2 u_point;
|
||||
float u_Strength;
|
||||
};
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
// const float u_Strength = 0.125;
|
||||
const int Samples = 64; //multiple of 2
|
||||
vec2 uv = fragCoord.xy;
|
||||
vec2 dir = (fragCoord.xy-u_point.xy);
|
||||
vec4 color = vec4(0.0,0.0,0.0,0.0);
|
||||
for (int i = 0; i < Samples; i += 2) //operating at 2 samples for better performance
|
||||
{
|
||||
color += texture2D(texture,uv+float(i)/float(Samples)*dir*u_Strength);
|
||||
color += texture2D(texture,uv+float(i+1)/float(Samples)*dir*u_Strength);
|
||||
}
|
||||
fragColor = color/float(Samples);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
mainImage(gl_FragColor, uv0);
|
||||
}
|
||||
}%
|
17
assets/Resources/effect/RadialBlur.effect.meta
Normal file
17
assets/Resources/effect/RadialBlur.effect.meta
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ver": "1.0.25",
|
||||
"uuid": "9d24dc19-8d72-483a-903d-914ccf86f169",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "uniform mat4 cc_matViewProj;\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}",
|
||||
"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 const int Samples = 64;\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 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}\nvoid main(void)\n{\n mainImage(gl_FragColor, uv0);\n}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "uniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\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}",
|
||||
"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 const int Samples = 64;\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 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}\nvoid main(void)\n{\n mainImage(gl_FragColor, uv0);\n}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
72
assets/Resources/effect/Water.effect
Normal file
72
assets/Resources/effect/Water.effect
Normal file
@@ -0,0 +1,72 @@
|
||||
//水波纹效果
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_resolution: { value: [1280,720] }
|
||||
u_time: { value: 1.0 }
|
||||
}%
|
||||
|
||||
CCProgram vs %{ // 顶点Shader模块开始
|
||||
#include <cc-global>
|
||||
precision highp float; //定义float高精度
|
||||
in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰;
|
||||
in vec2 a_uv0; // 纹理坐标;
|
||||
out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值
|
||||
void main () {
|
||||
gl_Position = cc_matViewProj * vec4(a_position, 1);
|
||||
uv0 = a_uv0;
|
||||
}
|
||||
}%
|
||||
|
||||
CCProgram fs %{
|
||||
precision highp float;
|
||||
in vec2 uv0;
|
||||
uniform sampler2D texture;
|
||||
uniform ARGS {
|
||||
vec4 UVoffset;
|
||||
vec2 u_resolution;
|
||||
float u_time;
|
||||
float rotated;
|
||||
};
|
||||
|
||||
#define F cos(x-y)*cos(y),sin(x+y)*sin(y)
|
||||
|
||||
vec2 s(vec2 p)
|
||||
{
|
||||
float d=u_time*0.2,x=8.*(p.x+d),y=8.*(p.y+d);
|
||||
return vec2(F);
|
||||
}
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
// 换成resolution
|
||||
vec2 rs = u_resolution.xy;
|
||||
// 换成纹理坐标v_texCoord.xy
|
||||
vec2 uv = fragCoord;
|
||||
vec2 q = uv+2./u_resolution.x*(s(uv)-s(uv+rs));
|
||||
//反转y
|
||||
//q.y=1.-q.y;
|
||||
fragColor = texture2D(texture, q);
|
||||
}
|
||||
void main()
|
||||
{
|
||||
vec2 UVnormalize;
|
||||
UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x);
|
||||
UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y);
|
||||
if(rotated > 0.5)
|
||||
{
|
||||
float temp = UVnormalize.x;
|
||||
UVnormalize.x = UVnormalize.y;
|
||||
UVnormalize.y = 1.0 - temp;
|
||||
}
|
||||
mainImage(gl_FragColor, uv0.xy);
|
||||
}
|
||||
}%
|
17
assets/Resources/effect/Water.effect.meta
Normal file
17
assets/Resources/effect/Water.effect.meta
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ver": "1.0.25",
|
||||
"uuid": "7d5495a0-26aa-4858-a9db-37507aff7ba4",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "uniform mat4 cc_matViewProj;\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}",
|
||||
"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 vec2 rs = u_resolution.xy;\n vec2 uv = fragCoord;\n vec2 q = uv+2./u_resolution.x*(s(uv)-s(uv+rs));\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}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "uniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\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}",
|
||||
"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};\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 vec2 rs = u_resolution.xy;\n vec2 uv = fragCoord;\n vec2 q = uv+2./u_resolution.x*(s(uv)-s(uv+rs));\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}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
82
assets/Resources/effect/WaveLight.effect
Normal file
82
assets/Resources/effect/WaveLight.effect
Normal file
@@ -0,0 +1,82 @@
|
||||
//波纹流光
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_time: { value: 0.5 }
|
||||
}%
|
||||
|
||||
CCProgram vs %{ // 顶点Shader模块开始
|
||||
#include <cc-global>
|
||||
precision highp float; //定义float高精度
|
||||
in vec3 a_position; // 顶点Shader 从渲染管道里面获取的顶点信息,使用attribute来修饰;
|
||||
in vec2 a_uv0; // 纹理坐标;
|
||||
out vec2 uv0; // 传递给着色Shader,varying 来修饰,进行插值
|
||||
void main () {
|
||||
gl_Position = cc_matViewProj * vec4(a_position, 1);
|
||||
uv0 = a_uv0;
|
||||
}
|
||||
}%
|
||||
|
||||
CCProgram fs %{
|
||||
#define TAU 6.12
|
||||
#define MAX_ITER 5
|
||||
precision highp float;
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D texture;
|
||||
uniform ARGS {
|
||||
vec4 UVoffset;
|
||||
float u_time;
|
||||
float rotated;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
float u_time = u_time * .5+5.;
|
||||
vec2 UVnormalize;
|
||||
UVnormalize.x = (uv0.x-UVoffset.x)/(UVoffset.z-UVoffset.x);
|
||||
UVnormalize.y = (uv0.y-UVoffset.y)/(UVoffset.w-UVoffset.y);
|
||||
if(rotated > 0.5)
|
||||
{
|
||||
float temp = UVnormalize.x;
|
||||
UVnormalize.x = UVnormalize.y;
|
||||
UVnormalize.y = 1.0 - temp;
|
||||
}
|
||||
|
||||
vec2 uv = uv0.xy;//fragCoord.xy / iResolution.xy;
|
||||
|
||||
vec2 p = mod(uv*TAU, TAU)-250.0;
|
||||
|
||||
vec2 i = vec2(p);
|
||||
float c = 1.0;
|
||||
float inten = .0065;
|
||||
|
||||
for (int n = 0; n < MAX_ITER; n++)
|
||||
{
|
||||
float t = u_time * (1.0 - (3.5 / float(n+1)));
|
||||
i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(1.5*t + i.x));
|
||||
c += 1.0/length(vec2(p.x / (cos(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));
|
||||
}
|
||||
c /= float(MAX_ITER);
|
||||
c = 1.17-pow(c, 1.4);
|
||||
vec4 tex = texture2D(texture,uv0);
|
||||
vec3 colour = vec3(pow(abs(c), 20.0));
|
||||
colour = clamp(colour + vec3(0.0, 0.0, .0), 0.0, tex.a);
|
||||
|
||||
// 混合波光
|
||||
float alpha = c*tex[3];
|
||||
tex[0] = tex[0] + colour[0]*alpha;
|
||||
tex[1] = tex[1] + colour[1]*alpha;
|
||||
tex[2] = tex[2] + colour[2]*alpha;
|
||||
gl_FragColor = vec4(1,1,1,1) * tex;
|
||||
}
|
||||
}%
|
17
assets/Resources/effect/WaveLight.effect.meta
Normal file
17
assets/Resources/effect/WaveLight.effect.meta
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ver": "1.0.25",
|
||||
"uuid": "ae91e5d2-7d0a-41f4-a4fa-ffe0037ff8a0",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "uniform mat4 cc_matViewProj;\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}",
|
||||
"frag": "\nprecision highp float;\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 vec2 uv = uv0.xy;\n vec2 p = mod(uv*6.12, 6.12)-250.0;\n vec2 i = vec2(p);\n float c = 1.0;\n float inten = .0065;\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 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}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "uniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\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}",
|
||||
"frag": "\nprecision highp float;\nin vec2 uv0;\nuniform sampler2D texture;\nuniform ARGS {\n vec4 UVoffset;\n float u_time;\n float rotated;\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 vec2 uv = uv0.xy;\n vec2 p = mod(uv*6.12, 6.12)-250.0;\n vec2 i = vec2(p);\n float c = 1.0;\n float inten = .0065;\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 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}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
12
assets/Resources/material.meta
Normal file
12
assets/Resources/material.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "7ac67478-2a74-402e-971b-8e4aa8058cbf",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Resources/material/BlurGauss.mtl
Normal file
13
assets/Resources/material/BlurGauss.mtl
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "d64b960e-910a-4f6a-a413-b37932350ea6"
|
||||
},
|
||||
"_defines": {},
|
||||
"_props": {
|
||||
"u_degree": 0.02
|
||||
}
|
||||
}
|
6
assets/Resources/material/BlurGauss.mtl.meta
Normal file
6
assets/Resources/material/BlurGauss.mtl.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "b4bd1276-dc2b-4f11-84d3-50c9f68daaaa",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
17
assets/Resources/material/BlurNormal.mtl
Normal file
17
assets/Resources/material/BlurNormal.mtl
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "14e64f7c-87c8-459a-ad37-6c773ceea4e6"
|
||||
},
|
||||
"_defines": {},
|
||||
"_props": {
|
||||
"u_resolution": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 284,
|
||||
"y": 399
|
||||
}
|
||||
}
|
||||
}
|
6
assets/Resources/material/BlurNormal.mtl.meta
Normal file
6
assets/Resources/material/BlurNormal.mtl.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "cbf349e7-9626-443d-ae30-4572f81fad2f",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Resources/material/Disslove.mtl
Normal file
13
assets/Resources/material/Disslove.mtl
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "ed4b64c1-0535-4ae5-9648-4acb0a4c0fd8"
|
||||
},
|
||||
"_defines": {},
|
||||
"_props": {
|
||||
"u_time": 0.5
|
||||
}
|
||||
}
|
6
assets/Resources/material/Disslove.mtl.meta
Normal file
6
assets/Resources/material/Disslove.mtl.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "9d0c46d2-2026-42ec-b3cf-d34b07471c6e",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
26
assets/Resources/material/Glowing.mtl
Normal file
26
assets/Resources/material/Glowing.mtl
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "0f9457ac-e49b-4ec4-bd74-11b0eabbdb4d"
|
||||
},
|
||||
"_defines": {
|
||||
"IS_Edge_Blur": false,
|
||||
"IS_EdgeGlowing": true,
|
||||
"USE_EDGE_COLOR": true
|
||||
},
|
||||
"_props": {
|
||||
"u_edge": 0.5,
|
||||
"u_offset": 0.1,
|
||||
"u_edgeBlur": 0.1,
|
||||
"u_edgeColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 245,
|
||||
"g": 220,
|
||||
"b": 41,
|
||||
"a": 255
|
||||
}
|
||||
}
|
||||
}
|
6
assets/Resources/material/Glowing.mtl.meta
Normal file
6
assets/Resources/material/Glowing.mtl.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "af53adf5-e563-42b6-b383-d6e0c56638c1",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
18
assets/Resources/material/Mosaic.mtl
Normal file
18
assets/Resources/material/Mosaic.mtl
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "8b12cd41-6673-45b2-8e81-f77078e331b4"
|
||||
},
|
||||
"_defines": {},
|
||||
"_props": {
|
||||
"u_resolution": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 200,
|
||||
"y": 300
|
||||
},
|
||||
"u_mosaicSize": 5
|
||||
}
|
||||
}
|
6
assets/Resources/material/Mosaic.mtl.meta
Normal file
6
assets/Resources/material/Mosaic.mtl.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "83e16eb7-e8bc-408d-9fe7-2a518e6803a0",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
16
assets/Resources/material/New Material.mtl
Normal file
16
assets/Resources/material/New Material.mtl
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "builtin-2d-sprite",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "2874f8dd-416c-4440-81b7-555975426e93"
|
||||
},
|
||||
"_techniqueData": {
|
||||
"0": {
|
||||
"defines": {
|
||||
"USE_TEXTURE": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
6
assets/Resources/material/New Material.mtl.meta
Normal file
6
assets/Resources/material/New Material.mtl.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "56ba2053-66bd-4240-bddb-c0977fe8a943",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
22
assets/Resources/material/RadialBlur.mtl
Normal file
22
assets/Resources/material/RadialBlur.mtl
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "9d24dc19-8d72-483a-903d-914ccf86f169"
|
||||
},
|
||||
"_defines": {},
|
||||
"_props": {
|
||||
"u_point": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"u_resolution": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 200,
|
||||
"y": 300
|
||||
}
|
||||
}
|
||||
}
|
6
assets/Resources/material/RadialBlur.mtl.meta
Normal file
6
assets/Resources/material/RadialBlur.mtl.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "8f0a0dc1-7084-4481-ba38-c404557dc52e",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
18
assets/Resources/material/Water.mtl
Normal file
18
assets/Resources/material/Water.mtl
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "7d5495a0-26aa-4858-a9db-37507aff7ba4"
|
||||
},
|
||||
"_defines": {},
|
||||
"_props": {
|
||||
"u_resolution": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 284,
|
||||
"y": 300
|
||||
},
|
||||
"u_time": 0.3
|
||||
}
|
||||
}
|
6
assets/Resources/material/Water.mtl.meta
Normal file
6
assets/Resources/material/Water.mtl.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "e673829a-3372-4e5e-b3ad-45090fb7b4b1",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
11
assets/Resources/material/WaveLight.mtl
Normal file
11
assets/Resources/material/WaveLight.mtl
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "ae91e5d2-7d0a-41f4-a4fa-ffe0037ff8a0"
|
||||
},
|
||||
"_defines": {},
|
||||
"_props": {}
|
||||
}
|
6
assets/Resources/material/WaveLight.mtl.meta
Normal file
6
assets/Resources/material/WaveLight.mtl.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "5105e692-6f15-42df-8b29-70646ea07be9",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
12
assets/Resources/picture.meta
Normal file
12
assets/Resources/picture.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "0421f3da-2a3b-452f-b35b-96b2e6548c12",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/Resources/picture/Lighting1.png
Normal file
BIN
assets/Resources/picture/Lighting1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
36
assets/Resources/picture/Lighting1.png.meta
Normal file
36
assets/Resources/picture/Lighting1.png.meta
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "ee84914d-bfad-4f0f-a92e-f88764d50828",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 130,
|
||||
"height": 50,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"Lighting1": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "1ee898d3-b293-4eb0-a9ea-dbd5f58a7877",
|
||||
"rawTextureUuid": "ee84914d-bfad-4f0f-a92e-f88764d50828",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 130,
|
||||
"height": 50,
|
||||
"rawWidth": 130,
|
||||
"rawHeight": 50,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/Resources/picture/button.png
Normal file
BIN
assets/Resources/picture/button.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
36
assets/Resources/picture/button.png.meta
Normal file
36
assets/Resources/picture/button.png.meta
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "ae28f27b-f641-4b35-855c-042c4edc9683",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 273,
|
||||
"height": 69,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"button": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "7cec85b1-18b2-4ecc-aa8b-df936cedb4cc",
|
||||
"rawTextureUuid": "ae28f27b-f641-4b35-855c-042c4edc9683",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 273,
|
||||
"height": 69,
|
||||
"rawWidth": 273,
|
||||
"rawHeight": 69,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/Resources/picture/card.png
Normal file
BIN
assets/Resources/picture/card.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 205 KiB |
36
assets/Resources/picture/card.png.meta
Normal file
36
assets/Resources/picture/card.png.meta
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "98b62bdd-03ee-41d7-832f-a0d0aeed4fee",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 307,
|
||||
"height": 465,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"card": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "58b39b44-d165-415a-afc9-1655148ada22",
|
||||
"rawTextureUuid": "98b62bdd-03ee-41d7-832f-a0d0aeed4fee",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -8.5,
|
||||
"offsetY": -18,
|
||||
"trimX": 3,
|
||||
"trimY": 51,
|
||||
"width": 284,
|
||||
"height": 399,
|
||||
"rawWidth": 307,
|
||||
"rawHeight": 465,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/Resources/picture/doge.jpg
Normal file
BIN
assets/Resources/picture/doge.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
36
assets/Resources/picture/doge.jpg.meta
Normal file
36
assets/Resources/picture/doge.jpg.meta
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "c8f25bc5-8fcc-4793-b7d2-e137572919b5",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": false,
|
||||
"width": 259,
|
||||
"height": 251,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"doge": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "d65aa96e-b301-4247-a2b8-98542cff5287",
|
||||
"rawTextureUuid": "c8f25bc5-8fcc-4793-b7d2-e137572919b5",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 259,
|
||||
"height": 251,
|
||||
"rawWidth": 259,
|
||||
"rawHeight": 251,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
12
assets/Resources/scene.meta
Normal file
12
assets/Resources/scene.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "6949475a-8182-4735-af5d-ceebd726f82e",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
1098
assets/Resources/scene/main.fire
Normal file
1098
assets/Resources/scene/main.fire
Normal file
File diff suppressed because it is too large
Load Diff
7
assets/Resources/scene/main.fire.meta
Normal file
7
assets/Resources/scene/main.fire.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.2.9",
|
||||
"uuid": "740c9049-6f22-4fa2-abda-61ad9e1335eb",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
12
assets/Resources/script.meta
Normal file
12
assets/Resources/script.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "da5ec520-7a5e-41c3-8388-b31a9e9840b1",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
61
assets/Resources/script/ShaderController.ts
Normal file
61
assets/Resources/script/ShaderController.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
const {ccclass,property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class ShaderTime extends cc.Component
|
||||
{
|
||||
/**记录时间 */
|
||||
private time: number;
|
||||
private sprite: cc.Sprite;
|
||||
/**精灵上的材质 */
|
||||
private material: any;
|
||||
/**增加还是减少 */
|
||||
private IsAdd: boolean;
|
||||
|
||||
/**速度 */
|
||||
@property({type: cc.Float,tooltip: "速度"})
|
||||
speed = 1.0;
|
||||
|
||||
/**是否循环 */
|
||||
@property({tooltip: "是否循环"})
|
||||
isLoop: boolean = false;
|
||||
|
||||
/**是否设置UV到effect(解决动态合图的bug) */
|
||||
@property({tooltip: "是否设置UV到effect(解决动态合图的bug)"})
|
||||
isSetUv: boolean = false;
|
||||
|
||||
start()
|
||||
{
|
||||
this.time = 0;
|
||||
this.IsAdd = true;
|
||||
this.sprite = this.node.getComponent(cc.Sprite);
|
||||
this.material = this.sprite.getMaterial(0); //获取材质
|
||||
}
|
||||
|
||||
update(dt)
|
||||
{
|
||||
this.material.setProperty("u_time",this.time); //设置材质对应的属性
|
||||
(this.isLoop && !this.IsAdd) ? this.time -= dt * this.speed : this.time += dt * this.speed;
|
||||
if(this.isSetUv)
|
||||
{ //传递UV 参数到 effect
|
||||
let frame = this.sprite.spriteFrame as any;
|
||||
let l = 0,r = 0,b = 1,t = 1;
|
||||
l = frame.uv[0];
|
||||
t = frame.uv[5];
|
||||
r = frame.uv[6];
|
||||
b = frame.uv[3];
|
||||
let u_UVoffset = new cc.Vec4(l,t,r,b);
|
||||
let u_rotated = frame.isRotated() ? 1.0 : 0.0;
|
||||
this.material.setProperty("u_UVoffset",u_UVoffset);
|
||||
this.material.setProperty("u_rotated",u_rotated);
|
||||
}
|
||||
cc.log(this.time);
|
||||
if(this.time > 1.5)
|
||||
{
|
||||
this.IsAdd = false;
|
||||
}
|
||||
else if(this.time < -0.5)
|
||||
{
|
||||
this.IsAdd = true;
|
||||
}
|
||||
}
|
||||
}
|
9
assets/Resources/script/ShaderController.ts.meta
Normal file
9
assets/Resources/script/ShaderController.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.8",
|
||||
"uuid": "ee8e4708-0626-4367-84ad-a44d4465fbb3",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
Reference in New Issue
Block a user