Compare commits
No commits in common. "master" and "0.4.0" have entirely different histories.
31
CHANGELOG.md
31
CHANGELOG.md
@ -1,36 +1,5 @@
|
|||||||
# ChangeLog
|
# ChangeLog
|
||||||
|
|
||||||
## 0.11.0 (2020-06-23)
|
|
||||||
|
|
||||||
- 新增内发光v2
|
|
||||||
- 此为另外一种内发光采样实现,正常情况下可能效果能和v1差不多,但是性能会好一点
|
|
||||||
|
|
||||||
## 0.10.0 (2020-04-10)
|
|
||||||
|
|
||||||
- 支持 Cocos Creator v2.3.3
|
|
||||||
- 加入纯 shader 实现的 loading 动画
|
|
||||||
|
|
||||||
## 0.9.0 (2020-02-17)
|
|
||||||
|
|
||||||
- 支持 Cocos Creator v2.3.0
|
|
||||||
- 由于2.3.0和2.2.2,2.2.1差别较大,因此,此Tag的最新项目已经无法在2.2.1,2.2.2中重新打开,如果确实需要在 2.2.1,2.2.2 中打开,请先切换到旧版本的tag(`0.8.0`),才能用 2.2.1,2.2.2打开
|
|
||||||
|
|
||||||
## 0.8.0 (2020-02-07)
|
|
||||||
|
|
||||||
- 支持 Cocos Creator v2.2.2
|
|
||||||
|
|
||||||
## 0.7.0 (2020-02-07)
|
|
||||||
|
|
||||||
- 加入高斯模糊V1版本(纯原理篇)
|
|
||||||
|
|
||||||
## 0.6.0 (2020-01-17)
|
|
||||||
|
|
||||||
- 加入新的圆角裁剪特效 v2 ,支持任意宽高纹理圆角裁剪
|
|
||||||
|
|
||||||
## 0.5.0 (2020-01-13)
|
|
||||||
|
|
||||||
- 加入扫光特效
|
|
||||||
|
|
||||||
## 0.4.0 (2020-01-12)
|
## 0.4.0 (2020-01-12)
|
||||||
|
|
||||||
- 加入点光特效
|
- 加入点光特效
|
||||||
|
57
README.md
57
README.md
@ -1,20 +1,14 @@
|
|||||||
# Cocos Creator Shader Effect Demo
|
# Cocos Creator Shader Effect Demo
|
||||||
|
|
||||||
[](CHANGELOG.md)
|
[](CHANGELOG.md)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
[](http://www.cocos.com/creator)
|
|
||||||
[](http://www.cocos.com/creator)
|
|
||||||
[](http://www.cocos.com/creator)
|
[](http://www.cocos.com/creator)
|
||||||
|
|
||||||
|
|
||||||
## 一、项目说明
|
## 一、项目说明
|
||||||
|
|
||||||
1. 此项目为我在学习过程中的一些分享和实现,因此项目名字以 **`Demo`** 为后缀。
|
1. 此项目为我在学习过程中的一些分享和实现,因此项目名字以 **`Demo`** 为后缀。
|
||||||
2. 项目重点在于 **「渔」**,不在于 **「鱼」** 。
|
2. 项目重点在于 **「渔」**,不在于 **「鱼」** 。
|
||||||
3. 如果你有意将此Demo中的效果加入到你的项目中,**请认真评估是否适合你的项目使用!**
|
3. 如果你有意将此Demo中的效果加入到你的项目中,**请认真评估是否适合你的项目使用!**
|
||||||
4. 本项目支持 Cocos Creator `v2.3.+` 、 ~~`v2.2.2`~~ 、 ~~`v2.2.1`~~
|
|
||||||
1. 项目当前正在使用 v2.3.3 开发
|
|
||||||
2. 由于2.3.+和2.2.2,2.2.1差别较大,因此,`master`分支的最新项目已经无法在2.2.1,2.2.2中重新打开,如果确实需要在 2.2.1,2.2.2 中打开,请先切换到旧版本的tag(`0.8.0`),才能用 2.2.1,2.2.2打开
|
|
||||||
|
|
||||||
## 二、系列文章
|
## 二、系列文章
|
||||||
|
|
||||||
@ -25,9 +19,6 @@
|
|||||||
* [Cocos Creator Shader Effect 系列 - 4 - 老照片特效](https://www.jianshu.com/p/711a54ff2fa0)
|
* [Cocos Creator Shader Effect 系列 - 4 - 老照片特效](https://www.jianshu.com/p/711a54ff2fa0)
|
||||||
* [Cocos Creator Shader Effect 系列 - 5 - 马赛克/像素化特效](https://www.jianshu.com/p/40e72ab76afd)
|
* [Cocos Creator Shader Effect 系列 - 5 - 马赛克/像素化特效](https://www.jianshu.com/p/40e72ab76afd)
|
||||||
* [Cocos Creator Shader Effect 系列 - 6 - 内发光特效](https://www.jianshu.com/p/326b73f86ecc)
|
* [Cocos Creator Shader Effect 系列 - 6 - 内发光特效](https://www.jianshu.com/p/326b73f86ecc)
|
||||||
* [Cocos Creator Shader Effect 系列 - 7 - 点光/扫光特效](https://www.jianshu.com/p/8ff03b34b0bd)
|
|
||||||
* [Cocos Creator Shader Effect 系列 - 8 - 高斯模糊](https://www.jianshu.com/p/9e42cbb1d4a8)
|
|
||||||
|
|
||||||
|
|
||||||
* 编写中...
|
* 编写中...
|
||||||
|
|
||||||
@ -35,9 +26,12 @@
|
|||||||
|
|
||||||
## 三、特效预览
|
## 三、特效预览
|
||||||
|
|
||||||
### 内发光([实现原理](https://www.jianshu.com/p/326b73f86ecc))
|
|
||||||
|
|
||||||
*ps:此效果有两个版本实现,见对应effect源码,前几行内有版本差异说明*
|
### 点光(实现原理,可能在编写中,催更可到底部扫码,支持急件~🤣)(2020.01.12更新)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 内发光([实现原理](https://www.jianshu.com/p/326b73f86ecc))
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -53,48 +47,14 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 点光([实现原理](https://www.jianshu.com/p/8ff03b34b0bd))(2020.01.12更新)
|
### 圆角裁剪
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 扫光(实现原理同点光一样,可参考[点光实现原理文章](https://www.jianshu.com/p/711a54ff2fa0))(2020.01.13更新)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 圆角裁剪-v1(2020.01.17更新)
|
|
||||||
|
|
||||||
> * 声明:此特效为搬运过来的特效,非原创。
|
> * 声明:此特效为搬运过来的特效,非原创。
|
||||||
> * 修改的地方:搬运后,在原来的主要代码上加入了自己的理解注释
|
> * 修改的地方:搬运后,在原来的主要代码上加入了自己的理解注释
|
||||||
> * 实现原理:参考文章 [《圆角计算 Shader》](https://www.cnblogs.com/jqm304775992/p/4987793.html)
|
> * 实现原理:参考文章 [《圆角计算 Shader》](https://www.cnblogs.com/jqm304775992/p/4987793.html)
|
||||||
> * 参考代码:Cocos 论坛帖子[《分享更高效的 creator 裁圆角头像 shader》](https://forum.cocos.org/t/creator-shader-2019-10-22-2-2-0/82548) 和对应的 [实现代码](https://github.com/yanjifa/shaderDemo/blob/master/assets/Effect/CircleAvatar.effect)
|
> * 参考代码:Cocos 论坛帖子[《分享更高效的 creator 裁圆角头像 shader》](https://forum.cocos.org/t/creator-shader-2019-10-22-2-2-0/82548) 和对应的 [实现代码](https://github.com/yanjifa/shaderDemo/blob/master/assets/Effect/CircleAvatar.effect)
|
||||||
|
|
||||||
**此版本存在局限性:只有在正方形纹理上,才能裁剪出圆角,在非正方形上,无法裁剪出圆角,具体变现为有拉伸效果**
|

|
||||||
|
|
||||||
如:下面GIF中第3到5秒演示所示,黄色和红色的非正方形纹理的圆角明显被拉伸
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 圆角裁剪-v2(2020.01.17更新)
|
|
||||||
|
|
||||||
在 **圆角裁剪-v1** 的原理基础上,新增支持任意宽高纹理的圆角裁剪
|
|
||||||
|
|
||||||
如:下面Gif中第3到5秒演示所示,黄色和红色的非正方形纹理也能裁剪出圆角效果
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 高斯模糊-V1([实现原理](https://www.jianshu.com/p/9e42cbb1d4a8))2020.02.07更新)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 纯 Shader Effect 实现的 Loading 动画(2020.04.10更新)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
ps:
|
|
||||||
|
|
||||||
* 模拟器或者原生平台下可能不会生效
|
|
||||||
* 这是因为 effect 中用到 `cc_time` 内置参数,此内置参数已有 [反馈](https://forum.cocos.org/t/creator-v2-2-2-effect-cc-time-android/88916) 在模拟器等原生平台下不生效的问题(坐等引擎修复,或者可以自行传值进去)
|
|
||||||
* 此为引导性 Demo 示例,仅供学习
|
|
||||||
|
|
||||||
### 外发光(完善中...)
|
### 外发光(完善中...)
|
||||||
|
|
||||||
@ -103,6 +63,7 @@ ps:
|
|||||||
## 四、TODO
|
## 四、TODO
|
||||||
|
|
||||||
* [ ] 图像模糊
|
* [ ] 图像模糊
|
||||||
|
* [ ] 闪光
|
||||||
* [ ] 波浪
|
* [ ] 波浪
|
||||||
* [ ] 雨滴
|
* [ ] 雨滴
|
||||||
* [ ] ...
|
* [ ] ...
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.25",
|
"ver": "1.0.23",
|
||||||
"uuid": "8f277982-dc0a-4030-90cc-b336a928a372",
|
"uuid": "8f277982-dc0a-4030-90cc-b336a928a372",
|
||||||
"compiledShaders": [
|
"compiledShaders": [
|
||||||
{
|
{
|
||||||
"glsl1": {
|
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\n\nattribute vec4 a_color;\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\n\nattribute vec2 a_uv0;\n\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\n\nvarying vec2 v_uv0;\n\nuniform sampler2D texture;\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n}\n"
|
||||||
},
|
},
|
||||||
"glsl3": {
|
"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\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\n\nin vec4 a_color;\n\nout vec4 v_color;\n\n#if USE_TEXTURE\n\nin vec2 a_uv0;\n\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\n\nin vec2 v_uv0;\n\nuniform sampler2D texture;\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n}\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1,224 +0,0 @@
|
|||||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
||||||
|
|
||||||
CCEffect %{
|
|
||||||
techniques:
|
|
||||||
- passes:
|
|
||||||
- vert: vs
|
|
||||||
frag: fs
|
|
||||||
blendState:
|
|
||||||
targets:
|
|
||||||
- blend: true
|
|
||||||
rasterizerState:
|
|
||||||
cullMode: none
|
|
||||||
properties:
|
|
||||||
texture: { value: white }
|
|
||||||
u_arc_color: {
|
|
||||||
value: [1.0, 1.0, 1.0, 1.0],
|
|
||||||
editor: {
|
|
||||||
type: color,
|
|
||||||
tooltip: "圆弧线颜色"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
u_arc_radius: {
|
|
||||||
value: 0.3,
|
|
||||||
editor: {
|
|
||||||
tooltip: "圆弧半径"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
u_arc_line_width: {
|
|
||||||
value: 0.1,
|
|
||||||
editor: {
|
|
||||||
tooltip: "圆弧线宽"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
u_ball_color: {
|
|
||||||
value: [1.0, 1.0, 0.0, 1.0],
|
|
||||||
editor: {
|
|
||||||
type: color,
|
|
||||||
tooltip: "小球颜色"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
u_ball_angle: {
|
|
||||||
value: 30.0,
|
|
||||||
editor: {
|
|
||||||
tooltip: "小球所在角度"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
u_ball_angle_range: {
|
|
||||||
value: 30.0,
|
|
||||||
editor: {
|
|
||||||
tooltip: "小球所在角度的夹角范围"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
u_ball_radius: {
|
|
||||||
value: 0.05,
|
|
||||||
editor: {
|
|
||||||
tooltip: "小球半径"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
in vec2 a_uv0;
|
|
||||||
out vec2 v_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 pos = vec4(a_position, 1);
|
|
||||||
|
|
||||||
#if CC_USE_MODEL
|
|
||||||
pos = cc_matViewProj * cc_matWorld * pos;
|
|
||||||
#else
|
|
||||||
pos = cc_matViewProj * pos;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
v_uv0 = a_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
v_color = a_color;
|
|
||||||
|
|
||||||
gl_Position = pos;
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
CCProgram fs %{
|
|
||||||
precision highp float;
|
|
||||||
|
|
||||||
#include <cc-global>
|
|
||||||
|
|
||||||
in vec4 v_color;
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
in vec2 v_uv0;
|
|
||||||
uniform sampler2D texture;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_ANTI_ALIAS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_LOADING_STYLE
|
|
||||||
uniform style{
|
|
||||||
|
|
||||||
// 圆弧线颜色
|
|
||||||
vec4 u_arc_color;
|
|
||||||
|
|
||||||
// 小球颜色
|
|
||||||
vec4 u_ball_color;
|
|
||||||
|
|
||||||
// 圆弧线宽
|
|
||||||
float u_arc_line_width;
|
|
||||||
|
|
||||||
// 圆弧半径
|
|
||||||
float u_arc_radius;
|
|
||||||
|
|
||||||
// 小球所在角度
|
|
||||||
float u_ball_angle;
|
|
||||||
|
|
||||||
// 小球所在角度的夹角范围
|
|
||||||
float u_ball_angle_range;
|
|
||||||
|
|
||||||
// 小球半径
|
|
||||||
float u_ball_radius;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 v_uv0 映射后的坐标
|
|
||||||
*/
|
|
||||||
vec2 getUv0Shadow() {
|
|
||||||
// 1. 将 v_uv0 映射到 以 (0.5, 0.5) 为圆心,Y轴向下,X轴向右的坐标系的坐标 uv0
|
|
||||||
vec2 uv0 = v_uv0 - vec2(0.5, 0.5);
|
|
||||||
|
|
||||||
// 2. 将映射后的 uv0 的坐标逆时针旋转一定角度(实际等同于旋转画布)
|
|
||||||
|
|
||||||
// 这里应用 cc-global.chunk 的 cc_time 参数,实现根据时间不断旋转的功能
|
|
||||||
float rotation_angle = u_ball_angle + cc_time.x * 200.0; // * 200 是加快旋转速度
|
|
||||||
float rotation_radians = radians(rotation_angle); // 角度转弧度
|
|
||||||
vec2 uv0_after_rotation = vec2( // 矩阵旋转
|
|
||||||
uv0.x * cos(rotation_radians) - uv0.y * sin(rotation_radians),
|
|
||||||
uv0.x * sin(rotation_radians) + uv0.y * cos(rotation_radians)
|
|
||||||
);
|
|
||||||
|
|
||||||
return uv0_after_rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 画圆弧
|
|
||||||
*
|
|
||||||
* 原理基于纹理中心,并且0角度先画圆弧,然后在旋转画布
|
|
||||||
*/
|
|
||||||
vec4 getArcColor() {
|
|
||||||
vec2 uv0 = getUv0Shadow();
|
|
||||||
|
|
||||||
// 求圆边范围
|
|
||||||
float len = length(uv0);
|
|
||||||
float min_radius = u_arc_radius - u_arc_line_width * 0.5;
|
|
||||||
float max_radius = u_arc_radius + u_arc_line_width * 0.5;
|
|
||||||
if (len >= min_radius && len <= max_radius) {
|
|
||||||
|
|
||||||
// 求(圆)缺口范围
|
|
||||||
float radian = acos(uv0.x / len);
|
|
||||||
float radian_range = radians(u_ball_angle_range * 0.5);
|
|
||||||
if (radian >= radian_range) {
|
|
||||||
float alpha = 1.0;
|
|
||||||
// 抗锯齿
|
|
||||||
#if USE_ANTI_ALIAS
|
|
||||||
alpha = smoothstep(0.0, 0.05, 1.0 - abs(len - u_arc_radius) / (u_arc_line_width * 0.5));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 非缺口范围内画圆弧
|
|
||||||
return u_arc_color * alpha;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return vec4(0.0, 0.0, 0.0, 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 画小球
|
|
||||||
*/
|
|
||||||
vec4 getBallColor() {
|
|
||||||
vec2 uv0 = getUv0Shadow();
|
|
||||||
vec2 ball_center_point = vec2(u_arc_radius, 0);
|
|
||||||
|
|
||||||
// cos 控制小球半径不断缩放
|
|
||||||
float ball_radius = u_ball_radius + u_ball_radius * 0.3 * cos(radians(cc_time.x * 200.0));
|
|
||||||
float dis = distance(uv0, ball_center_point);
|
|
||||||
if (dis <= ball_radius) {
|
|
||||||
|
|
||||||
float alpha = 1.0;
|
|
||||||
// 抗锯齿
|
|
||||||
#if USE_ANTI_ALIAS
|
|
||||||
alpha = smoothstep(0.0, 0.01, ball_radius - dis);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return u_ball_color * alpha;
|
|
||||||
} else{
|
|
||||||
return vec4(0.0, 0.0, 0.0, 0.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 o = vec4(1, 1, 1, 1);
|
|
||||||
gl_FragColor = o;
|
|
||||||
#if USE_LOADING_STYLE
|
|
||||||
vec4 arc_color = getArcColor();
|
|
||||||
vec4 ball_color = getBallColor();
|
|
||||||
gl_FragColor = ball_color * ball_color.a + arc_color;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}%
|
|
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.25",
|
|
||||||
"uuid": "aa3b729c-fb16-4293-8789-8b7f36e017f1",
|
|
||||||
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
|
||||||
"frag": "\nprecision highp float;\nuniform vec4 cc_time;\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_ANTI_ALIAS\n#endif\n#if USE_LOADING_STYLE\nuniform vec4 u_arc_color;\nuniform vec4 u_ball_color;\nuniform float u_arc_line_width;\nuniform float u_arc_radius;\nuniform float u_ball_angle;\nuniform float u_ball_angle_range;\nuniform float u_ball_radius;\nvec2 getUv0Shadow() {\n vec2 uv0 = v_uv0 - vec2(0.5, 0.5);\n float rotation_angle = u_ball_angle + cc_time.x * 200.0;\n float rotation_radians = radians(rotation_angle);\n vec2 uv0_after_rotation = vec2(\n uv0.x * cos(rotation_radians) - uv0.y * sin(rotation_radians),\n uv0.x * sin(rotation_radians) + uv0.y * cos(rotation_radians)\n );\n return uv0_after_rotation;\n}\nvec4 getArcColor() {\n vec2 uv0 = getUv0Shadow();\n float len = length(uv0);\n float min_radius = u_arc_radius - u_arc_line_width * 0.5;\n float max_radius = u_arc_radius + u_arc_line_width * 0.5;\n if (len >= min_radius && len <= max_radius) {\n float radian = acos(uv0.x / len);\n float radian_range = radians(u_ball_angle_range * 0.5);\n if (radian >= radian_range) {\n float alpha = 1.0;\n #if USE_ANTI_ALIAS\n alpha = smoothstep(0.0, 0.05, 1.0 - abs(len - u_arc_radius) / (u_arc_line_width * 0.5));\n #endif\n return u_arc_color * alpha;\n }\n }\n return vec4(0.0, 0.0, 0.0, 0.0);\n}\nvec4 getBallColor() {\n vec2 uv0 = getUv0Shadow();\n vec2 ball_center_point = vec2(u_arc_radius, 0);\n float ball_radius = u_ball_radius + u_ball_radius * 0.3 * cos(radians(cc_time.x * 200.0));\n float dis = distance(uv0, ball_center_point);\n if (dis <= ball_radius) {\n float alpha = 1.0;\n #if USE_ANTI_ALIAS\n alpha = smoothstep(0.0, 0.01, ball_radius - dis);\n #endif\n return u_ball_color * alpha;\n } else{\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n gl_FragColor = o;\n #if USE_LOADING_STYLE\n vec4 arc_color = getArcColor();\n vec4 ball_color = getBallColor();\n gl_FragColor = ball_color * ball_color.a + arc_color;\n #endif\n}"
|
|
||||||
},
|
|
||||||
"glsl3": {
|
|
||||||
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
|
||||||
"frag": "\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};\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_ANTI_ALIAS\n#endif\n#if USE_LOADING_STYLE\nuniform style{\n vec4 u_arc_color;\n vec4 u_ball_color;\n float u_arc_line_width;\n float u_arc_radius;\n float u_ball_angle;\n float u_ball_angle_range;\n float u_ball_radius;\n};\nvec2 getUv0Shadow() {\n vec2 uv0 = v_uv0 - vec2(0.5, 0.5);\n float rotation_angle = u_ball_angle + cc_time.x * 200.0;\n float rotation_radians = radians(rotation_angle);\n vec2 uv0_after_rotation = vec2(\n uv0.x * cos(rotation_radians) - uv0.y * sin(rotation_radians),\n uv0.x * sin(rotation_radians) + uv0.y * cos(rotation_radians)\n );\n return uv0_after_rotation;\n}\nvec4 getArcColor() {\n vec2 uv0 = getUv0Shadow();\n float len = length(uv0);\n float min_radius = u_arc_radius - u_arc_line_width * 0.5;\n float max_radius = u_arc_radius + u_arc_line_width * 0.5;\n if (len >= min_radius && len <= max_radius) {\n float radian = acos(uv0.x / len);\n float radian_range = radians(u_ball_angle_range * 0.5);\n if (radian >= radian_range) {\n float alpha = 1.0;\n #if USE_ANTI_ALIAS\n alpha = smoothstep(0.0, 0.05, 1.0 - abs(len - u_arc_radius) / (u_arc_line_width * 0.5));\n #endif\n return u_arc_color * alpha;\n }\n }\n return vec4(0.0, 0.0, 0.0, 0.0);\n}\nvec4 getBallColor() {\n vec2 uv0 = getUv0Shadow();\n vec2 ball_center_point = vec2(u_arc_radius, 0);\n float ball_radius = u_ball_radius + u_ball_radius * 0.3 * cos(radians(cc_time.x * 200.0));\n float dis = distance(uv0, ball_center_point);\n if (dis <= ball_radius) {\n float alpha = 1.0;\n #if USE_ANTI_ALIAS\n alpha = smoothstep(0.0, 0.01, ball_radius - dis);\n #endif\n return u_ball_color * alpha;\n } else{\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n gl_FragColor = o;\n #if USE_LOADING_STYLE\n vec4 arc_color = getArcColor();\n vec4 ball_color = getBallColor();\n gl_FragColor = ball_color * ball_color.a + arc_color;\n #endif\n}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,235 +0,0 @@
|
|||||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
||||||
// 闪光(光速扫过)
|
|
||||||
// 原理(和点光的很类似):
|
|
||||||
// 1. 画光束
|
|
||||||
// 2. 圆心中间高亮(透明度=1.0),边缘不亮(透明度=0.0)
|
|
||||||
// 3. 在原图像上方叠加光束
|
|
||||||
|
|
||||||
CCEffect %{
|
|
||||||
techniques:
|
|
||||||
- passes:
|
|
||||||
- vert: vs
|
|
||||||
frag: fs
|
|
||||||
blendState:
|
|
||||||
targets:
|
|
||||||
- blend: true
|
|
||||||
rasterizerState:
|
|
||||||
cullMode: none
|
|
||||||
properties:
|
|
||||||
texture: { value: white }
|
|
||||||
alphaThreshold: { value: 0.5 }
|
|
||||||
|
|
||||||
# 光束颜色
|
|
||||||
lightColor: {
|
|
||||||
value: [1.0, 1.0, 0.0, 1.0],
|
|
||||||
editor: {
|
|
||||||
type: color,
|
|
||||||
tooltip: "光束颜色"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 光束中心点坐标
|
|
||||||
lightCenterPoint: {
|
|
||||||
value: [0.2, 0.2],
|
|
||||||
editor: {
|
|
||||||
tooltip: "光束中心点坐标"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 光束倾斜角度
|
|
||||||
lightAngle: {
|
|
||||||
value: 36.0,
|
|
||||||
editor: {
|
|
||||||
tooltip: "光束倾斜角度",
|
|
||||||
range: [0.0, 1.0],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 光束宽度
|
|
||||||
lightWidth: {
|
|
||||||
value: 0.2,
|
|
||||||
editor: {
|
|
||||||
tooltip: "光束宽度"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 启用光束渐变
|
|
||||||
enableGradient: {
|
|
||||||
value: 1.0,
|
|
||||||
editor: {
|
|
||||||
tooltip: "是否启用光束渐变。0:不启用,非0:启用"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 裁剪掉透明区域上的光
|
|
||||||
cropAlpha: {
|
|
||||||
value: 1.0,
|
|
||||||
editor: {
|
|
||||||
tooltip: "是否裁剪透明区域上的光。0:不启用,非0:启用"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 是否启用迷雾效果
|
|
||||||
enableFog: {
|
|
||||||
value: 0.0,
|
|
||||||
editor: {
|
|
||||||
tooltip: "是否启用迷雾效果。0:不启用,非0:启用"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
in vec2 a_uv0;
|
|
||||||
out vec2 v_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 pos = vec4(a_position, 1);
|
|
||||||
|
|
||||||
#if CC_USE_MODEL
|
|
||||||
pos = cc_matViewProj * cc_matWorld * pos;
|
|
||||||
#else
|
|
||||||
pos = cc_matViewProj * pos;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
v_uv0 = a_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
v_color = a_color;
|
|
||||||
|
|
||||||
gl_Position = pos;
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
CCProgram fs %{
|
|
||||||
precision highp float;
|
|
||||||
|
|
||||||
#include <alpha-test>
|
|
||||||
|
|
||||||
in vec4 v_color;
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
in vec2 v_uv0;
|
|
||||||
uniform sampler2D texture;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLE_LIGHT
|
|
||||||
uniform Light {
|
|
||||||
// 光束颜色
|
|
||||||
vec4 lightColor;
|
|
||||||
|
|
||||||
// 光束中心点坐标
|
|
||||||
vec2 lightCenterPoint;
|
|
||||||
|
|
||||||
// 光束倾斜角度
|
|
||||||
float lightAngle;
|
|
||||||
|
|
||||||
// 光束宽度
|
|
||||||
float lightWidth;
|
|
||||||
|
|
||||||
// 启用光束渐变
|
|
||||||
// ps:编辑器还不支持 bool 类型的样子,因此用float来定义
|
|
||||||
float enableGradient;
|
|
||||||
|
|
||||||
// 裁剪掉透明区域上的光
|
|
||||||
// ps:编辑器还不支持 bool 类型的样子,因此用float来定义
|
|
||||||
float cropAlpha;
|
|
||||||
|
|
||||||
// 是否启用迷雾效果
|
|
||||||
// ps:编辑器还不支持 bool 类型的样子,因此用float来定义
|
|
||||||
float enableFog;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加光束颜色
|
|
||||||
*/
|
|
||||||
vec4 addLightColor(vec4 textureColor, vec4 lightColor, vec2 lightCenterPoint, float lightAngle, float lightWidth) {
|
|
||||||
// 边界值处理,没有宽度就返回原始颜色
|
|
||||||
if (lightWidth <= 0.0) {
|
|
||||||
return textureColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算当前 uv 到 光束 的距离
|
|
||||||
float angleInRadians = radians(lightAngle);
|
|
||||||
|
|
||||||
// 角度0与非0不同处理
|
|
||||||
float dis = 0.0;
|
|
||||||
if (mod(lightAngle, 180.0) != 0.0) {
|
|
||||||
// 计算光束中心线下方与X轴交点的X坐标
|
|
||||||
// 1.0 - lightCenterPoint.y 是将转换为OpenGL坐标系,下文的 1.0 - y 类似
|
|
||||||
float lightOffsetX = lightCenterPoint.x - ((1.0 - lightCenterPoint.y) / tan(angleInRadians));
|
|
||||||
|
|
||||||
// 以当前点画一条平行于X轴的线,假设此线和光束中心线相交的点为D点
|
|
||||||
// 那么
|
|
||||||
// D.y = uv0.y
|
|
||||||
// D.x = lightOffsetX + D.y / tan(angle)
|
|
||||||
float dx = lightOffsetX + (1.0 - v_uv0.y) / tan(angleInRadians);
|
|
||||||
|
|
||||||
// D 到当前 uv0 的距离就是
|
|
||||||
// dis = |uv0.x - D.x|
|
|
||||||
float offsetDis = abs(v_uv0.x - dx);
|
|
||||||
|
|
||||||
// 当前点到光束中心线的的垂直距离就好算了
|
|
||||||
dis = sin(angleInRadians) * offsetDis;
|
|
||||||
} else {
|
|
||||||
dis = abs(v_uv0.y - lightCenterPoint.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
float a = 1.0 ;
|
|
||||||
// 裁剪掉透明区域上的点光
|
|
||||||
if (bool(cropAlpha)) {
|
|
||||||
a *= step(0.01, textureColor.a);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 裁剪掉光束范围外的uv(迷雾效果)
|
|
||||||
if (!bool(enableFog)) {
|
|
||||||
a *= step(dis, lightWidth * 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加入从中心往外渐变的效果
|
|
||||||
if (bool(enableGradient)) {
|
|
||||||
a *= 1.0 - dis / (lightWidth * 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算出扩散范围内,不同 uv 对应的实际扩散颜色值
|
|
||||||
vec4 finalLightColor = lightColor * a;
|
|
||||||
|
|
||||||
// 混合颜色:在原始图像颜色上叠加扩散颜色
|
|
||||||
return textureColor * textureColor.a + finalLightColor;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 o = vec4(1, 1, 1, 1);
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
o *= texture(texture, v_uv0);
|
|
||||||
#if CC_USE_ALPHA_ATLAS_TEXTURE
|
|
||||||
o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
o *= v_color;
|
|
||||||
|
|
||||||
ALPHA_TEST(o);
|
|
||||||
|
|
||||||
gl_FragColor = o;
|
|
||||||
|
|
||||||
#if ENABLE_LIGHT
|
|
||||||
gl_FragColor = addLightColor(gl_FragColor, lightColor, lightCenterPoint, lightAngle, lightWidth);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}%
|
|
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.25",
|
|
||||||
"uuid": "e9682cd1-a19c-4fcb-ad8c-cf1783b805e6",
|
|
||||||
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_LIGHT\nuniform vec4 lightColor;\nuniform vec2 lightCenterPoint;\nuniform float lightAngle;\nuniform float lightWidth;\nuniform float enableGradient;\nuniform float cropAlpha;\nuniform float enableFog;\nvec4 addLightColor(vec4 textureColor, vec4 lightColor, vec2 lightCenterPoint, float lightAngle, float lightWidth) {\n if (lightWidth <= 0.0) {\n return textureColor;\n }\n float angleInRadians = radians(lightAngle);\n float dis = 0.0;\n if (mod(lightAngle, 180.0) != 0.0) {\n float lightOffsetX = lightCenterPoint.x - ((1.0 - lightCenterPoint.y) / tan(angleInRadians));\n float dx = lightOffsetX + (1.0 - v_uv0.y) / tan(angleInRadians);\n float offsetDis = abs(v_uv0.x - dx);\n dis = sin(angleInRadians) * offsetDis;\n } else {\n dis = abs(v_uv0.y - lightCenterPoint.y);\n }\n float a = 1.0 ;\n if (bool(cropAlpha)) {\n a *= step(0.01, textureColor.a);\n }\n if (!bool(enableFog)) {\n a *= step(dis, lightWidth * 0.5);\n }\n if (bool(enableGradient)) {\n a *= 1.0 - dis / (lightWidth * 0.5);\n }\n vec4 finalLightColor = lightColor * a;\n return textureColor * textureColor.a + finalLightColor;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if ENABLE_LIGHT\n gl_FragColor = addLightColor(gl_FragColor, lightColor, lightCenterPoint, lightAngle, lightWidth);\n #endif\n}"
|
|
||||||
},
|
|
||||||
"glsl3": {
|
|
||||||
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_LIGHT\nuniform Light {\n vec4 lightColor;\n vec2 lightCenterPoint;\n float lightAngle;\n float lightWidth;\n float enableGradient;\n float cropAlpha;\n float enableFog;\n};\nvec4 addLightColor(vec4 textureColor, vec4 lightColor, vec2 lightCenterPoint, float lightAngle, float lightWidth) {\n if (lightWidth <= 0.0) {\n return textureColor;\n }\n float angleInRadians = radians(lightAngle);\n float dis = 0.0;\n if (mod(lightAngle, 180.0) != 0.0) {\n float lightOffsetX = lightCenterPoint.x - ((1.0 - lightCenterPoint.y) / tan(angleInRadians));\n float dx = lightOffsetX + (1.0 - v_uv0.y) / tan(angleInRadians);\n float offsetDis = abs(v_uv0.x - dx);\n dis = sin(angleInRadians) * offsetDis;\n } else {\n dis = abs(v_uv0.y - lightCenterPoint.y);\n }\n float a = 1.0 ;\n if (bool(cropAlpha)) {\n a *= step(0.01, textureColor.a);\n }\n if (!bool(enableFog)) {\n a *= step(dis, lightWidth * 0.5);\n }\n if (bool(enableGradient)) {\n a *= 1.0 - dis / (lightWidth * 0.5);\n }\n vec4 finalLightColor = lightColor * a;\n return textureColor * textureColor.a + finalLightColor;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if ENABLE_LIGHT\n gl_FragColor = addLightColor(gl_FragColor, lightColor, lightCenterPoint, lightAngle, lightWidth);\n #endif\n}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,196 +0,0 @@
|
|||||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
||||||
// 高斯模糊
|
|
||||||
//
|
|
||||||
// 参考资料(必读)
|
|
||||||
// * http://www.ruanyifeng.com/blog/2012/11/gaussian_blur.html
|
|
||||||
// * https://zh.wikipedia.org/wiki/%E9%AB%98%E6%96%AF%E6%A8%A1%E7%B3%8A
|
|
||||||
|
|
||||||
|
|
||||||
CCEffect %{
|
|
||||||
techniques:
|
|
||||||
- passes:
|
|
||||||
- vert: vs
|
|
||||||
frag: fs
|
|
||||||
blendState:
|
|
||||||
targets:
|
|
||||||
- blend: true
|
|
||||||
rasterizerState:
|
|
||||||
cullMode: none
|
|
||||||
properties:
|
|
||||||
texture: { value: white }
|
|
||||||
alphaThreshold: { value: 0.5 }
|
|
||||||
# # 标准方差值
|
|
||||||
# stDev: {
|
|
||||||
# value: 0.84089642,
|
|
||||||
# editor: {
|
|
||||||
# tooltip: "标准方差值"
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# 纹理尺寸
|
|
||||||
textureSize: {
|
|
||||||
value: [100.0, 100.0],
|
|
||||||
editor: {
|
|
||||||
tooltip: "纹理尺寸px(宽 x 高)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
in vec2 a_uv0;
|
|
||||||
out vec2 v_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 pos = vec4(a_position, 1);
|
|
||||||
|
|
||||||
#if CC_USE_MODEL
|
|
||||||
pos = cc_matViewProj * cc_matWorld * pos;
|
|
||||||
#else
|
|
||||||
pos = cc_matViewProj * pos;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
v_uv0 = a_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
v_color = a_color;
|
|
||||||
|
|
||||||
gl_Position = pos;
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
CCProgram fs %{
|
|
||||||
precision highp float;
|
|
||||||
|
|
||||||
#include <alpha-test>
|
|
||||||
|
|
||||||
in vec4 v_color;
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
in vec2 v_uv0;
|
|
||||||
uniform sampler2D texture;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLE_GAUSSIAN_BLUR
|
|
||||||
|
|
||||||
// 定义无理数
|
|
||||||
#define e 2.718281828459045
|
|
||||||
|
|
||||||
// 定义标准方差值(方差值越大,越模糊,但是需要计算的高斯矩阵范围会变大,从而带来巨大的计算量)
|
|
||||||
// #define stDev 0.84089642
|
|
||||||
#define stDev 1.5
|
|
||||||
// #define stDev 5.0
|
|
||||||
// #define stDev 10.0
|
|
||||||
|
|
||||||
// 定义π
|
|
||||||
#define pi 3.141592653589793
|
|
||||||
|
|
||||||
// 接收外部变量
|
|
||||||
uniform GaussianBlur {
|
|
||||||
// 纹理尺寸(宽 x 高)(px)
|
|
||||||
vec2 textureSize;
|
|
||||||
|
|
||||||
// // 标准方差值
|
|
||||||
// float stDev;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取权重(对应二维高斯函数公式,见 https://zh.wikipedia.org/wiki/%E9%AB%98%E6%96%AF%E6%A8%A1%E7%B3%8A )
|
|
||||||
*/
|
|
||||||
float getWeight(float x, float y) {
|
|
||||||
return (1.0 / (2.0 * pi * pow(stDev, 2.0))) * pow(1.0 / e, (pow(x, 2.0) + pow(y, 2.0)) / (2.0 * pow(stDev, 2.0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 o = vec4(1, 1, 1, 1);
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
o *= texture(texture, v_uv0);
|
|
||||||
#if CC_USE_ALPHA_ATLAS_TEXTURE
|
|
||||||
o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
o *= v_color;
|
|
||||||
|
|
||||||
ALPHA_TEST(o);
|
|
||||||
|
|
||||||
gl_FragColor = o;
|
|
||||||
#if ENABLE_GAUSSIAN_BLUR
|
|
||||||
|
|
||||||
// 根据高斯分布(也叫正态分布),在3个标准差范围内的分布比例占到99%的权重,因此我们只需要计算矩阵范围 [6 * stDev + 1, 6 * stDev +1] 上的权重
|
|
||||||
const float size = floor(stDev * 6.0 + 1.0);
|
|
||||||
const float halfSize = floor(size / 2.0);
|
|
||||||
|
|
||||||
// 步骤一:计算高斯矩阵上所有权重的和
|
|
||||||
|
|
||||||
// // v1:遍历所有点,每个点都计算权重
|
|
||||||
// float totalWeight = 0.0;
|
|
||||||
// for(float x = -halfSize; x<= halfSize; x++) {
|
|
||||||
// for (float y = -halfSize; y<= halfSize; y++) {
|
|
||||||
// totalWeight += getWeight(x, y);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// v2:因为高斯分布是对称的,所以只计算原点、X轴正方向 * 2 、Y轴正方向 * 2 、第一象限的权重 * 4即可求出所有权重之和,相比起v1版本,减少很多循环计算
|
|
||||||
|
|
||||||
// 原点
|
|
||||||
float totalWeight = getWeight(0.0, 0.0);
|
|
||||||
|
|
||||||
// X轴正方向上的权重 * 2.0 就是整个X轴上的权重
|
|
||||||
for(float x = 1.0; x <= halfSize; x++) {
|
|
||||||
totalWeight += getWeight(x, 0.0) * 2.0;
|
|
||||||
}
|
|
||||||
// Y轴正方向上的权重 * 2.0 就是整个Y轴上的权重
|
|
||||||
for(float y = 1.0; y <= halfSize; y++) {
|
|
||||||
totalWeight += getWeight(0.0, y) * 2.0;
|
|
||||||
}
|
|
||||||
// 第一象限的权重 * 4.0 就是4个象限的权重
|
|
||||||
for(float x = 1.0; x <= halfSize; x++) {
|
|
||||||
for (float y = 1.0; y<= halfSize; y++) {
|
|
||||||
totalWeight += getWeight(x, y) * 4.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
//
|
|
||||||
// 因为权重矩阵是一次性计算即可不断应用,因此可以将权重矩阵的计算放到CPU计算,并传入到Shader直接渲染,因此有以下优化方案
|
|
||||||
//
|
|
||||||
// v3:原始权重矩阵在CPU计算并传入到Shader
|
|
||||||
// v4:加权平均后的权重矩阵在CPU计算并传入Shader
|
|
||||||
|
|
||||||
|
|
||||||
// 步骤二:采样周边像素并应用加权平均值,得出最终像素值
|
|
||||||
vec4 finalColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
||||||
// float divider = 0.01;
|
|
||||||
float onePxWidth = 1.0 / textureSize.x;
|
|
||||||
float onePxHeight = 1.0 / textureSize.y;
|
|
||||||
for(float x = -halfSize; x<= halfSize; x++) {
|
|
||||||
for (float y = -halfSize; y<= halfSize; y++) {
|
|
||||||
// 求出对应坐标的真正权重(对应权重矩阵)
|
|
||||||
float weight = getWeight(x, y) / totalWeight;
|
|
||||||
|
|
||||||
// 求出对应坐标像素颜色值的加权值
|
|
||||||
// finalColor += texture(texture, v_uv0 + vec2(divider * x, divider * y)) * weight;
|
|
||||||
finalColor += texture(texture, v_uv0 + vec2(onePxWidth * x, onePxHeight * y)) * weight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gl_FragColor = finalColor;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}%
|
|
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.25",
|
|
||||||
"uuid": "41f4d474-d707-45bb-af93-637573f92d54",
|
|
||||||
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_GAUSSIAN_BLUR\nuniform vec2 textureSize;\nfloat getWeight(float x, float y) {\n return (1.0 / (2.0 * 3.141592653589793 * pow(1.5, 2.0))) * pow(1.0 / 2.718281828459045, (pow(x, 2.0) + pow(y, 2.0)) / (2.0 * pow(1.5, 2.0)));\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if ENABLE_GAUSSIAN_BLUR\n const float size = floor(1.5 * 6.0 + 1.0);\n const float halfSize = floor(size / 2.0);\n float totalWeight = getWeight(0.0, 0.0);\n for(float x = 1.0; x <= halfSize; x++) {\n totalWeight += getWeight(x, 0.0) * 2.0;\n }\n for(float y = 1.0; y <= halfSize; y++) {\n totalWeight += getWeight(0.0, y) * 2.0;\n }\n for(float x = 1.0; x <= halfSize; x++) {\n for (float y = 1.0; y<= halfSize; y++) {\n totalWeight += getWeight(x, y) * 4.0;\n }\n }\n vec4 finalColor = vec4(0.0, 0.0, 0.0, 0.0);\n float onePxWidth = 1.0 / textureSize.x;\n float onePxHeight = 1.0 / textureSize.y;\n for(float x = -halfSize; x<= halfSize; x++) {\n for (float y = -halfSize; y<= halfSize; y++) {\n float weight = getWeight(x, y) / totalWeight;\n finalColor += texture2D(texture, v_uv0 + vec2(onePxWidth * x, onePxHeight * y)) * weight;\n }\n }\n gl_FragColor = finalColor;\n #endif\n}"
|
|
||||||
},
|
|
||||||
"glsl3": {
|
|
||||||
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_GAUSSIAN_BLUR\nuniform GaussianBlur {\n vec2 textureSize;\n};\nfloat getWeight(float x, float y) {\n return (1.0 / (2.0 * 3.141592653589793 * pow(1.5, 2.0))) * pow(1.0 / 2.718281828459045, (pow(x, 2.0) + pow(y, 2.0)) / (2.0 * pow(1.5, 2.0)));\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if ENABLE_GAUSSIAN_BLUR\n const float size = floor(1.5 * 6.0 + 1.0);\n const float halfSize = floor(size / 2.0);\n float totalWeight = getWeight(0.0, 0.0);\n for(float x = 1.0; x <= halfSize; x++) {\n totalWeight += getWeight(x, 0.0) * 2.0;\n }\n for(float y = 1.0; y <= halfSize; y++) {\n totalWeight += getWeight(0.0, y) * 2.0;\n }\n for(float x = 1.0; x <= halfSize; x++) {\n for (float y = 1.0; y<= halfSize; y++) {\n totalWeight += getWeight(x, y) * 4.0;\n }\n }\n vec4 finalColor = vec4(0.0, 0.0, 0.0, 0.0);\n float onePxWidth = 1.0 / textureSize.x;\n float onePxHeight = 1.0 / textureSize.y;\n for(float x = -halfSize; x<= halfSize; x++) {\n for (float y = -halfSize; y<= halfSize; y++) {\n float weight = getWeight(x, y) / totalWeight;\n finalColor += texture(texture, v_uv0 + vec2(onePxWidth * x, onePxHeight * y)) * weight;\n }\n }\n gl_FragColor = finalColor;\n #endif\n}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.25",
|
|
||||||
"uuid": "345a48c3-c00c-45d2-b6c9-b1ac49f46662",
|
|
||||||
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if SHOW_INNER_GLOW\nuniform vec4 glowColor;\nuniform float glowColorSize;\nuniform float glowThreshold;\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture2D(texture, v_uv0);\n}\nfloat getColorAlpha(float angle, float dist) {\n float radian = radians(angle);\n vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian)));\n return color.a;\n}\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n}\nfloat getGlowAlpha() {\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n vec4 srcColor = getTextureColor(texture, v_uv0);\n if (srcColor.a <= glowThreshold) {\n return srcColor.a;\n }\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if SHOW_INNER_GLOW\n vec4 color_dest = o;\n float alpha = getGlowAlpha();\n if (alpha > glowThreshold) {\n alpha = 1.0 - alpha;\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n vec4 color_src = glowColor * alpha;\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}"
|
|
||||||
},
|
|
||||||
"glsl3": {
|
|
||||||
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if SHOW_INNER_GLOW\nuniform glow {\n vec4 glowColor;\n float glowColorSize;\n float glowThreshold;\n};\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture(texture, v_uv0);\n}\nfloat getColorAlpha(float angle, float dist) {\n float radian = radians(angle);\n vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian)));\n return color.a;\n}\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n}\nfloat getGlowAlpha() {\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n vec4 srcColor = getTextureColor(texture, v_uv0);\n if (srcColor.a <= glowThreshold) {\n return srcColor.a;\n }\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if SHOW_INNER_GLOW\n vec4 color_dest = o;\n float alpha = getGlowAlpha();\n if (alpha > glowThreshold) {\n alpha = 1.0 - alpha;\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n vec4 color_src = glowColor * alpha;\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,238 +0,0 @@
|
|||||||
// 相比起 v1 版本的变更
|
|
||||||
//
|
|
||||||
// 1. 切换了采样算法,由原来圆采样,改为矩形采样,减少大量三角函数运算,在保持差不多效果的前提下,性能得到大幅提升
|
|
||||||
|
|
||||||
CCEffect %{
|
|
||||||
techniques:
|
|
||||||
- passes:
|
|
||||||
- vert: vs
|
|
||||||
frag: fs
|
|
||||||
blendState:
|
|
||||||
targets:
|
|
||||||
- blend: true
|
|
||||||
rasterizerState:
|
|
||||||
cullMode: none
|
|
||||||
properties:
|
|
||||||
texture: { value: white }
|
|
||||||
alphaThreshold: { value: 0.5 }
|
|
||||||
# 自定义参数
|
|
||||||
glowColor: {
|
|
||||||
value: [1.0, 1.0, 0.0, 1.0],
|
|
||||||
editor: {
|
|
||||||
type: color,
|
|
||||||
tooltip: "发光颜色(RGBA)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spriteWidth: {
|
|
||||||
value: 500,
|
|
||||||
editor: {
|
|
||||||
tooltip: "纹理宽度(px)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spriteHeight: {
|
|
||||||
value: 500,
|
|
||||||
editor: {
|
|
||||||
tooltip: "纹理高度(px)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
glowRange: {
|
|
||||||
value: 20,
|
|
||||||
editor: {
|
|
||||||
tooltip: "内发光范围(px)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# 发光透明度阈值
|
|
||||||
# 只有超过这个透明度的点才会发光
|
|
||||||
# 一般用于解决图像边缘存在渐变透明的时,决定超过这个透明度阈值的边缘点才点发光,具体可以操作一下
|
|
||||||
glowThreshold: {
|
|
||||||
value: 0.1,
|
|
||||||
editor: {
|
|
||||||
tooltip: "发光阈值(只有超过这个透明度的点才会发光)",
|
|
||||||
range: [0.0, 1.0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
in vec2 a_uv0;
|
|
||||||
out vec2 v_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 pos = vec4(a_position, 1);
|
|
||||||
|
|
||||||
#if CC_USE_MODEL
|
|
||||||
pos = cc_matViewProj * cc_matWorld * pos;
|
|
||||||
#else
|
|
||||||
pos = cc_matViewProj * pos;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
v_uv0 = a_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
v_color = a_color;
|
|
||||||
|
|
||||||
gl_Position = pos;
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
CCProgram fs %{
|
|
||||||
precision highp float;
|
|
||||||
|
|
||||||
#include <alpha-test>
|
|
||||||
|
|
||||||
in vec4 v_color;
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
in vec2 v_uv0;
|
|
||||||
uniform sampler2D texture;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 定义向周边搜索的圈数
|
|
||||||
#define range 5.0
|
|
||||||
|
|
||||||
#if SHOW_INNER_GLOW
|
|
||||||
|
|
||||||
uniform glow {
|
|
||||||
// 发光颜色
|
|
||||||
vec4 glowColor;
|
|
||||||
|
|
||||||
// 纹理宽度(px)
|
|
||||||
float spriteWidth;
|
|
||||||
|
|
||||||
// 纹理高度(px)
|
|
||||||
float spriteHeight;
|
|
||||||
|
|
||||||
// 内发光范围(px)
|
|
||||||
float glowRange;
|
|
||||||
|
|
||||||
// 发光阈值
|
|
||||||
float glowThreshold;
|
|
||||||
|
|
||||||
// 特别地,必须是 vec4 先于 float 声明
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取纹理uv颜色
|
|
||||||
*
|
|
||||||
* 主要实现:超出边界的统一返回 vec4(0.0, 0.0, 0.0, 0.0)
|
|
||||||
*
|
|
||||||
* 在 Cocos Creator 2.2.1 的编辑器中,超出边界的uv并不是返回 vec4(0.0, 0.0, 0.0, 0.0),实际返回为
|
|
||||||
*
|
|
||||||
* * 超出左边界的uv,返回 v_uv0.x = 0 的颜色
|
|
||||||
* * 超出右边界的uv,返回 v_uv0.x = 1 的颜色
|
|
||||||
* * 超出上边界的uv,返回 v_uv0.y = 1 的颜色
|
|
||||||
* * 超出下边界的uv,返回 v_uv0.y = 0 的颜色
|
|
||||||
*
|
|
||||||
* 和实际在浏览器上显示(超出边界即为透明)的有区别,为了统一,这里适配一下,这样子,在编辑器上预览的效果就能和实际浏览器的保持一致
|
|
||||||
*/
|
|
||||||
vec4 getTextureColor(sampler2D texture, vec2 v_uv0) {
|
|
||||||
if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {
|
|
||||||
return vec4(0.0, 0.0, 0.0, 0.0);
|
|
||||||
}
|
|
||||||
return texture(texture, v_uv0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取发光的透明度
|
|
||||||
*/
|
|
||||||
float getGlowAlpha() {
|
|
||||||
// 如果发光宽度为0,直接返回0.0透明度,减少计算量
|
|
||||||
if (glowRange == 0.0) {
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 因为我们是要做内发光,所以如果点本来是透明的或者接近透明的
|
|
||||||
// 那么就意味着这个点是图像外的透明点或者图像内透明点(如空洞)之类的
|
|
||||||
// 内发光的话,这些透明点我们不用处理,让它保持原样,否则就是会有内描边或者一点扩边的效果
|
|
||||||
// 同时也是提前直接结束,减少计算量
|
|
||||||
vec4 srcColor = getTextureColor(texture, v_uv0);
|
|
||||||
if (srcColor.a <= glowThreshold) {
|
|
||||||
return srcColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 每一圈的对应的步长
|
|
||||||
float per_step_x = (1.0 / spriteWidth) * (glowRange / range);
|
|
||||||
float per_step_y = (1.0 / spriteHeight) * (glowRange / range);
|
|
||||||
|
|
||||||
// 取样周边一定范围透明度
|
|
||||||
float totalAlpha = 0.0;
|
|
||||||
for (float x = -range; x <= range; x++) {
|
|
||||||
for (float y = -range; y <= range; y++) {
|
|
||||||
totalAlpha += getTextureColor(texture, v_uv0 + vec2(x * per_step_x, y * per_step_y)).a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
totalAlpha /= (range + range + 1.0) * (range + range + 1.0);
|
|
||||||
return totalAlpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 o = vec4(1, 1, 1, 1);
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
o *= texture(texture, v_uv0);
|
|
||||||
#if CC_USE_ALPHA_ATLAS_TEXTURE
|
|
||||||
o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
o *= v_color;
|
|
||||||
|
|
||||||
ALPHA_TEST(o);
|
|
||||||
|
|
||||||
gl_FragColor = o;
|
|
||||||
|
|
||||||
#if SHOW_INNER_GLOW
|
|
||||||
// 目标颜色(图像)
|
|
||||||
vec4 color_dest = o;
|
|
||||||
|
|
||||||
// 获取发光透明度
|
|
||||||
// 此时我们得到的是内部透明度为1,靠近边缘的为接近0的透明度,其他位置为0的透明度
|
|
||||||
float alpha = getGlowAlpha();
|
|
||||||
|
|
||||||
// 而内发光是从边缘开始的,那么什么算是边缘呢?
|
|
||||||
// 如果图像边缘有大量渐变,那么如果我们取大于 0.0 点就算是图像内的话,那么可能边缘会出现锯齿
|
|
||||||
// 因此为了确定边缘,引入了发光阈值,我们只需要比较一下发光阈值就可以,大于发光阈值的点都是(图像内)发光点
|
|
||||||
if (alpha > glowThreshold) {
|
|
||||||
|
|
||||||
// 内发光是从边缘发光的,是需要内部透明度为0,靠近边缘的接近1的透明度
|
|
||||||
// 因此我们需要翻转一下透明度
|
|
||||||
alpha = 1.0 - alpha;
|
|
||||||
|
|
||||||
// 给点调料,让靠近边缘的更加亮
|
|
||||||
alpha = -1.0 * pow((alpha - 1.0), 4.0) + 1.0;
|
|
||||||
}
|
|
||||||
// 源颜色(内发光)
|
|
||||||
vec4 color_src = glowColor * alpha;
|
|
||||||
|
|
||||||
// 按照这个顺序,源颜色就是内发光颜色,目标颜色就是图案颜色色
|
|
||||||
// 所以命名就是 color_src, color_dest
|
|
||||||
|
|
||||||
// 按照混合颜色规则 http://docs.cocos.com/creator/manual/zh/advanced-topics/ui-auto-batch.html#blend-%E6%A8%A1%E5%BC%8F
|
|
||||||
// 要在图案上方,叠加一个内发光,将两者颜色混合起来,那么最终选择的混合模式如下:
|
|
||||||
//
|
|
||||||
// (内发光)color_src: GL_SRC_ALPHA
|
|
||||||
// (原图像)color_dest: GL_ONE
|
|
||||||
//
|
|
||||||
// 即最终颜色如下:
|
|
||||||
// color_src * GL_SRC_ALPHA + color_dest * GL_ONE
|
|
||||||
|
|
||||||
gl_FragColor = color_src * color_src.a + color_dest;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}%
|
|
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.25",
|
|
||||||
"uuid": "c49fbec9-7e8c-4114-a058-354eebd04446",
|
|
||||||
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if SHOW_INNER_GLOW\nuniform vec4 glowColor;\nuniform float spriteWidth;\nuniform float spriteHeight;\nuniform float glowRange;\nuniform float glowThreshold;\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture2D(texture, v_uv0);\n}\nfloat getGlowAlpha() {\n if (glowRange == 0.0) {\n return 0.0;\n }\n vec4 srcColor = getTextureColor(texture, v_uv0);\n if (srcColor.a <= glowThreshold) {\n return srcColor.a;\n }\n float per_step_x = (1.0 / spriteWidth) * (glowRange / 5.0);\n float per_step_y = (1.0 / spriteHeight) * (glowRange / 5.0);\n float totalAlpha = 0.0;\n for (float x = -5.0; x <= 5.0; x++) {\n for (float y = -5.0; y <= 5.0; y++) {\n totalAlpha += getTextureColor(texture, v_uv0 + vec2(x * per_step_x, y * per_step_y)).a;\n }\n }\n totalAlpha /= (5.0 + 5.0 + 1.0) * (5.0 + 5.0 + 1.0);\n return totalAlpha;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if SHOW_INNER_GLOW\n vec4 color_dest = o;\n float alpha = getGlowAlpha();\n if (alpha > glowThreshold) {\n alpha = 1.0 - alpha;\n alpha = -1.0 * pow((alpha - 1.0), 4.0) + 1.0;\n }\n vec4 color_src = glowColor * alpha;\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}"
|
|
||||||
},
|
|
||||||
"glsl3": {
|
|
||||||
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if SHOW_INNER_GLOW\nuniform glow {\n vec4 glowColor;\n float spriteWidth;\n float spriteHeight;\n float glowRange;\n float glowThreshold;\n};\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture(texture, v_uv0);\n}\nfloat getGlowAlpha() {\n if (glowRange == 0.0) {\n return 0.0;\n }\n vec4 srcColor = getTextureColor(texture, v_uv0);\n if (srcColor.a <= glowThreshold) {\n return srcColor.a;\n }\n float per_step_x = (1.0 / spriteWidth) * (glowRange / 5.0);\n float per_step_y = (1.0 / spriteHeight) * (glowRange / 5.0);\n float totalAlpha = 0.0;\n for (float x = -5.0; x <= 5.0; x++) {\n for (float y = -5.0; y <= 5.0; y++) {\n totalAlpha += getTextureColor(texture, v_uv0 + vec2(x * per_step_x, y * per_step_y)).a;\n }\n }\n totalAlpha /= (5.0 + 5.0 + 1.0) * (5.0 + 5.0 + 1.0);\n return totalAlpha;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if SHOW_INNER_GLOW\n vec4 color_dest = o;\n float alpha = getGlowAlpha();\n if (alpha > glowThreshold) {\n alpha = 1.0 - alpha;\n alpha = -1.0 * pow((alpha - 1.0), 4.0) + 1.0;\n }\n vec4 color_src = glowColor * alpha;\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||||
|
// 内发光特效
|
||||||
|
// 原理: 采样周边像素alpha取平均值,叠加发光效果
|
||||||
CCEffect %{
|
CCEffect %{
|
||||||
techniques:
|
techniques:
|
||||||
- passes:
|
- passes:
|
||||||
@ -13,11 +14,12 @@ CCEffect %{
|
|||||||
properties:
|
properties:
|
||||||
texture: { value: white }
|
texture: { value: white }
|
||||||
alphaThreshold: { value: 0.5 }
|
alphaThreshold: { value: 0.5 }
|
||||||
|
|
||||||
# 自定义参数
|
# 自定义参数
|
||||||
# 发光颜色
|
# 发光颜色
|
||||||
glowColor: {
|
glowColor: {
|
||||||
value: [1.0, 1.0, 0.0, 1.0],
|
value: [1.0, 1.0, 0.0, 1.0],
|
||||||
editor: {
|
inspector: {
|
||||||
type: color,
|
type: color,
|
||||||
tooltip: "发光颜色"
|
tooltip: "发光颜色"
|
||||||
}
|
}
|
||||||
@ -25,7 +27,7 @@ CCEffect %{
|
|||||||
# 发光宽度
|
# 发光宽度
|
||||||
glowColorSize: {
|
glowColorSize: {
|
||||||
value: 0.2,
|
value: 0.2,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "发光宽度",
|
tooltip: "发光宽度",
|
||||||
range: [0.0, 1.0],
|
range: [0.0, 1.0],
|
||||||
}
|
}
|
||||||
@ -35,7 +37,7 @@ CCEffect %{
|
|||||||
# 一般用于解决图像边缘存在渐变透明的时,决定超过这个透明度阈值的边缘点才点发光,具体可以操作一下
|
# 一般用于解决图像边缘存在渐变透明的时,决定超过这个透明度阈值的边缘点才点发光,具体可以操作一下
|
||||||
glowThreshold: {
|
glowThreshold: {
|
||||||
value: 0.1,
|
value: 0.1,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "发光阈值",
|
tooltip: "发光阈值",
|
||||||
range: [0.0, 1.0]
|
range: [0.0, 1.0]
|
||||||
}
|
}
|
||||||
@ -205,7 +207,7 @@ CCProgram fs %{
|
|||||||
vec4 o = vec4(1, 1, 1, 1);
|
vec4 o = vec4(1, 1, 1, 1);
|
||||||
|
|
||||||
#if USE_TEXTURE
|
#if USE_TEXTURE
|
||||||
o *= texture(texture, v_uv0);
|
o *= getTextureColor(texture, v_uv0);
|
||||||
#if CC_USE_ALPHA_ATLAS_TEXTURE
|
#if CC_USE_ALPHA_ATLAS_TEXTURE
|
||||||
o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;
|
o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;
|
||||||
#endif
|
#endif
|
17
assets/effects/sprite-glow-inner.effect.meta
Normal file
17
assets/effects/sprite-glow-inner.effect.meta
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.23",
|
||||||
|
"uuid": "90211f16-c00e-4c37-a192-43ec50c9ea35",
|
||||||
|
"compiledShaders": [
|
||||||
|
{
|
||||||
|
"glsl1": {
|
||||||
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n",
|
||||||
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform vec4 glowColor;\nuniform float glowColorSize;\nuniform float glowThreshold;\n\n/**\n * 获取纹理uv颜色 \n *\n * 主要实现:超出边界的统一返回 vec4(0.0, 0.0, 0.0, 0.0)\n * \n * 在 Cocos Creator 2.2.1 的编辑器中,超出边界的uv并不是返回 vec4(0.0, 0.0, 0.0, 0.0),实际返回为\n * \n * * 超出左边界的uv,返回 v_uv0.x = 0 的颜色\n * * 超出右边界的uv,返回 v_uv0.x = 1 的颜色\n * * 超出上边界的uv,返回 v_uv0.y = 1 的颜色\n * * 超出下边界的uv,返回 v_uv0.y = 0 的颜色\n *\n * 和实际在浏览器上显示(超出边界即为透明)的有区别,为了统一,这里适配一下,这样子,在编辑器上预览的效果就能和实际浏览器的保持一致\n */\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture2D(texture, v_uv0);\n}\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param dist 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float dist) {\n\n float radian = radians(angle);\n vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param dist 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n\n vec4 srcColor = getTextureColor(texture, v_uv0);\n if (srcColor.a <= glowThreshold) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= getTextureColor(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > glowThreshold) {\n\n alpha = 1.0 - alpha;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n"
|
||||||
|
},
|
||||||
|
"glsl3": {
|
||||||
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n",
|
||||||
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform glow {\n\n vec4 glowColor;\n\n float glowColorSize;\n\n float glowThreshold;\n\n};\n\n/**\n * 获取纹理uv颜色 \n *\n * 主要实现:超出边界的统一返回 vec4(0.0, 0.0, 0.0, 0.0)\n * \n * 在 Cocos Creator 2.2.1 的编辑器中,超出边界的uv并不是返回 vec4(0.0, 0.0, 0.0, 0.0),实际返回为\n * \n * * 超出左边界的uv,返回 v_uv0.x = 0 的颜色\n * * 超出右边界的uv,返回 v_uv0.x = 1 的颜色\n * * 超出上边界的uv,返回 v_uv0.y = 1 的颜色\n * * 超出下边界的uv,返回 v_uv0.y = 0 的颜色\n *\n * 和实际在浏览器上显示(超出边界即为透明)的有区别,为了统一,这里适配一下,这样子,在编辑器上预览的效果就能和实际浏览器的保持一致\n */\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture(texture, v_uv0);\n}\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param dist 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float dist) {\n\n float radian = radians(angle);\n vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param dist 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n\n vec4 srcColor = getTextureColor(texture, v_uv0);\n if (srcColor.a <= glowThreshold) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= getTextureColor(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > glowThreshold) {\n\n alpha = 1.0 - alpha;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||||
|
// 外发光特效
|
||||||
|
// 原理:采样周边像素alpha取平均值,给外部加发光效果(1-col.a可避免内部发光)
|
||||||
CCEffect %{
|
CCEffect %{
|
||||||
techniques:
|
techniques:
|
||||||
- passes:
|
- passes:
|
||||||
@ -13,11 +14,12 @@ CCEffect %{
|
|||||||
properties:
|
properties:
|
||||||
texture: { value: white }
|
texture: { value: white }
|
||||||
alphaThreshold: { value: 0.5 }
|
alphaThreshold: { value: 0.5 }
|
||||||
|
|
||||||
# 自定义参数
|
# 自定义参数
|
||||||
# 发光颜色
|
# 发光颜色
|
||||||
glowColor: {
|
glowColor: {
|
||||||
value: [1.0, 1.0, 0.0, 1.0],
|
value: [1.0, 1.0, 0.0, 1.0],
|
||||||
editor: {
|
inspector: {
|
||||||
type: color,
|
type: color,
|
||||||
tooltip: "发光颜色"
|
tooltip: "发光颜色"
|
||||||
}
|
}
|
||||||
@ -25,7 +27,7 @@ CCEffect %{
|
|||||||
# 发光宽度
|
# 发光宽度
|
||||||
glowColorSize: {
|
glowColorSize: {
|
||||||
value: 0.15,
|
value: 0.15,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "发光宽度",
|
tooltip: "发光宽度",
|
||||||
range: [0.0, 1.0],
|
range: [0.0, 1.0],
|
||||||
}
|
}
|
||||||
@ -34,7 +36,7 @@ CCEffect %{
|
|||||||
# 只有小于等于这个透明度的点才会发光
|
# 只有小于等于这个透明度的点才会发光
|
||||||
glowThreshold: {
|
glowThreshold: {
|
||||||
value: 1.0,
|
value: 1.0,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "发光阈值",
|
tooltip: "发光阈值",
|
||||||
range: [0.0, 1.0]
|
range: [0.0, 1.0]
|
||||||
}
|
}
|
||||||
@ -48,17 +50,20 @@ CCProgram vs %{
|
|||||||
#include <cc-global>
|
#include <cc-global>
|
||||||
#include <cc-local>
|
#include <cc-local>
|
||||||
|
|
||||||
|
// a_position 是笛卡尔坐标右手系,也是OpenGL的坐标系,原点在左下角,X轴正方向往右,Y轴正方向往上,Z轴正方向往外
|
||||||
in vec3 a_position;
|
in vec3 a_position;
|
||||||
in vec4 a_color;
|
in vec4 a_color;
|
||||||
out vec4 v_color;
|
out vec4 v_color;
|
||||||
|
|
||||||
#if USE_TEXTURE
|
#if USE_TEXTURE
|
||||||
|
// a_uv0 是标准屏幕坐标系,即原点在左上角,X轴正方向往右,Y轴正方向往下
|
||||||
in vec2 a_uv0;
|
in vec2 a_uv0;
|
||||||
out vec2 v_uv0;
|
out vec2 v_uv0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void main () {
|
void main () {
|
||||||
vec4 pos = vec4(a_position, 1);
|
vec4 pos = vec4(a_position, 1);
|
||||||
|
// vec4 pos = vec4(a_position * vec3(1.0, 1.0, 1.0), 1);
|
||||||
|
|
||||||
#if CC_USE_MODEL
|
#if CC_USE_MODEL
|
||||||
pos = cc_matViewProj * cc_matWorld * pos;
|
pos = cc_matViewProj * cc_matWorld * pos;
|
||||||
@ -234,7 +239,7 @@ CCProgram fs %{
|
|||||||
vec4 o = vec4(1, 1, 1, 1);
|
vec4 o = vec4(1, 1, 1, 1);
|
||||||
|
|
||||||
#if USE_TEXTURE
|
#if USE_TEXTURE
|
||||||
o *= texture(texture, v_uv0);
|
o *= getTextureColor(texture, v_uv0);
|
||||||
#if CC_USE_ALPHA_ATLAS_TEXTURE
|
#if CC_USE_ALPHA_ATLAS_TEXTURE
|
||||||
o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;
|
o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.25",
|
"ver": "1.0.23",
|
||||||
"uuid": "67e9833e-aa43-427a-ba89-d7bdd1ef0aed",
|
"uuid": "89f30b2e-b75e-49b1-9dfc-cb341cadd30a",
|
||||||
"compiledShaders": [
|
"compiledShaders": [
|
||||||
{
|
{
|
||||||
"glsl1": {
|
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\n\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture2D(texture, v_uv0);\n}\n#if SHOW_OUTTER_GLOW\nuniform vec4 glowColor;\nuniform float glowColorSize;\nuniform float glowThreshold;\nfloat getColorAlpha(float angle, float dist) {\n float radian = angle * 0.01745329252;\n vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian)));\n return color.a;\n}\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n}\nfloat getGlowAlpha() {\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if SHOW_OUTTER_GLOW\n float alpha = getGlowAlpha();\n if (alpha <= glowThreshold) {\n alpha = alpha / glowThreshold;\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n } else {\n alpha = 0.0;\n }\n vec4 color_dest = glowColor * alpha;\n vec4 color_src = o;\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n/**\n * 获取纹理uv颜色 \n *\n * 主要实现:超出边界的统一返回 vec4(0.0, 0.0, 0.0, 0.0)\n * \n * 在 Cocos Creator 2.2.1 的编辑器中,超出边界的uv并不是返回 vec4(0.0, 0.0, 0.0, 0.0),实际返回为\n * \n * * 超出左边界的uv,返回 v_uv0.x = 0 的颜色\n * * 超出右边界的uv,返回 v_uv0.x = 1 的颜色\n * * 超出上边界的uv,返回 v_uv0.y = 1 的颜色\n * * 超出下边界的uv,返回 v_uv0.y = 0 的颜色\n *\n * 和实际在浏览器上显示(超出边界即为透明)的有区别,为了统一,这里适配一下,这样子,在编辑器上预览的效果就能和实际浏览器的保持一致\n */\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture2D(texture, v_uv0);\n}\n\n#if SHOW_OUTTER_GLOW\n\nuniform vec4 glowColor;\nuniform float glowColorSize;\nuniform float glowThreshold;\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param dist 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float dist) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param dist 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= getTextureColor(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUTTER_GLOW\n\n float alpha = getGlowAlpha();\n\n if (alpha <= glowThreshold) {\n\n alpha = alpha / glowThreshold;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n } else {\n\n alpha = 0.0;\n }\n\n vec4 color_dest = glowColor * alpha;\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}\n"
|
||||||
},
|
},
|
||||||
"glsl3": {
|
"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\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\n\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture(texture, v_uv0);\n}\n#if SHOW_OUTTER_GLOW\nuniform glow {\n vec4 glowColor;\n float glowColorSize;\n float glowThreshold;\n};\nfloat getColorAlpha(float angle, float dist) {\n float radian = angle * 0.01745329252;\n vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian)));\n return color.a;\n}\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n}\nfloat getGlowAlpha() {\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if SHOW_OUTTER_GLOW\n float alpha = getGlowAlpha();\n if (alpha <= glowThreshold) {\n alpha = alpha / glowThreshold;\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n } else {\n alpha = 0.0;\n }\n vec4 color_dest = glowColor * alpha;\n vec4 color_src = o;\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n/**\n * 获取纹理uv颜色 \n *\n * 主要实现:超出边界的统一返回 vec4(0.0, 0.0, 0.0, 0.0)\n * \n * 在 Cocos Creator 2.2.1 的编辑器中,超出边界的uv并不是返回 vec4(0.0, 0.0, 0.0, 0.0),实际返回为\n * \n * * 超出左边界的uv,返回 v_uv0.x = 0 的颜色\n * * 超出右边界的uv,返回 v_uv0.x = 1 的颜色\n * * 超出上边界的uv,返回 v_uv0.y = 1 的颜色\n * * 超出下边界的uv,返回 v_uv0.y = 0 的颜色\n *\n * 和实际在浏览器上显示(超出边界即为透明)的有区别,为了统一,这里适配一下,这样子,在编辑器上预览的效果就能和实际浏览器的保持一致\n */\nvec4 getTextureColor(sampler2D texture, vec2 v_uv0) {\n if (v_uv0.x > 1.0 || v_uv0.x < 0.0 || v_uv0.y > 1.0 || v_uv0.y < 0.0) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n }\n return texture(texture, v_uv0);\n}\n\n#if SHOW_OUTTER_GLOW\n\nuniform glow {\n\n vec4 glowColor;\n\n float glowColorSize;\n\n float glowThreshold;\n\n};\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param dist 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float dist) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param dist 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= getTextureColor(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUTTER_GLOW\n\n float alpha = getGlowAlpha();\n\n if (alpha <= glowThreshold) {\n\n alpha = alpha / glowThreshold;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n } else {\n\n alpha = 0.0;\n }\n\n vec4 color_dest = glowColor * alpha;\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -21,7 +21,7 @@ CCEffect %{
|
|||||||
# 灰化程度
|
# 灰化程度
|
||||||
grayLevel: {
|
grayLevel: {
|
||||||
value: 1.0,
|
value: 1.0,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "灰化程度",
|
tooltip: "灰化程度",
|
||||||
range: [0.0, 1.0]
|
range: [0.0, 1.0]
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ CCProgram fs %{
|
|||||||
uniform GrayPhoto {
|
uniform GrayPhoto {
|
||||||
// 灰化程度
|
// 灰化程度
|
||||||
float grayLevel;
|
float grayLevel;
|
||||||
};
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void main () {
|
void main () {
|
||||||
@ -103,14 +103,7 @@ CCProgram fs %{
|
|||||||
float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;
|
float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;
|
||||||
vec4 grayColor = vec4(gray, gray, gray, o.a);
|
vec4 grayColor = vec4(gray, gray, gray, o.a);
|
||||||
|
|
||||||
|
o = srcColor + (grayColor - srcColor) * grayLevel;
|
||||||
// o = srcColor + (grayColor - srcColor) * grayLevel;
|
|
||||||
// 实际上,在OpenGL中内置了mix混合函数,实际效果就是上面这条公式
|
|
||||||
// mix(x, y, a)函数理解:x * (1.0 - a) + y * a
|
|
||||||
// 为了看起来更像OpenGL,因此这里改为采用内置函数
|
|
||||||
|
|
||||||
o = mix(srcColor, grayColor, grayLevel);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
gl_FragColor = o;
|
gl_FragColor = o;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.25",
|
"ver": "1.0.23",
|
||||||
"uuid": "2e5b29d9-dd5e-4f3d-92e9-e580745b3bc8",
|
"uuid": "2e5b29d9-dd5e-4f3d-92e9-e580745b3bc8",
|
||||||
"compiledShaders": [
|
"compiledShaders": [
|
||||||
{
|
{
|
||||||
"glsl1": {
|
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_GRAY\nuniform float grayLevel;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if USE_GRAY\n vec4 srcColor = o;\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n vec4 grayColor = vec4(gray, gray, gray, o.a);\n o = mix(srcColor, grayColor, grayLevel);\n #endif\n gl_FragColor = o;\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if USE_GRAY\nuniform float grayLevel;\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n #if USE_GRAY\n vec4 srcColor = o;\n\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n vec4 grayColor = vec4(gray, gray, gray, o.a);\n\n o = srcColor + (grayColor - srcColor) * grayLevel;\n #endif\n gl_FragColor = o;\n}\n"
|
||||||
},
|
},
|
||||||
"glsl3": {
|
"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\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_GRAY\nuniform GrayPhoto {\n float grayLevel;\n};\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if USE_GRAY\n vec4 srcColor = o;\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n vec4 grayColor = vec4(gray, gray, gray, o.a);\n o = mix(srcColor, grayColor, grayLevel);\n #endif\n gl_FragColor = o;\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if USE_GRAY\nuniform GrayPhoto {\n\n float grayLevel;\n}\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n #if USE_GRAY\n vec4 srcColor = o;\n\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n vec4 grayColor = vec4(gray, gray, gray, o.a);\n\n o = srcColor + (grayColor - srcColor) * grayLevel;\n #endif\n gl_FragColor = o;\n}\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -18,14 +18,14 @@ CCEffect %{
|
|||||||
# X轴方块数量
|
# X轴方块数量
|
||||||
xBlockCount: {
|
xBlockCount: {
|
||||||
value: 30.0,
|
value: 30.0,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "X轴方向马赛克方块数量"
|
tooltip: "X轴方向马赛克方块数量"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Y轴方块数量
|
# Y轴方块数量
|
||||||
yBlockCount: {
|
yBlockCount: {
|
||||||
value: 30.0,
|
value: 30.0,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "Y轴方向马赛克方块数量"
|
tooltip: "Y轴方向马赛克方块数量"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ CCProgram fs %{
|
|||||||
float xBlockCount;
|
float xBlockCount;
|
||||||
// Y轴方块数量
|
// Y轴方块数量
|
||||||
float yBlockCount;
|
float yBlockCount;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取v_uv0最终映射的马赛格格子的坐标
|
* 获取v_uv0最终映射的马赛格格子的坐标
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.25",
|
"ver": "1.0.23",
|
||||||
"uuid": "9638979d-62b3-4e5b-adea-7ad706e66e65",
|
"uuid": "9638979d-62b3-4e5b-adea-7ad706e66e65",
|
||||||
"compiledShaders": [
|
"compiledShaders": [
|
||||||
{
|
{
|
||||||
"glsl1": {
|
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_MOSAIC\nuniform float xBlockCount;\nuniform float yBlockCount;\nvec2 getUvMapPos() {\n float xCount;\n if (xBlockCount <= 0.0) {\n xCount = 1.0;\n } else {\n xCount = xBlockCount;\n }\n float blockWidth = 1.0 / xCount;\n float blockXIndex = floor(v_uv0.x / blockWidth);\n float yCount;\n if (yBlockCount <= 0.0) {\n yCount = 1.0;\n } else {\n yCount = yBlockCount;\n }\n float blockHeight = 1.0 / yCount;\n float blockYIndex = floor(v_uv0.y / blockHeight);\n return vec2(blockWidth * (blockXIndex + 0.5), blockHeight * (blockYIndex + 0.5));\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n vec2 realPos = v_uv0;\n #if USE_MOSAIC\n realPos = getUvMapPos();\n #endif\n #if USE_TEXTURE\n o *= texture2D(texture, realPos);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, realPos + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if USE_MOSAIC\nuniform float xBlockCount;\nuniform float yBlockCount;\n/**\n * 获取v_uv0最终映射的马赛格格子的坐标\n *\n * @return 映射后坐标\n */\nvec2 getUvMapPos() {\n\n float xCount;\n if (xBlockCount <= 0.0) {\n xCount = 1.0;\n } else {\n xCount = xBlockCount;\n }\n float blockWidth = 1.0 / xCount;\n\n float blockXIndex = floor(v_uv0.x / blockWidth);\n\n float yCount; \n if (yBlockCount <= 0.0) {\n yCount = 1.0;\n } else {\n yCount = yBlockCount;\n }\n float blockHeight = 1.0 / yCount;\n float blockYIndex = floor(v_uv0.y / blockHeight);\n\n return vec2(blockWidth * (blockXIndex + 0.5), blockHeight * (blockYIndex + 0.5));\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n vec2 realPos = v_uv0;\n #if USE_MOSAIC\n realPos = getUvMapPos();\n #endif\n\n #if USE_TEXTURE\n o *= texture2D(texture, realPos);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, realPos + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n}\n"
|
||||||
},
|
},
|
||||||
"glsl3": {
|
"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\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_MOSAIC\nuniform Mosaic {\n float xBlockCount;\n float yBlockCount;\n};\nvec2 getUvMapPos() {\n float xCount;\n if (xBlockCount <= 0.0) {\n xCount = 1.0;\n } else {\n xCount = xBlockCount;\n }\n float blockWidth = 1.0 / xCount;\n float blockXIndex = floor(v_uv0.x / blockWidth);\n float yCount;\n if (yBlockCount <= 0.0) {\n yCount = 1.0;\n } else {\n yCount = yBlockCount;\n }\n float blockHeight = 1.0 / yCount;\n float blockYIndex = floor(v_uv0.y / blockHeight);\n return vec2(blockWidth * (blockXIndex + 0.5), blockHeight * (blockYIndex + 0.5));\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n vec2 realPos = v_uv0;\n #if USE_MOSAIC\n realPos = getUvMapPos();\n #endif\n #if USE_TEXTURE\n o *= texture(texture, realPos);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, realPos + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if USE_MOSAIC\nuniform Mosaic {\n\n float xBlockCount;\n\n float yBlockCount;\n}\n\n/**\n * 获取v_uv0最终映射的马赛格格子的坐标\n *\n * @return 映射后坐标\n */\nvec2 getUvMapPos() {\n\n float xCount;\n if (xBlockCount <= 0.0) {\n xCount = 1.0;\n } else {\n xCount = xBlockCount;\n }\n float blockWidth = 1.0 / xCount;\n\n float blockXIndex = floor(v_uv0.x / blockWidth);\n\n float yCount; \n if (yBlockCount <= 0.0) {\n yCount = 1.0;\n } else {\n yCount = yBlockCount;\n }\n float blockHeight = 1.0 / yCount;\n float blockYIndex = floor(v_uv0.y / blockHeight);\n\n return vec2(blockWidth * (blockXIndex + 0.5), blockHeight * (blockYIndex + 0.5));\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n vec2 realPos = v_uv0;\n #if USE_MOSAIC\n realPos = getUvMapPos();\n #endif\n\n #if USE_TEXTURE\n o *= texture(texture, realPos);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, realPos + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n}\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -21,7 +21,7 @@ CCEffect %{
|
|||||||
# 老化程度
|
# 老化程度
|
||||||
oldLevel: {
|
oldLevel: {
|
||||||
value: 1.0,
|
value: 1.0,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "老化程度",
|
tooltip: "老化程度",
|
||||||
range: [0.0, 1.0]
|
range: [0.0, 1.0]
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ CCProgram fs %{
|
|||||||
uniform OldPhoto {
|
uniform OldPhoto {
|
||||||
// 老化程度
|
// 老化程度
|
||||||
float oldLevel;
|
float oldLevel;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取老化颜色
|
* 获取老化颜色
|
||||||
@ -115,8 +115,7 @@ CCProgram fs %{
|
|||||||
vec4 srcColor = o;
|
vec4 srcColor = o;
|
||||||
vec4 oldColor = getOldPhotoColor(srcColor);
|
vec4 oldColor = getOldPhotoColor(srcColor);
|
||||||
|
|
||||||
// o = srcColor + (oldColor - srcColor) * oldLevel;
|
o = srcColor + (oldColor - srcColor) * oldLevel;
|
||||||
o = mix(srcColor, oldColor, oldLevel);
|
|
||||||
#endif
|
#endif
|
||||||
gl_FragColor = o;
|
gl_FragColor = o;
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.25",
|
"ver": "1.0.23",
|
||||||
"uuid": "211eddf3-c53d-46e3-8c09-c1bf38e644e2",
|
"uuid": "211eddf3-c53d-46e3-8c09-c1bf38e644e2",
|
||||||
"compiledShaders": [
|
"compiledShaders": [
|
||||||
{
|
{
|
||||||
"glsl1": {
|
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_OLD_PHOTO\nuniform float oldLevel;\nvec4 getOldPhotoColor(vec4 color) {\n float r = 0.393 * color.r + 0.769 * color.g + 0.189 * color.b;\n float g = 0.349 * color.r + 0.686 * color.g + 0.168 * color.b;\n float b = 0.272 * color.r + 0.534 * color.g + 0.131 * color.b;\n return vec4(r, g, b, color.a);\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if USE_OLD_PHOTO\n vec4 srcColor = o;\n vec4 oldColor = getOldPhotoColor(srcColor);\n o = mix(srcColor, oldColor, oldLevel);\n #endif\n gl_FragColor = o;\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if USE_OLD_PHOTO\nuniform float oldLevel;\n/**\n * 获取老化颜色\n * \n * @param color 原始颜色 \n *\n * @return 老化后的颜色\n */\nvec4 getOldPhotoColor(vec4 color) {\n float r = 0.393 * color.r + 0.769 * color.g + 0.189 * color.b; \n float g = 0.349 * color.r + 0.686 * color.g + 0.168 * color.b; \n float b = 0.272 * color.r + 0.534 * color.g + 0.131 * color.b;\n return vec4(r, g, b, color.a);\n}\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n #if USE_OLD_PHOTO\n vec4 srcColor = o;\n vec4 oldColor = getOldPhotoColor(srcColor);\n\n o = srcColor + (oldColor - srcColor) * oldLevel;\n #endif\n gl_FragColor = o;\n}\n"
|
||||||
},
|
},
|
||||||
"glsl3": {
|
"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\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if USE_OLD_PHOTO\nuniform OldPhoto {\n float oldLevel;\n};\nvec4 getOldPhotoColor(vec4 color) {\n float r = 0.393 * color.r + 0.769 * color.g + 0.189 * color.b;\n float g = 0.349 * color.r + 0.686 * color.g + 0.168 * color.b;\n float b = 0.272 * color.r + 0.534 * color.g + 0.131 * color.b;\n return vec4(r, g, b, color.a);\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if USE_OLD_PHOTO\n vec4 srcColor = o;\n vec4 oldColor = getOldPhotoColor(srcColor);\n o = mix(srcColor, oldColor, oldLevel);\n #endif\n gl_FragColor = o;\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if USE_OLD_PHOTO\nuniform OldPhoto {\n\n float oldLevel;\n}\n\n/**\n * 获取老化颜色\n * \n * @param color 原始颜色 \n *\n * @return 老化后的颜色\n */\nvec4 getOldPhotoColor(vec4 color) {\n float r = 0.393 * color.r + 0.769 * color.g + 0.189 * color.b; \n float g = 0.349 * color.r + 0.686 * color.g + 0.168 * color.b; \n float b = 0.272 * color.r + 0.534 * color.g + 0.131 * color.b;\n return vec4(r, g, b, color.a);\n}\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n #if USE_OLD_PHOTO\n vec4 srcColor = o;\n vec4 oldColor = getOldPhotoColor(srcColor);\n\n o = srcColor + (oldColor - srcColor) * oldLevel;\n #endif\n gl_FragColor = o;\n}\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||||
|
// 描边特效
|
||||||
CCEffect %{
|
CCEffect %{
|
||||||
techniques:
|
techniques:
|
||||||
- passes:
|
- passes:
|
||||||
@ -17,7 +17,7 @@ CCEffect %{
|
|||||||
# 描边颜色
|
# 描边颜色
|
||||||
outlineColor: {
|
outlineColor: {
|
||||||
value: [1.0, 0.0, 0.0, 1.0],
|
value: [1.0, 0.0, 0.0, 1.0],
|
||||||
editor: {
|
inspector: {
|
||||||
type: color,
|
type: color,
|
||||||
tooltip: "描边颜色",
|
tooltip: "描边颜色",
|
||||||
}
|
}
|
||||||
@ -26,12 +26,11 @@ CCEffect %{
|
|||||||
# 描边宽度
|
# 描边宽度
|
||||||
outlineWidth: {
|
outlineWidth: {
|
||||||
value: 0.002,
|
value: 0.002,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "描边宽度",
|
tooltip: "描边宽度",
|
||||||
range: [0.0, 1.0]
|
range: [0.0, 1.0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}%
|
}%
|
||||||
|
|
||||||
|
|
||||||
@ -110,6 +109,7 @@ CCProgram fs %{
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void main () {
|
void main () {
|
||||||
vec4 o = vec4(1, 1, 1, 1);
|
vec4 o = vec4(1, 1, 1, 1);
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.25",
|
"ver": "1.0.23",
|
||||||
"uuid": "34c2ed47-4d59-41c4-b91c-157c32e9d0eb",
|
"uuid": "559dcd1e-233b-4e1f-b1da-733c9232f06f",
|
||||||
"compiledShaders": [
|
"compiledShaders": [
|
||||||
{
|
{
|
||||||
"glsl1": {
|
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if SHOW_OUT_LINE\nuniform vec4 outlineColor;\nuniform float outlineWidth;\nfloat getBgAlpha() {\n vec4 color_up = texture2D(texture, v_uv0 + vec2(0, outlineWidth));\n vec4 color_down = texture2D(texture, v_uv0 - vec2(0, outlineWidth));\n vec4 color_left = texture2D(texture, v_uv0 - vec2(outlineWidth, 0));\n vec4 color_right = texture2D(texture, v_uv0 + vec2(outlineWidth, 0));\n vec4 color_up_left = texture2D(texture, v_uv0 + vec2(outlineWidth, -outlineWidth));\n vec4 color_up_right = texture2D(texture, v_uv0 + vec2(outlineWidth, outlineWidth));\n vec4 color_down_left = texture2D(texture, v_uv0 + vec2(-outlineWidth, -outlineWidth));\n vec4 color_down_right = texture2D(texture, v_uv0 + vec2(-outlineWidth, outlineWidth));\n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a;\n return clamp(total, 0.0, 1.0);\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if SHOW_OUT_LINE\n if (outlineWidth == 0.0) {\n return;\n }\n vec4 color_dest = outlineColor * getBgAlpha();\n vec4 color_src = o;\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform vec4 outlineColor;\nuniform float outlineWidth;\n\nfloat getBgAlpha() {\n vec4 color_up = texture2D(texture, v_uv0 + vec2(0, outlineWidth)); \n vec4 color_down = texture2D(texture, v_uv0 - vec2(0, outlineWidth)); \n vec4 color_left = texture2D(texture, v_uv0 - vec2(outlineWidth, 0)); \n vec4 color_right = texture2D(texture, v_uv0 + vec2(outlineWidth, 0)); \n vec4 color_up_left = texture2D(texture, v_uv0 + vec2(outlineWidth, -outlineWidth)); \n vec4 color_up_right = texture2D(texture, v_uv0 + vec2(outlineWidth, outlineWidth)); \n vec4 color_down_left = texture2D(texture, v_uv0 + vec2(-outlineWidth, -outlineWidth)); \n vec4 color_down_right = texture2D(texture, v_uv0 + vec2(-outlineWidth, outlineWidth)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n return clamp(total, 0.0, 1.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n if (outlineWidth == 0.0) {\n return;\n }\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}\n"
|
||||||
},
|
},
|
||||||
"glsl3": {
|
"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\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if SHOW_OUT_LINE\nuniform Outline {\n vec4 outlineColor;\n float outlineWidth;\n};\nfloat getBgAlpha() {\n vec4 color_up = texture(texture, v_uv0 + vec2(0, outlineWidth));\n vec4 color_down = texture(texture, v_uv0 - vec2(0, outlineWidth));\n vec4 color_left = texture(texture, v_uv0 - vec2(outlineWidth, 0));\n vec4 color_right = texture(texture, v_uv0 + vec2(outlineWidth, 0));\n vec4 color_up_left = texture(texture, v_uv0 + vec2(outlineWidth, -outlineWidth));\n vec4 color_up_right = texture(texture, v_uv0 + vec2(outlineWidth, outlineWidth));\n vec4 color_down_left = texture(texture, v_uv0 + vec2(-outlineWidth, -outlineWidth));\n vec4 color_down_right = texture(texture, v_uv0 + vec2(-outlineWidth, outlineWidth));\n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a;\n return clamp(total, 0.0, 1.0);\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if SHOW_OUT_LINE\n if (outlineWidth == 0.0) {\n return;\n }\n vec4 color_dest = outlineColor * getBgAlpha();\n vec4 color_src = o;\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_OUT_LINE\n\nuniform Outline {\n\n vec4 outlineColor;\n\n float outlineWidth;\n\n};\n\nfloat getBgAlpha() {\n vec4 color_up = texture(texture, v_uv0 + vec2(0, outlineWidth)); \n vec4 color_down = texture(texture, v_uv0 - vec2(0, outlineWidth)); \n vec4 color_left = texture(texture, v_uv0 - vec2(outlineWidth, 0)); \n vec4 color_right = texture(texture, v_uv0 + vec2(outlineWidth, 0)); \n vec4 color_up_left = texture(texture, v_uv0 + vec2(outlineWidth, -outlineWidth)); \n vec4 color_up_right = texture(texture, v_uv0 + vec2(outlineWidth, outlineWidth)); \n vec4 color_down_left = texture(texture, v_uv0 + vec2(-outlineWidth, -outlineWidth)); \n vec4 color_down_right = texture(texture, v_uv0 + vec2(-outlineWidth, outlineWidth)); \n float total = color_right.a + color_left.a + color_down.a + color_up.a + color_up_left.a + color_up_right.a + color_down_left.a + color_down_right.a; \n return clamp(total, 0.0, 1.0);\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_OUT_LINE\n\n if (outlineWidth == 0.0) {\n return;\n }\n\n vec4 color_dest = outlineColor * getBgAlpha();\n\n vec4 color_src = o;\n\n gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);\n #endif\n}\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -22,7 +22,7 @@ CCEffect %{
|
|||||||
# 扩散颜色
|
# 扩散颜色
|
||||||
centerColor: {
|
centerColor: {
|
||||||
value: [1.0, 1.0, 0.0, 1.0],
|
value: [1.0, 1.0, 0.0, 1.0],
|
||||||
editor: {
|
inspector: {
|
||||||
type: color,
|
type: color,
|
||||||
tooltip: "发光颜色"
|
tooltip: "发光颜色"
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ CCEffect %{
|
|||||||
# 扩散起点坐标
|
# 扩散起点坐标
|
||||||
centerPoint: {
|
centerPoint: {
|
||||||
value: [0.2, 0.2],
|
value: [0.2, 0.2],
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "扩散起点坐标"
|
tooltip: "扩散起点坐标"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,26 +39,10 @@ CCEffect %{
|
|||||||
# 扩散半径
|
# 扩散半径
|
||||||
radius: {
|
radius: {
|
||||||
value: 0.4,
|
value: 0.4,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "扩散半径"
|
tooltip: "扩散半径"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# 裁剪掉透明区域上的光
|
|
||||||
cropAlpha: {
|
|
||||||
value: 1.0,
|
|
||||||
editor: {
|
|
||||||
tooltip: "是否裁剪透明区域上的光。0:不启用,非0:启用"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 是否启用迷雾效果
|
|
||||||
enableFog: {
|
|
||||||
value: 0.0,
|
|
||||||
editor: {
|
|
||||||
tooltip: "是否启用迷雾效果。0:不启用,非0:启用"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}%
|
}%
|
||||||
|
|
||||||
|
|
||||||
@ -120,42 +104,46 @@ CCProgram fs %{
|
|||||||
// 扩展半径
|
// 扩展半径
|
||||||
float radius;
|
float radius;
|
||||||
|
|
||||||
// 裁剪掉透明区域上的光
|
// 裁剪掉透明区域上的点光
|
||||||
// ps:编辑器还不支持 bool 类型的样子,因此用float来定义
|
// ps:编辑器还不支持 bool 类型的样子,因此没在 CCEffect 中定义
|
||||||
float cropAlpha;
|
bool cropAlpha;
|
||||||
|
|
||||||
// 是否启用迷雾效果
|
// 是否启用迷雾效果
|
||||||
// ps:编辑器还不支持 bool 类型的样子,因此用float来定义
|
// ps:编辑器还不支持 bool 类型的样子,因此没在 CCEffect 中定义
|
||||||
float enableFog;
|
bool enableFog;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加某个扩散点后混合后的纹理颜色
|
* 添加某个扩散点后混合后的纹理颜色
|
||||||
*/
|
*/
|
||||||
vec4 addLightColor(vec4 textureColor, vec2 centerPoint, float radius, vec4 centerColor) {
|
vec4 addDiffusionColor(vec4 textureColor, vec2 centerPoint, float radius, vec4 centerColor) {
|
||||||
// 计算当前 uv 到圆心起点的距离
|
// 计算当前 uv 到扩散起点的距离
|
||||||
float dis = distance(v_uv0, centerPoint);
|
float dis = distance(v_uv0, centerPoint);
|
||||||
|
|
||||||
float a = 1.0 ;
|
float a = 1.0 ;
|
||||||
|
|
||||||
// 裁剪掉透明区域上的点光
|
// 裁剪掉透明区域上的点光
|
||||||
if (bool(cropAlpha)) {
|
if (cropAlpha) {
|
||||||
a *= step(0.01, textureColor.a);
|
a *= step(0.01, textureColor.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 裁剪掉光束范围外的uv(迷雾效果)
|
// 裁剪掉扩散范围外的uv(迷雾效果)
|
||||||
if (!bool(enableFog)) {
|
if (!enableFog) {
|
||||||
a *= step(dis, radius);
|
a *= step(dis, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加入从中心往外渐变的效果
|
// 加入从中心往外渐变的效果
|
||||||
a *= 1.0 - (dis / radius);
|
a *= 1.0 - (dis / radius);
|
||||||
|
|
||||||
// 计算出圆范围内,不同 uv 对应的实际颜色值
|
// 加点料,让中心点更加亮
|
||||||
vec4 lightColor = centerColor * a;
|
// a = -1.0 * (a - 1.0) * (a - 1.0) + 1.0;
|
||||||
|
// a = -1.0 * (a - 1.0) * (a - 1.0) * (a - 1.0) * (a - 1.0) + 1.0;
|
||||||
|
|
||||||
// 混合颜色:在原始图像颜色上叠加圆颜色
|
// 计算出扩散范围内,不同 uv 对应的实际扩散颜色值
|
||||||
return textureColor * textureColor.a + lightColor;
|
vec4 diffusionColor = centerColor * a;
|
||||||
|
|
||||||
|
// 混合颜色:在原始图像颜色上叠加扩散颜色
|
||||||
|
return textureColor * textureColor.a + diffusionColor;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -176,7 +164,7 @@ CCProgram fs %{
|
|||||||
gl_FragColor = o;
|
gl_FragColor = o;
|
||||||
|
|
||||||
#if ENABLE_DIFFUSION
|
#if ENABLE_DIFFUSION
|
||||||
gl_FragColor = addLightColor(gl_FragColor, centerPoint, radius, centerColor);
|
gl_FragColor = addDiffusionColor(gl_FragColor, centerPoint, radius, centerColor);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}%
|
}%
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.25",
|
"ver": "1.0.23",
|
||||||
"uuid": "72a182fc-08a6-4faa-8e36-8bd84b4a0b53",
|
"uuid": "72a182fc-08a6-4faa-8e36-8bd84b4a0b53",
|
||||||
"compiledShaders": [
|
"compiledShaders": [
|
||||||
{
|
{
|
||||||
"glsl1": {
|
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_DIFFUSION\nuniform vec4 centerColor;\nuniform vec2 centerPoint;\nuniform float radius;\nuniform float cropAlpha;\nuniform float enableFog;\nvec4 addLightColor(vec4 textureColor, vec2 centerPoint, float radius, vec4 centerColor) {\n float dis = distance(v_uv0, centerPoint);\n float a = 1.0 ;\n if (bool(cropAlpha)) {\n a *= step(0.01, textureColor.a);\n }\n if (!bool(enableFog)) {\n a *= step(dis, radius);\n }\n a *= 1.0 - (dis / radius);\n vec4 lightColor = centerColor * a;\n return textureColor * textureColor.a + lightColor;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if ENABLE_DIFFUSION\n gl_FragColor = addLightColor(gl_FragColor, centerPoint, radius, centerColor);\n #endif\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if ENABLE_DIFFUSION\nuniform vec4 centerColor;\nuniform vec2 centerPoint;\nuniform float radius;\nuniform bool cropAlpha;\nuniform bool enableFog;\n/**\n * 添加某个扩散点后混合后的纹理颜色\n */\nvec4 addDiffusionColor(vec4 textureColor, vec2 centerPoint, float radius, vec4 centerColor) {\n\n float dis = distance(v_uv0, centerPoint);\n\n float a = 1.0 ;\n\n if (cropAlpha) {\n a *= step(0.01, textureColor.a);\n }\n\n if (!enableFog) {\n a *= step(dis, radius);\n }\n\n a *= 1.0 - (dis / radius);\n\n vec4 diffusionColor = centerColor * a;\n\n return textureColor * textureColor.a + diffusionColor;\n}\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n \n #if ENABLE_DIFFUSION\n gl_FragColor = addDiffusionColor(gl_FragColor, centerPoint, radius, centerColor);\n #endif\n}\n"
|
||||||
},
|
},
|
||||||
"glsl3": {
|
"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\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_DIFFUSION\nuniform Diffusion {\n vec4 centerColor;\n vec2 centerPoint;\n float radius;\n float cropAlpha;\n float enableFog;\n};\nvec4 addLightColor(vec4 textureColor, vec2 centerPoint, float radius, vec4 centerColor) {\n float dis = distance(v_uv0, centerPoint);\n float a = 1.0 ;\n if (bool(cropAlpha)) {\n a *= step(0.01, textureColor.a);\n }\n if (!bool(enableFog)) {\n a *= step(dis, radius);\n }\n a *= 1.0 - (dis / radius);\n vec4 lightColor = centerColor * a;\n return textureColor * textureColor.a + lightColor;\n}\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #if ENABLE_DIFFUSION\n gl_FragColor = addLightColor(gl_FragColor, centerPoint, radius, centerColor);\n #endif\n}"
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if ENABLE_DIFFUSION\nuniform Diffusion {\n\n vec4 centerColor;\n\n vec2 centerPoint;\n\n float radius;\n\n bool cropAlpha;\n\n bool enableFog;\n}\n\n/**\n * 添加某个扩散点后混合后的纹理颜色\n */\nvec4 addDiffusionColor(vec4 textureColor, vec2 centerPoint, float radius, vec4 centerColor) {\n\n float dis = distance(v_uv0, centerPoint);\n\n float a = 1.0 ;\n\n if (cropAlpha) {\n a *= step(0.01, textureColor.a);\n }\n\n if (!enableFog) {\n a *= step(dis, radius);\n }\n\n a *= 1.0 - (dis / radius);\n\n vec4 diffusionColor = centerColor * a;\n\n return textureColor * textureColor.a + diffusionColor;\n}\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n \n #if ENABLE_DIFFUSION\n gl_FragColor = addDiffusionColor(gl_FragColor, centerPoint, radius, centerColor);\n #endif\n}\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.25",
|
|
||||||
"uuid": "a4afedba-5234-44d7-9031-cba83051d521",
|
|
||||||
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_ROUNDCORNER\nuniform float radius;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if ENABLE_ROUNDCORNER\n float circleRadius = clamp(0.0, 0.5, radius);\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n float rx = abs(uv.x) - (0.5 - circleRadius);\n float ry = abs(uv.y) - (0.5 - circleRadius);\n float mx = step(0.5 - circleRadius, abs(uv.x));\n float my = step(0.5 - circleRadius, abs(uv.y));\n float len = length(vec2(rx, ry));\n float a = 1.0 - mx * my * step(circleRadius, len) * smoothstep(0., circleRadius * 0.01, len - circleRadius);\n o = vec4(o.rgb, o.a * a);\n #endif\n gl_FragColor = o;\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\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_ROUNDCORNER\nuniform RoundCorner {\n float radius;\n};\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if ENABLE_ROUNDCORNER\n float circleRadius = clamp(0.0, 0.5, radius);\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n float rx = abs(uv.x) - (0.5 - circleRadius);\n float ry = abs(uv.y) - (0.5 - circleRadius);\n float mx = step(0.5 - circleRadius, abs(uv.x));\n float my = step(0.5 - circleRadius, abs(uv.y));\n float len = length(vec2(rx, ry));\n float a = 1.0 - mx * my * step(circleRadius, len) * smoothstep(0., circleRadius * 0.01, len - circleRadius);\n o = vec4(o.rgb, o.a * a);\n #endif\n gl_FragColor = o;\n}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,192 +0,0 @@
|
|||||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
||||||
//
|
|
||||||
// 圆角裁剪(支持任意宽高纹理)
|
|
||||||
//
|
|
||||||
// 原理:
|
|
||||||
// 1. 正方形纹理的圆角原理参考 https://www.cnblogs.com/jqm304775992/p/4987793.html
|
|
||||||
// 2. 正方形纹理的圆角代码参考 yanjifa/shaderDemor 的 https://github.com/yanjifa/shaderDemo/blob/master/assets/Effect/CircleAvatar.effect
|
|
||||||
// 3. 上述皆为只针对正方形纹理做的操作,如果是长方形的纹理,那么圆角就会有拉伸后的效果,最后变成看起来就不是圆角了,本特效支持任意长方形做圆角
|
|
||||||
|
|
||||||
CCEffect %{
|
|
||||||
techniques:
|
|
||||||
- passes:
|
|
||||||
- vert: vs
|
|
||||||
frag: fs
|
|
||||||
blendState:
|
|
||||||
targets:
|
|
||||||
- blend: true
|
|
||||||
rasterizerState:
|
|
||||||
cullMode: none
|
|
||||||
properties:
|
|
||||||
texture: { value: white }
|
|
||||||
alphaThreshold: { value: 0.5 }
|
|
||||||
|
|
||||||
# 圆角x轴半径长度(相对于纹理宽度)
|
|
||||||
xRadius: {
|
|
||||||
value: 0.4,
|
|
||||||
editor: {
|
|
||||||
tooltip: "圆角x轴半径长度(相对于纹理宽度)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 圆角y轴半径长度(相对于纹理高度)
|
|
||||||
yRadius: {
|
|
||||||
value: 0.4,
|
|
||||||
editor: {
|
|
||||||
tooltip: "圆角y轴半径长度(相对于纹理高度)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
in vec2 a_uv0;
|
|
||||||
out vec2 v_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 pos = vec4(a_position, 1);
|
|
||||||
|
|
||||||
#if CC_USE_MODEL
|
|
||||||
pos = cc_matViewProj * cc_matWorld * pos;
|
|
||||||
#else
|
|
||||||
pos = cc_matViewProj * pos;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
v_uv0 = a_uv0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
v_color = a_color;
|
|
||||||
|
|
||||||
gl_Position = pos;
|
|
||||||
}
|
|
||||||
}%
|
|
||||||
|
|
||||||
|
|
||||||
CCProgram fs %{
|
|
||||||
precision highp float;
|
|
||||||
|
|
||||||
#include <alpha-test>
|
|
||||||
|
|
||||||
in vec4 v_color;
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
in vec2 v_uv0;
|
|
||||||
uniform sampler2D texture;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLE_ROUNDCORNER
|
|
||||||
uniform RoundCorner {
|
|
||||||
// 圆角x轴半径长度(相对于纹理宽度)
|
|
||||||
float xRadius;
|
|
||||||
|
|
||||||
// 圆角y轴半径长度(相对于纹理高度)
|
|
||||||
float yRadius;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main () {
|
|
||||||
vec4 o = vec4(1, 1, 1, 1);
|
|
||||||
|
|
||||||
#if USE_TEXTURE
|
|
||||||
o *= texture(texture, v_uv0);
|
|
||||||
#if CC_USE_ALPHA_ATLAS_TEXTURE
|
|
||||||
o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
o *= v_color;
|
|
||||||
|
|
||||||
ALPHA_TEST(o);
|
|
||||||
|
|
||||||
#if ENABLE_ROUNDCORNER
|
|
||||||
|
|
||||||
// 约束圆角半径范围在 [0.0, 0.5]
|
|
||||||
//
|
|
||||||
// 请注意这里我是用椭圆前缀去命名的半径
|
|
||||||
//
|
|
||||||
// 为什么是椭圆?
|
|
||||||
//
|
|
||||||
// 因为圆角,相对于长方形的纹理的宽高来说,归一化后值并不一样,不是圆,而是一个椭圆
|
|
||||||
//
|
|
||||||
// 比如:
|
|
||||||
//
|
|
||||||
// 纹理是 200 x 100 的像素,圆角半径是20像素,那么归一化后
|
|
||||||
// X轴上的半径就是 20 / 200 = 0.1
|
|
||||||
// Y轴上的半径就是 20 / 100 = 0.2
|
|
||||||
//
|
|
||||||
// 这就会变成是椭圆,而不是圆
|
|
||||||
float ellipseXRadius = clamp(0.0, 0.5, xRadius);
|
|
||||||
float ellipseYRadius = clamp(0.0, 0.5, yRadius);
|
|
||||||
|
|
||||||
// 将纹理uv往左上偏移,实现偏移后的坐标系原点在纹理中心
|
|
||||||
vec2 uv = v_uv0.xy - vec2(0.5, 0.5);
|
|
||||||
|
|
||||||
// uv.x , uv.y : 为偏移后的的uv
|
|
||||||
// abs(uv.x) , abs(uv.y) : 将第二、三、四象限的点都投影到第一象限上,这样子只需要处理第一象限的情况就可以,简化判断
|
|
||||||
// 0.5 - radius : 计算出第一象限的圆角所在圆的圆心坐标
|
|
||||||
// (rx, ry) : 偏移映射后的 新的uv 坐标,相对于 第一象限圆角坐在圆心坐标 的相对坐标
|
|
||||||
float rx = abs(uv.x) - (0.5 - ellipseXRadius);
|
|
||||||
float ry = abs(uv.y) - (0.5 - ellipseYRadius);
|
|
||||||
|
|
||||||
// 区分 以第一象限圆角所在圆心坐标为原点的坐标的四个象限
|
|
||||||
//
|
|
||||||
// 第一象限 mx = 1, my = 1
|
|
||||||
// 第二象限 mx = 0, my = 1
|
|
||||||
// 第三象限 mx = 0, my = 0
|
|
||||||
// 第四象限 mx = 1, my = 0
|
|
||||||
//
|
|
||||||
// 当 mx * my 时,只要等于1,那就是标识第一象限(实际对应圆角区域所在矩形),否则就是第二、三、四象限
|
|
||||||
float mx = step(0.5 - ellipseXRadius, abs(uv.x));
|
|
||||||
float my = step(0.5 - ellipseYRadius, abs(uv.y));
|
|
||||||
|
|
||||||
// 判断点(rx, ry)是否在椭圆外部(应用椭圆公式)
|
|
||||||
float isOutOfEllipse = step(1.0, pow(rx, 2.0) / pow(xRadius, 2.0) + pow(ry, 2.0) / pow(yRadius, 2.0));
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// 抗锯齿
|
|
||||||
// 1. 先计算当前点到椭圆中心的角度
|
|
||||||
float angleInRadian = atan(ry / rx);
|
|
||||||
|
|
||||||
// 2. 计算这个角度下,对于对应圆角(椭圆)上的点
|
|
||||||
vec2 pointInEllipse = vec2(xRadius * cos(angleInRadian), yRadius * sin(angleInRadian));
|
|
||||||
|
|
||||||
// 3. 计算这个角度下,比当前圆角大一点椭圆上的点
|
|
||||||
vec2 pointInBigEllipse = vec2((xRadius * 1.01) * cos(angleInRadian), (yRadius * 1.01)* sin(angleInRadian));
|
|
||||||
|
|
||||||
// 4. 计算最远点到当前椭圆的距离
|
|
||||||
float maxDis = distance(pointInBigEllipse, pointInEllipse);
|
|
||||||
|
|
||||||
// 5. 计算当前点到当前椭圆的距离
|
|
||||||
float curDis = distance(vec2(rx, ry), pointInEllipse);
|
|
||||||
|
|
||||||
// 6. 生成插值
|
|
||||||
float smo = smoothstep(0.0, maxDis, curDis);
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// mx * my = 0 时,代表非椭圆角区域,alpha 值为1,代表完全采用原始纹理的透明度
|
|
||||||
// mx * my = 1 时,代表椭圆角所在矩形区域
|
|
||||||
// isOutOfEllipse:
|
|
||||||
// 当点在椭圆外部时,此值为1,导致 alpha 最终值为0.0,即表示不显示椭圆外部的像素
|
|
||||||
// 当点在椭圆内部时,此值为0,导致 alpha 最终值为1.0,即表示显示椭圆内部的像素
|
|
||||||
// smo : 抗锯齿实现
|
|
||||||
// float alpha = 1.0 - mx * my * isOutOfEllipse;
|
|
||||||
float alpha = 1.0 - mx * my * isOutOfEllipse * smo;
|
|
||||||
|
|
||||||
o = vec4(o.rgb, o.a * alpha);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
gl_FragColor = o;
|
|
||||||
}
|
|
||||||
}%
|
|
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.25",
|
|
||||||
"uuid": "7c24b57e-e819-4fc9-a8d2-b06cf61b782d",
|
|
||||||
"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\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_ROUNDCORNER\nuniform float xRadius;\nuniform float yRadius;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if ENABLE_ROUNDCORNER\n float ellipseXRadius = clamp(0.0, 0.5, xRadius);\n float ellipseYRadius = clamp(0.0, 0.5, yRadius);\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n float rx = abs(uv.x) - (0.5 - ellipseXRadius);\n float ry = abs(uv.y) - (0.5 - ellipseYRadius);\n float mx = step(0.5 - ellipseXRadius, abs(uv.x));\n float my = step(0.5 - ellipseYRadius, abs(uv.y));\n float isOutOfEllipse = step(1.0, pow(rx, 2.0) / pow(xRadius, 2.0) + pow(ry, 2.0) / pow(yRadius, 2.0));\n float angleInRadian = atan(ry / rx);\n vec2 pointInEllipse = vec2(xRadius * cos(angleInRadian), yRadius * sin(angleInRadian));\n vec2 pointInBigEllipse = vec2((xRadius * 1.01) * cos(angleInRadian), (yRadius * 1.01)* sin(angleInRadian));\n float maxDis = distance(pointInBigEllipse, pointInEllipse);\n float curDis = distance(vec2(rx, ry), pointInEllipse);\n float smo = smoothstep(0.0, maxDis, curDis);\n float alpha = 1.0 - mx * my * isOutOfEllipse * smo;\n o = vec4(o.rgb, o.a * alpha);\n #endif\n gl_FragColor = o;\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\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\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;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n#if ENABLE_ROUNDCORNER\nuniform RoundCorner {\n float xRadius;\n float yRadius;\n};\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if ENABLE_ROUNDCORNER\n float ellipseXRadius = clamp(0.0, 0.5, xRadius);\n float ellipseYRadius = clamp(0.0, 0.5, yRadius);\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n float rx = abs(uv.x) - (0.5 - ellipseXRadius);\n float ry = abs(uv.y) - (0.5 - ellipseYRadius);\n float mx = step(0.5 - ellipseXRadius, abs(uv.x));\n float my = step(0.5 - ellipseYRadius, abs(uv.y));\n float isOutOfEllipse = step(1.0, pow(rx, 2.0) / pow(xRadius, 2.0) + pow(ry, 2.0) / pow(yRadius, 2.0));\n float angleInRadian = atan(ry / rx);\n vec2 pointInEllipse = vec2(xRadius * cos(angleInRadian), yRadius * sin(angleInRadian));\n vec2 pointInBigEllipse = vec2((xRadius * 1.01) * cos(angleInRadian), (yRadius * 1.01)* sin(angleInRadian));\n float maxDis = distance(pointInBigEllipse, pointInEllipse);\n float curDis = distance(vec2(rx, ry), pointInEllipse);\n float smo = smoothstep(0.0, maxDis, curDis);\n float alpha = 1.0 - mx * my * isOutOfEllipse * smo;\n o = vec4(o.rgb, o.a * alpha);\n #endif\n gl_FragColor = o;\n}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,7 +1,5 @@
|
|||||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||||
//
|
// 圆角裁剪
|
||||||
// 圆角裁剪(仅支持正方形纹理)
|
|
||||||
//
|
|
||||||
// 原理:https://www.cnblogs.com/jqm304775992/p/4987793.html
|
// 原理:https://www.cnblogs.com/jqm304775992/p/4987793.html
|
||||||
// 代码:复制 yanjifa/shaderDemor 的 https://github.com/yanjifa/shaderDemo/blob/master/assets/Effect/CircleAvatar.effect
|
// 代码:复制 yanjifa/shaderDemor 的 https://github.com/yanjifa/shaderDemo/blob/master/assets/Effect/CircleAvatar.effect
|
||||||
|
|
||||||
@ -19,10 +17,11 @@ CCEffect %{
|
|||||||
texture: { value: white }
|
texture: { value: white }
|
||||||
alphaThreshold: { value: 0.5 }
|
alphaThreshold: { value: 0.5 }
|
||||||
# 圆角半径
|
# 圆角半径
|
||||||
radius: {
|
roundCornerRadius: {
|
||||||
value: 0.4,
|
value: 0.1,
|
||||||
editor: {
|
inspector: {
|
||||||
tooltip: "圆角半径"
|
tooltip: "圆角半径",
|
||||||
|
range: [0.0, 0.5]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}%
|
}%
|
||||||
@ -78,8 +77,8 @@ CCProgram fs %{
|
|||||||
#if ENABLE_ROUNDCORNER
|
#if ENABLE_ROUNDCORNER
|
||||||
uniform RoundCorner {
|
uniform RoundCorner {
|
||||||
// 圆角半径
|
// 圆角半径
|
||||||
float radius;
|
float roundCornerRadius;
|
||||||
};
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void main () {
|
void main () {
|
||||||
@ -98,17 +97,17 @@ CCProgram fs %{
|
|||||||
|
|
||||||
#if ENABLE_ROUNDCORNER
|
#if ENABLE_ROUNDCORNER
|
||||||
// 约束圆角半径范围在 [0.0, 0.5]
|
// 约束圆角半径范围在 [0.0, 0.5]
|
||||||
float circleRadius = clamp(0.0, 0.5, radius);
|
float radius = clamp(0.0, 0.5, roundCornerRadius);
|
||||||
|
|
||||||
// 将纹理uv往左上偏移,实现偏移后的坐标系原点在纹理中心
|
// 将纹理uv往左下偏移,实现偏移后的纹理中心点在 OpenGL 坐标系的原点
|
||||||
vec2 uv = v_uv0.xy - vec2(0.5, 0.5);
|
vec2 uv = v_uv0.xy - vec2(0.5, 0.5);
|
||||||
|
|
||||||
// uv.x , uv.y : 为偏移后的的uv
|
// uv.x , uv.y : 为偏移后的的uv
|
||||||
// abs(uv.x) , abs(uv.y) : 将第二、三、四象限的点都投影到第一象限上,这样子只需要处理第一象限的情况就可以,简化判断
|
// abs(uv.x) , abs(uv.y) : 将第二、三、四象限的点都投影到第一象限上,这样子只需要处理第一象限的情况就可以,简化判断
|
||||||
// 0.5 - radius : 计算出第一象限的圆角所在圆的圆心坐标
|
// 0.5 - radius : 计算出第一象限的圆角所在圆的圆心坐标
|
||||||
// (rx, ry) : 偏移映射后的 新的uv 坐标,相对于 第一象限圆角坐在圆心坐标 的相对坐标
|
// (rx, ry) : 偏移映射后的 新的uv 坐标,相对于 第一象限圆角坐在圆心坐标 的相对坐标
|
||||||
float rx = abs(uv.x) - (0.5 - circleRadius);
|
float rx = abs(uv.x) - (0.5 - radius);
|
||||||
float ry = abs(uv.y) - (0.5 - circleRadius);
|
float ry = abs(uv.y) - (0.5 - radius);
|
||||||
|
|
||||||
// 区分 以第一象限圆角所在圆心坐标为原点的坐标的四个象限
|
// 区分 以第一象限圆角所在圆心坐标为原点的坐标的四个象限
|
||||||
//
|
//
|
||||||
@ -118,26 +117,26 @@ CCProgram fs %{
|
|||||||
// 第四象限 mx = 1, my = 0
|
// 第四象限 mx = 1, my = 0
|
||||||
//
|
//
|
||||||
// 当 mx * my 时,只要等于1,那就是标识第一象限(实际对应圆角区域所在矩形),否则就是第二、三、四象限
|
// 当 mx * my 时,只要等于1,那就是标识第一象限(实际对应圆角区域所在矩形),否则就是第二、三、四象限
|
||||||
float mx = step(0.5 - circleRadius, abs(uv.x));
|
float mx = step(0.5 - radius, abs(uv.x));
|
||||||
float my = step(0.5 - circleRadius, abs(uv.y));
|
float my = step(0.5 - radius, abs(uv.y));
|
||||||
|
|
||||||
// 计算相对uv坐标到圆心的距离
|
// 计算相对uv坐标到圆心的距离
|
||||||
float len = length(vec2(rx, ry));
|
float len = length(vec2(rx, ry));
|
||||||
|
|
||||||
// mx * my = 0 时,代表非圆角区域,a 值为1,代表完全采用原始纹理的透明度
|
// mx * my = 0 时,代表非圆角区域,a 值为1,代表完全采用原始纹理的透明度
|
||||||
// mx * my = 1 时,代表园所所在矩形区域
|
// mx * my = 1 时,代表园所所在矩形区域
|
||||||
// step(circleRadius, len) 可以区分出圆角所在矩形区域的 圆角区域 和 非圆角区域
|
// step(radius, len) 可以区分出圆角所在矩形区域的 圆角区域 和 非圆角区域
|
||||||
// 其中圆角区域值为0,非圆角区域值为1
|
// 其中圆角区域值为0,非圆角区域值为1
|
||||||
// 当为圆角区域时,a 值为1,代表完全采用原始纹理透明度
|
// 当为圆角区域时,a 值为1,代表完全采用原始纹理透明度
|
||||||
// 当为非圆角区域时,a 值为0,代表完全透明
|
// 当为非圆角区域时,a 值为0,代表完全透明
|
||||||
// 至此已经实现圆角裁剪
|
// 至此已经实现圆角裁剪
|
||||||
//
|
//
|
||||||
// smoothstep(0., circleRadius * 0.01, len - circleRadius) 是用于抗锯齿优化
|
// smoothstep(0., radius * 0.01, len - radius) 是用于抗锯齿优化
|
||||||
// 原理:针对点在非圆角区域的情况,针对点在大于「圆半径一点点」地方的区域,进行平滑过渡,以实现抗锯齿
|
// 原理:针对点在非圆角区域的情况,针对点在大于「圆半径一点点」地方的区域,进行平滑过渡,以实现抗锯齿
|
||||||
// 其中,
|
// 其中,
|
||||||
// 「圆半径一点点」用 circleRadius * 0.01 表示(0.01 可自行改变)
|
// 「圆半径一点点」用 radius * 0.01 表示(0.01 可自行改变)
|
||||||
// 点在大于圆半径的区域用 len - circleRadius ,此值会在 [0.0, circleRadius * 0.01] 之间时会平滑过渡
|
// 点在大于圆半径的区域用 len - radius ,此值会在 [0.0, radius * 0.01] 之间时会平滑过渡
|
||||||
float a = 1.0 - mx * my * step(circleRadius, len) * smoothstep(0., circleRadius * 0.01, len - circleRadius);
|
float a = 1.0 - mx * my * step(radius, len) * smoothstep(0., radius * 0.01, len - radius);
|
||||||
o = vec4(o.rgb, o.a * a);
|
o = vec4(o.rgb, o.a * a);
|
||||||
#endif
|
#endif
|
||||||
gl_FragColor = o;
|
gl_FragColor = o;
|
17
assets/effects/sprite-round-corner-crop.effect.meta
Normal file
17
assets/effects/sprite-round-corner-crop.effect.meta
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.23",
|
||||||
|
"uuid": "a4afedba-5234-44d7-9031-cba83051d521",
|
||||||
|
"compiledShaders": [
|
||||||
|
{
|
||||||
|
"glsl1": {
|
||||||
|
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n",
|
||||||
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if ENABLE_ROUNDCORNER\nuniform float roundCornerRadius;\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n #if ENABLE_ROUNDCORNER\n\n float radius = clamp(0.0, 0.5, roundCornerRadius);\n\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n\n float rx = abs(uv.x) - (0.5 - radius);\n float ry = abs(uv.y) - (0.5 - radius);\n\n float mx = step(0.5 - radius, abs(uv.x));\n float my = step(0.5 - radius, abs(uv.y));\n\n float len = length(vec2(rx, ry));\n\n float a = 1.0 - mx * my * step(radius, len) * smoothstep(0., radius * 0.01, len - radius);\n o = vec4(o.rgb, o.a * a);\n #endif\n gl_FragColor = o;\n}\n"
|
||||||
|
},
|
||||||
|
"glsl3": {
|
||||||
|
"vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n",
|
||||||
|
"frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if ENABLE_ROUNDCORNER\nuniform RoundCorner {\n\n float roundCornerRadius;\n}\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n #if ENABLE_ROUNDCORNER\n\n float radius = clamp(0.0, 0.5, roundCornerRadius);\n\n vec2 uv = v_uv0.xy - vec2(0.5, 0.5);\n\n float rx = abs(uv.x) - (0.5 - radius);\n float ry = abs(uv.y) - (0.5 - radius);\n\n float mx = step(0.5 - radius, abs(uv.x));\n float my = step(0.5 - radius, abs(uv.y));\n\n float len = length(vec2(rx, ry));\n\n float a = 1.0 - mx * my * step(radius, len) * smoothstep(0., radius * 0.01, len - radius);\n o = vec4(o.rgb, o.a * a);\n #endif\n gl_FragColor = o;\n}\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
@ -1,16 +1,13 @@
|
|||||||
{
|
{
|
||||||
"__type__": "cc.Material",
|
"__type__": "cc.Material",
|
||||||
"_name": "builtin-2d-sprite-explain",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_native": "",
|
"_native": "",
|
||||||
"_effectAsset": {
|
"_effectAsset": {
|
||||||
"__uuid__": "8f277982-dc0a-4030-90cc-b336a928a372"
|
"__uuid__": "8f277982-dc0a-4030-90cc-b336a928a372"
|
||||||
},
|
},
|
||||||
"_techniqueData": {
|
"_defines": {
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true
|
"USE_TEXTURE": true
|
||||||
}
|
},
|
||||||
}
|
"_props": {}
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.3",
|
"ver": "1.0.2",
|
||||||
"uuid": "ca058f99-941b-40f2-b208-d776de59abed",
|
"uuid": "ca058f99-941b-40f2-b208-d776de59abed",
|
||||||
"dataAsSubAsset": null,
|
"dataAsSubAsset": null,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"__type__": "cc.Material",
|
|
||||||
"_name": "loading-style-1",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"_effectAsset": {
|
|
||||||
"__uuid__": "aa3b729c-fb16-4293-8789-8b7f36e017f1"
|
|
||||||
},
|
|
||||||
"_techniqueIndex": 0,
|
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
|
||||||
"USE_LOADING_STYLE": true,
|
|
||||||
"USE_ANTI_ALIAS": true
|
|
||||||
},
|
|
||||||
"props": {
|
|
||||||
"u_arc_color": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 255,
|
|
||||||
"g": 255,
|
|
||||||
"b": 255,
|
|
||||||
"a": 255
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.3",
|
|
||||||
"uuid": "297af3e9-5fd3-41ec-9005-ae50b366f81c",
|
|
||||||
"dataAsSubAsset": null,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"__type__": "cc.Material",
|
|
||||||
"_name": "sprite-flash-light",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"_effectAsset": {
|
|
||||||
"__uuid__": "e9682cd1-a19c-4fcb-ad8c-cf1783b805e6"
|
|
||||||
},
|
|
||||||
"_techniqueIndex": 0,
|
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"props": {
|
|
||||||
"lightColor": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 255,
|
|
||||||
"g": 245,
|
|
||||||
"b": 0,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"lightAngle": 36,
|
|
||||||
"lightWidth": 0.2
|
|
||||||
},
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
|
||||||
"ENABLE_LIGHT": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.3",
|
|
||||||
"uuid": "43a22f18-72fc-4399-b5ae-8305705861f4",
|
|
||||||
"dataAsSubAsset": null,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"__type__": "cc.Material",
|
|
||||||
"_name": "sprite-gaussian-blur-v1",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"_effectAsset": {
|
|
||||||
"__uuid__": "41f4d474-d707-45bb-af93-637573f92d54"
|
|
||||||
},
|
|
||||||
"_techniqueIndex": 0,
|
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
|
||||||
"ENABLE_GAUSSIAN_BLUR": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.3",
|
|
||||||
"uuid": "dd3d8f78-9b79-4ca7-9bf7-7a09f7b34108",
|
|
||||||
"dataAsSubAsset": null,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"__type__": "cc.Material",
|
|
||||||
"_name": "New Material",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"_effectAsset": {
|
|
||||||
"__uuid__": "345a48c3-c00c-45d2-b6c9-b1ac49f46662"
|
|
||||||
},
|
|
||||||
"_techniqueIndex": 0,
|
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
|
||||||
"SHOW_INNER_GLOW": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.3",
|
|
||||||
"uuid": "647e873f-e0ed-4ce7-84cb-9e4d4f8a211f",
|
|
||||||
"dataAsSubAsset": null,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"__type__": "cc.Material",
|
|
||||||
"_name": "sprite-glow-inner-v2",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"_effectAsset": {
|
|
||||||
"__uuid__": "c49fbec9-7e8c-4114-a058-354eebd04446"
|
|
||||||
},
|
|
||||||
"_techniqueIndex": 0,
|
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
|
||||||
"SHOW_INNER_GLOW": true
|
|
||||||
},
|
|
||||||
"props": {
|
|
||||||
"glowColor": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 255,
|
|
||||||
"g": 255,
|
|
||||||
"b": 0,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"glowRange": 60
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.3",
|
|
||||||
"uuid": "5e2baa0c-d8bf-493f-89f7-a11352092439",
|
|
||||||
"dataAsSubAsset": null,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
26
assets/materials/sprite-glow-inner.mtl
Normal file
26
assets/materials/sprite-glow-inner.mtl
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"__type__": "cc.Material",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_native": "",
|
||||||
|
"_effectAsset": {
|
||||||
|
"__uuid__": "90211f16-c00e-4c37-a192-43ec50c9ea35"
|
||||||
|
},
|
||||||
|
"_defines": {
|
||||||
|
"USE_TEXTURE": true,
|
||||||
|
"USE_ALPHA_TEST": false,
|
||||||
|
"SHOW_INNER_GLOW": true
|
||||||
|
},
|
||||||
|
"_props": {
|
||||||
|
"texture": null,
|
||||||
|
"glowColor": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 0,
|
||||||
|
"b": 0,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"glowColorSize": 0.2,
|
||||||
|
"glowThreshold": 0.1
|
||||||
|
}
|
||||||
|
}
|
6
assets/materials/sprite-glow-inner.mtl.meta
Normal file
6
assets/materials/sprite-glow-inner.mtl.meta
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.2",
|
||||||
|
"uuid": "2c760728-404d-4553-a1d0-7ab18263845c",
|
||||||
|
"dataAsSubAsset": null,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
@ -1,18 +1,26 @@
|
|||||||
{
|
{
|
||||||
"__type__": "cc.Material",
|
"__type__": "cc.Material",
|
||||||
"_name": "New Material",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_native": "",
|
"_native": "",
|
||||||
"_effectAsset": {
|
"_effectAsset": {
|
||||||
"__uuid__": "67e9833e-aa43-427a-ba89-d7bdd1ef0aed"
|
"__uuid__": "89f30b2e-b75e-49b1-9dfc-cb341cadd30a"
|
||||||
},
|
},
|
||||||
"_techniqueIndex": 0,
|
"_defines": {
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
"USE_TEXTURE": true,
|
||||||
|
"USE_ALPHA_TEST": false,
|
||||||
"SHOW_OUTTER_GLOW": true
|
"SHOW_OUTTER_GLOW": true
|
||||||
}
|
},
|
||||||
}
|
"_props": {
|
||||||
|
"texture": null,
|
||||||
|
"glowColor": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 0,
|
||||||
|
"b": 0,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"glowColorSize": 0.15,
|
||||||
|
"glowThreshold": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.3",
|
"ver": "1.0.2",
|
||||||
"uuid": "b82b2ec7-1bf3-4840-b9af-66d2a0250c14",
|
"uuid": "16dd0f06-6280-4d74-8483-a50e23c00733",
|
||||||
"dataAsSubAsset": null,
|
"dataAsSubAsset": null,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
}
|
}
|
@ -1,18 +1,14 @@
|
|||||||
{
|
{
|
||||||
"__type__": "cc.Material",
|
"__type__": "cc.Material",
|
||||||
"_name": "sprite-gray",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_native": "",
|
"_native": "",
|
||||||
"_effectAsset": {
|
"_effectAsset": {
|
||||||
"__uuid__": "2e5b29d9-dd5e-4f3d-92e9-e580745b3bc8"
|
"__uuid__": "2e5b29d9-dd5e-4f3d-92e9-e580745b3bc8"
|
||||||
},
|
},
|
||||||
"_techniqueIndex": 0,
|
"_defines": {
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
"USE_TEXTURE": true,
|
||||||
"USE_GRAY": true
|
"USE_GRAY": true
|
||||||
}
|
},
|
||||||
}
|
"_props": {}
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.3",
|
"ver": "1.0.2",
|
||||||
"uuid": "ee9df2cd-dc1c-4fa7-9ef6-b253eee81746",
|
"uuid": "ee9df2cd-dc1c-4fa7-9ef6-b253eee81746",
|
||||||
"dataAsSubAsset": null,
|
"dataAsSubAsset": null,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
|
@ -1,22 +1,17 @@
|
|||||||
{
|
{
|
||||||
"__type__": "cc.Material",
|
"__type__": "cc.Material",
|
||||||
"_name": "sprite-mosaic",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_native": "",
|
"_native": "",
|
||||||
"_effectAsset": {
|
"_effectAsset": {
|
||||||
"__uuid__": "9638979d-62b3-4e5b-adea-7ad706e66e65"
|
"__uuid__": "9638979d-62b3-4e5b-adea-7ad706e66e65"
|
||||||
},
|
},
|
||||||
"_techniqueIndex": 0,
|
"_defines": {
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"props": {
|
|
||||||
"xBlockCount": 40,
|
|
||||||
"yBlockCount": 40
|
|
||||||
},
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
"USE_TEXTURE": true,
|
||||||
"USE_MOSAIC": true
|
"USE_MOSAIC": true
|
||||||
}
|
},
|
||||||
}
|
"_props": {
|
||||||
|
"xBlockCount": 40,
|
||||||
|
"yBlockCount": 40
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.3",
|
"ver": "1.0.2",
|
||||||
"uuid": "f2651803-80c3-4665-bd81-2ad946a12dec",
|
"uuid": "f2651803-80c3-4665-bd81-2ad946a12dec",
|
||||||
"dataAsSubAsset": null,
|
"dataAsSubAsset": null,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
{
|
{
|
||||||
"__type__": "cc.Material",
|
"__type__": "cc.Material",
|
||||||
"_name": "sprite-old-photo",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_native": "",
|
"_native": "",
|
||||||
"_effectAsset": {
|
"_effectAsset": {
|
||||||
"__uuid__": "211eddf3-c53d-46e3-8c09-c1bf38e644e2"
|
"__uuid__": "211eddf3-c53d-46e3-8c09-c1bf38e644e2"
|
||||||
},
|
},
|
||||||
"_techniqueIndex": 0,
|
"_defines": {
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
"USE_TEXTURE": true,
|
||||||
"USE_OLD_PHOTO": true
|
"USE_OLD_PHOTO": true
|
||||||
}
|
},
|
||||||
}
|
"_props": {}
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.3",
|
"ver": "1.0.2",
|
||||||
"uuid": "268b1aff-299a-4735-9f5c-5aa8d4d51788",
|
"uuid": "268b1aff-299a-4735-9f5c-5aa8d4d51788",
|
||||||
"dataAsSubAsset": null,
|
"dataAsSubAsset": null,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
|
@ -1,18 +1,25 @@
|
|||||||
{
|
{
|
||||||
"__type__": "cc.Material",
|
"__type__": "cc.Material",
|
||||||
"_name": "New Material",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_native": "",
|
"_native": "",
|
||||||
"_effectAsset": {
|
"_effectAsset": {
|
||||||
"__uuid__": "34c2ed47-4d59-41c4-b91c-157c32e9d0eb"
|
"__uuid__": "559dcd1e-233b-4e1f-b1da-733c9232f06f"
|
||||||
},
|
},
|
||||||
"_techniqueIndex": 0,
|
"_defines": {
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
"USE_TEXTURE": true,
|
||||||
|
"USE_ALPHA_TEST": false,
|
||||||
"SHOW_OUT_LINE": true
|
"SHOW_OUT_LINE": true
|
||||||
}
|
},
|
||||||
}
|
"_props": {
|
||||||
|
"texture": null,
|
||||||
|
"outlineColor": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 0,
|
||||||
|
"b": 0,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"outlineWidth": 0.002
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.3",
|
"ver": "1.0.2",
|
||||||
"uuid": "df1eb418-ec89-4e04-a579-03fcfbc315fc",
|
"uuid": "daf44951-2c80-4778-b99f-52cfc78ab053",
|
||||||
"dataAsSubAsset": null,
|
"dataAsSubAsset": null,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
}
|
}
|
@ -1,21 +1,16 @@
|
|||||||
{
|
{
|
||||||
"__type__": "cc.Material",
|
"__type__": "cc.Material",
|
||||||
"_name": "sprite-point-light",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_native": "",
|
"_native": "",
|
||||||
"_effectAsset": {
|
"_effectAsset": {
|
||||||
"__uuid__": "72a182fc-08a6-4faa-8e36-8bd84b4a0b53"
|
"__uuid__": "72a182fc-08a6-4faa-8e36-8bd84b4a0b53"
|
||||||
},
|
},
|
||||||
"_techniqueIndex": 0,
|
"_defines": {
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"props": {
|
|
||||||
"radius": 0.4
|
|
||||||
},
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
"USE_TEXTURE": true,
|
||||||
"ENABLE_DIFFUSION": true
|
"ENABLE_DIFFUSION": true
|
||||||
}
|
},
|
||||||
}
|
"_props": {
|
||||||
|
"radius": 0.4
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.3",
|
"ver": "1.0.2",
|
||||||
"uuid": "d88d982e-4ed7-4f90-9566-2ac2fef4bcb3",
|
"uuid": "d88d982e-4ed7-4f90-9566-2ac2fef4bcb3",
|
||||||
"dataAsSubAsset": null,
|
"dataAsSubAsset": null,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"__type__": "cc.Material",
|
|
||||||
"_name": "sprite-round-corner-crop-v1",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"_effectAsset": {
|
|
||||||
"__uuid__": "a4afedba-5234-44d7-9031-cba83051d521"
|
|
||||||
},
|
|
||||||
"_techniqueIndex": 0,
|
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
|
||||||
"ENABLE_ROUNDCORNER": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"__type__": "cc.Material",
|
|
||||||
"_name": "sprite-round-corner-crop-v2",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"_effectAsset": {
|
|
||||||
"__uuid__": "7c24b57e-e819-4fc9-a8d2-b06cf61b782d"
|
|
||||||
},
|
|
||||||
"_techniqueIndex": 0,
|
|
||||||
"_techniqueData": {
|
|
||||||
"0": {
|
|
||||||
"defines": {
|
|
||||||
"USE_TEXTURE": true,
|
|
||||||
"ENABLE_ROUNDCORNER": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.3",
|
|
||||||
"uuid": "a86e8864-5390-443f-b41b-b38e9d584c43",
|
|
||||||
"dataAsSubAsset": null,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
16
assets/materials/sprite-round-corner-crop.mtl
Normal file
16
assets/materials/sprite-round-corner-crop.mtl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"__type__": "cc.Material",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_native": "",
|
||||||
|
"_effectAsset": {
|
||||||
|
"__uuid__": "a4afedba-5234-44d7-9031-cba83051d521"
|
||||||
|
},
|
||||||
|
"_defines": {
|
||||||
|
"USE_TEXTURE": true,
|
||||||
|
"ENABLE_ROUNDCORNER": true
|
||||||
|
},
|
||||||
|
"_props": {
|
||||||
|
"roundCornerRadius": 0.1
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.3",
|
"ver": "1.0.2",
|
||||||
"uuid": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310",
|
"uuid": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310",
|
||||||
"dataAsSubAsset": null,
|
"dataAsSubAsset": null,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.1",
|
|
||||||
"uuid": "4a779443-b2a6-4aa1-ba46-02baa772b60f",
|
|
||||||
"isSubpackage": false,
|
|
||||||
"subpackageName": "",
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
/*
|
|
||||||
* This script is automatically generated by Cocos Creator and is only used for projects compatible with v2.1.0/v2.1.1/v2.3.0/v2.3.1/v2.3.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.3.0/v2.3.1/v2.3.2 版本的工程,
|
|
||||||
* 你无需在任何其它项目中手动添加此脚本。
|
|
||||||
* 如果你的项目中没用到 Action,可直接删除该脚本。
|
|
||||||
* 如果你的项目有托管于 git 等版本库,请将此脚本一并上传。
|
|
||||||
*/
|
|
||||||
|
|
||||||
cc.RotateBy._reverse = true;
|
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.7",
|
|
||||||
"uuid": "147d5b9f-b769-4112-9daf-2e28236161fa",
|
|
||||||
"asyncLoadAssets": false,
|
|
||||||
"autoReleaseAssets": false,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.2.7",
|
"ver": "1.2.5",
|
||||||
"uuid": "54bdad42-93aa-4869-a465-c0eac37bf0d2",
|
"uuid": "69a920f1-0509-4d54-b033-5fb5b1283b72",
|
||||||
"asyncLoadAssets": false,
|
"asyncLoadAssets": false,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
||||||
"subMetas": {}
|
"subMetas": {}
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.7",
|
|
||||||
"uuid": "d9314270-2175-430f-9b5b-e4cef9314a76",
|
|
||||||
"asyncLoadAssets": false,
|
|
||||||
"autoReleaseAssets": false,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.7",
|
|
||||||
"uuid": "6d781c30-9520-4a95-9e9d-eb99fb2bbded",
|
|
||||||
"asyncLoadAssets": false,
|
|
||||||
"autoReleaseAssets": false,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -78,13 +78,10 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 126
|
"__id__": 130
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 127
|
"__id__": 131
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 128
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -174,7 +171,7 @@
|
|||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
324.7595264191645,
|
407.8979651824706,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -254,7 +251,7 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 125
|
"__id__": 129
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -673,8 +670,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 2,
|
"_N$horizontalAlign": 2,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -1242,8 +1237,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 0,
|
"_N$horizontalAlign": 0,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -1438,8 +1431,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 2,
|
"_N$horizontalAlign": 2,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -2007,8 +1998,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 0,
|
"_N$horizontalAlign": 0,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -2203,8 +2192,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 2,
|
"_N$horizontalAlign": 2,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -2772,8 +2759,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 0,
|
"_N$horizontalAlign": 0,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -2968,8 +2953,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 2,
|
"_N$horizontalAlign": 2,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -3537,8 +3520,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 0,
|
"_N$horizontalAlign": 0,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -3733,8 +3714,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 2,
|
"_N$horizontalAlign": 2,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -4302,8 +4281,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 0,
|
"_N$horizontalAlign": 0,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -4498,8 +4475,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 2,
|
"_N$horizontalAlign": 2,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -5067,8 +5042,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 0,
|
"_N$horizontalAlign": 0,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -5182,15 +5155,21 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 121
|
"__id__": 121
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 123
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 125
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 123
|
"__id__": 127
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 124
|
"__id__": 128
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -5313,7 +5292,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "b82b2ec7-1bf3-4840-b9af-66d2a0250c14"
|
"__uuid__": "16dd0f06-6280-4d74-8483-a50e23c00733"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -5407,7 +5386,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "b82b2ec7-1bf3-4840-b9af-66d2a0250c14"
|
"__uuid__": "16dd0f06-6280-4d74-8483-a50e23c00733"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -5429,6 +5408,100 @@
|
|||||||
"_atlas": null,
|
"_atlas": null,
|
||||||
"_id": "74+WCqN01NIbcSpr5gcxmE"
|
"_id": "74+WCqN01NIbcSpr5gcxmE"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "ball_1",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 114
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": false,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 120
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": null,
|
||||||
|
"_opacity": 255,
|
||||||
|
"_color": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 255,
|
||||||
|
"b": 255,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 60,
|
||||||
|
"height": 60
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_trs": {
|
||||||
|
"__type__": "TypedArray",
|
||||||
|
"ctor": "Float64Array",
|
||||||
|
"array": [
|
||||||
|
0,
|
||||||
|
-360,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_eulerAngles": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_skewX": 0,
|
||||||
|
"_skewY": 0,
|
||||||
|
"_is3DNode": false,
|
||||||
|
"_groupIndex": 0,
|
||||||
|
"groupIndex": 0,
|
||||||
|
"_id": "08wsP0gQdCnrq+UzPWkn0+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Sprite",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"node": {
|
||||||
|
"__id__": 119
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"_materials": [
|
||||||
|
{
|
||||||
|
"__uuid__": "16dd0f06-6280-4d74-8483-a50e23c00733"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_srcBlendFactor": 770,
|
||||||
|
"_dstBlendFactor": 771,
|
||||||
|
"_spriteFrame": {
|
||||||
|
"__uuid__": "969fa66a-ae10-4157-b16e-4c1a4665920c"
|
||||||
|
},
|
||||||
|
"_type": 0,
|
||||||
|
"_sizeMode": 1,
|
||||||
|
"_fillType": 0,
|
||||||
|
"_fillCenter": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"_fillStart": 0,
|
||||||
|
"_fillRange": 0,
|
||||||
|
"_isTrimmedMode": true,
|
||||||
|
"_atlas": null,
|
||||||
|
"_id": "4bH5hzKe9LsLQeXjLynIHQ"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "video_btn",
|
"_name": "video_btn",
|
||||||
@ -5440,7 +5513,7 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 120
|
"__id__": 122
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -5496,12 +5569,12 @@
|
|||||||
"_name": "",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 119
|
"__id__": 121
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "b82b2ec7-1bf3-4840-b9af-66d2a0250c14"
|
"__uuid__": "16dd0f06-6280-4d74-8483-a50e23c00733"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -5523,6 +5596,98 @@
|
|||||||
"_atlas": null,
|
"_atlas": null,
|
||||||
"_id": "f43fJCjNdOS5VHAEhp0yDU"
|
"_id": "f43fJCjNdOS5VHAEhp0yDU"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "SystemFont",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 114
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": false,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 124
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": null,
|
||||||
|
"_opacity": 255,
|
||||||
|
"_color": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 255,
|
||||||
|
"b": 255,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 97.87,
|
||||||
|
"height": 50.4
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_trs": {
|
||||||
|
"__type__": "TypedArray",
|
||||||
|
"ctor": "Float64Array",
|
||||||
|
"array": [
|
||||||
|
0,
|
||||||
|
-657.2,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_eulerAngles": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_skewX": 0,
|
||||||
|
"_skewY": 0,
|
||||||
|
"_is3DNode": false,
|
||||||
|
"_groupIndex": 0,
|
||||||
|
"groupIndex": 0,
|
||||||
|
"_id": "5dfIaYLgJPQKk50HqrgyHI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Label",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"node": {
|
||||||
|
"__id__": 123
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"_materials": [
|
||||||
|
{
|
||||||
|
"__uuid__": "16dd0f06-6280-4d74-8483-a50e23c00733"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_useOriginalSize": false,
|
||||||
|
"_string": "System Font",
|
||||||
|
"_N$string": "System Font",
|
||||||
|
"_fontSize": 40,
|
||||||
|
"_lineHeight": 40,
|
||||||
|
"_enableWrapText": true,
|
||||||
|
"_N$file": null,
|
||||||
|
"_isSystemFontUsed": true,
|
||||||
|
"_spacingX": 0,
|
||||||
|
"_batchAsBitmap": false,
|
||||||
|
"_N$horizontalAlign": 1,
|
||||||
|
"_N$verticalAlign": 1,
|
||||||
|
"_N$fontFamily": "Arial",
|
||||||
|
"_N$overflow": 0,
|
||||||
|
"_N$cacheMode": 0,
|
||||||
|
"_id": "d1whc7H8RHdrROcYj+2Qh1"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "BmFont",
|
"_name": "BmFont",
|
||||||
@ -5534,7 +5699,7 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 122
|
"__id__": 126
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -5590,12 +5755,12 @@
|
|||||||
"_name": "",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 121
|
"__id__": 125
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "b82b2ec7-1bf3-4840-b9af-66d2a0250c14"
|
"__uuid__": "16dd0f06-6280-4d74-8483-a50e23c00733"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_useOriginalSize": false,
|
"_useOriginalSize": false,
|
||||||
@ -5610,8 +5775,6 @@
|
|||||||
"_isSystemFontUsed": false,
|
"_isSystemFontUsed": false,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 1,
|
"_N$horizontalAlign": 1,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -5715,32 +5878,5 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_id": "86FdoQVK1Lo6LFPRQ25Wpn"
|
"_id": "86FdoQVK1Lo6LFPRQ25Wpn"
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 1,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 0,
|
|
||||||
"_originalHeight": 0,
|
|
||||||
"_id": "5f1iMtZkxEdIa7zsEtvN72"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.2.7",
|
"ver": "1.2.5",
|
||||||
"uuid": "6c0134dc-238e-4bed-b9a3-3f09c1e320a3",
|
"uuid": "6c0134dc-238e-4bed-b9a3-3f09c1e320a3",
|
||||||
"asyncLoadAssets": false,
|
"asyncLoadAssets": false,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
||||||
|
@ -82,9 +82,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 46
|
"__id__": 46
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 47
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -2061,31 +2058,5 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_id": "15Zc5pRfhPD5BBaIqSPNrC"
|
"_id": "15Zc5pRfhPD5BBaIqSPNrC"
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 1,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 0,
|
|
||||||
"_originalHeight": 0
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.2.7",
|
"ver": "1.2.5",
|
||||||
"uuid": "46f3cebd-8cc8-462a-885d-9a2984712368",
|
"uuid": "46f3cebd-8cc8-462a-885d-9a2984712368",
|
||||||
"asyncLoadAssets": false,
|
"asyncLoadAssets": false,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
||||||
|
@ -1,587 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"__type__": "cc.SceneAsset",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"scene": {
|
|
||||||
"__id__": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Scene",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": null,
|
|
||||||
"_children": [
|
|
||||||
{
|
|
||||||
"__id__": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_active": false,
|
|
||||||
"_components": [],
|
|
||||||
"_prefab": null,
|
|
||||||
"_opacity": 255,
|
|
||||||
"_color": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 255,
|
|
||||||
"g": 255,
|
|
||||||
"b": 255,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"_contentSize": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"_anchorPoint": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"_trs": {
|
|
||||||
"__type__": "TypedArray",
|
|
||||||
"ctor": "Float64Array",
|
|
||||||
"array": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"_is3DNode": true,
|
|
||||||
"_groupIndex": 0,
|
|
||||||
"groupIndex": 0,
|
|
||||||
"autoReleaseAssets": false,
|
|
||||||
"_id": "e00a9056-db3b-4893-a3cf-dcf28d8cb22f"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_name": "Canvas",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"_children": [
|
|
||||||
{
|
|
||||||
"__id__": 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 5
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_active": true,
|
|
||||||
"_components": [
|
|
||||||
{
|
|
||||||
"__id__": 12
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 13
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 14
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_prefab": null,
|
|
||||||
"_opacity": 255,
|
|
||||||
"_color": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 252,
|
|
||||||
"g": 252,
|
|
||||||
"b": 252,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"_contentSize": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 960,
|
|
||||||
"height": 640
|
|
||||||
},
|
|
||||||
"_anchorPoint": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0.5,
|
|
||||||
"y": 0.5
|
|
||||||
},
|
|
||||||
"_trs": {
|
|
||||||
"__type__": "TypedArray",
|
|
||||||
"ctor": "Float64Array",
|
|
||||||
"array": [
|
|
||||||
480,
|
|
||||||
320,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"_eulerAngles": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"_skewX": 0,
|
|
||||||
"_skewY": 0,
|
|
||||||
"_is3DNode": false,
|
|
||||||
"_groupIndex": 0,
|
|
||||||
"groupIndex": 0,
|
|
||||||
"_id": "a286bbGknJLZpRpxROV6M94"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_name": "Main Camera",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_children": [],
|
|
||||||
"_active": true,
|
|
||||||
"_components": [
|
|
||||||
{
|
|
||||||
"__id__": 4
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_prefab": null,
|
|
||||||
"_opacity": 255,
|
|
||||||
"_color": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 255,
|
|
||||||
"g": 255,
|
|
||||||
"b": 255,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"_contentSize": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"_anchorPoint": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0.5,
|
|
||||||
"y": 0.5
|
|
||||||
},
|
|
||||||
"_trs": {
|
|
||||||
"__type__": "TypedArray",
|
|
||||||
"ctor": "Float64Array",
|
|
||||||
"array": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
398.3716857408418,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"_eulerAngles": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"_skewX": 0,
|
|
||||||
"_skewY": 0,
|
|
||||||
"_is3DNode": false,
|
|
||||||
"_groupIndex": 0,
|
|
||||||
"groupIndex": 0,
|
|
||||||
"_id": "fbL5wf1mhFa6PPZbeZvnZ9"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Camera",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 3
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"_cullingMask": 4294967295,
|
|
||||||
"_clearFlags": 7,
|
|
||||||
"_backgroundColor": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 0,
|
|
||||||
"g": 0,
|
|
||||||
"b": 0,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"_depth": -1,
|
|
||||||
"_zoomRatio": 1,
|
|
||||||
"_targetTexture": null,
|
|
||||||
"_fov": 60,
|
|
||||||
"_orthoSize": 10,
|
|
||||||
"_nearClip": 1,
|
|
||||||
"_farClip": 4096,
|
|
||||||
"_ortho": true,
|
|
||||||
"_rect": {
|
|
||||||
"__type__": "cc.Rect",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"width": 1,
|
|
||||||
"height": 1
|
|
||||||
},
|
|
||||||
"_renderStages": 1,
|
|
||||||
"_alignWithScreen": true,
|
|
||||||
"_id": "adItdqNzZHbYUhDAmfCr9b"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_name": "Content",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_children": [
|
|
||||||
{
|
|
||||||
"__id__": 6
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 9
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_active": true,
|
|
||||||
"_components": [
|
|
||||||
{
|
|
||||||
"__id__": 11
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_prefab": null,
|
|
||||||
"_opacity": 255,
|
|
||||||
"_color": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 255,
|
|
||||||
"g": 255,
|
|
||||||
"b": 255,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"_contentSize": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 960,
|
|
||||||
"height": 640
|
|
||||||
},
|
|
||||||
"_anchorPoint": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0.5,
|
|
||||||
"y": 0.5
|
|
||||||
},
|
|
||||||
"_trs": {
|
|
||||||
"__type__": "TypedArray",
|
|
||||||
"ctor": "Float64Array",
|
|
||||||
"array": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"_eulerAngles": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"_skewX": 0,
|
|
||||||
"_skewY": 0,
|
|
||||||
"_is3DNode": false,
|
|
||||||
"_groupIndex": 0,
|
|
||||||
"groupIndex": 0,
|
|
||||||
"_id": "faqYlnbttBCaJJgkn4Ntv/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_name": "Bg",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": {
|
|
||||||
"__id__": 5
|
|
||||||
},
|
|
||||||
"_children": [],
|
|
||||||
"_active": true,
|
|
||||||
"_components": [
|
|
||||||
{
|
|
||||||
"__id__": 7
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 8
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_prefab": null,
|
|
||||||
"_opacity": 255,
|
|
||||||
"_color": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 27,
|
|
||||||
"g": 38,
|
|
||||||
"b": 46,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"_contentSize": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 960,
|
|
||||||
"height": 640
|
|
||||||
},
|
|
||||||
"_anchorPoint": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0.5,
|
|
||||||
"y": 0.5
|
|
||||||
},
|
|
||||||
"_trs": {
|
|
||||||
"__type__": "TypedArray",
|
|
||||||
"ctor": "Float64Array",
|
|
||||||
"array": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"_eulerAngles": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"_skewX": 0,
|
|
||||||
"_skewY": 0,
|
|
||||||
"_is3DNode": false,
|
|
||||||
"_groupIndex": 0,
|
|
||||||
"groupIndex": 0,
|
|
||||||
"_id": "e2e0crkOLxGrpMxpbC4iQg1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 6
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 0,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 200,
|
|
||||||
"_originalHeight": 150,
|
|
||||||
"_id": "89IA6P0/5JEZERosKJJo6k"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Sprite",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 6
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"_materials": [
|
|
||||||
{
|
|
||||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_srcBlendFactor": 770,
|
|
||||||
"_dstBlendFactor": 771,
|
|
||||||
"_spriteFrame": {
|
|
||||||
"__uuid__": "410fb916-8721-4663-bab8-34397391ace7"
|
|
||||||
},
|
|
||||||
"_type": 1,
|
|
||||||
"_sizeMode": 0,
|
|
||||||
"_fillType": 0,
|
|
||||||
"_fillCenter": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"_fillStart": 0,
|
|
||||||
"_fillRange": 0,
|
|
||||||
"_isTrimmedMode": true,
|
|
||||||
"_atlas": null,
|
|
||||||
"_id": "2azjUbJNxALLAfDZrJ8TV0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_name": "LoadingEffect",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": {
|
|
||||||
"__id__": 5
|
|
||||||
},
|
|
||||||
"_children": [],
|
|
||||||
"_active": true,
|
|
||||||
"_components": [
|
|
||||||
{
|
|
||||||
"__id__": 10
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_prefab": null,
|
|
||||||
"_opacity": 255,
|
|
||||||
"_color": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 255,
|
|
||||||
"g": 255,
|
|
||||||
"b": 255,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"_contentSize": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 300,
|
|
||||||
"height": 300
|
|
||||||
},
|
|
||||||
"_anchorPoint": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0.5,
|
|
||||||
"y": 0.5
|
|
||||||
},
|
|
||||||
"_trs": {
|
|
||||||
"__type__": "TypedArray",
|
|
||||||
"ctor": "Float64Array",
|
|
||||||
"array": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"_eulerAngles": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"_skewX": 0,
|
|
||||||
"_skewY": 0,
|
|
||||||
"_is3DNode": false,
|
|
||||||
"_groupIndex": 0,
|
|
||||||
"groupIndex": 0,
|
|
||||||
"_id": "eaOw97g6VPlqi9X+HgLDbU"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Sprite",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 9
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"_materials": [
|
|
||||||
{
|
|
||||||
"__uuid__": "297af3e9-5fd3-41ec-9005-ae50b366f81c"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_srcBlendFactor": 770,
|
|
||||||
"_dstBlendFactor": 771,
|
|
||||||
"_spriteFrame": {
|
|
||||||
"__uuid__": "410fb916-8721-4663-bab8-34397391ace7"
|
|
||||||
},
|
|
||||||
"_type": 0,
|
|
||||||
"_sizeMode": 0,
|
|
||||||
"_fillType": 0,
|
|
||||||
"_fillCenter": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"_fillStart": 0,
|
|
||||||
"_fillRange": 0,
|
|
||||||
"_isTrimmedMode": true,
|
|
||||||
"_atlas": null,
|
|
||||||
"_id": "7at8uTCAVC4ITQp51YFx8w"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "68622NlRNJFN4QrXlFCQMe/",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 5
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"_id": "d0LfKEJ/dDCIoTfYJyyNvM"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Canvas",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"_designResolution": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 960,
|
|
||||||
"height": 640
|
|
||||||
},
|
|
||||||
"_fitWidth": true,
|
|
||||||
"_fitHeight": true,
|
|
||||||
"_id": "4bz2+ak99DBYVlSVIMFGN0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 1,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 0,
|
|
||||||
"_originalHeight": 0,
|
|
||||||
"_id": "baGc8fMtRAmaROqHbDl034"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "9ed1dQP3bBHS7dzMbIxKbil",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"_id": "feQUZ11GBOyYOcovtTdSee"
|
|
||||||
}
|
|
||||||
]
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.7",
|
|
||||||
"uuid": "e00a9056-db3b-4893-a3cf-dcf28d8cb22f",
|
|
||||||
"asyncLoadAssets": false,
|
|
||||||
"autoReleaseAssets": false,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -82,9 +82,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 80
|
"__id__": 80
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 81
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -3589,31 +3586,5 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_id": "67qshjCz5HzY6Lsg7VINZL"
|
"_id": "67qshjCz5HzY6Lsg7VINZL"
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 1,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 0,
|
|
||||||
"_originalHeight": 0
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.2.7",
|
"ver": "1.2.5",
|
||||||
"uuid": "4dcbd4ff-0bf9-4429-8c1f-44ad1b7a2192",
|
"uuid": "4dcbd4ff-0bf9-4429-8c1f-44ad1b7a2192",
|
||||||
"asyncLoadAssets": false,
|
"asyncLoadAssets": false,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
||||||
|
@ -82,9 +82,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 46
|
"__id__": 46
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 47
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -2061,31 +2058,5 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_id": "3aYHIG9t9FUI79rHpB2dpu"
|
"_id": "3aYHIG9t9FUI79rHpB2dpu"
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 1,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 0,
|
|
||||||
"_originalHeight": 0
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.2.7",
|
"ver": "1.2.5",
|
||||||
"uuid": "7f52e736-cdaf-44df-bd73-e2120e59267b",
|
"uuid": "7f52e736-cdaf-44df-bd73-e2120e59267b",
|
||||||
"asyncLoadAssets": false,
|
"asyncLoadAssets": false,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
||||||
|
@ -82,9 +82,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 46
|
"__id__": 46
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 47
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -174,7 +171,7 @@
|
|||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
324.7595264191645,
|
492.17758360225525,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -658,8 +655,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 2,
|
"_N$horizontalAlign": 2,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -1227,8 +1222,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 0,
|
"_N$horizontalAlign": 0,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -1371,7 +1364,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 384,
|
"width": 384,
|
||||||
"height": 590.4
|
"height": 583.73
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@ -1479,7 +1472,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "df1eb418-ec89-4e04-a579-03fcfbc315fc"
|
"__uuid__": "daf44951-2c80-4778-b99f-52cfc78ab053"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -1573,7 +1566,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "df1eb418-ec89-4e04-a579-03fcfbc315fc"
|
"__uuid__": "daf44951-2c80-4778-b99f-52cfc78ab053"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -1667,7 +1660,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "df1eb418-ec89-4e04-a579-03fcfbc315fc"
|
"__uuid__": "daf44951-2c80-4778-b99f-52cfc78ab053"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -1761,7 +1754,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "df1eb418-ec89-4e04-a579-03fcfbc315fc"
|
"__uuid__": "daf44951-2c80-4778-b99f-52cfc78ab053"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -1855,7 +1848,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "df1eb418-ec89-4e04-a579-03fcfbc315fc"
|
"__uuid__": "daf44951-2c80-4778-b99f-52cfc78ab053"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_useOriginalSize": false,
|
"_useOriginalSize": false,
|
||||||
@ -1868,8 +1861,6 @@
|
|||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 1,
|
"_N$horizontalAlign": 1,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -1903,7 +1894,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 167.5,
|
"width": 167.5,
|
||||||
"height": 40
|
"height": 33.33
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@ -1915,7 +1906,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
-570.4000000000001,
|
-567.065,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1949,7 +1940,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "df1eb418-ec89-4e04-a579-03fcfbc315fc"
|
"__uuid__": "daf44951-2c80-4778-b99f-52cfc78ab053"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_useOriginalSize": false,
|
"_useOriginalSize": false,
|
||||||
@ -1964,8 +1955,6 @@
|
|||||||
"_isSystemFontUsed": false,
|
"_isSystemFontUsed": false,
|
||||||
"_spacingX": 0,
|
"_spacingX": 0,
|
||||||
"_batchAsBitmap": false,
|
"_batchAsBitmap": false,
|
||||||
"_styleFlags": 0,
|
|
||||||
"_underlineHeight": 0,
|
|
||||||
"_N$horizontalAlign": 1,
|
"_N$horizontalAlign": 1,
|
||||||
"_N$verticalAlign": 1,
|
"_N$verticalAlign": 1,
|
||||||
"_N$fontFamily": "Arial",
|
"_N$fontFamily": "Arial",
|
||||||
@ -2011,7 +2000,7 @@
|
|||||||
"_layoutSize": {
|
"_layoutSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 384,
|
"width": 384,
|
||||||
"height": 590.4
|
"height": 583.73
|
||||||
},
|
},
|
||||||
"_resize": 1,
|
"_resize": 1,
|
||||||
"_N$layoutType": 2,
|
"_N$layoutType": 2,
|
||||||
@ -2069,32 +2058,5 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_id": "580AzT6xFJvb7ohciGgehV"
|
"_id": "580AzT6xFJvb7ohciGgehV"
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 1,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 0,
|
|
||||||
"_originalHeight": 0,
|
|
||||||
"_id": "f7GTkBg4hJMpPgwjS3Vbiz"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.2.7",
|
"ver": "1.2.5",
|
||||||
"uuid": "dbecc9f5-b74f-4e1d-a024-bf3d5eac0847",
|
"uuid": "dbecc9f5-b74f-4e1d-a024-bf3d5eac0847",
|
||||||
"asyncLoadAssets": false,
|
"asyncLoadAssets": false,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
||||||
|
@ -82,9 +82,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 138
|
"__id__": 138
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 139
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -6289,31 +6286,5 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_id": "8aXDbxs9dKkpT0kIbw8yNe"
|
"_id": "8aXDbxs9dKkpT0kIbw8yNe"
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 1,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 0,
|
|
||||||
"_originalHeight": 0
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.2.7",
|
"ver": "1.2.5",
|
||||||
"uuid": "7d64bd80-8e2c-4c7c-8d65-ea69b0c4b3d3",
|
"uuid": "7d64bd80-8e2c-4c7c-8d65-ea69b0c4b3d3",
|
||||||
"asyncLoadAssets": false,
|
"asyncLoadAssets": false,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.2.7",
|
"ver": "1.2.5",
|
||||||
"uuid": "3bf0537b-ca38-4d1d-9c51-4e6c8a6369b0",
|
"uuid": "3bf0537b-ca38-4d1d-9c51-4e6c8a6369b0",
|
||||||
"asyncLoadAssets": false,
|
"asyncLoadAssets": false,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
"_groupIndex": 0,
|
"_groupIndex": 0,
|
||||||
"groupIndex": 0,
|
"groupIndex": 0,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
||||||
"_id": "147d5b9f-b769-4112-9daf-2e28236161fa"
|
"_id": "6c351889-b6c8-409f-b36c-4263b06d0b23"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
@ -82,9 +82,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 48
|
"__id__": 48
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 49
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
@ -174,7 +171,7 @@
|
|||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
491.9024293495612,
|
418.2902700278839,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -431,7 +428,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "Controller",
|
"_name": "Sliders",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_parent": {
|
"_parent": {
|
||||||
"__id__": 5
|
"__id__": 5
|
||||||
@ -462,7 +459,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 576,
|
"width": 576,
|
||||||
"height": -36
|
"height": 60
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@ -500,7 +497,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "BlurSlider",
|
"_name": "RoundCornerRadiusSlider",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_parent": {
|
"_parent": {
|
||||||
"__id__": 9
|
"__id__": 9
|
||||||
@ -516,7 +513,7 @@
|
|||||||
"__id__": 23
|
"__id__": 23
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": false,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 26
|
"__id__": 26
|
||||||
@ -649,8 +646,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_useOriginalSize": false,
|
"_useOriginalSize": false,
|
||||||
"_string": "模糊程度:",
|
"_string": "圆角半径:",
|
||||||
"_N$string": "模糊程度:",
|
"_N$string": "圆角半径:",
|
||||||
"_fontSize": 40,
|
"_fontSize": 40,
|
||||||
"_lineHeight": 40,
|
"_lineHeight": 40,
|
||||||
"_enableWrapText": true,
|
"_enableWrapText": true,
|
||||||
@ -1297,7 +1294,7 @@
|
|||||||
"_layoutSize": {
|
"_layoutSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 576,
|
"width": 576,
|
||||||
"height": -36
|
"height": 60
|
||||||
},
|
},
|
||||||
"_resize": 1,
|
"_resize": 1,
|
||||||
"_N$layoutType": 2,
|
"_N$layoutType": 2,
|
||||||
@ -1370,7 +1367,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 384,
|
"width": 384,
|
||||||
"height": 805.73
|
"height": 629.73
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@ -1414,7 +1411,7 @@
|
|||||||
"__id__": 29
|
"__id__": 29
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": true,
|
"_active": false,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 31
|
"__id__": 31
|
||||||
@ -1478,7 +1475,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "dd3d8f78-9b79-4ca7-9bf7-7a09f7b34108"
|
"__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -1502,7 +1499,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "gaussian_blur",
|
"_name": "freedom",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"_parent": {
|
"_parent": {
|
||||||
"__id__": 29
|
"__id__": 29
|
||||||
@ -1525,8 +1522,8 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 316,
|
"width": 240,
|
||||||
"height": 210
|
"height": 240
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@ -1538,7 +1535,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
-177,
|
-120,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1560,7 +1557,7 @@
|
|||||||
"_is3DNode": false,
|
"_is3DNode": false,
|
||||||
"_groupIndex": 0,
|
"_groupIndex": 0,
|
||||||
"groupIndex": 0,
|
"groupIndex": 0,
|
||||||
"_id": "0c1gWopWlLwLl+GiSUizBJ"
|
"_id": "47hFX2oHFLvrpZ4r0ouXPs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Sprite",
|
"__type__": "cc.Sprite",
|
||||||
@ -1572,16 +1569,16 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "dd3d8f78-9b79-4ca7-9bf7-7a09f7b34108"
|
"__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
"_dstBlendFactor": 771,
|
"_dstBlendFactor": 771,
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "91f28953-0d5f-4379-9ae6-f3f6afb3241c"
|
"__uuid__": "dbc8f785-d78b-4179-bfce-ffbf69396712"
|
||||||
},
|
},
|
||||||
"_type": 0,
|
"_type": 0,
|
||||||
"_sizeMode": 1,
|
"_sizeMode": 0,
|
||||||
"_fillType": 0,
|
"_fillType": 0,
|
||||||
"_fillCenter": {
|
"_fillCenter": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@ -1592,7 +1589,7 @@
|
|||||||
"_fillRange": 0,
|
"_fillRange": 0,
|
||||||
"_isTrimmedMode": true,
|
"_isTrimmedMode": true,
|
||||||
"_atlas": null,
|
"_atlas": null,
|
||||||
"_id": "eckV5v4lpDULdq2uKByFTd"
|
"_id": "f61+UyKJdOyIJQABsng1SX"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
@ -1632,7 +1629,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
-429,
|
-387,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1666,7 +1663,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "dd3d8f78-9b79-4ca7-9bf7-7a09f7b34108"
|
"__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -1696,7 +1693,7 @@
|
|||||||
"__id__": 29
|
"__id__": 29
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": true,
|
"_active": false,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 37
|
"__id__": 37
|
||||||
@ -1726,7 +1723,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
-606,
|
-564,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1760,7 +1757,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "dd3d8f78-9b79-4ca7-9bf7-7a09f7b34108"
|
"__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -1790,7 +1787,7 @@
|
|||||||
"__id__": 29
|
"__id__": 29
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": true,
|
"_active": false,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 39
|
"__id__": 39
|
||||||
@ -1820,7 +1817,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
-673,
|
-631,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1854,7 +1851,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "dd3d8f78-9b79-4ca7-9bf7-7a09f7b34108"
|
"__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
@ -1914,7 +1911,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
-735.2,
|
-559.2,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1948,7 +1945,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "dd3d8f78-9b79-4ca7-9bf7-7a09f7b34108"
|
"__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_useOriginalSize": false,
|
"_useOriginalSize": false,
|
||||||
@ -2006,7 +2003,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
-789.065,
|
-613.065,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -2040,7 +2037,7 @@
|
|||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
{
|
{
|
||||||
"__uuid__": "dd3d8f78-9b79-4ca7-9bf7-7a09f7b34108"
|
"__uuid__": "642c2d0e-7eb6-4d65-96f2-d6e0d0305310"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_useOriginalSize": false,
|
"_useOriginalSize": false,
|
||||||
@ -2100,7 +2097,7 @@
|
|||||||
"_layoutSize": {
|
"_layoutSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 384,
|
"width": 384,
|
||||||
"height": 805.73
|
"height": 629.73
|
||||||
},
|
},
|
||||||
"_resize": 1,
|
"_resize": 1,
|
||||||
"_N$layoutType": 2,
|
"_N$layoutType": 2,
|
||||||
@ -2150,39 +2147,13 @@
|
|||||||
"_id": "4bz2+ak99DBYVlSVIMFGN0"
|
"_id": "4bz2+ak99DBYVlSVIMFGN0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "f460djPUfdEdrpZFw3saPVi",
|
"__type__": "d3d2b7nIXNDbKEclKMbIFTC",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 2
|
"__id__": 2
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_id": "77Tlx8YKFO6aLFI6G67OJ+"
|
"_id": "9ayfD37bZP1IEjPxGKO6+/"
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Widget",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"alignMode": 1,
|
|
||||||
"_target": null,
|
|
||||||
"_alignFlags": 45,
|
|
||||||
"_left": 0,
|
|
||||||
"_right": 0,
|
|
||||||
"_top": 0,
|
|
||||||
"_bottom": 0,
|
|
||||||
"_verticalCenter": 0,
|
|
||||||
"_horizontalCenter": 0,
|
|
||||||
"_isAbsLeft": true,
|
|
||||||
"_isAbsRight": true,
|
|
||||||
"_isAbsTop": true,
|
|
||||||
"_isAbsBottom": true,
|
|
||||||
"_isAbsHorizontalCenter": true,
|
|
||||||
"_isAbsVerticalCenter": true,
|
|
||||||
"_originalWidth": 0,
|
|
||||||
"_originalHeight": 0
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.2.7",
|
"ver": "1.2.5",
|
||||||
"uuid": "6c351889-b6c8-409f-b36c-4263b06d0b23",
|
"uuid": "6c351889-b6c8-409f-b36c-4263b06d0b23",
|
||||||
"asyncLoadAssets": false,
|
"asyncLoadAssets": false,
|
||||||
"autoReleaseAssets": false,
|
"autoReleaseAssets": false,
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.7",
|
|
||||||
"uuid": "c2dec4ed-8129-40a2-9a1e-2440da772015",
|
|
||||||
"asyncLoadAssets": false,
|
|
||||||
"autoReleaseAssets": false,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,97 +0,0 @@
|
|||||||
const { ccclass, property } = cc._decorator;
|
|
||||||
|
|
||||||
@ccclass
|
|
||||||
export default class FlashLightCtrlComponent extends cc.Component {
|
|
||||||
private _flashLightUBO: FlashLightUBO = new FlashLightUBO();
|
|
||||||
|
|
||||||
onEnable() {
|
|
||||||
this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchStart, this);
|
|
||||||
this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this);
|
|
||||||
this.node.on("on_property_change", this._onPropertyChange, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
onDisable() {
|
|
||||||
this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchStart, this);
|
|
||||||
this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this);
|
|
||||||
this.node.off("on_property_change", this._onPropertyChange, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private _onTouchStart(event: cc.Event.EventTouch) {
|
|
||||||
this._onTouchMove(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
private _onTouchMove(event: cc.Event.EventTouch) {
|
|
||||||
let touchPointInWorldSpace = event.getLocation();
|
|
||||||
let touchPointInNodeSpace = this.node.convertToNodeSpaceAR(touchPointInWorldSpace);
|
|
||||||
|
|
||||||
// 将触摸点转换为OPENGL坐标系并归一化
|
|
||||||
// OpenGl 坐标系原点在左上角
|
|
||||||
this._flashLightUBO.lightCenterPoint = cc.v2(
|
|
||||||
this.node.anchorX + touchPointInNodeSpace.x / this.node.width,
|
|
||||||
1 - (this.node.anchorY + touchPointInNodeSpace.y / this.node.height)
|
|
||||||
);
|
|
||||||
|
|
||||||
this._updateMaterial();
|
|
||||||
}
|
|
||||||
|
|
||||||
private _onPropertyChange(localDiffusionUniform: FlashLightUBO) {
|
|
||||||
this._flashLightUBO.lightColor = localDiffusionUniform.lightColor;
|
|
||||||
this._flashLightUBO.lightAngle = localDiffusionUniform.lightAngle;
|
|
||||||
this._flashLightUBO.lightWidth = localDiffusionUniform.lightWidth;
|
|
||||||
this._flashLightUBO.enableGradient = localDiffusionUniform.enableGradient;
|
|
||||||
this._flashLightUBO.cropAlpha = localDiffusionUniform.cropAlpha;
|
|
||||||
this._flashLightUBO.enableFog = localDiffusionUniform.enableFog;
|
|
||||||
this._updateMaterial();
|
|
||||||
}
|
|
||||||
|
|
||||||
private _updateMaterial() {
|
|
||||||
this.getComponents(cc.RenderComponent).forEach(renderComponent => {
|
|
||||||
let material: cc.Material = renderComponent.getMaterial(0);
|
|
||||||
material.setProperty("lightColor", this._flashLightUBO.lightColor);
|
|
||||||
material.setProperty("lightCenterPoint", this._flashLightUBO.lightCenterPoint);
|
|
||||||
material.setProperty("lightAngle", this._flashLightUBO.lightAngle);
|
|
||||||
material.setProperty("lightWidth", this._flashLightUBO.lightWidth);
|
|
||||||
material.setProperty("enableGradient", this._flashLightUBO.enableGradient);
|
|
||||||
material.setProperty("cropAlpha", this._flashLightUBO.cropAlpha);
|
|
||||||
material.setProperty("enableFog", this._flashLightUBO.enableFog);
|
|
||||||
renderComponent.setMaterial(0, material);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class FlashLightUBO {
|
|
||||||
/**
|
|
||||||
* 中心点颜色
|
|
||||||
*/
|
|
||||||
lightColor: cc.Color = cc.Color.YELLOW;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 中心点坐标 ([0.0, 1.0], [0.0, 1.0])
|
|
||||||
*/
|
|
||||||
lightCenterPoint: cc.Vec2 = cc.v2(0.5, 0.5);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 光束角度 [0.0, 180.0]
|
|
||||||
*/
|
|
||||||
lightAngle: number = 45;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 光束宽度 [0.0, +∞]
|
|
||||||
*/
|
|
||||||
lightWidth: number = 0.5;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否启用光束渐变
|
|
||||||
*/
|
|
||||||
enableGradient: boolean = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否裁剪掉透明区域上的点光
|
|
||||||
*/
|
|
||||||
cropAlpha: boolean = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否开启战争迷雾效果
|
|
||||||
*/
|
|
||||||
enableFog: boolean = false;
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.8",
|
|
||||||
"uuid": "3edca38f-0f12-489f-847a-0d89d9e55c6c",
|
|
||||||
"isPlugin": false,
|
|
||||||
"loadPluginInWeb": true,
|
|
||||||
"loadPluginInNative": true,
|
|
||||||
"loadPluginInEditor": false,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,111 +0,0 @@
|
|||||||
import FlashLightCtrlComponent, { FlashLightUBO } from "./FlashLightCtrlComponent";
|
|
||||||
|
|
||||||
const { ccclass, property } = cc._decorator;
|
|
||||||
|
|
||||||
@ccclass
|
|
||||||
export default class FlashLightEffectScene extends cc.Component {
|
|
||||||
private _redSlider: cc.Slider = null;
|
|
||||||
private _redSliderLabel: cc.Label = null;
|
|
||||||
private _greenSlider: cc.Slider = null;
|
|
||||||
private _greenSliderLabel: cc.Label = null;
|
|
||||||
private _blueSlider: cc.Slider = null;
|
|
||||||
private _blueSliderLabel: cc.Label = null;
|
|
||||||
private _alphaSlider: cc.Slider = null;
|
|
||||||
private _alphaSliderLabel: cc.Label = null;
|
|
||||||
private _lightWidthSlider: cc.Slider = null;
|
|
||||||
private _lightWidthSliderLabel: cc.Label = null;
|
|
||||||
private _lightAngleSlider: cc.Slider = null;
|
|
||||||
private _lightAngleSliderLabel: cc.Label = null;
|
|
||||||
|
|
||||||
private _enableGradientToggle: cc.Toggle = null;
|
|
||||||
private _cropAlphaToggle: cc.Toggle = null;
|
|
||||||
private _enableFogToggle: cc.Toggle = null;
|
|
||||||
|
|
||||||
private _examplesParentNode: cc.Node = null;
|
|
||||||
|
|
||||||
onLoad() {
|
|
||||||
cc.dynamicAtlasManager.enabled = false;
|
|
||||||
|
|
||||||
this._redSlider = cc.find("Canvas/Content/Controller/ColorRedSlider/Slider").getComponent(cc.Slider);
|
|
||||||
this._redSliderLabel = cc.find("Canvas/Content/Controller/ColorRedSlider/ValueLabel").getComponent(cc.Label);
|
|
||||||
this._greenSlider = cc.find("Canvas/Content/Controller/ColorGreenSlider/Slider").getComponent(cc.Slider);
|
|
||||||
this._greenSliderLabel = cc.find("Canvas/Content/Controller/ColorGreenSlider/ValueLabel").getComponent(cc.Label);
|
|
||||||
this._blueSlider = cc.find("Canvas/Content/Controller/ColorBlueSlider/Slider").getComponent(cc.Slider);
|
|
||||||
this._blueSliderLabel = cc.find("Canvas/Content/Controller/ColorBlueSlider/ValueLabel").getComponent(cc.Label);
|
|
||||||
this._alphaSlider = cc.find("Canvas/Content/Controller/ColorAlphaSlider/Slider").getComponent(cc.Slider);
|
|
||||||
this._alphaSliderLabel = cc.find("Canvas/Content/Controller/ColorAlphaSlider/ValueLabel").getComponent(cc.Label);
|
|
||||||
this._lightWidthSlider = cc.find("Canvas/Content/Controller/LightWidthSlider/Slider").getComponent(cc.Slider);
|
|
||||||
this._lightWidthSliderLabel = cc.find("Canvas/Content/Controller/LightWidthSlider/ValueLabel").getComponent(cc.Label);
|
|
||||||
this._lightAngleSlider = cc.find("Canvas/Content/Controller/LightAngleSlider/Slider").getComponent(cc.Slider);
|
|
||||||
this._lightAngleSliderLabel = cc.find("Canvas/Content/Controller/LightAngleSlider/ValueLabel").getComponent(cc.Label);
|
|
||||||
|
|
||||||
this._enableGradientToggle = cc.find("Canvas/Content/Controller/EnableGradientToggle/Toggle").getComponent(cc.Toggle);
|
|
||||||
this._cropAlphaToggle = cc.find("Canvas/Content/Controller/CropAlphaToggle/Toggle").getComponent(cc.Toggle);
|
|
||||||
this._enableFogToggle = cc.find("Canvas/Content/Controller/EnableFogToggle/Toggle").getComponent(cc.Toggle);
|
|
||||||
|
|
||||||
// 代码添加控制脚本
|
|
||||||
this._examplesParentNode = cc.find("Canvas/Content/Examples");
|
|
||||||
this._examplesParentNode.children.forEach(childNode => {
|
|
||||||
childNode.addComponent(FlashLightCtrlComponent);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onEnable() {
|
|
||||||
this._redSlider.node.on("slide", this._onPropertyChanged, this);
|
|
||||||
this._greenSlider.node.on("slide", this._onPropertyChanged, this);
|
|
||||||
this._blueSlider.node.on("slide", this._onPropertyChanged, this);
|
|
||||||
this._alphaSlider.node.on("slide", this._onPropertyChanged, this);
|
|
||||||
this._lightWidthSlider.node.on("slide", this._onPropertyChanged, this);
|
|
||||||
this._lightAngleSlider.node.on("slide", this._onPropertyChanged, this);
|
|
||||||
|
|
||||||
this._enableGradientToggle.node.on("toggle", this._onPropertyChanged, this);
|
|
||||||
this._cropAlphaToggle.node.on("toggle", this._onPropertyChanged, this);
|
|
||||||
this._enableFogToggle.node.on("toggle", this._onPropertyChanged, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
onDisable() {
|
|
||||||
this._redSlider.node.off("slide", this._onPropertyChanged, this);
|
|
||||||
this._greenSlider.node.off("slide", this._onPropertyChanged, this);
|
|
||||||
this._blueSlider.node.off("slide", this._onPropertyChanged, this);
|
|
||||||
this._alphaSlider.node.off("slide", this._onPropertyChanged, this);
|
|
||||||
this._lightWidthSlider.node.off("slide", this._onPropertyChanged, this);
|
|
||||||
this._lightAngleSlider.node.off("slide", this._onPropertyChanged, this);
|
|
||||||
|
|
||||||
this._enableGradientToggle.node.off("toggle", this._onPropertyChanged, this);
|
|
||||||
this._cropAlphaToggle.node.off("toggle", this._onPropertyChanged, this);
|
|
||||||
this._enableFogToggle.node.off("toggle", this._onPropertyChanged, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
this._onPropertyChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private _onPropertyChanged() {
|
|
||||||
// 更新进度条值 Label 文本
|
|
||||||
this._redSliderLabel.string = `${this._redSlider.progress.toFixed(2)} | ${Math.round(255 * this._redSlider.progress)}`;
|
|
||||||
this._greenSliderLabel.string = `${this._greenSlider.progress.toFixed(2)} | ${Math.round(255 * this._greenSlider.progress)}`;
|
|
||||||
this._blueSliderLabel.string = `${this._blueSlider.progress.toFixed(2)} | ${Math.round(255 * this._blueSlider.progress)}`;
|
|
||||||
this._alphaSliderLabel.string = `${this._alphaSlider.progress.toFixed(2)} | ${Math.round(255 * this._alphaSlider.progress)}`;
|
|
||||||
this._lightWidthSliderLabel.string = `${this._lightWidthSlider.progress.toFixed(2)}`;
|
|
||||||
|
|
||||||
let angle = 180 * this._lightAngleSlider.progress;
|
|
||||||
this._lightAngleSliderLabel.string = `${this._lightAngleSlider.progress.toFixed(2)} | ${angle.toFixed(2)}`;
|
|
||||||
|
|
||||||
// 通知子节点更新材质
|
|
||||||
this._examplesParentNode.children.forEach(childNode => {
|
|
||||||
childNode.emit("on_property_change", <FlashLightUBO>{
|
|
||||||
lightColor: cc.color(
|
|
||||||
Math.round(255 * this._redSlider.progress),
|
|
||||||
Math.round(255 * this._greenSlider.progress),
|
|
||||||
Math.round(255 * this._blueSlider.progress),
|
|
||||||
Math.round(255 * this._alphaSlider.progress)
|
|
||||||
),
|
|
||||||
lightAngle: angle,
|
|
||||||
lightWidth: this._lightWidthSlider.progress,
|
|
||||||
enableGradient: this._enableGradientToggle.isChecked,
|
|
||||||
cropAlpha: this._cropAlphaToggle.isChecked,
|
|
||||||
enableFog: this._enableFogToggle.isChecked
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.8",
|
|
||||||
"uuid": "6d3aff77-2683-4417-8960-2a5fd5d0757c",
|
|
||||||
"isPlugin": false,
|
|
||||||
"loadPluginInWeb": true,
|
|
||||||
"loadPluginInNative": true,
|
|
||||||
"loadPluginInEditor": false,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
const { ccclass, property } = cc._decorator;
|
|
||||||
|
|
||||||
@ccclass
|
|
||||||
export default class GaussianBlurV1EffectScene extends cc.Component {
|
|
||||||
private _blurSlider: cc.Slider = null;
|
|
||||||
private _blurSliderLabel: cc.Label = null;
|
|
||||||
|
|
||||||
private _examplesParentNode: cc.Node = null;
|
|
||||||
|
|
||||||
onLoad() {
|
|
||||||
cc.dynamicAtlasManager.enabled = false;
|
|
||||||
|
|
||||||
this._blurSlider = cc.find("Canvas/Content/Controller/BlurSlider/Slider").getComponent(cc.Slider);
|
|
||||||
this._blurSliderLabel = cc.find("Canvas/Content/Controller/BlurSlider/ValueLabel").getComponent(cc.Label);
|
|
||||||
|
|
||||||
this._examplesParentNode = cc.find("Canvas/Content/Examples");
|
|
||||||
}
|
|
||||||
|
|
||||||
onEnable() {
|
|
||||||
this._blurSlider.node.on("slide", this._onSliderChanged, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
onDisable() {
|
|
||||||
this._blurSlider.node.off("slide", this._onSliderChanged, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
this._onSliderChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private _onSliderChanged() {
|
|
||||||
this._blurSliderLabel.string = `${this._blurSlider.progress.toFixed(2)}`;
|
|
||||||
|
|
||||||
// 更新材质
|
|
||||||
this._updateRenderComponentMaterial({});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新渲染组件的材质
|
|
||||||
*
|
|
||||||
* 1. 获取材质
|
|
||||||
* 2. 给材质的 unitform 变量赋值
|
|
||||||
* 3. 重新将材质赋值回去
|
|
||||||
*/
|
|
||||||
private _updateRenderComponentMaterial(param: {}) {
|
|
||||||
this._examplesParentNode.children.forEach(childNode => {
|
|
||||||
childNode.getComponents(cc.RenderComponent).forEach(renderComponent => {
|
|
||||||
let material: cc.Material = renderComponent.getMaterial(0);
|
|
||||||
material.setProperty("textureSize", cc.v2(childNode.width, childNode.height));
|
|
||||||
renderComponent.setMaterial(0, material);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.0.8",
|
|
||||||
"uuid": "f460d8cf-51f7-4476-ba59-170dec68f562",
|
|
||||||
"isPlugin": false,
|
|
||||||
"loadPluginInWeb": true,
|
|
||||||
"loadPluginInNative": true,
|
|
||||||
"loadPluginInEditor": false,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@ -20,10 +20,9 @@ export default class GlowInnerEffectScene extends cc.Component {
|
|||||||
private _glowThresholdSlider: cc.Slider = null;
|
private _glowThresholdSlider: cc.Slider = null;
|
||||||
private _glowThresholdSliderLabel: cc.Label = null;
|
private _glowThresholdSliderLabel: cc.Label = null;
|
||||||
|
|
||||||
private _scrollView: cc.ScrollView = null;
|
private _examplesParentNode: cc.Node = null;
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
cc.dynamicAtlasManager.enabled = false;
|
|
||||||
this._redSlider = cc.find("Canvas/Content/Sliders/ColorRedSlider/Slider").getComponent(cc.Slider);
|
this._redSlider = cc.find("Canvas/Content/Sliders/ColorRedSlider/Slider").getComponent(cc.Slider);
|
||||||
this._redSliderLabel = cc.find("Canvas/Content/Sliders/ColorRedSlider/ValueLabel").getComponent(cc.Label);
|
this._redSliderLabel = cc.find("Canvas/Content/Sliders/ColorRedSlider/ValueLabel").getComponent(cc.Label);
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ export default class GlowInnerEffectScene extends cc.Component {
|
|||||||
this._glowThresholdSlider = cc.find("Canvas/Content/Sliders/GlowThresholdSlider/Slider").getComponent(cc.Slider);
|
this._glowThresholdSlider = cc.find("Canvas/Content/Sliders/GlowThresholdSlider/Slider").getComponent(cc.Slider);
|
||||||
this._glowThresholdSliderLabel = cc.find("Canvas/Content/Sliders/GlowThresholdSlider/ValueLabel").getComponent(cc.Label);
|
this._glowThresholdSliderLabel = cc.find("Canvas/Content/Sliders/GlowThresholdSlider/ValueLabel").getComponent(cc.Label);
|
||||||
|
|
||||||
this._scrollView = cc.find("Canvas/Content/ScrollView").getComponent(cc.ScrollView);
|
this._examplesParentNode = cc.find("Canvas/Content/Examples");
|
||||||
}
|
}
|
||||||
|
|
||||||
onEnable() {
|
onEnable() {
|
||||||
@ -75,7 +74,7 @@ export default class GlowInnerEffectScene extends cc.Component {
|
|||||||
this._alphaSliderLabel.string = `${this._alphaSlider.progress.toFixed(2)} | ${Math.round(255 * this._alphaSlider.progress)}`;
|
this._alphaSliderLabel.string = `${this._alphaSlider.progress.toFixed(2)} | ${Math.round(255 * this._alphaSlider.progress)}`;
|
||||||
|
|
||||||
// 这里为约束一下值发光宽度值在 [0.0, 0.1] 因为 0.1+ 之后的效果可能不明显,也可以自己尝试修改
|
// 这里为约束一下值发光宽度值在 [0.0, 0.1] 因为 0.1+ 之后的效果可能不明显,也可以自己尝试修改
|
||||||
let realGlowWidthProgress = this._glowWidthSlider.progress * 0.2;
|
let realGlowWidthProgress = this._glowWidthSlider.progress * 0.1;
|
||||||
this._glowWidthSliderLabel.string = `${realGlowWidthProgress.toFixed(2)}`;
|
this._glowWidthSliderLabel.string = `${realGlowWidthProgress.toFixed(2)}`;
|
||||||
|
|
||||||
// 这里为约束一下值发光阈值值在 [0.0, 0.5] 因为 0.5+ 之后的效果可能就是其他效果,也可以自己修改这里
|
// 这里为约束一下值发光阈值值在 [0.0, 0.5] 因为 0.5+ 之后的效果可能就是其他效果,也可以自己修改这里
|
||||||
@ -87,7 +86,7 @@ export default class GlowInnerEffectScene extends cc.Component {
|
|||||||
this._updateRenderComponentMaterial({
|
this._updateRenderComponentMaterial({
|
||||||
glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress),
|
glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress),
|
||||||
glowColorSize: realGlowWidthProgress,
|
glowColorSize: realGlowWidthProgress,
|
||||||
glowThreshold: realGlowThresholdProgress,
|
glowThreshold: realGlowThresholdProgress
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,8 +113,8 @@ export default class GlowInnerEffectScene extends cc.Component {
|
|||||||
*/
|
*/
|
||||||
glowThreshold: number;
|
glowThreshold: number;
|
||||||
}) {
|
}) {
|
||||||
this._scrollView.content.children.forEach((childNode) => {
|
this._examplesParentNode.children.forEach(childNode => {
|
||||||
childNode.getComponents(cc.RenderComponent).forEach((renderComponent) => {
|
childNode.getComponents(cc.RenderComponent).forEach(renderComponent => {
|
||||||
let material: cc.Material = renderComponent.getMaterial(0);
|
let material: cc.Material = renderComponent.getMaterial(0);
|
||||||
material.setProperty("glowColorSize", param.glowColorSize);
|
material.setProperty("glowColorSize", param.glowColorSize);
|
||||||
material.setProperty("glowColor", param.glowColor);
|
material.setProperty("glowColor", param.glowColor);
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.8",
|
"ver": "1.0.5",
|
||||||
"uuid": "eebe516b-e5b8-4c3b-b22c-a30a0b5bf629",
|
"uuid": "eebe516b-e5b8-4c3b-b22c-a30a0b5bf629",
|
||||||
"isPlugin": false,
|
"isPlugin": false,
|
||||||
"loadPluginInWeb": true,
|
"loadPluginInWeb": true,
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user