Merge branch 'release/0.1.0'

This commit is contained in:
caizhitao 2020-01-01 17:31:08 +08:00
commit 5dd387ff1b
69 changed files with 21649 additions and 752 deletions

9
CHANGELOG.md Normal file
View File

@ -0,0 +1,9 @@
# ChangeLog
## 0.1.0 (2020-01-01)
- 加入马赛克特效
- 加入老照片特效
- 加入内发光特效
- 加入外发光特效(未完善)
- 加入描边特效(未完善)

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Zhitao Cai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,2 +1,80 @@
# hello-world
Hello world new project template.
# Cocos Creator Shader Effect Demo
[![](https://img.shields.io/badge/Release-0.1.0-green.svg)](CHANGELOG.md)
[![](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![](https://img.shields.io/badge/Support-Cocos%20Creator%20v2.2.1-orange.svg)](http://www.cocos.com/creator)
## 项目说明
1. 此项目为我在学习过程中的一些分享和实现,因此项目名字以 **`Demo`** 为后缀。
2. 项目重点在于 **「渔」**,不在于 **「鱼」** 。
3. 如果你有意将此Demo中的效果加入到你的项目中**请认真评估是否适合你的项目使用!**
## 系列文章
* [Cocos Creator Shader Effect 系列 - 0 - 前言](https://www.jianshu.com/p/20b906d7269c)
* [Cocos Creator Shader Effect 系列 - 1 - 材质EffectInspector纹理之间的关系](https://www.jianshu.com/p/ca28666d25d2)
* 编写中...
## 特效预览
那么现在,我们先来轻松地看下有哪些特效效果吧~
### 内发光([实现原理及使用说明]() 编写中... ,催更麻烦移步一下到文末 **激活作者** 😜)
![](static/effects/2d-sprite-glow-inner.gif)
### 马赛克([实现原理及使用说明]() 编写中... ,催更麻烦移步一下到文末 **激活作者** 😜)
![](static/effects/2d-sprite-mosaic.gif)
### 老照片([实现原理及使用说明]() 编写中... ,催更麻烦移步一下到文末 **激活作者** 😜)
![](static/effects/2d-sprite-old-photo.gif)
### 外发光(完善中...
### 外描边(完善中...
## TODO
* [ ] 图像裁剪
* [ ] 图像模糊
* [ ] 闪光
* [ ] 波浪
* [ ] 雨滴
* [ ] ...
## 支持一下作者吧
如果此项目对你学习和理解Shader有帮助不妨支持一下我吧~
ps支持扫码催更哦🤣🤣🤣👇👇👇👇
![](static/PAY.png)
## LICENSE
MIT License
Copyright (c) 2020 Zhitao Cai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -46,6 +46,7 @@ CCProgram vs %{
// in 用在函数的参数中表示这个参数是输入的在函数中改变这个值并不会影响对调用的函数产生副作用。相当于C语言的传值这个是函数参数默认的修饰符
// 顶点坐标
// a_position 是笛卡尔坐标右手系也是OpenGL的坐标系原点在左下角X轴正方向往右Y轴正方向往上Z轴正方向往外
in vec3 a_position;
// 顶点颜色,实际为对应节点的颜色
@ -61,6 +62,7 @@ CCProgram vs %{
#if USE_TEXTURE
// 输入的纹理坐标
// a_uv0 是标准屏幕坐标系即原点在左上角X轴正方向往右Y轴正方向往下
in vec2 a_uv0;
// 输出的纹理坐标

View File

@ -0,0 +1,261 @@
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
// 内发光特效
// 原理: 采样周边像素alpha取平均值叠加发光效果
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],
inspector: {
type: color,
tooltip: "发光颜色"
}
}
# 发光宽度
glowColorSize: {
value: 0.2,
inspector: {
tooltip: "发光宽度",
range: [0.0, 1.0],
}
}
# 发光透明度阈值
# 只有超过这个透明度的点才会发光
# 一般用于解决图像边缘存在渐变透明的时,决定超过这个透明度阈值的边缘点才点发光,具体可以操作一下
glowThreshold: {
value: 0.1,
inspector: {
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
#if SHOW_INNER_GLOW
uniform glow {
// 发光颜色
vec4 glowColor;
// 发光范围
float glowColorSize;
// 发光阈值
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);
}
/**
* 获取指定角度方向距离为xxx的像素的透明度
*
* @param angle 角度 [0.0, 360.0]
* @param dist 距离 [0.0, 1.0]
*
* @return alpha [0.0, 1.0]
*/
float getColorAlpha(float angle, float dist) {
// 角度转弧度,公式为:弧度 = 角度 * (pi / 180)
float radian = angle * 0.01745329252; // 这个浮点数是 pi / 180
vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian)));
return color.a;
}
/**
* 获取指定距离的周边像素的透明度平均值
*
* @param dist 距离 [0.0, 1.0]
*
* @return average alpha [0.0, 1.0]
*/
float getAverageAlpha(float dist) {
float totalAlpha = 0.0;
// 以30度为一个单位那么「周边一圈」就由0到360度中共计12个点的组成
totalAlpha += getColorAlpha(0.0, dist);
totalAlpha += getColorAlpha(30.0, dist);
totalAlpha += getColorAlpha(60.0, dist);
totalAlpha += getColorAlpha(90.0, dist);
totalAlpha += getColorAlpha(120.0, dist);
totalAlpha += getColorAlpha(150.0, dist);
totalAlpha += getColorAlpha(180.0, dist);
totalAlpha += getColorAlpha(210.0, dist);
totalAlpha += getColorAlpha(240.0, dist);
totalAlpha += getColorAlpha(270.0, dist);
totalAlpha += getColorAlpha(300.0, dist);
totalAlpha += getColorAlpha(330.0, dist);
return totalAlpha * 0.0833; // 1 / 12 = 0.08333
}
/**
* 获取发光的透明度
*/
float getGlowAlpha() {
// 如果发光宽度为0直接返回0.0透明度,减少计算量
if (glowColorSize == 0.0) {
return 0.0;
}
// 因为我们是要做内发光,所以如果点本来是透明的或者接近透明的
// 那么就意味着这个点是图像外的透明点或者图像内透明点(如空洞)之类的
// 内发光的话,这些透明点我们不用处理,让它保持原样,否则就是会有内描边或者一点扩边的效果
// 同时也是提前直接结束,减少计算量
vec4 srcColor = getTextureColor(texture, v_uv0);
if (srcColor.a <= glowThreshold) {
return srcColor.a;
}
// 将传入的指定距离平均分成10圈求出每一圈的平均透明度
// 然后求和取平均值,那么就可以得到该点的平均透明度
float totalAlpha = 0.0;
totalAlpha += getAverageAlpha(glowColorSize * 0.1);
totalAlpha += getAverageAlpha(glowColorSize * 0.2);
totalAlpha += getAverageAlpha(glowColorSize * 0.3);
totalAlpha += getAverageAlpha(glowColorSize * 0.4);
totalAlpha += getAverageAlpha(glowColorSize * 0.5);
totalAlpha += getAverageAlpha(glowColorSize * 0.6);
totalAlpha += getAverageAlpha(glowColorSize * 0.7);
totalAlpha += getAverageAlpha(glowColorSize * 0.8);
totalAlpha += getAverageAlpha(glowColorSize * 0.9);
totalAlpha += getAverageAlpha(glowColorSize * 1.0);
return totalAlpha * 0.1;
}
#endif
void main () {
vec4 o = vec4(1, 1, 1, 1);
#if USE_TEXTURE
o *= getTextureColor(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 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.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
}
}%

View 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 = 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\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 = 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\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": {}
}

View File

@ -0,0 +1,296 @@
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
// 外发光特效
// 原理采样周边像素alpha取平均值给外部加发光效果(1-col.a可避免内部发光)
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],
inspector: {
type: color,
tooltip: "发光颜色"
}
}
# 发光宽度
glowColorSize: {
value: 0.15,
inspector: {
tooltip: "发光宽度",
range: [0.0, 1.0],
}
}
# 发光透明度阈值
# 只有小于等于这个透明度的点才会发光
glowThreshold: {
value: 1.0,
inspector: {
tooltip: "发光阈值",
range: [0.0, 1.0]
}
}
}%
CCProgram vs %{
precision highp float;
#include <cc-global>
#include <cc-local>
// a_position 是笛卡尔坐标右手系也是OpenGL的坐标系原点在左下角X轴正方向往右Y轴正方向往上Z轴正方向往外
in vec3 a_position;
in vec4 a_color;
out vec4 v_color;
#if USE_TEXTURE
// a_uv0 是标准屏幕坐标系即原点在左上角X轴正方向往右Y轴正方向往下
in vec2 a_uv0;
out vec2 v_uv0;
#endif
void main () {
vec4 pos = vec4(a_position, 1);
// vec4 pos = vec4(a_position * vec3(1.0, 1.0, 1.0), 1);
#if CC_USE_MODEL
pos = cc_matViewProj * cc_matWorld * pos;
#else
pos = cc_matViewProj * pos;
#endif
#if USE_TEXTURE
v_uv0 = a_uv0;
// // 左移
// v_uv0 = a_uv0 + vec2(0.1, 0.0);
// // 右移
// v_uv0 = a_uv0 + vec2(-0.1, 0.0);
// // 上移
// v_uv0 = a_uv0 + vec2(0.0, 0.1);
// // 下移
// v_uv0 = a_uv0 + vec2(0.0, -0.1);
// // x轴拉伸
// v_uv0 = a_uv0 * vec2(0.5, 1.0);
// // x轴压缩
// v_uv0 = a_uv0 * vec2(2.0, 1.0);
// // y轴拉伸
// v_uv0 = a_uv0 * vec2(1.0, 0.5);
// // y轴压缩
// v_uv0 = a_uv0 * vec2(1.0, 2.0);
// 先缩小一倍,然后在移动回去中间
// v_uv0 = a_uv0 * 2.0 - 0.5;
#endif
v_color = a_color;
// pos *= vec4(2.0, 2.0, 1.0, 1.0);
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
/**
* 获取纹理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);
}
#if SHOW_OUTTER_GLOW
uniform glow {
// 发光颜色
vec4 glowColor;
// 发光范围
float glowColorSize;
// 发光阈值
float glowThreshold;
// 特别地,必须是 vec4 先于 float 声明
};
/**
* 获取指定角度方向距离为xxx的像素的透明度
*
* @param angle 角度 [0.0, 360.0]
* @param dist 距离 [0.0, 1.0]
*
* @return alpha [0.0, 1.0]
*/
float getColorAlpha(float angle, float dist) {
// 角度转弧度,公式为:弧度 = 角度 * (pi / 180)
float radian = angle * 0.01745329252; // 这个浮点数是 pi / 180
vec4 color = getTextureColor(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian)));
return color.a;
}
/**
* 获取指定距离的周边像素的透明度平均值
*
* @param dist 距离 [0.0, 1.0]
*
* @return average alpha [0.0, 1.0]
*/
float getAverageAlpha(float dist) {
float totalAlpha = 0.0;
// 以30度为一个单位那么「周边一圈」就由0到360度中共计12个点的组成
totalAlpha += getColorAlpha(0.0, dist);
totalAlpha += getColorAlpha(30.0, dist);
totalAlpha += getColorAlpha(60.0, dist);
totalAlpha += getColorAlpha(90.0, dist);
totalAlpha += getColorAlpha(120.0, dist);
totalAlpha += getColorAlpha(150.0, dist);
totalAlpha += getColorAlpha(180.0, dist);
totalAlpha += getColorAlpha(210.0, dist);
totalAlpha += getColorAlpha(240.0, dist);
totalAlpha += getColorAlpha(270.0, dist);
totalAlpha += getColorAlpha(300.0, dist);
totalAlpha += getColorAlpha(330.0, dist);
return totalAlpha * 0.0833; // 1 / 12 = 0.08333
// // for 循环写法据说耗性能
// float totalAlpha = 0.0;
// const float count = 12.0;
// const float angle = 360.0 / count;
// for (float i = 0.0; i < count; i += 1.0) {
// totalAlpha += getColorAlpha(angle * i, dist) ;
// }
// return totalAlpha / count;
}
/**
* 获取发光的透明度
*/
float getGlowAlpha() {
// 如果发光宽度为0直接返回0.0透明度,减少计算量
if (glowColorSize == 0.0) {
return 0.0;
}
// // 因为我们是要做内发光,所以如果点本来是透明的或者接近透明的
// // 那么就意味着这个点是图像外的透明点或者图像内透明点(如空洞)之类的
// // 内发光的话,这些透明点我们不用处理,让它保持原样,否则就是会有内描边或者一点扩边的效果
// // 同时也是提前直接结束,减少计算量
// vec4 srcColor = texture(texture, v_uv0);
// if (srcColor.a <= glowThreshold) {
// return srcColor.a;
// }
// 将传入的指定距离平均分成10圈求出每一圈的平均透明度
// 然后求和取平均值,那么就可以得到该点的平均透明度
float totalAlpha = 0.0;
totalAlpha += getAverageAlpha(glowColorSize * 0.1);
totalAlpha += getAverageAlpha(glowColorSize * 0.2);
totalAlpha += getAverageAlpha(glowColorSize * 0.3);
totalAlpha += getAverageAlpha(glowColorSize * 0.4);
totalAlpha += getAverageAlpha(glowColorSize * 0.5);
totalAlpha += getAverageAlpha(glowColorSize * 0.6);
totalAlpha += getAverageAlpha(glowColorSize * 0.7);
totalAlpha += getAverageAlpha(glowColorSize * 0.8);
totalAlpha += getAverageAlpha(glowColorSize * 0.9);
totalAlpha += getAverageAlpha(glowColorSize * 1.0);
return totalAlpha * 0.1;
}
#endif
void main () {
vec4 o = vec4(1, 1, 1, 1);
#if USE_TEXTURE
o *= getTextureColor(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_OUTTER_GLOW
// 获取发光透明度
// 此时我们得到的是内部透明度为1靠近边缘的为接近0的透明度其他位置为0的透明度
float alpha = getGlowAlpha();
// 而外发光是从边缘开始的,那么什么算是边缘呢?
// 一般图像边缘是存在渐变,即从图像内 1.0-> 0.0 图像外,那么发光边缘我们可以这样子定义
// 当该点的透明度小于一个阈值,那么我们就当该点为一个发光点
if (alpha <= glowThreshold) {
// 然后以阈值作为标量,重新将透明度归一化
alpha = alpha / glowThreshold;
// 给点调料,让靠近边缘的更加亮
alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;
} else {
// 然后这里大于阈值的基本就是便是图像本身不需要发光那么将发光透明度置为0
alpha = 0.0;
}
// 忽略阈值,直接处理
// // 给点调料,让靠近边缘的更加亮
// alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;
// 外发光颜色
vec4 color_dest = glowColor * alpha;
vec4 color_src = o;
// 本次我们将先画外发光作为背景,然后在上方放图像
//
// 按照混合颜色规则 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_MINUS_SRC_ALPHAA
//
// 即最终颜色如下:
// color_src * GL_SRC_ALPHA + color_dest * GL_ONE_MINUS_SRC_ALPHAA
gl_FragColor = color_src * color_src.a + color_dest * (1.0 - color_src.a);
#endif
}
}%

View File

@ -0,0 +1,17 @@
{
"ver": "1.0.23",
"uuid": "89f30b2e-b75e-49b1-9dfc-cb341cadd30a",
"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\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\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": {
"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\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"
}
}
],
"subMetas": {}
}

