[add] First
53
.gitignore
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
# Fireball Projects
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/library/
|
||||||
|
/temp/
|
||||||
|
/local/
|
||||||
|
/build/
|
||||||
|
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
# npm files
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
npm-debug.log
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
# Logs and databases
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
*.log
|
||||||
|
*.sql
|
||||||
|
*.sqlite
|
||||||
|
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
# files for debugger
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
*.sln
|
||||||
|
*.csproj
|
||||||
|
*.pidb
|
||||||
|
*.unityproj
|
||||||
|
*.suo
|
||||||
|
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
# OS generated files
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
# WebStorm files
|
||||||
|
#/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
#//////////////////////////
|
||||||
|
# VS Code files
|
||||||
|
#//////////////////////////
|
||||||
|
|
||||||
|
.vscode/
|
200
README.md
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
# Cosos Creator 2.2.X shader 教程
|
||||||
|
## 前言
|
||||||
|
自己之前要做shader的一些效果,发现cocos相关文档很少,后面在论坛看帖子慢慢摸索了几周,也踩了几个坑耽误了一些功夫
|
||||||
|
现在把自己总结的一些笔记和大家分享讨论一下,有什么错误或者不足的欢迎提建议,自己也还是个刚入门的,希望可以帮到一些想着手的童鞋,也算是回馈社区
|
||||||
|
## 几个简单的效果
|
||||||
|
|
||||||
|
[查看demo代码](https://github.com/XuDaFei/CocosCreator-2.2.X-shader-demo)
|
||||||
|
|
||||||
|
![shader使用流程](/readme_pic/shader.png)
|
||||||
|
## 新建 shader 资源
|
||||||
|
### 编辑器中:
|
||||||
|
在 Creator 中新建所需的 matrial、effect, 并且在 material 中设置对应的 effct 资源
|
||||||
|
|
||||||
|
### 代码中:
|
||||||
|
你需要在creator.d.ts 中添加几个接口来防止 ts 报错(不加只是爆红,不影响使用)
|
||||||
|
```typescript
|
||||||
|
export class Material extends Asset {
|
||||||
|
effectAsset: Asset; //材质对应的effect资源
|
||||||
|
define(name: string, val: any): void; //设置宏定义
|
||||||
|
setProperty(name:string, val: any); //设置变量
|
||||||
|
static getBuiltinMaterial(materialUrl: string): Material //获取系统的材质
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class EffectAsset extends Asset
|
||||||
|
{
|
||||||
|
}
|
||||||
|
```
|
||||||
|
设置材质的接口
|
||||||
|
```typescript
|
||||||
|
/** !#en
|
||||||
|
Base class for components which supports rendering features.
|
||||||
|
!#zh
|
||||||
|
所有支持渲染的组件的基类 */
|
||||||
|
export class RenderComponent extends Component
|
||||||
|
{
|
||||||
|
/** !#en The materials used by this render component.
|
||||||
|
!#zh 渲染组件使用的材质。 */
|
||||||
|
sharedMaterials: Material[];
|
||||||
|
/**
|
||||||
|
!#en Get the material by index.
|
||||||
|
!#zh 根据指定索引获取材质
|
||||||
|
@param index index
|
||||||
|
*/
|
||||||
|
getMaterial(index: number): Material;
|
||||||
|
/**
|
||||||
|
!#en Set the material by index.
|
||||||
|
!#zh 根据指定索引设置材质
|
||||||
|
@param index index
|
||||||
|
@param material material
|
||||||
|
*/
|
||||||
|
setMaterial(index: number,material: Material): void;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
你可以用上面的几个接口来加载对应 effect 和 material,设置属性,设置对应的材质到对应的组件上
|
||||||
|
只要是继承了 RenderComponent 的组件,比如是Sprite, Label, Spine等,都可以设置和获取材质
|
||||||
|
|
||||||
|
## Effect 资源和 Matrial 资源
|
||||||
|
EffectAsset 就是保存我们自己编写的 shader 程序, 在引擎中对应着 EffectAsset 资源, 引擎读取渲染组件中的 effect 配置,并设置
|
||||||
|
对应渲染数据后调用WebGL的API进行渲染。
|
||||||
|
Creator 2.2 版本已经更新了 effect 文件的格式,关于 Matrial 和 Effect 的可以参考 [Cocos Creator 3D文档](https://docs.cocos.com/creator3d/manual/zh/material-system/overview.html)
|
||||||
|
这里用一个最简单的栗子来介绍一下
|
||||||
|
```yaml
|
||||||
|
CCEffect %{
|
||||||
|
techniques:
|
||||||
|
- passes:
|
||||||
|
- vert: vs //指向vert shader
|
||||||
|
frag: fs //指向frag shader
|
||||||
|
blendState: //渲染参数
|
||||||
|
targets:
|
||||||
|
- blend: true
|
||||||
|
rasterizerState:
|
||||||
|
cullMode: none
|
||||||
|
properties: //变量,会显示在 material 面板 上
|
||||||
|
texture: { value: white }
|
||||||
|
u_time: { value: 1.0 }
|
||||||
|
}%
|
||||||
|
|
||||||
|
CCProgram vs %{ //顶点着色器(GLSL 300 es格式)
|
||||||
|
#include <cc-global> //引用头文件,cc_matViewProj 变换矩阵就是在里面的变量
|
||||||
|
precision highp float; //定义精度
|
||||||
|
in vec3 a_position; //顶点位置
|
||||||
|
in vec2 a_uv0; //uv 坐标
|
||||||
|
out vec2 uv0; //插值输出到片元的uv 坐标
|
||||||
|
void main () {
|
||||||
|
gl_Position = cc_matViewProj * vec4(a_position, 1);
|
||||||
|
uv0 = a_uv0;
|
||||||
|
}
|
||||||
|
}%
|
||||||
|
|
||||||
|
CCProgram fs %{ //片元着色器
|
||||||
|
precision highp float; //定义精度
|
||||||
|
uniform sampler2D texture; //纹理
|
||||||
|
uniform ARGS { //除了系统的uniform ,其他uniform 变量都要定义在UBO(统一变量块)内
|
||||||
|
//时间 根据时间计算需要丢弃的像素颜色值范围,也就是溶解的范围
|
||||||
|
float u_time;
|
||||||
|
}
|
||||||
|
in vec2 uv0;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
float time = u_time;
|
||||||
|
vec4 c = texture2D(texture,uv0); //用纹理和uv坐标采样到对应片元的颜色
|
||||||
|
float height = c.g;
|
||||||
|
if(height < time)
|
||||||
|
{
|
||||||
|
//丢弃像素,相当于溶解效果
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
if(height < time + 0.1) {
|
||||||
|
//这里可以对溶解边缘进行一些处理,比如透明度减少等
|
||||||
|
c.a = c.a-0.1;
|
||||||
|
}
|
||||||
|
//给片元(像素)赋值
|
||||||
|
gl_FragColor = c;
|
||||||
|
}
|
||||||
|
}%
|
||||||
|
```
|
||||||
|
Material 只需要在编辑器或者代码中设置对应的effect。在初始化和运行的时候设置对应的变量
|
||||||
|
|
||||||
|
## 运行
|
||||||
|
像溶解和流光等效果都需要在运行的代码中更新对应的时间参数,下面也举个小栗子
|
||||||
|
```typescript
|
||||||
|
const {ccclass,property} = cc._decorator;
|
||||||
|
|
||||||
|
@ccclass
|
||||||
|
export default class ShaderTime extends cc.Component
|
||||||
|
{
|
||||||
|
/**记录时间 */
|
||||||
|
private time: number;
|
||||||
|
/**精灵上的材质 */
|
||||||
|
private material: any;
|
||||||
|
private IsAdd: boolean;
|
||||||
|
|
||||||
|
/**时间参数 */
|
||||||
|
@property(cc.Float)
|
||||||
|
speed: number = 1.0;
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
this.time = 0;
|
||||||
|
this.IsAdd = true;
|
||||||
|
this.material = this.node.getComponent(cc.Sprite).getMaterial(0); //获取材质
|
||||||
|
}
|
||||||
|
|
||||||
|
update(dt)
|
||||||
|
{
|
||||||
|
this.material.setProperty("u_time",this.time); //设置材质对应的属性
|
||||||
|
this.IsAdd ? this.time += dt * this.speed : this.time -= dt * this.speed;
|
||||||
|
if(this.time > 1.5)
|
||||||
|
{
|
||||||
|
this.IsAdd = false;
|
||||||
|
}
|
||||||
|
else if(this.time < -0.5)
|
||||||
|
{
|
||||||
|
this.IsAdd = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## 关于合图导致web和模拟器显示不一致的BUG
|
||||||
|
![合图错误](/readme_pic/hetucuowu.png)
|
||||||
|
原因: Cocos 会把小于512*512的碎图自动合图以减少DrawCall,而effect中接收到的uv 坐标是整个合图的uv, 导致需要用到uv坐标的effect在自动合图下显示不正确。
|
||||||
|
解决办法:
|
||||||
|
- 关闭自动合图
|
||||||
|
ps: 在Cocos Creator 2.1.3和2.2.0 以上都支持单独取消某个纹理的合图
|
||||||
|
- 手动获取当前sprite 的纹理uv坐标传入到effect(无需取消自动合图)
|
||||||
|
```typescript
|
||||||
|
//获取UV位置到Effect
|
||||||
|
let frame = 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);
|
||||||
|
//在Effect 中接受u_UVoffset u_rotated 后重新设置UV
|
||||||
|
vec2 UVnormalize;
|
||||||
|
UVnormalize.x = (uv0.x-u_UVoffset.x)/(u_UVoffset.z-u_UVoffset.x);
|
||||||
|
UVnormalize.y = (uv0.y-u_UVoffset.y)/(u_UVoffset.w-u_UVoffset.y);
|
||||||
|
if(u_rotated > 0.5)
|
||||||
|
{
|
||||||
|
float temp = UVnormalize.x;
|
||||||
|
UVnormalize.x = UVnormalize.y;
|
||||||
|
UVnormalize.y = 1.0 - temp;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 总结
|
||||||
|
有了材质和Effect以后,cocos使用shader 更加直观了。
|
||||||
|
移植一个需要shader 效果其实也只是在effect文件中设置好变量,修改一下shader 的代码片段语法,最后在代码或面板中设置参数即可
|
||||||
|
当然里面可能会有一些不兼容的属性或者一些细节的问题
|
||||||
|
|
||||||
|
## 学习Shader
|
||||||
|
- [OpenGL 教程](https://learnopengl-cn.github.io/intro/) 手把手教学,我自己之前也是看这个,良心教程!
|
||||||
|
- [WebGL 教程](https://webglfundamentals.org/webgl/lessons/zh_cn/)
|
||||||
|
- [GLSL语法](https://thebookofshaders.com/02/?lan=ch)
|
12
assets/Resources.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.1.2",
|
||||||
|
"uuid": "c04aeca1-cbce-4add-9ff9-5dd17296b80b",
|
||||||
|
"isBundle": false,
|
||||||
|
"bundleName": "",
|
||||||
|
"priority": 1,
|
||||||
|
"compressionType": {},
|
||||||
|
"optimizeHotUpdate": {},
|
||||||
|
"inlineSpriteFrames": {},
|
||||||
|
"isRemoteBundle": {},
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.3",
|
||||||
|
"uuid": "5105e692-6f15-42df-8b29-70646ea07be9",
|
||||||
|
"dataAsSubAsset": null,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
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
After Width: | Height: | Size: 19 KiB |
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
After Width: | Height: | Size: 35 KiB |
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
After Width: | Height: | Size: 205 KiB |
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
After Width: | Height: | Size: 8.5 KiB |
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
@ -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
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
@ -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
@ -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
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.8",
|
||||||
|
"uuid": "ee8e4708-0626-4367-84ad-a44d4465fbb3",
|
||||||
|
"isPlugin": false,
|
||||||
|
"loadPluginInWeb": true,
|
||||||
|
"loadPluginInNative": true,
|
||||||
|
"loadPluginInEditor": false,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
12
assets/Shader/FluxayTexture.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.1.2",
|
||||||
|
"uuid": "a35ff310-19b5-4f06-a82a-601579ffd48a",
|
||||||
|
"isBundle": false,
|
||||||
|
"bundleName": "",
|
||||||
|
"priority": 1,
|
||||||
|
"compressionType": {},
|
||||||
|
"optimizeHotUpdate": {},
|
||||||
|
"inlineSpriteFrames": {},
|
||||||
|
"isRemoteBundle": {},
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
116
assets/Shader/FluxayTexture/FluxayTexture.effect
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
//扫光-纹理
|
||||||
|
|
||||||
|
CCEffect %{
|
||||||
|
techniques:
|
||||||
|
- passes:
|
||||||
|
- vert: vs
|
||||||
|
frag: fs
|
||||||
|
blendState:
|
||||||
|
targets:
|
||||||
|
- blend: true
|
||||||
|
rasterizerState:
|
||||||
|
cullMode: none
|
||||||
|
properties:
|
||||||
|
texture: { value: white }
|
||||||
|
u_fluxayTexture: { value: white }
|
||||||
|
u_time: { value: 0 }
|
||||||
|
}%
|
||||||
|
|
||||||
|
// Vertex Shader(顶点着色器)
|
||||||
|
// 将顶点从模型空间坐标系统转化到屏幕空间坐标系统
|
||||||
|
// 顶点着色器分为输入和输出两部分
|
||||||
|
// 负责的功能是把输入的数据进行矩阵变换位置,计算光照公式生成逐顶点颜⾊,⽣成/变换纹理坐标
|
||||||
|
// 并且把位置和纹理坐标这样的参数发送到片段着色器
|
||||||
|
CCProgram vs %{
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
#include <cc-global>
|
||||||
|
#include <cc-local>
|
||||||
|
|
||||||
|
// 输入的顶点坐标
|
||||||
|
in vec3 a_position;
|
||||||
|
// 输入的顶点颜色
|
||||||
|
in vec4 a_color;
|
||||||
|
// 输出的顶点颜色
|
||||||
|
out vec4 v_color;
|
||||||
|
|
||||||
|
#if USE_TEXTURE
|
||||||
|
// 输入的纹理坐标
|
||||||
|
// UV坐标:原点在左上角,u轴是向右,v轴是向下,范围是0-1
|
||||||
|
in vec2 a_uv0;
|
||||||
|
// 输出的纹理坐标
|
||||||
|
out vec2 v_uv0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void main () {
|
||||||
|
mat4 mvp;
|
||||||
|
|
||||||
|
#if CC_USE_MODEL
|
||||||
|
mvp = cc_matViewProj * cc_matWorld;
|
||||||
|
#else
|
||||||
|
mvp = cc_matViewProj;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
v_uv0 = a_uv0;
|
||||||
|
|
||||||
|
v_color = a_color;
|
||||||
|
|
||||||
|
gl_Position = mvp * vec4(a_position, 1);
|
||||||
|
}
|
||||||
|
}%
|
||||||
|
|
||||||
|
// Fragment Shader(片段着色器)
|
||||||
|
// 片元着色器的作用是处理由光栅化阶段生成的每个片元,最终计算出每个像素的最终颜色(RGBA)
|
||||||
|
CCProgram fs %{
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
#include <alpha-test>
|
||||||
|
#include <texture>
|
||||||
|
|
||||||
|
in vec4 v_color;
|
||||||
|
|
||||||
|
in vec2 v_uv0;
|
||||||
|
|
||||||
|
uniform sampler2D texture;
|
||||||
|
|
||||||
|
uniform sampler2D u_fluxayTexture; //流光纹理
|
||||||
|
|
||||||
|
// 自定义属性
|
||||||
|
// 所有非 sampler 的 uniform 都必须以 UBO 形式声明
|
||||||
|
// UBO 成员声明类型和顺序有严格的校验机制,以排除 GL 标准下隐式布局对齐带来的内存消耗
|
||||||
|
uniform ARGS {
|
||||||
|
float u_time;
|
||||||
|
};
|
||||||
|
|
||||||
|
void main () {
|
||||||
|
vec4 o = vec4(1, 1, 1, 1);
|
||||||
|
|
||||||
|
#if USE_TEXTURE
|
||||||
|
// texture.inc 核心函数
|
||||||
|
// o = texture2D(texture, v_uv0);
|
||||||
|
// texture: 纹理,v_uv0: 纹理坐标,通过 GLSL 的内建函数 texture2D 来获取纹理上对应UV坐标的颜色(RGBA)
|
||||||
|
o = texture2D(texture, v_uv0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 纹理颜色和顶点颜色(节点颜色)叠加得到最终颜色
|
||||||
|
o *= v_color;
|
||||||
|
|
||||||
|
// alpha-test.inc 核心函数
|
||||||
|
// if (color.a < alphaThreshold) discard;
|
||||||
|
// discard:退出片段着色器,不执行后面的片段着色操作,片段也不会写入帧缓冲区
|
||||||
|
ALPHA_TEST(o);
|
||||||
|
|
||||||
|
// 在底图不透明的地方叠加流光纹理的颜色
|
||||||
|
if(o.a >= 1.0) {
|
||||||
|
// 根据时间控制流光纹理的UV
|
||||||
|
vec2 fluxayUV = vec2(v_uv0.x, v_uv0.y);
|
||||||
|
fluxayUV.x -= u_time - 1.0;
|
||||||
|
// 获取流光纹理上UV的颜色
|
||||||
|
vec4 fluxay = texture2D(u_fluxayTexture, fluxayUV);
|
||||||
|
// 叠加颜色
|
||||||
|
gl_FragColor = o + fluxay;
|
||||||
|
} else {
|
||||||
|
gl_FragColor = o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}%
|
17
assets/Shader/FluxayTexture/FluxayTexture.effect.meta
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.25",
|
||||||
|
"uuid": "1034a341-a01d-4cb3-84d9-4e848d4242e0",
|
||||||
|
"compiledShaders": [
|
||||||
|
{
|
||||||
|
"glsl1": {
|
||||||
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\n attribute vec2 a_uv0;\n varying vec2 v_uv0;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = mvp * vec4(a_position, 1);\n}",
|
||||||
|
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\nvarying vec2 v_uv0;\nuniform sampler2D texture;\nuniform sampler2D u_fluxayTexture;\nuniform float u_time;\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o = texture2D(texture, v_uv0);\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n if(o.a >= 1.0) {\n vec2 fluxayUV = vec2(v_uv0.x, v_uv0.y);\n fluxayUV.x -= u_time - 1.0;\n vec4 fluxay = texture2D(u_fluxayTexture, fluxayUV);\n gl_FragColor = o + fluxay;\n } else {\n gl_FragColor = o;\n }\n}"
|
||||||
|
},
|
||||||
|
"glsl3": {
|
||||||
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\n in vec2 a_uv0;\n out vec2 v_uv0;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = mvp * vec4(a_position, 1);\n}",
|
||||||
|
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\nin vec2 v_uv0;\nuniform sampler2D texture;\nuniform sampler2D u_fluxayTexture;\nuniform ARGS {\n float u_time;\n};\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o = texture2D(texture, v_uv0);\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n if(o.a >= 1.0) {\n vec2 fluxayUV = vec2(v_uv0.x, v_uv0.y);\n fluxayUV.x -= u_time - 1.0;\n vec4 fluxay = texture2D(u_fluxayTexture, fluxayUV);\n gl_FragColor = o + fluxay;\n } else {\n gl_FragColor = o;\n }\n}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
BIN
assets/Shader/FluxayTexture/FluxayTexture.jpg
Normal file
After Width: | Height: | Size: 433 KiB |
36
assets/Shader/FluxayTexture/FluxayTexture.jpg.meta
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"ver": "2.3.5",
|
||||||
|
"uuid": "830f2d03-846e-4447-8cc9-ff4e131d0e23",
|
||||||
|
"type": "sprite",
|
||||||
|
"wrapMode": "clamp",
|
||||||
|
"filterMode": "bilinear",
|
||||||
|
"premultiplyAlpha": false,
|
||||||
|
"genMipmaps": false,
|
||||||
|
"packable": true,
|
||||||
|
"width": 1700,
|
||||||
|
"height": 1275,
|
||||||
|
"platformSettings": {},
|
||||||
|
"subMetas": {
|
||||||
|
"FluxayTexture": {
|
||||||
|
"ver": "1.0.4",
|
||||||
|
"uuid": "7a4c3caa-0517-48b3-85ee-edb13b351576",
|
||||||
|
"rawTextureUuid": "830f2d03-846e-4447-8cc9-ff4e131d0e23",
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 1700,
|
||||||
|
"height": 1275,
|
||||||
|
"rawWidth": 1700,
|
||||||
|
"rawHeight": 1275,
|
||||||
|
"borderTop": 0,
|
||||||
|
"borderBottom": 0,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
assets/Shader/FluxayTexture/FluxayTexture.mtl
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"__type__": "cc.Material",
|
||||||
|
"_name": "FluxayTexture",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_native": "",
|
||||||
|
"_effectAsset": {
|
||||||
|
"__uuid__": "1034a341-a01d-4cb3-84d9-4e848d4242e0"
|
||||||
|
},
|
||||||
|
"_techniqueIndex": 0,
|
||||||
|
"_techniqueData": {
|
||||||
|
"0": {
|
||||||
|
"defines": {
|
||||||
|
"USE_TEXTURE": true
|
||||||
|
},
|
||||||
|
"props": {
|
||||||
|
"u_fluxayTexture": {
|
||||||
|
"__uuid__": "830f2d03-846e-4447-8cc9-ff4e131d0e23"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
assets/Shader/FluxayTexture/FluxayTexture.mtl.meta
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.3",
|
||||||
|
"uuid": "4c0164f6-b508-4eb2-991e-14e973aff9ea",
|
||||||
|
"dataAsSubAsset": null,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
23
assets/Shader/FluxayTexture/FluxayTexture.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
const { ccclass, property } = cc._decorator;
|
||||||
|
|
||||||
|
@ccclass
|
||||||
|
export default class FluxayTexture extends cc.Component {
|
||||||
|
|
||||||
|
private _speed: number = 2;
|
||||||
|
private _time: number = 0;
|
||||||
|
private _material: cc.MaterialVariant;
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
// 获取材质
|
||||||
|
this._material = this.node.getComponent(cc.Sprite).getMaterial(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(dt) {
|
||||||
|
if (this._time > 2) {
|
||||||
|
this._time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._material.setProperty("u_time", this._time);
|
||||||
|
this._time += dt * this._speed;
|
||||||
|
}
|
||||||
|
}
|
9
assets/Shader/FluxayTexture/FluxayTexture.ts.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.8",
|
||||||
|
"uuid": "50899011-15b8-493b-acaa-bf9ab5ad596e",
|
||||||
|
"isPlugin": false,
|
||||||
|
"loadPluginInWeb": true,
|
||||||
|
"loadPluginInNative": true,
|
||||||
|
"loadPluginInEditor": false,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
12
assets/migration.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.1.2",
|
||||||
|
"uuid": "3250b1c3-4e2a-4d02-8fbe-e4a8b1ba3492",
|
||||||
|
"isBundle": false,
|
||||||
|
"bundleName": "",
|
||||||
|
"priority": 1,
|
||||||
|
"compressionType": {},
|
||||||
|
"optimizeHotUpdate": {},
|
||||||
|
"inlineSpriteFrames": {},
|
||||||
|
"isRemoteBundle": {},
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
13
assets/migration/use_reversed_rotateTo.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* This script is automatically generated by Cocos Creator and is only used for projects compatible with v2.1.0/v2.1.1/v2.2.1/v2.2.2 versions.
|
||||||
|
* You do not need to manually add this script in any other project.
|
||||||
|
* If you don't use cc.Action in your project, you can delete this script directly.
|
||||||
|
* If your project is hosted in VCS such as git, submit this script together.
|
||||||
|
*
|
||||||
|
* 此脚本由 Cocos Creator 自动生成,仅用于兼容 v2.1.0/v2.1.1/v2.2.1/v2.2.2 版本的工程,
|
||||||
|
* 你无需在任何其它项目中手动添加此脚本。
|
||||||
|
* 如果你的项目中没用到 Action,可直接删除该脚本。
|
||||||
|
* 如果你的项目有托管于 git 等版本库,请将此脚本一并上传。
|
||||||
|
*/
|
||||||
|
|
||||||
|
cc.RotateTo._reverse = true;
|
9
assets/migration/use_reversed_rotateTo.js.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.8",
|
||||||
|
"uuid": "47cc29c7-db37-4aa4-a3cf-debeb7c4f66d",
|
||||||
|
"isPlugin": false,
|
||||||
|
"loadPluginInWeb": true,
|
||||||
|
"loadPluginInNative": true,
|
||||||
|
"loadPluginInEditor": false,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
17
assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* This script is automatically generated by Cocos Creator and is only used for projects compatible with the v2.1.0 ~ 2.2.1 version.
|
||||||
|
* You do not need to manually add this script in any other project.
|
||||||
|
* If you don't use cc.Toggle in your project, you can delete this script directly.
|
||||||
|
* If your project is hosted in VCS such as git, submit this script together.
|
||||||
|
*
|
||||||
|
* 此脚本由 Cocos Creator 自动生成,仅用于兼容 v2.1.0 ~ 2.2.1 版本的工程,
|
||||||
|
* 你无需在任何其它项目中手动添加此脚本。
|
||||||
|
* 如果你的项目中没用到 Toggle,可直接删除该脚本。
|
||||||
|
* 如果你的项目有托管于 git 等版本库,请将此脚本一并上传。
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (cc.Toggle) {
|
||||||
|
// Whether to trigger 'toggle' and 'checkEvents' events when modifying 'toggle.isChecked' in the code
|
||||||
|
// 在代码中修改 'toggle.isChecked' 时是否触发 'toggle' 与 'checkEvents' 事件
|
||||||
|
cc.Toggle._triggerEventInScript_isChecked = true;
|
||||||
|
}
|
9
assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.8",
|
||||||
|
"uuid": "b0e788a3-2566-430d-b051-7cbc5502bcb2",
|
||||||
|
"isPlugin": false,
|
||||||
|
"loadPluginInWeb": true,
|
||||||
|
"loadPluginInNative": true,
|
||||||
|
"loadPluginInEditor": false,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
26513
creator.d.ts
vendored
Normal file
15
jsconfig.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es6",
|
||||||
|
"module": "commonjs",
|
||||||
|
"experimentalDecorators": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
".vscode",
|
||||||
|
"library",
|
||||||
|
"local",
|
||||||
|
"settings",
|
||||||
|
"temp"
|
||||||
|
]
|
||||||
|
}
|
7
project.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"engine": "cocos-creator-js",
|
||||||
|
"packages": "packages",
|
||||||
|
"version": "2.4.4",
|
||||||
|
"id": "a7b70274-07dd-4988-8f4d-fa47015832df",
|
||||||
|
"isNew": false
|
||||||
|
}
|
BIN
readme_pic/hetucuowu.png
Normal file
After Width: | Height: | Size: 338 KiB |
BIN
readme_pic/shader.png
Normal file
After Width: | Height: | Size: 30 KiB |
43
settings/project.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"start-scene": "current",
|
||||||
|
"group-list": [
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"collision-matrix": [
|
||||||
|
[
|
||||||
|
true
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"excluded-modules": [
|
||||||
|
"3D Physics/cannon.js",
|
||||||
|
"3D Physics/Builtin",
|
||||||
|
"3D Particle",
|
||||||
|
"SafeArea"
|
||||||
|
],
|
||||||
|
"last-module-event-record-time": 0,
|
||||||
|
"design-resolution-width": 960,
|
||||||
|
"design-resolution-height": 640,
|
||||||
|
"fit-width": false,
|
||||||
|
"fit-height": true,
|
||||||
|
"use-project-simulator-setting": false,
|
||||||
|
"simulator-orientation": false,
|
||||||
|
"use-customize-simulator": false,
|
||||||
|
"simulator-resolution": {
|
||||||
|
"width": 960,
|
||||||
|
"height": 640
|
||||||
|
},
|
||||||
|
"assets-sort-type": "name",
|
||||||
|
"facebook": {
|
||||||
|
"enable": false,
|
||||||
|
"appID": "",
|
||||||
|
"live": {
|
||||||
|
"enable": false
|
||||||
|
},
|
||||||
|
"audience": {
|
||||||
|
"enable": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"migrate-history": [
|
||||||
|
"cloud-function"
|
||||||
|
]
|
||||||
|
}
|
6
settings/services.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"game": {
|
||||||
|
"name": "未知游戏",
|
||||||
|
"appid": "UNKNOW"
|
||||||
|
}
|
||||||
|
}
|