View File

@ -0,0 +1,146 @@
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
// 马赛克特效
// 原理: n x n 方块内取同一颜色
CCEffect %{
techniques:
- passes:
- vert: vs
frag: fs
blendState:
targets:
- blend: true
rasterizerState:
cullMode: none
properties:
texture: { value: white }
alphaThreshold: { value: 0.5 }
# X轴方块数量
xBlockCount: {
value: 30.0,
inspector: {
tooltip: "X轴方向马赛克方块数量"
}
}
# Y轴方块数量
yBlockCount: {
value: 30.0,
inspector: {
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 USE_MOSAIC
uniform Mosaic {
// X轴方块数量
float xBlockCount;
// Y轴方块数量
float yBlockCount;
}
/**
* 获取v_uv0最终映射的马赛格格子的坐标
*
* @return 映射后坐标
*/
vec2 getUvMapPos() {
// 计算x轴格子宽度
float xCount;
if (xBlockCount <= 0.0) {
xCount = 1.0;
} else {
xCount = xBlockCount;
}
float blockWidth = 1.0 / xCount;
// 计算当前 v_uv0 在x轴的哪个格子上
float blockXIndex = floor(v_uv0.x / blockWidth);
// 同理,求出当前 v_uv0 在y轴上的哪个格子
float yCount;
if (yBlockCount <= 0.0) {
yCount = 1.0;
} else {
yCount = yBlockCount;
}
float blockHeight = 1.0 / yCount;
float blockYIndex = floor(v_uv0.y / blockHeight);
// 找到该格子的中心点实际对应的uv坐标
return vec2(blockWidth * (blockXIndex + 0.5), blockHeight * (blockYIndex + 0.5));
}
#endif
void main () {
vec4 o = vec4(1, 1, 1, 1);
vec2 realPos = v_uv0;
#if USE_MOSAIC
realPos = getUvMapPos();
#endif
#if USE_TEXTURE
o *= texture(texture, realPos);
#if CC_USE_ALPHA_ATLAS_TEXTURE
o.a *= texture2D(texture, realPos + vec2(0, 0.5)).r;
#endif
#endif
o *= v_color;
ALPHA_TEST(o);
gl_FragColor = o;
}
}%

View File

@ -0,0 +1,17 @@
{
"ver": "1.0.23",
"uuid": "9638979d-62b3-4e5b-adea-7ad706e66e65",
"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 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": {
"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 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"
}
}
],
"subMetas": {}
}

View File

@ -0,0 +1,122 @@
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
// 老照片特效
// 原理:
// r = 0.393 * r + 0.769 * g + 0.189 * b;
// g = 0.349 * r + 0.686 * g + 0.168 * b;
// b = 0.272 * r + 0.534 * g + 0.131 * b;
CCEffect %{
techniques:
- passes:
- vert: vs
frag: fs
blendState:
targets:
- blend: true
rasterizerState:
cullMode: none
properties:
texture: { value: white }
alphaThreshold: { value: 0.5 }
# 老化程度
oldLevel: {
value: 1.0,
inspector: {
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
#if USE_OLD_PHOTO
uniform OldPhoto {
// 老化程度
float oldLevel;
}
/**
* 获取老化颜色
*
* @param color 原始颜色
*
* @return 老化后的颜色
*/
vec4 getOldPhotoColor(vec4 color) {
float r = 0.393 * color.r + 0.769 * color.g + 0.189 * color.b;
float g = 0.349 * color.r + 0.686 * color.g + 0.168 * color.b;
float b = 0.272 * color.r + 0.534 * color.g + 0.131 * color.b;
return vec4(r, g, b, color.a);
}
#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 USE_OLD_PHOTO
vec4 srcColor = o;
vec4 oldColor = getOldPhotoColor(srcColor);
o = srcColor + (oldColor - srcColor) * oldLevel;
#endif
gl_FragColor = o;
}
}%

View File

@ -0,0 +1,17 @@
{
"ver": "1.0.23",
"uuid": "211eddf3-c53d-46e3-8c09-c1bf38e644e2",
"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 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": {
"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 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"
}
}
],
"subMetas": {}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
// 描边特效
CCEffect %{
techniques:
- passes:
@ -13,8 +13,24 @@ CCEffect %{
properties:
texture: { value: white }
alphaThreshold: { value: 0.5 }
outlineColor: { value: [1., .0, .0, 1.], editor: { type: color } }
outlineSize: { value: .01 }
# 描边颜色
outlineColor: {
value: [1.0, 0.0, 0.0, 1.0],
inspector: {
type: color,
tooltip: "描边颜色",
}
}
# 描边宽度
outlineWidth: {
value: 0.002,
inspector: {
tooltip: "描边宽度",
range: [0.0, 1.0]
}
}
}%
@ -71,23 +87,23 @@ CCProgram fs %{
// 描边颜色
vec4 outlineColor;
// 描边偏移大小
float outlineSize;
float outlineWidth;
// 特别地,必须是 vec4 先于 float 声明
};
// 将图像往8个方向偏移后得到一个类放大效果然后取放大后的图像的透明度即可得到一个放大后的区域可以很方便填充描边颜色
// 取当前点上、下、左、右、上左、上右、下左、下右共计8个方向距离为 outlineSize 的8个点求他们的透明度之和
// 将图像往8个方向偏移后得到一个类放大效果,然后取放大后的图像的透明度,即可得到一个放大后的区域,可以很方便填充(描边)颜色
// 取当前点上、下、左、右、上左、上右、下左、下右共计8个方向距离为 outlineWidth 的8个点求他们的透明度之和
// 由此可以得到当前点是否属于图像往八个方向做偏移后得到的放大图区域,并且能得到该点最终透明度值
// 最终对应的为图像偏移/放大后的背景区域
float getBgAlpha() {
vec4 color_up = texture(texture, v_uv0 + vec2(0, outlineSize));
vec4 color_down = texture(texture, v_uv0 - vec2(0, outlineSize));
vec4 color_left = texture(texture, v_uv0 - vec2(outlineSize, 0));
vec4 color_right = texture(texture, v_uv0 + vec2(outlineSize, 0));
vec4 color_up_left = texture(texture, v_uv0 + vec2(outlineSize, -outlineSize));
vec4 color_up_right = texture(texture, v_uv0 + vec2(outlineSize, outlineSize));
vec4 color_down_left = texture(texture, v_uv0 + vec2(-outlineSize, -outlineSize));
vec4 color_down_right = texture(texture, v_uv0 + vec2(-outlineSize, outlineSize));
vec4 color_up = texture(texture, v_uv0 + vec2(0, outlineWidth));
vec4 color_down = texture(texture, v_uv0 - vec2(0, outlineWidth));
vec4 color_left = texture(texture, v_uv0 - vec2(outlineWidth, 0));
vec4 color_right = texture(texture, v_uv0 + vec2(outlineWidth, 0));
vec4 color_up_left = texture(texture, v_uv0 + vec2(outlineWidth, -outlineWidth));
vec4 color_up_right = texture(texture, v_uv0 + vec2(outlineWidth, outlineWidth));
vec4 color_down_left = texture(texture, v_uv0 + vec2(-outlineWidth, -outlineWidth));
vec4 color_down_right = texture(texture, v_uv0 + vec2(-outlineWidth, outlineWidth));
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;
return clamp(total, 0.0, 1.0);
}
@ -111,6 +127,11 @@ CCProgram fs %{
gl_FragColor = o;
#if SHOW_OUT_LINE
// 无描边宽度即结束
if (outlineWidth == 0.0) {
return;
}
// 先画背景色
vec4 color_dest = outlineColor * getBgAlpha();

View File

@ -5,11 +5,11 @@
{
"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_OUT_LINE\n\nuniform vec4 outlineColor;\nuniform float outlineSize;\n\nfloat getBgAlpha() {\n vec4 color_up = texture2D(texture, v_uv0 + vec2(0, outlineSize)); \n vec4 color_down = texture2D(texture, v_uv0 - vec2(0, outlineSize)); \n vec4 color_left = texture2D(texture, v_uv0 - vec2(outlineSize, 0)); \n vec4 color_right = texture2D(texture, v_uv0 + vec2(outlineSize, 0)); \n vec4 color_up_left = texture2D(texture, v_uv0 + vec2(outlineSize, -outlineSize)); \n vec4 color_up_right = texture2D(texture, v_uv0 + vec2(outlineSize, outlineSize)); \n vec4 color_down_left = texture2D(texture, v_uv0 + vec2(-outlineSize, -outlineSize)); \n vec4 color_down_right = texture2D(texture, v_uv0 + vec2(-outlineSize, outlineSize)); \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 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"
"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": {
"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_OUT_LINE\n\nuniform Outline {\n\n vec4 outlineColor;\n\n float outlineSize;\n\n};\n\nfloat getBgAlpha() {\n vec4 color_up = texture(texture, v_uv0 + vec2(0, outlineSize)); \n vec4 color_down = texture(texture, v_uv0 - vec2(0, outlineSize)); \n vec4 color_left = texture(texture, v_uv0 - vec2(outlineSize, 0)); \n vec4 color_right = texture(texture, v_uv0 + vec2(outlineSize, 0)); \n vec4 color_up_left = texture(texture, v_uv0 + vec2(outlineSize, -outlineSize)); \n vec4 color_up_right = texture(texture, v_uv0 + vec2(outlineSize, outlineSize)); \n vec4 color_down_left = texture(texture, v_uv0 + vec2(-outlineSize, -outlineSize)); \n vec4 color_down_right = texture(texture, v_uv0 + vec2(-outlineSize, outlineSize)); \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 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"
"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"
}
}
],

View 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
}
}

View File

@ -0,0 +1,6 @@
{
"ver": "1.0.2",
"uuid": "2c760728-404d-4553-a1d0-7ab18263845c",
"dataAsSubAsset": null,
"subMetas": {}
}

View File

@ -0,0 +1,26 @@
{
"__type__": "cc.Material",
"_name": "",
"_objFlags": 0,
"_native": "",
"_effectAsset": {
"__uuid__": "89f30b2e-b75e-49b1-9dfc-cb341cadd30a"
},
"_defines": {
"USE_TEXTURE": true,
"USE_ALPHA_TEST": false,
"SHOW_OUTTER_GLOW": true
},
"_props": {
"texture": null,
"glowColor": {
"__type__": "cc.Color",
"r": 255,
"g": 0,
"b": 0,
"a": 255
},
"glowColorSize": 0.15,
"glowThreshold": 1
}
}

View File

@ -0,0 +1,6 @@
{
"ver": "1.0.2",
"uuid": "16dd0f06-6280-4d74-8483-a50e23c00733",
"dataAsSubAsset": null,
"subMetas": {}
}

View File

@ -0,0 +1,17 @@
{
"__type__": "cc.Material",
"_name": "",
"_objFlags": 0,
"_native": "",
"_effectAsset": {
"__uuid__": "9638979d-62b3-4e5b-adea-7ad706e66e65"
},
"_defines": {
"USE_TEXTURE": true,
"USE_MOSAIC": true
},
"_props": {
"xBlockCount": 50,
"yBlockCount": 50
}
}

View File

@ -0,0 +1,6 @@
{
"ver": "1.0.2",
"uuid": "f2651803-80c3-4665-bd81-2ad946a12dec",
"dataAsSubAsset": null,
"subMetas": {}
}

View File

@ -0,0 +1,14 @@
{
"__type__": "cc.Material",
"_name": "",
"_objFlags": 0,
"_native": "",
"_effectAsset": {
"__uuid__": "211eddf3-c53d-46e3-8c09-c1bf38e644e2"
},
"_defines": {
"USE_TEXTURE": true,
"USE_OLD_PHOTO": true
},
"_props": {}
}

View File

@ -0,0 +1,6 @@
{
"ver": "1.0.2",
"uuid": "268b1aff-299a-4735-9f5c-5aa8d4d51788",
"dataAsSubAsset": null,
"subMetas": {}
}

View File

@ -14,12 +14,12 @@
"_props": {
"texture": null,
"outlineColor": {
"__type__": "cc.Vec4",
"x": 1,
"y": 0,
"z": 0,
"w": 1
"__type__": "cc.Color",
"r": 255,
"g": 0,
"b": 0,
"a": 255
},
"outlineSize": 0.01
"outlineWidth": 0.002
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"ver": "1.2.5",
"uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"uuid": "69a920f1-0509-4d54-b033-5fb5b1283b72",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"ver": "1.2.5",
"uuid": "6c0134dc-238e-4bed-b9a3-3f09c1e320a3",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

View File

@ -1,677 +0,0 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_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": "2d2f792f-a40c-49bb-a189-ed176a246e49"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 8
},
{
"__id__": 10
},
{
"__id__": 12
}
],
"_active": true,
"_components": [
{
"__id__": 14
},
{
"__id__": 15
}
],
"_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,
351.60631393648214,
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": "Bg",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
},
{
"__id__": 7
}
],
"_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__": 5
},
"_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__": 5
},
"_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": "CocosLogoSprite",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 195,
"height": 270
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
111.898,
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": "c4f30YOS65G64U2TwufdJ+2"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_materials": [
{
"__uuid__": "daf44951-2c80-4778-b99f-52cfc78ab053"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "31bc895a-c003-4566-a9f3-2e54ae1c17dc"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "c5wu68mipC4qBjTD+u0rFa"
},
{
"__type__": "cc.Node",
"_name": "HelloLabel",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_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": 342.33,
"height": 75.6
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-117.787,
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": "31f1bH7V69Ajr1iXhluMpTB"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_useOriginalSize": false,
"_string": "Hello, World!",
"_N$string": "Hello, World!",
"_fontSize": 60,
"_lineHeight": 60,
"_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": "9fH5zrVThO/I9ly3o3xhIT"
},
{
"__type__": "cc.Node",
"_name": "ball_00",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 13
}
],
"_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": [
-243,
106,
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": "7c8OSA1YJNqKRZUzDDNpTz"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
},
"_enabled": true,
"_materials": [
{
"__uuid__": "daf44951-2c80-4778-b99f-52cfc78ab053"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "d0b78623-4e79-4de1-b1d2-ea211bf4652c"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "07Kzm51XBOGJMcszXVW8uC"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 960,
"height": 640
},
"_fitWidth": false,
"_fitHeight": true,
"_id": "4bz2+ak99DBYVlSVIMFGN0"
},
{
"__type__": "e1b90/rohdEk4SdmmEZANaD",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"label": {
"__id__": 11
},
"text": "hello",
"_id": "aa8ulaDR9JcbRoT7r3pqZq"
}
]

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"ver": "1.2.5",
"uuid": "4dcbd4ff-0bf9-4429-8c1f-44ad1b7a2192",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"ver": "1.2.5",
"uuid": "7f52e736-cdaf-44df-bd73-e2120e59267b",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"ver": "1.2.5",
"uuid": "dbecc9f5-b74f-4e1d-a024-bf3d5eac0847",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

View File

@ -0,0 +1,126 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class GlowInnerEffectScene 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 _glowWidthSlider: cc.Slider = null;
private _glowWidthSliderLabel: cc.Label = null;
private _glowThresholdSlider: cc.Slider = null;
private _glowThresholdSliderLabel: cc.Label = null;
private _examplesParentNode: cc.Node = null;
onLoad() {
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._greenSlider = cc.find("Canvas/Content/Sliders/ColorGreenSlider/Slider").getComponent(cc.Slider);
this._greenSliderLabel = cc.find("Canvas/Content/Sliders/ColorGreenSlider/ValueLabel").getComponent(cc.Label);
this._blueSlider = cc.find("Canvas/Content/Sliders/ColorBlueSlider/Slider").getComponent(cc.Slider);
this._blueSliderLabel = cc.find("Canvas/Content/Sliders/ColorBlueSlider/ValueLabel").getComponent(cc.Label);
this._alphaSlider = cc.find("Canvas/Content/Sliders/ColorAlphaSlider/Slider").getComponent(cc.Slider);
this._alphaSliderLabel = cc.find("Canvas/Content/Sliders/ColorAlphaSlider/ValueLabel").getComponent(cc.Label);
this._glowWidthSlider = cc.find("Canvas/Content/Sliders/GlowWidthSlider/Slider").getComponent(cc.Slider);
this._glowWidthSliderLabel = cc.find("Canvas/Content/Sliders/GlowWidthSlider/ValueLabel").getComponent(cc.Label);
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._examplesParentNode = cc.find("Canvas/Content/Examples");
}
onEnable() {
this._redSlider.node.on("slide", this._onSliderChanged, this);
this._greenSlider.node.on("slide", this._onSliderChanged, this);
this._blueSlider.node.on("slide", this._onSliderChanged, this);
this._alphaSlider.node.on("slide", this._onSliderChanged, this);
this._glowWidthSlider.node.on("slide", this._onSliderChanged, this);
this._glowThresholdSlider.node.on("slide", this._onSliderChanged, this);
}
onDisable() {
this._redSlider.node.off("slide", this._onSliderChanged, this);
this._greenSlider.node.off("slide", this._onSliderChanged, this);
this._blueSlider.node.off("slide", this._onSliderChanged, this);
this._alphaSlider.node.off("slide", this._onSliderChanged, this);
this._glowWidthSlider.node.off("slide", this._onSliderChanged, this);
this._glowThresholdSlider.node.off("slide", this._onSliderChanged, this);
}
start() {
this._onSliderChanged();
}
private _onSliderChanged() {
// 更新进度条值 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)}`;
// 这里为约束一下值发光宽度值在 [0.0, 0.1] 因为 0.1+ 之后的效果可能不明显,也可以自己尝试修改
let realGlowWidthProgress = this._glowWidthSlider.progress * 0.1;
this._glowWidthSliderLabel.string = `${realGlowWidthProgress.toFixed(2)}`;
// 这里为约束一下值发光阈值值在 [0.0, 0.5] 因为 0.5+ 之后的效果可能就是其他效果,也可以自己修改这里
// let realGlowThresholdProgress = this._glowThresholdSlider.progress * 0.5;
let realGlowThresholdProgress = this._glowThresholdSlider.progress;
this._glowThresholdSliderLabel.string = `${realGlowThresholdProgress.toFixed(2)}`;
// 更新材质
this._updateRenderComponentMaterial({
glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress),
glowColorSize: realGlowWidthProgress,
glowThreshold: realGlowThresholdProgress
});
}
/**
*
*
* 1.
* 2. unitform
* 3.
*/
private _updateRenderComponentMaterial(param: {
/**
* [0.0, 1.0]
*/
glowColorSize: number;
/**
* [0.0, 1.0]
*/
glowColor: cc.Vec4;
/**
* [0.0, 1.0]
*/
glowThreshold: number;
}) {
this._examplesParentNode.children.forEach(childNode => {
childNode.getComponents(cc.RenderComponent).forEach(renderComponent => {
let material: cc.Material = renderComponent.getMaterial(0);
material.setProperty("glowColorSize", param.glowColorSize);
material.setProperty("glowColor", param.glowColor);
material.setProperty("glowThreshold", param.glowThreshold);
renderComponent.setMaterial(0, material);
});
});
}
}

View File

@ -1,6 +1,6 @@
{
"ver": "1.0.5",
"uuid": "e1b90feb-a217-4493-849d-9a611900d683",
"uuid": "eebe516b-e5b8-4c3b-b22c-a30a0b5bf629",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,

View File

@ -0,0 +1,129 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class GlowOutterEffectScene 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 _glowWidthSlider: cc.Slider = null;
private _glowWidthSliderLabel: cc.Label = null;
private _glowThresholdSlider: cc.Slider = null;
private _glowThresholdSliderLabel: cc.Label = null;
private _examplesParentNode: cc.Node = null;
onLoad() {
// 关闭动态合图
cc.dynamicAtlasManager.enabled = false;
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._greenSlider = cc.find("Canvas/Content/Sliders/ColorGreenSlider/Slider").getComponent(cc.Slider);
this._greenSliderLabel = cc.find("Canvas/Content/Sliders/ColorGreenSlider/ValueLabel").getComponent(cc.Label);
this._blueSlider = cc.find("Canvas/Content/Sliders/ColorBlueSlider/Slider").getComponent(cc.Slider);
this._blueSliderLabel = cc.find("Canvas/Content/Sliders/ColorBlueSlider/ValueLabel").getComponent(cc.Label);
this._alphaSlider = cc.find("Canvas/Content/Sliders/ColorAlphaSlider/Slider").getComponent(cc.Slider);
this._alphaSliderLabel = cc.find("Canvas/Content/Sliders/ColorAlphaSlider/ValueLabel").getComponent(cc.Label);
this._glowWidthSlider = cc.find("Canvas/Content/Sliders/GlowWidthSlider/Slider").getComponent(cc.Slider);
this._glowWidthSliderLabel = cc.find("Canvas/Content/Sliders/GlowWidthSlider/ValueLabel").getComponent(cc.Label);
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._examplesParentNode = cc.find("Canvas/Content/Examples");
}
onEnable() {
this._redSlider.node.on("slide", this._onSliderChanged, this);
this._greenSlider.node.on("slide", this._onSliderChanged, this);
this._blueSlider.node.on("slide", this._onSliderChanged, this);
this._alphaSlider.node.on("slide", this._onSliderChanged, this);
this._glowWidthSlider.node.on("slide", this._onSliderChanged, this);
this._glowThresholdSlider.node.on("slide", this._onSliderChanged, this);
}
onDisable() {
this._redSlider.node.off("slide", this._onSliderChanged, this);
this._greenSlider.node.off("slide", this._onSliderChanged, this);
this._blueSlider.node.off("slide", this._onSliderChanged, this);
this._alphaSlider.node.off("slide", this._onSliderChanged, this);
this._glowWidthSlider.node.off("slide", this._onSliderChanged, this);
this._glowThresholdSlider.node.off("slide", this._onSliderChanged, this);
}
start() {
this._onSliderChanged();
}
private _onSliderChanged() {
// 更新进度条值 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)}`;
// 这里为约束一下值发光宽度值在 [0.0, 0.1] 因为 0.1+ 之后的效果可能不明显,也可以自己尝试修改
let realGlowWidthProgress = this._glowWidthSlider.progress * 0.1;
this._glowWidthSliderLabel.string = `${realGlowWidthProgress.toFixed(2)}`;
// 这里为约束一下值发光阈值值在 [0.0, 0.5] 因为 0.5+ 之后的效果可能就是其他效果,也可以自己修改这里
// let realGlowThresholdProgress = this._glowThresholdSlider.progress * 0.5;
let realGlowThresholdProgress = this._glowThresholdSlider.progress;
this._glowThresholdSliderLabel.string = `${realGlowThresholdProgress.toFixed(2)}`;
// 更新材质
this._updateRenderComponentMaterial({
glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress),
glowColorSize: realGlowWidthProgress,
glowThreshold: realGlowThresholdProgress
});
}
/**
*
*
* 1.
* 2. unitform
* 3.
*/
private _updateRenderComponentMaterial(param: {
/**
* [0.0, 1.0]
*/
glowColorSize: number;
/**
* [0.0, 1.0]
*/
glowColor: cc.Vec4;
/**
* [0.0, 1.0]
*/
glowThreshold: number;
}) {
this._examplesParentNode.children.forEach(childNode => {
childNode.getComponents(cc.RenderComponent).forEach(renderComponent => {
let material: cc.Material = renderComponent.getMaterial(0);
material.setProperty("glowColorSize", param.glowColorSize);
material.setProperty("glowColor", param.glowColor);
material.setProperty("glowThreshold", param.glowThreshold);
renderComponent.setMaterial(0, material);
});
});
}
}

View File

@ -1,6 +1,6 @@
{
"ver": "1.0.5",
"uuid": "93154cca-114c-4db2-938b-f750f686fe9b",
"uuid": "885555a3-a2a6-4260-a7a9-d363145fced6",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,

View File

@ -1,16 +0,0 @@
const {ccclass, property} = cc._decorator;
@ccclass
export default class MainSceneCtrl extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
start () {
// init logic
this.label.string = this.text;
}
}

View File

@ -0,0 +1,96 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class MosaicEffectScene extends cc.Component {
private _xMosaicCountSlider: cc.Slider = null;
private _xMosaicCountSliderLabel: cc.Label = null;
private _yMosaicCountSlider: cc.Slider = null;
private _yMosaicCountSliderLabel: cc.Label = null;
private _mosaicCountSlider: cc.Slider = null;
private _mosaicCountSliderLabel: cc.Label = null;
private _examplesParentNode: cc.Node = null;
onLoad() {
// 关闭动态合图
cc.dynamicAtlasManager.enabled = false;
this._xMosaicCountSlider = cc.find("Canvas/Content/Sliders/XMosaicCountSlider/Slider").getComponent(cc.Slider);
this._xMosaicCountSliderLabel = cc.find("Canvas/Content/Sliders/XMosaicCountSlider/ValueLabel").getComponent(cc.Label);
this._yMosaicCountSlider = cc.find("Canvas/Content/Sliders/YMosaicCountSlider/Slider").getComponent(cc.Slider);
this._yMosaicCountSliderLabel = cc.find("Canvas/Content/Sliders/YMosaicCountSlider/ValueLabel").getComponent(cc.Label);
this._mosaicCountSlider = cc.find("Canvas/Content/Sliders/MosaicCountSlider/Slider").getComponent(cc.Slider);
this._mosaicCountSliderLabel = cc.find("Canvas/Content/Sliders/MosaicCountSlider/ValueLabel").getComponent(cc.Label);
this._examplesParentNode = cc.find("Canvas/Content/Examples");
}
onEnable() {
this._xMosaicCountSlider.node.on("slide", this._onSliderChanged, this);
this._yMosaicCountSlider.node.on("slide", this._onSliderChanged, this);
this._mosaicCountSlider.node.on("slide", this._onSliderChangedTogether, this);
}
onDisable() {
this._xMosaicCountSlider.node.off("slide", this._onSliderChanged, this);
this._yMosaicCountSlider.node.off("slide", this._onSliderChanged, this);
this._mosaicCountSlider.node.off("slide", this._onSliderChangedTogether, this);
}
start() {
this._onSliderChanged();
}
private _onSliderChangedTogether() {
let mosaicCount = Math.round(this._mosaicCountSlider.progress * 300);
this._mosaicCountSliderLabel.string = `${mosaicCount}`;
// 更新材质
this._updateRenderComponentMaterial({
xBlockCount: mosaicCount,
yBlockCount: mosaicCount
});
}
private _onSliderChanged() {
let xMosaicCount = Math.round(this._xMosaicCountSlider.progress * 300);
this._xMosaicCountSliderLabel.string = `${xMosaicCount}`;
let yMosaicCount = Math.round(this._yMosaicCountSlider.progress * 300);
this._yMosaicCountSliderLabel.string = `${yMosaicCount}`;
// 更新材质
this._updateRenderComponentMaterial({
xBlockCount: xMosaicCount,
yBlockCount: yMosaicCount
});
}
/**
*
*
* 1.
* 2. unitform
* 3.
*/
private _updateRenderComponentMaterial(param: {
/**
* X轴方块数量 [1.0, ]
*/
xBlockCount: number;
/**
* Y轴方块数量 [1.0, ]
*/
yBlockCount: number;
}) {
this._examplesParentNode.children.forEach(childNode => {
childNode.getComponents(cc.RenderComponent).forEach(renderComponent => {
let material: cc.Material = renderComponent.getMaterial(0);
material.setProperty("xBlockCount", param.xBlockCount);
material.setProperty("yBlockCount", param.yBlockCount);
renderComponent.setMaterial(0, material);
});
});
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "79bbea43-4873-4c16-a20a-6824f7135017",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,59 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class OldPhotoEffectScene extends cc.Component {
private _oldLevelSlider: cc.Slider = null;
private _oldLevelSliderLabel: cc.Label = null;
private _examplesParentNode: cc.Node = null;
onLoad() {
this._oldLevelSlider = cc.find("Canvas/Content/Sliders/OldLevelSlider/Slider").getComponent(cc.Slider);
this._oldLevelSliderLabel = cc.find("Canvas/Content/Sliders/OldLevelSlider/ValueLabel").getComponent(cc.Label);
this._examplesParentNode = cc.find("Canvas/Content/Examples");
}
onEnable() {
this._oldLevelSlider.node.on("slide", this._onSliderChanged, this);
}
onDisable() {
this._oldLevelSlider.node.off("slide", this._onSliderChanged, this);
}
start() {
this._onSliderChanged();
}
private _onSliderChanged() {
this._oldLevelSliderLabel.string = `${this._oldLevelSlider.progress.toFixed(2)}`;
// 更新材质
this._updateRenderComponentMaterial({
oldLevel: this._oldLevelSlider.progress
});
}
/**
*
*
* 1.
* 2. unitform
* 3.
*/
private _updateRenderComponentMaterial(param: {
/**
* [0.0, 1.0] 1.0
*/
oldLevel: number;
}) {
this._examplesParentNode.children.forEach(childNode => {
childNode.getComponents(cc.RenderComponent).forEach(renderComponent => {
let material: cc.Material = renderComponent.getMaterial(0);
material.setProperty("oldLevel", param.oldLevel);
renderComponent.setMaterial(0, material);
});
});
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "1e14f8ce-f223-4250-abe0-2a0cc6c22ecf",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,63 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class OutlineEffectScene extends cc.Component {
private _widthSlider: cc.Slider = null;
private _widthSliderLabel: cc.Label = null;
private _examplesParentNode: cc.Node = null;
onLoad() {
// 关闭动态合图
cc.dynamicAtlasManager.enabled = false;
this._widthSlider = cc.find("Canvas/Content/Sliders/WidthSlider/Slider").getComponent(cc.Slider);
this._widthSliderLabel = cc.find("Canvas/Content/Sliders/WidthSlider/ValueLabel").getComponent(cc.Label);
this._examplesParentNode = cc.find("Canvas/Content/Examples");
}
onEnable() {
this._widthSlider.node.on("slide", this._onSliderChanged, this);
}
onDisable() {
this._widthSlider.node.off("slide", this._onSliderChanged, this);
}
start() {
this._onSliderChanged();
}
private _onSliderChanged() {
let outlineWidth = parseFloat((this._widthSlider.progress / 100).toFixed(4));
this._widthSliderLabel.string = `${outlineWidth}`;
// 更新材质
this._updateRenderComponentMaterial({
outlineWidth: outlineWidth
});
}
/**
*
*
* 1.
* 2. unitform
* 3.
*/
private _updateRenderComponentMaterial(param: {
/**
* [0.0, 1.0]0.5*0.5 *0.5
*/
outlineWidth: number;
}) {
this._examplesParentNode.children.forEach(childNode => {
childNode.getComponents(cc.RenderComponent).forEach(renderComponent => {
let material: cc.Material = renderComponent.getMaterial(0);
material.setProperty("outlineWidth", param.outlineWidth);
renderComponent.setMaterial(0, material);
});
});
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "7c634e1e-a19e-4498-9f51-a2e8d07e221d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -1,21 +0,0 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class SpriteOutlineCtrl extends cc.Component {
private _sprite: cc.Sprite = null;
onLoad() {
this._sprite = this.getComponent(cc.Sprite);
if (this._sprite == null) {
throw new Error(`${this.name} can only bind on Sprite`);
}
}
start() {
// let material: cc.Material = this._sprite.getMaterial(0);
// material.setProperty("test", 0);
// this._sprite.setMaterial(0, material);
}
// update (dt) {}
}

View File

@ -0,0 +1,7 @@
{
"ver": "1.0.1",
"uuid": "f997b961-2f60-436e-8980-c469c1effc84",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}

View File

@ -0,0 +1,7 @@
{
"ver": "1.0.1",
"uuid": "238b77a1-92fc-44ee-a44a-f44b3999faa2",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}

View File

@ -0,0 +1,79 @@
const { ccclass, property } = cc._decorator;
/**
* @classdesc
* @author caizhitao
* @version 0.1.0
* @since 2018-11-30
* @description
*
*
* 1.
*
*
* 1. Size适配
*
*
* 1. Widget组件
* 2. SHOW_ALL
*
* @example
```
// e.g.
// 代码中设置 SHOW_ALL 模式的参考代码
cc.view.setDesignResolutionSize(720, 1280, cc.ResolutionPolicy.SHOW_ALL);
// 或者 Canvas 组件中,同时勾选 Fit Width 和 Fit Height
```
*/
@ccclass
export default class ContentAdapter extends cc.Component {
onLoad() {
// if (CC_DEBUG) {
// cc.log("调整前");
// cc.log(`屏幕分辨率: ${cc.view.getCanvasSize().width} x ${cc.view.getCanvasSize().height}`);
// cc.log(`视图窗口可见区域分辨率: ${cc.view.getVisibleSize().width} x ${cc.view.getVisibleSize().height}`);
// cc.log(`视图中边框尺寸: ${cc.view.getFrameSize().width} x ${cc.view.getFrameSize().height}`);
// cc.log(`设备或浏览器像素比例: ${cc.view.getDevicePixelRatio()}`);
// cc.log(`节点宽高: ${this.node.width} x ${this.node.height}`);
// }
// 1. 先找到 SHOW_ALL 模式适配之后,本节点的实际宽高以及初始缩放值
let srcScaleForShowAll = Math.min(cc.view.getCanvasSize().width / this.node.width, cc.view.getCanvasSize().height / this.node.height);
let realWidth = this.node.width * srcScaleForShowAll;
let realHeight = this.node.height * srcScaleForShowAll;
// 2. 基于第一步的数据,再做节点宽高适配
this.node.width = this.node.width * (cc.view.getCanvasSize().width / realWidth);
this.node.height = this.node.height * (cc.view.getCanvasSize().height / realHeight);
// // 3. 因为本节点的宽高发生了改变,所以要手动更新剩下子节点的宽高
// this._updateAllChildNodeWidget(this.node);
// if (CC_DEBUG) {
// cc.log(`节点在SHOW_ALL模式下展示的宽高: ${realWidth} x ${realHeight}`);
// cc.log(`节点在SHOW_ALL模式下展示的缩放: ${srcScaleForShowAll}`);
// cc.log(
// `节点在SHOW_ALL模式下做全屏处理后的实际宽高${cc.view.getCanvasSize().width}x${
// cc.view.getCanvasSize().height
// })等价于于原节点的宽高(${this.node.width}x${this.node.height})`
// );
// }
}
// private _updateAllChildNodeWidget(parentNode: cc.Node) {
// if (parentNode == null) {
// return;
// }
// let widget = parentNode.getComponent(cc.Widget);
// if (widget != null) {
// widget.updateAlignment();
// }
// if (parentNode.childrenCount == 0) {
// return;
// }
// parentNode.children.forEach((childNode: cc.Node) => {
// this._updateAllChildNodeWidget(childNode);
// });
// }
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "68622365-44d2-4537-842b-5e514240c7bf",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -9,7 +9,7 @@
"packable": true,
"platformSettings": {},
"subMetas": {
"ball_00": {
"ball_0": {
"ver": "1.0.4",
"uuid": "d0b78623-4e79-4de1-b1d2-ea211bf4652c",
"rawTextureUuid": "c996c862-3d09-4bc6-915d-e8a8e7226933",

BIN
assets/textures/ball_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -0,0 +1,34 @@
{
"ver": "2.3.3",
"uuid": "bdfd3151-8c13-406b-8f94-1f101c972e7e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"platformSettings": {},
"subMetas": {
"ball_1": {
"ver": "1.0.4",
"uuid": "969fa66a-ae10-4157-b16e-4c1a4665920c",
"rawTextureUuid": "bdfd3151-8c13-406b-8f94-1f101c972e7e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 10,
"trimY": 10,
"width": 60,
"height": 60,
"rawWidth": 80,
"rawHeight": 80,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,34 @@
{
"ver": "2.3.3",
"uuid": "2453b01d-4364-4d87-ab53-391d1a42d07d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"platformSettings": {},
"subMetas": {
"video_btn": {
"ver": "1.0.4",
"uuid": "54142b08-a163-426e-a75e-4c7b21046413",
"rawTextureUuid": "2453b01d-4364-4d87-ab53-391d1a42d07d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 1,
"trimX": 6,
"trimY": 4,
"width": 50,
"height": 50,
"rawWidth": 60,
"rawHeight": 60,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

263
assets/textures/xmlBMFont.fnt Executable file
View File

@ -0,0 +1,263 @@
<font>
<info face="font" size="48" bold="0" italic="0" charset="" unicode="" stretchH="100" smooth="1" aa="1" padding="2,2,2,2" spacing="0,0" outline="0"/>
<common lineHeight="56" base="41" scaleW="1114" scaleH="512" pages="1" packed="0"/>
<pages>
<page id="0" file="xmlBMFont.png"/>
</pages>
<chars count="253">
<char id="97" x="2" y="2" width="39" height="36" xoffset="0" yoffset="9" xadvance="35" page="0" chnl="15"/>
<char id="98" x="2" y="40" width="32" height="39" xoffset="1" yoffset="7" xadvance="29" page="0" chnl="15"/>
<char id="99" x="2" y="81" width="33" height="35" xoffset="-1" yoffset="11" xadvance="28" page="0" chnl="15"/>
<char id="100" x="36" y="40" width="39" height="39" xoffset="0" yoffset="9" xadvance="34" page="0" chnl="15"/>
<char id="101" x="2" y="118" width="32" height="37" xoffset="0" yoffset="9" xadvance="29" page="0" chnl="15"/>
<char id="102" x="43" y="2" width="30" height="36" xoffset="-1" yoffset="9" xadvance="23" page="0" chnl="15"/>
<char id="103" x="2" y="157" width="36" height="37" xoffset="0" yoffset="8" xadvance="31" page="0" chnl="15"/>
<char id="104" x="75" y="2" width="31" height="36" xoffset="0" yoffset="10" xadvance="28" page="0" chnl="15"/>
<char id="105" x="36" y="118" width="13" height="32" xoffset="-2" yoffset="14" xadvance="8" page="0" chnl="15"/>
<char id="106" x="2" y="196" width="23" height="37" xoffset="-2" yoffset="8" xadvance="19" page="0" chnl="15"/>
<char id="107" x="2" y="235" width="37" height="37" xoffset="0" yoffset="8" xadvance="34" page="0" chnl="15"/>
<char id="108" x="37" y="81" width="27" height="34" xoffset="-1" yoffset="11" xadvance="21" page="0" chnl="15"/>
<char id="109" x="27" y="196" width="38" height="37" xoffset="0" yoffset="8" xadvance="33" page="0" chnl="15"/>
<char id="110" x="40" y="152" width="34" height="38" xoffset="1" yoffset="8" xadvance="32" page="0" chnl="15"/>
<char id="111" x="66" y="81" width="33" height="36" xoffset="1" yoffset="11" xadvance="30" page="0" chnl="15"/>
<char id="112" x="77" y="40" width="34" height="36" xoffset="-2" yoffset="10" xadvance="28" page="0" chnl="15"/>
<char id="113" x="2" y="274" width="41" height="37" xoffset="1" yoffset="11" xadvance="34" page="0" chnl="15"/>
<char id="114" x="2" y="313" width="37" height="40" xoffset="2" yoffset="5" xadvance="35" page="0" chnl="15"/>
<char id="115" x="2" y="355" width="35" height="40" xoffset="0" yoffset="6" xadvance="30" page="0" chnl="15"/>
<char id="116" x="108" y="2" width="35" height="36" xoffset="0" yoffset="9" xadvance="30" page="0" chnl="15"/>
<char id="117" x="41" y="235" width="34" height="35" xoffset="1" yoffset="10" xadvance="32" page="0" chnl="15"/>
<char id="118" x="67" y="192" width="32" height="36" xoffset="0" yoffset="10" xadvance="29" page="0" chnl="15"/>
<char id="119" x="76" y="119" width="40" height="33" xoffset="2" yoffset="13" xadvance="39" page="0" chnl="15"/>
<char id="120" x="76" y="154" width="36" height="36" xoffset="0" yoffset="10" xadvance="31" page="0" chnl="15"/>
<char id="121" x="113" y="40" width="28" height="40" xoffset="-1" yoffset="9" xadvance="23" page="0" chnl="15"/>
<char id="122" x="2" y="397" width="36" height="37" xoffset="-1" yoffset="8" xadvance="31" page="0" chnl="15"/>
<char id="65" x="2" y="436" width="46" height="43" xoffset="-3" yoffset="5" xadvance="39" page="0" chnl="15"/>
<char id="66" x="40" y="355" width="38" height="46" xoffset="-2" yoffset="3" xadvance="32" page="0" chnl="15"/>
<char id="67" x="41" y="313" width="39" height="40" xoffset="-4" yoffset="8" xadvance="31" page="0" chnl="15"/>
<char id="68" x="77" y="230" width="46" height="46" xoffset="-4" yoffset="5" xadvance="38" page="0" chnl="15"/>
<char id="69" x="114" y="154" width="38" height="44" xoffset="-3" yoffset="5" xadvance="32" page="0" chnl="15"/>
<char id="70" x="118" y="82" width="35" height="43" xoffset="-4" yoffset="5" xadvance="25" page="0" chnl="15"/>
<char id="71" x="145" y="2" width="43" height="44" xoffset="-4" yoffset="5" xadvance="35" page="0" chnl="15"/>
<char id="72" x="50" y="403" width="39" height="42" xoffset="-4" yoffset="6" xadvance="31" page="0" chnl="15"/>
<char id="73" x="45" y="272" width="14" height="38" xoffset="-2" yoffset="10" xadvance="9" page="0" chnl="15"/>
<char id="74" x="80" y="355" width="27" height="44" xoffset="-4" yoffset="4" xadvance="21" page="0" chnl="15"/>
<char id="75" x="50" y="447" width="45" height="43" xoffset="-3" yoffset="5" xadvance="37" page="0" chnl="15"/>
<char id="76" x="91" y="401" width="31" height="40" xoffset="-3" yoffset="7" xadvance="23" page="0" chnl="15"/>
<char id="77" x="97" y="443" width="45" height="44" xoffset="-3" yoffset="4" xadvance="37" page="0" chnl="15"/>
<char id="78" x="82" y="278" width="40" height="45" xoffset="-2" yoffset="4" xadvance="36" page="0" chnl="15"/>
<char id="79" x="109" y="325" width="39" height="42" xoffset="-2" yoffset="7" xadvance="33" page="0" chnl="15"/>
<char id="80" x="124" y="278" width="40" height="42" xoffset="-5" yoffset="3" xadvance="31" page="0" chnl="15"/>
<char id="81" x="124" y="369" width="50" height="43" xoffset="-3" yoffset="8" xadvance="37" page="0" chnl="15"/>
<char id="82" x="125" y="200" width="45" height="47" xoffset="-2" yoffset="1" xadvance="38" page="0" chnl="15"/>
<char id="83" x="154" y="127" width="41" height="47" xoffset="-4" yoffset="2" xadvance="34" page="0" chnl="15"/>
<char id="84" x="150" y="322" width="42" height="43" xoffset="-3" yoffset="5" xadvance="33" page="0" chnl="15"/>
<char id="85" x="166" y="249" width="41" height="41" xoffset="-2" yoffset="7" xadvance="35" page="0" chnl="15"/>
<char id="86" x="172" y="176" width="38" height="42" xoffset="-3" yoffset="6" xadvance="32" page="0" chnl="15"/>
<char id="87" x="155" y="48" width="48" height="39" xoffset="-2" yoffset="9" xadvance="44" page="0" chnl="15"/>
<char id="88" x="190" y="2" width="42" height="41" xoffset="-3" yoffset="6" xadvance="35" page="0" chnl="15"/>
<char id="89" x="197" y="89" width="33" height="49" xoffset="-4" yoffset="5" xadvance="25" page="0" chnl="15"/>
<char id="90" x="144" y="414" width="43" height="43" xoffset="-4" yoffset="4" xadvance="34" page="0" chnl="15"/>
<char id="33" x="176" y="367" width="16" height="44" xoffset="-3" yoffset="4" xadvance="10" page="0" chnl="15"/>
<char id="8470" x="144" y="459" width="56" height="45" xoffset="-4" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="59" x="197" y="140" width="17" height="34" xoffset="-3" yoffset="20" xadvance="11" page="0" chnl="15"/>
<char id="37" x="189" y="413" width="47" height="43" xoffset="-3" yoffset="4" xadvance="40" page="0" chnl="15"/>
<char id="58" x="124" y="414" width="16" height="27" xoffset="-2" yoffset="21" xadvance="12" page="0" chnl="15"/>
<char id="63" x="202" y="458" width="25" height="44" xoffset="-3" yoffset="4" xadvance="19" page="0" chnl="15"/>
<char id="42" x="166" y="292" width="27" height="28" xoffset="-4" yoffset="8" xadvance="20" page="0" chnl="15"/>
<char id="40" x="229" y="458" width="19" height="51" xoffset="-6" yoffset="4" xadvance="10" page="0" chnl="15"/>
<char id="41" x="194" y="322" width="20" height="51" xoffset="-3" yoffset="4" xadvance="13" page="0" chnl="15"/>
<char id="95" x="125" y="249" width="36" height="12" xoffset="-3" yoffset="36" xadvance="28" page="0" chnl="15"/>
<char id="43" x="155" y="89" width="30" height="30" xoffset="-4" yoffset="17" xadvance="20" page="0" chnl="15"/>
<char id="45" x="82" y="325" width="25" height="14" xoffset="-3" yoffset="27" xadvance="18" page="0" chnl="15"/>
<char id="61" x="97" y="489" width="31" height="21" xoffset="-3" yoffset="21" xadvance="24" page="0" chnl="15"/>
<char id="46" x="154" y="176" width="16" height="16" xoffset="-2" yoffset="32" xadvance="11" page="0" chnl="15"/>
<char id="44" x="101" y="82" width="15" height="22" xoffset="-3" yoffset="33" xadvance="9" page="0" chnl="15"/>
<char id="47" x="209" y="220" width="28" height="46" xoffset="-4" yoffset="2" xadvance="20" page="0" chnl="15"/>
<char id="124" x="209" y="268" width="13" height="48" xoffset="1" yoffset="7" xadvance="15" page="0" chnl="15"/>
<char id="34" x="101" y="200" width="21" height="22" xoffset="-3" yoffset="7" xadvance="15" page="0" chnl="15"/>
<char id="39" x="118" y="127" width="15" height="23" xoffset="-4" yoffset="7" xadvance="8" page="0" chnl="15"/>
<char id="64" x="212" y="176" width="36" height="39" xoffset="-3" yoffset="8" xadvance="29" page="0" chnl="15"/>
<char id="35" x="216" y="318" width="33" height="43" xoffset="-3" yoffset="5" xadvance="26" page="0" chnl="15"/>
<char id="36" x="238" y="363" width="33" height="50" xoffset="-4" yoffset="3" xadvance="24" page="0" chnl="15"/>
<char id="94" x="2" y="492" width="26" height="15" xoffset="-4" yoffset="3" xadvance="15" page="0" chnl="15"/>
<char id="38" x="224" y="268" width="36" height="45" xoffset="-4" yoffset="3" xadvance="31" page="0" chnl="15"/>
<char id="123" x="239" y="217" width="25" height="49" xoffset="-4" yoffset="6" xadvance="16" page="0" chnl="15"/>
<char id="125" x="262" y="268" width="25" height="48" xoffset="-4" yoffset="6" xadvance="16" page="0" chnl="15"/>
<char id="91" x="250" y="415" width="22" height="49" xoffset="-4" yoffset="6" xadvance="14" page="0" chnl="15"/>
<char id="93" x="273" y="318" width="22" height="49" xoffset="-2" yoffset="6" xadvance="18" page="0" chnl="15"/>
<char id="32" x="41" y="272" width="0" height="0" xoffset="0" yoffset="43" xadvance="10" page="0" chnl="15"/>
<char id="48" x="216" y="140" width="28" height="32" xoffset="-3" yoffset="17" xadvance="22" page="0" chnl="15"/>
<char id="49" x="194" y="375" width="21" height="34" xoffset="1" yoffset="13" xadvance="21" page="0" chnl="15"/>
<char id="50" x="205" y="45" width="30" height="32" xoffset="-4" yoffset="16" xadvance="22" page="0" chnl="15"/>
<char id="51" x="234" y="2" width="25" height="41" xoffset="-2" yoffset="12" xadvance="22" page="0" chnl="15"/>
<char id="52" x="273" y="369" width="30" height="39" xoffset="-3" yoffset="13" xadvance="22" page="0" chnl="15"/>
<char id="53" x="250" y="466" width="29" height="37" xoffset="-3" yoffset="15" xadvance="22" page="0" chnl="15"/>
<char id="54" x="274" y="410" width="27" height="42" xoffset="-2" yoffset="6" xadvance="22" page="0" chnl="15"/>
<char id="55" x="281" y="454" width="29" height="40" xoffset="-3" yoffset="12" xadvance="22" page="0" chnl="15"/>
<char id="56" x="232" y="79" width="30" height="43" xoffset="-4" yoffset="6" xadvance="22" page="0" chnl="15"/>
<char id="57" x="303" y="410" width="26" height="38" xoffset="-1" yoffset="15" xadvance="22" page="0" chnl="15"/>
<char id="60" x="51" y="119" width="21" height="30" xoffset="-3" yoffset="13" xadvance="14" page="0" chnl="15"/>
<char id="62" x="237" y="45" width="21" height="30" xoffset="-4" yoffset="13" xadvance="13" page="0" chnl="15"/>
<char id="92" x="246" y="124" width="23" height="49" xoffset="-4" yoffset="6" xadvance="13" page="0" chnl="15"/>
<char id="96" x="30" y="492" width="21" height="16" xoffset="-4" yoffset="0" xadvance="13" page="0" chnl="15"/>
<char id="126" x="53" y="492" width="32" height="17" xoffset="-2" yoffset="23" xadvance="30" page="0" chnl="15"/>
<char id="20070" x="312" y="450" width="45" height="48" xoffset="2" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="31461" x="261" y="2" width="46" height="51" xoffset="1" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="29983" x="264" y="55" width="43" height="45" xoffset="3" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="31168" x="266" y="175" width="47" height="48" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="25165" x="271" y="102" width="44" height="46" xoffset="3" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="20030" x="289" y="225" width="49" height="49" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="20154" x="315" y="150" width="42" height="45" xoffset="4" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="35299" x="297" y="276" width="48" height="49" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="20803" x="340" y="197" width="42" height="46" xoffset="4" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="36129" x="305" y="327" width="45" height="45" xoffset="1" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="22763" x="331" y="374" width="46" height="45" xoffset="1" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="21516" x="347" y="245" width="44" height="45" xoffset="2" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="36827" x="352" y="292" width="48" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="20986" x="359" y="421" width="41" height="48" xoffset="3" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="36523" x="379" y="342" width="45" height="48" xoffset="2" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="25506" x="309" y="2" width="48" height="47" xoffset="-1" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="33457" x="317" y="51" width="47" height="50" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="27036" x="359" y="103" width="49" height="50" xoffset="-1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="30524" x="359" y="2" width="47" height="47" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="29366" x="366" y="51" width="47" height="47" xoffset="0" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="32534" x="408" y="2" width="47" height="47" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="20462" x="384" y="155" width="48" height="48" xoffset="-1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="24220" x="410" y="100" width="44" height="49" xoffset="2" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="19998" x="415" y="51" width="45" height="47" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="32752" x="393" y="205" width="48" height="49" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="26519" x="434" y="151" width="48" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="23398" x="456" y="100" width="44" height="49" xoffset="3" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="24481" x="402" y="256" width="50" height="51" xoffset="-1" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="21490" x="443" y="201" width="44" height="49" xoffset="3" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="20013" x="484" y="151" width="41" height="48" xoffset="4" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="35449" x="462" y="2" width="45" height="51" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="20365" x="502" y="55" width="48" height="49" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="37070" x="509" y="2" width="45" height="47" xoffset="2" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="22823" x="402" y="392" width="44" height="45" xoffset="2" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="25991" x="402" y="439" width="46" height="49" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="26354" x="426" y="309" width="43" height="45" xoffset="3" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="26143" x="454" y="252" width="43" height="48" xoffset="3" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="30830" x="448" y="356" width="49" height="50" xoffset="-1" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="23450" x="489" y="201" width="43" height="49" xoffset="3" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="35201" x="471" y="302" width="45" height="47" xoffset="2" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="36864" x="499" y="252" width="46" height="47" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="21527" x="527" y="106" width="47" height="46" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="65311" x="317" y="103" width="25" height="45" xoffset="0" yoffset="9" xadvance="48" page="0" chnl="15"/>
<char id="65281" x="527" y="154" width="16" height="45" xoffset="4" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="65292" x="271" y="150" width="15" height="22" xoffset="5" yoffset="32" xadvance="48" page="0" chnl="15"/>
<char id="12290" x="402" y="309" width="22" height="19" xoffset="1" yoffset="33" xadvance="48" page="0" chnl="15"/>
<char id="20998" x="534" y="201" width="47" height="47" xoffset="1" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="20139" x="552" y="51" width="46" height="49" xoffset="2" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="22909" x="556" y="2" width="48" height="46" xoffset="1" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="21451" x="576" y="102" width="44" height="49" xoffset="2" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="23545" x="576" y="153" width="47" height="46" xoffset="1" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="20915" x="600" y="50" width="48" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="25490" x="622" y="100" width="47" height="49" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="34892" x="606" y="2" width="46" height="46" xoffset="1" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="30591" x="654" y="2" width="50" height="51" xoffset="-1" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="40511" x="450" y="408" width="50" height="49" xoffset="-2" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="28216" x="450" y="459" width="48" height="47" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="25103" x="500" y="459" width="47" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="26102" x="499" y="351" width="47" height="47" xoffset="0" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="38388" x="518" y="301" width="43" height="45" xoffset="3" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="21040" x="547" y="250" width="45" height="46" xoffset="1" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="30475" x="583" y="201" width="44" height="47" xoffset="2" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="35270" x="625" y="151" width="49" height="47" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="39057" x="502" y="400" width="48" height="47" xoffset="0" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="22797" x="548" y="348" width="44" height="49" xoffset="2" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="27963" x="563" y="298" width="48" height="48" xoffset="0" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="21457" x="549" y="449" width="43" height="47" xoffset="3" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="36215" x="671" y="55" width="47" height="49" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="25361" x="552" y="399" width="46" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="25112" x="594" y="348" width="46" height="48" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="36755" x="706" y="2" width="48" height="49" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="36194" x="594" y="449" width="46" height="51" xoffset="2" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="19979" x="594" y="250" width="45" height="46" xoffset="1" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="19968" x="549" y="498" width="41" height="12" xoffset="4" yoffset="19" xadvance="48" page="0" chnl="15"/>
<char id="20010" x="629" y="200" width="47" height="48" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="21363" x="613" y="298" width="47" height="47" xoffset="2" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="23558" x="676" y="106" width="50" height="50" xoffset="-1" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="36229" x="600" y="398" width="47" height="49" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="36234" x="642" y="347" width="48" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="30340" x="720" y="53" width="47" height="48" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="20320" x="642" y="449" width="48" height="50" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="20102" x="756" y="2" width="41" height="47" xoffset="4" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="22833" x="649" y="397" width="43" height="47" xoffset="2" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="36133" x="692" y="446" width="48" height="47" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="20877" x="662" y="250" width="45" height="47" xoffset="2" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="26469" x="678" y="158" width="44" height="48" xoffset="3" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="23616" x="692" y="299" width="44" height="47" xoffset="2" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="25104" x="709" y="208" width="44" height="48" xoffset="2" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="21151" x="694" y="348" width="46" height="49" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="36807" x="724" y="158" width="48" height="46" xoffset="1" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="20851" x="728" y="103" width="46" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="24685" x="769" y="51" width="48" height="49" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="21916" x="738" y="258" width="49" height="51" xoffset="-1" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="20026" x="799" y="2" width="44" height="47" xoffset="2" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="21319" x="755" y="206" width="45" height="46" xoffset="2" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="32423" x="774" y="153" width="47" height="48" xoffset="1" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="29609" x="694" y="399" width="48" height="45" xoffset="0" yoffset="6" xadvance="48" page="0" chnl="15"/>
<char id="26597" x="776" y="102" width="44" height="48" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="20840" x="819" y="51" width="46" height="46" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="37096" x="822" y="99" width="48" height="49" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="21382" x="845" y="2" width="42" height="46" xoffset="4" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="26368" x="742" y="446" width="48" height="51" xoffset="0" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="39640" x="742" y="311" width="41" height="48" xoffset="4" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="26412" x="744" y="361" width="48" height="49" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="27425" x="792" y="412" width="47" height="49" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="24471" x="789" y="254" width="48" height="49" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="32676" x="867" y="50" width="47" height="47" xoffset="0" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="27599" x="789" y="305" width="48" height="50" xoffset="1" yoffset="1" xadvance="48" page="0" chnl="15"/>
<char id="21608" x="889" y="2" width="41" height="45" xoffset="5" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="26356" x="792" y="463" width="42" height="46" xoffset="3" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="26032" x="802" y="203" width="48" height="49" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="19978" x="836" y="463" width="45" height="42" xoffset="2" yoffset="6" xadvance="48" page="0" chnl="15"/>
<char id="39029" x="823" y="150" width="39" height="47" xoffset="5" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="39764" x="794" y="357" width="44" height="50" xoffset="2" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="26041" x="839" y="254" width="45" height="47" xoffset="2" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="22681" x="839" y="303" width="49" height="50" xoffset="-2" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="25214" x="852" y="199" width="47" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="19981" x="864" y="150" width="47" height="43" xoffset="0" yoffset="7" xadvance="48" page="0" chnl="15"/>
<char id="22359" x="872" y="99" width="49" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="28857" x="886" y="249" width="45" height="49" xoffset="2" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="20987" x="916" y="49" width="46" height="46" xoffset="1" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="25353" x="901" y="195" width="48" height="49" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="32426" x="913" y="149" width="47" height="44" xoffset="1" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="24405" x="923" y="97" width="48" height="46" xoffset="0" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="36992" x="840" y="355" width="46" height="48" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="35831" x="841" y="405" width="48" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="24320" x="888" y="355" width="47" height="47" xoffset="1" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="22987" x="890" y="300" width="49" height="48" xoffset="0" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="22810" x="933" y="246" width="38" height="50" xoffset="5" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="28040" x="951" y="195" width="46" height="49" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="65306" x="61" y="278" width="16" height="33" xoffset="4" yoffset="21" xadvance="48" page="0" chnl="15"/>
<char id="12288" x="43" y="272" width="0" height="0" xoffset="0" yoffset="43" xadvance="48" page="0" chnl="15"/>
<char id="20108" x="932" y="2" width="46" height="35" xoffset="1" yoffset="8" xadvance="48" page="0" chnl="15"/>
<char id="24687" x="883" y="455" width="45" height="49" xoffset="2" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="36890" x="962" y="145" width="48" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="32473" x="891" y="404" width="46" height="49" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="23567" x="937" y="350" width="49" height="47" xoffset="-1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="20249" x="941" y="298" width="48" height="47" xoffset="-1" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="20276" x="973" y="246" width="48" height="48" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="21543" x="999" y="195" width="48" height="47" xoffset="0" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="20934" x="930" y="455" width="46" height="50" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="22791" x="939" y="399" width="47" height="50" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="31561" x="964" y="39" width="47" height="50" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="24453" x="973" y="91" width="48" height="50" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="21152" x="1012" y="143" width="50" height="48" xoffset="-1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="20837" x="978" y="451" width="44" height="42" xoffset="2" yoffset="6" xadvance="48" page="0" chnl="15"/>
<char id="26187" x="1013" y="2" width="48" height="48" xoffset="1" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="31215" x="1023" y="52" width="50" height="45" xoffset="-2" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="21019" x="1063" y="2" width="47" height="48" xoffset="-1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="24314" x="988" y="347" width="47" height="49" xoffset="0" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="24050" x="991" y="296" width="39" height="43" xoffset="4" yoffset="5" xadvance="48" page="0" chnl="15"/>
<char id="37325" x="1023" y="244" width="43" height="47" xoffset="3" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="25151" x="1049" y="193" width="45" height="49" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="35265" x="988" y="398" width="44" height="46" xoffset="3" yoffset="4" xadvance="48" page="0" chnl="15"/>
<char id="28385" x="1032" y="293" width="48" height="48" xoffset="-2" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="31163" x="1024" y="446" width="44" height="49" xoffset="3" yoffset="3" xadvance="48" page="0" chnl="15"/>
<char id="25955" x="1064" y="99" width="48" height="50" xoffset="1" yoffset="2" xadvance="48" page="0" chnl="15"/>
<char id="32" x="0" y="0" width="0" height="0" xoffset="1" yoffset="2" xadvance="10" page="0" chnl="15"/>
</chars>
</font>

View File

@ -0,0 +1,7 @@
{
"ver": "2.1.0",
"uuid": "4c95de7e-8cca-47bf-a446-47b7594e0992",
"textureUuid": "a5454758-921f-46ab-a314-0a7936d03be7",
"fontSize": 48,
"subMetas": {}
}

BIN
assets/textures/xmlBMFont.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

View File

@ -0,0 +1,34 @@
{
"ver": "2.3.3",
"uuid": "a5454758-921f-46ab-a314-0a7936d03be7",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"platformSettings": {},
"subMetas": {
"xmlBMFont": {
"ver": "1.0.4",
"uuid": "3982ad46-6016-4e58-a083-8fe4d8866553",
"rawTextureUuid": "a5454758-921f-46ab-a314-0a7936d03be7",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 2,
"trimY": 2,
"width": 1110,
"height": 508,
"rawWidth": 1114,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

2
creator.d.ts vendored
View File

@ -1633,7 +1633,7 @@ declare namespace cc {
var v4 = cc.v4({x: 100, y: 100, z: 0});
```
*/
export function v4(x?: number|any, y?: number, z?: number): Vec4;
export function v4(x?: number|any, y?: number, z?: number, w?: number): Vec4;
export var dynamicAtlasManager: DynamicAtlasManager;
/** !#en
cc.NodePool is the cache pool designed for node type.<br/>

View File

@ -8,28 +8,28 @@
"group-list": [
"default"
],
"start-scene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"design-resolution-width": 960,
"design-resolution-height": 640,
"fit-width": false,
"fit-height": true,
"use-project-simulator-setting": false,
"simulator-orientation": false,
"use-customize-simulator": false,
"use-customize-simulator": true,
"simulator-resolution": {
"width": 960,
"height": 640
"height": 640,
"width": 960
},
"last-module-event-record-time": 1575989336079,
"assets-sort-type": "name",
"facebook": {
"enable": false,
"appID": "",
"live": {
"enable": false
},
"audience": {
"enable": false
},
"enable": false,
"live": {
"enable": false
}
}
},
"start-scene": "current"
}

BIN
static/PAY.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 KiB