diff --git a/README-DEV.md b/README-DEV.md index ca56818d..9beb85fc 100644 --- a/README-DEV.md +++ b/README-DEV.md @@ -55,7 +55,6 @@ ## 版本计划 - 原生平台上支持 Spine 与其它组件合批 -- tiledMap 生成的 Label 好像不能使用 CacheMode,然后考虑对其进行一些优化 - 动态图集支持预乘纹理 - 补充原理文档 - Char 模式因为 bleed 问题只能复用完全相同宽高的区域,试着增加一个选项,能够先用空纹理覆盖,之所以做选项是不知道性能消耗大不大 diff --git a/README.md b/README.md index 1c34b507..1ab7eaad 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ - [功能演示](#功能演示) - [使用方法](#使用方法) - [更新日志](#更新日志) + - [Enhance Kit v1.2.0](#enhance-kit-v120) - [Enhance Kit v1.1.0](#enhance-kit-v110) - [Enhance Kit v1.0.0](#enhance-kit-v100) - [贡献指南](#贡献指南) @@ -70,6 +71,12 @@ ## 更新日志 +### Enhance Kit v1.2.0 + +- **[新特性] cc.TiledLayer 支持复用 Culling 数据** +- [修复] 修复 MotionStreak 初始化报错的问题 +- [修复] 修复勾选延迟加载资源时资源不会加载的问题 + ### Enhance Kit v1.1.0 - **[新特性] 动态合图在符合条件的情况下会忽略 padding 将纹理加入动态图集** @@ -123,3 +130,9 @@ ### 启动 Cocos Creator 报 Error: Can not parse this input:undefined 错误 这是你可能忘记安装配套的引擎扩展,所以没有找到增强包的内置资源导致的报错。 + +### 原生平台或模拟器报错:Assertion failed: (_type == Type::String), function toString, file Value.cpp, line 496. + +这是你没有替换引擎的 `jsb-adapter` 部分,或者说没有重启以生效。 + +注意:原生平台构建时可能需要先删除原有的 build 文件,替换操作才会生效。 diff --git a/docs/docs/intro.md b/docs/docs/intro.md index 225bca5a..05ee94c8 100644 --- a/docs/docs/intro.md +++ b/docs/docs/intro.md @@ -59,6 +59,12 @@ hide_title: true ## 更新日志 +### Enhance Kit v1.2.0 + +- **[新特性] cc.TiledLayer 支持复用 Culling 数据** +- [修复] 修复 MotionStreak 初始化报错的问题 +- [修复] 修复勾选延迟加载资源时资源不会加载的问题 + ### Enhance Kit v1.1.0 - **[新特性] 动态合图在符合条件的情况下会忽略 padding 将纹理加入动态图集** @@ -112,3 +118,9 @@ hide_title: true ### 启动 Cocos Creator 报 Error: Can not parse this input:undefined 错误 这是你可能忘记安装配套的引擎扩展,所以没有找到增强包的内置资源导致的报错。 + +### 原生平台或模拟器报错:Assertion failed: (_type == Type::String), function toString, file Value.cpp, line 496. + +这是你没有替换引擎的 `jsb-adapter` 部分,或者说没有重启以生效。 + +注意:原生平台构建时可能需要先删除原有的 build 文件,替换操作才会生效。 diff --git a/docs/docs/start-guide/new-features.md b/docs/docs/start-guide/new-features.md index 054bcd73..94f072bf 100644 --- a/docs/docs/start-guide/new-features.md +++ b/docs/docs/start-guide/new-features.md @@ -57,3 +57,10 @@ skeletonComponent.setRegionData('Head', 'Head', new sp.RegionData(spriteFrame)); 虽然加上去也简单,但这可能是很少用得到的功能,主要还是我们看到几乎所有渲染组件都可以自定义材质,这个组件却不可以。 可前往 [RichText 自定义材质](../user-guide/text-render/text-richtext.md) 文档了解更多详情。 + +--- +## 复用 TiledMap 的 Culling 数据 + +一个 TiledMap 可能会有很多 TiledLayer,如果开启了 Culling,那这些 Layer 都需要单独计算 Culling 数据,增强包新增了在满足一定条件的情况下可以复用 Culling 数据的特性,以减少 CPU 的性能消耗。 + +可前往 [复用 Culling 数据](../user-guide/tiledmap/tiledmap-culling.md) 文档了解更多详情。 diff --git a/docs/docs/theory-guide/tiledmap-theory.md b/docs/docs/theory-guide/tiledmap-theory.md new file mode 100644 index 00000000..29ec69bb --- /dev/null +++ b/docs/docs/theory-guide/tiledmap-theory.md @@ -0,0 +1,12 @@ +--- +sidebar_position: 5 +description: "详细了解增强 TiledMap 的实现方式。" +--- + +# 增强 TiledMap + +:::caution TODO + +施工中... + +::: diff --git a/docs/docs/update-log.md b/docs/docs/update-log.md index 7203c088..34dc7088 100644 --- a/docs/docs/update-log.md +++ b/docs/docs/update-log.md @@ -4,6 +4,15 @@ sidebar_position: 7 # 更新日志 +--- +## Enhance Kit v1.2.0 + +适配 Cocos Creator v2.4.9 版本,[点此下载压缩包](https://github.com/smallmain/cocos-enhance-kit/releases/tag/v1.2.0) + +- **[新特性] cc.TiledLayer 支持复用 Culling 数据** +- [修复] 修复 MotionStreak 初始化报错的问题 +- [修复] 修复勾选延迟加载资源时资源不会加载的问题 + --- ## Enhance Kit v1.1.0 diff --git a/docs/docs/user-guide/tiledmap/_category_.json b/docs/docs/user-guide/tiledmap/_category_.json new file mode 100644 index 00000000..59e24f39 --- /dev/null +++ b/docs/docs/user-guide/tiledmap/_category_.json @@ -0,0 +1,9 @@ +{ + "label": "TiledMap", + "position": 5, + "collapsed": true, + "link": { + "type": "doc", + "id": "tiledmap-intro" + } +} diff --git a/docs/docs/user-guide/tiledmap/assets/tiledmap-inspector.png b/docs/docs/user-guide/tiledmap/assets/tiledmap-inspector.png new file mode 100644 index 00000000..8a521293 Binary files /dev/null and b/docs/docs/user-guide/tiledmap/assets/tiledmap-inspector.png differ diff --git a/docs/docs/user-guide/tiledmap/assets/tiledmap-nodetree.png b/docs/docs/user-guide/tiledmap/assets/tiledmap-nodetree.png new file mode 100644 index 00000000..d2fb68eb Binary files /dev/null and b/docs/docs/user-guide/tiledmap/assets/tiledmap-nodetree.png differ diff --git a/docs/docs/user-guide/tiledmap/tiledmap-culling.md b/docs/docs/user-guide/tiledmap/tiledmap-culling.md new file mode 100644 index 00000000..89ba397d --- /dev/null +++ b/docs/docs/user-guide/tiledmap/tiledmap-culling.md @@ -0,0 +1,37 @@ +--- +sidebar_position: 2 +description: "像其它渲染组件一样在 Spine 组件上使用动态合图。" +--- + +# 复用 Culling 数据 + +一个 TiledMap 可能会有很多 TiledLayer,如果开启了 Culling,那这些 Layer 都需要单独计算 Culling 数据,增强包新增了在满足一定条件的情况下可以复用 Culling 数据的特性,以减少 CPU 的性能消耗。 + +## 大致原理 + +通过为 TiledLayer 指定另一个 TiledLayer,来复用指定的 TiledLayer 的 Culling 数据。 + +## 前提条件 + +- 两者的世界矩阵(也是大小、位置、缩放等属性)一致 +- 两者所用的 Camera 一致 +- 两者的 TiledLayer 类型、属性一致 +- 确保被复用的 Layer 会更早进行渲染(否则 Culling 数据同步可能会延迟一帧) + +:::tip 注意 + +复用可以是不同 TiledMap 的 TiledLayer,但一定要满足上面几个条件,否则 Culling 结果可能不正确。 + +::: + +## 使用方式 + +假设项目中有 TiledMap 由 5 个 TiledLayer 组合成一张地图。 + +![](./assets/tiledmap-nodetree.png) + +这种情况如果需要复用 Culling 数据只需要多选后四个节点,然后将第一个节点拖入这四个节点的 `Culling Layer` 属性中即可。 + +![](./assets/tiledmap-inspector.png) + +这样就使后四个 Layer 复用第一个 Layer 的 Culling 数据了。 diff --git a/docs/docs/user-guide/tiledmap/tiledmap-intro.mdx b/docs/docs/user-guide/tiledmap/tiledmap-intro.mdx new file mode 100644 index 00000000..65511fce --- /dev/null +++ b/docs/docs/user-guide/tiledmap/tiledmap-intro.mdx @@ -0,0 +1,12 @@ +import DocCardList from '@theme/DocCardList'; +import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; + +# TiledMap + +增强包对 TiledMap 进行了优化: + +- 复用 TiledLayer 的 Culling 数据 + +你可以阅读下面的文档了解详情: + + diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 0b557422..fa162d02 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -37,6 +37,9 @@ const config = { sidebarPath: require.resolve('./sidebars.js'), includeCurrentVersion: true, versions: { + "1.2.0": { + label: "v1.2.0", + }, "1.1.0": { label: "v1.1.0", }, diff --git a/extension/v1.2.0/enhance-kit-support/inspectors/comps/label.js b/extension/v1.2.0/enhance-kit-support/inspectors/comps/label.js new file mode 100644 index 00000000..15e476dc --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/inspectors/comps/label.js @@ -0,0 +1,129 @@ +"use strict"; +Vue.component("cc-label", { + dependencies: ["packages://inspector/share/blend.js"], + template: ` + + + + + + + :multi-values="multi" + + + + + + + + + + + + + + + + + + + + + + + `, + props: { + target: { + twoWay: !0, + type: Object + }, + multi: { + type: Boolean + } + }, + methods: { + T: Editor.T, + _isBMFont() { + return this.target._bmFontOriginalSize.value > 0 + }, + _isSystemFont() { + return this.target.useSystemFont.value + }, + _hiddenWrapText() { + let t = this.target.overflow.value; + return 0 === t || 3 === t + }, + _hiddenActualFontSize() { + return 2 !== this.target.overflow.value + }, + _isCharCacheMode() { + return 2 === this.target.cacheMode.value + }, + } +}); diff --git a/extension/v1.2.0/enhance-kit-support/inspectors/comps/richtext.js b/extension/v1.2.0/enhance-kit-support/inspectors/comps/richtext.js new file mode 100644 index 00000000..568e2679 --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/inspectors/comps/richtext.js @@ -0,0 +1,73 @@ +"use strict"; +Vue.component("cc-richtext", { + template: ` + + + + :multi-values="multi" + + + + + + + + + + + + + + + `, + props: { + target: { + twoWay: !0, + type: Object + }, + multi: { + type: Boolean + } + }, + methods: { + T: Editor.T, + _isSystemFont() { + return this.target.useSystemFont.value + }, + _isCharCacheMode() { + return 2 === this.target.cacheMode.value + }, + } +}); diff --git a/extension/v1.2.0/enhance-kit-support/inspectors/comps/sprite.js b/extension/v1.2.0/enhance-kit-support/inspectors/comps/sprite.js new file mode 100644 index 00000000..30b36cf1 --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/inspectors/comps/sprite.js @@ -0,0 +1,155 @@ +"use strict"; +Vue.component("cc-sprite", { + dependencies: ["packages://inspector/share/blend.js"], + template: ` + + + + {{T('COMPONENT.sprite.select_button')}} + + + + + + + {{T('COMPONENT.sprite.edit_button')}} + + + + + +
+ + + + +
+ + + + + + + + + + `, + props: { + target: { + twoWay: !0, + type: Object + }, + multi: { + twoWay: !0, + type: Boolean + } + }, + data: ()=>({ + atlasUuid: "", + atlasUuids: "", + atlasMulti: !1, + spriteUuid: "", + spriteUuids: "", + spriteMulti: !1 + }), + created() { + this.target && (this._updateAtlas(), + this._updateSprite()) + }, + watch: { + target() { + this._updateAtlas(), + this._updateSprite() + } + }, + methods: { + T: Editor.T, + selectAtlas() { + Editor.Ipc.sendToPanel("assets", "change-filter", "t:sprite-atlas") + }, + editSprite() { + Editor.Panel.open("sprite-editor", { + uuid: this.target.spriteFrame.value.uuid + }) + }, + allowTrim() { + return this.target.type.value === cc.Sprite.Type.SIMPLE + }, + isFilledType() { + return this.target.type.value === cc.Sprite.Type.FILLED + }, + isRadialFilled() { + return this.target.fillType.value === cc.Sprite.FillType.RADIAL + }, + _updateAtlas() { + if (!this.target) + return this.atlasUuid = "", + this.atlasUuids = "", + this.atlasMulti = !1, + void 0; + this.atlasUuid = this.target._atlas.value.uuid, + this.atlasUuids = this.target._atlas.values.map(t=>t.uuid); + var t = this.atlasUuids[0]; + this.atlasMulti = !this.atlasUuids.every((i,e)=>0 === e || i === t) + }, + _updateSprite() { + if (!this.target) + return this.spriteUuid = "", + this.spriteUuids = "", + this.spriteMulti = !1, + void 0; + this.spriteUuid = this.target.spriteFrame.value.uuid, + this.spriteUuids = this.target.spriteFrame.values.map(t=>t.uuid); + var t = this.spriteUuids[0]; + this.spriteMulti = !this.spriteUuids.every((i,e)=>0 === e || i === t) + } + } +}); diff --git a/extension/v1.2.0/enhance-kit-support/inspectors/comps/tiled-layer.js b/extension/v1.2.0/enhance-kit-support/inspectors/comps/tiled-layer.js new file mode 100644 index 00000000..99993394 --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/inspectors/comps/tiled-layer.js @@ -0,0 +1,15 @@ +"use strict"; +Vue.component("cc-tiled-layer", { + dependencies: ["packages://inspector/share/blend.js"], + template: '\n \n\n ', + props: { + target: { + twoWay: !0, + type: Object + }, + multi: { + twoWay: !0, + type: Boolean + } + } +}); diff --git a/extension/v1.2.0/enhance-kit-support/main.js b/extension/v1.2.0/enhance-kit-support/main.js new file mode 100644 index 00000000..8b46fbba --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/main.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = {}; diff --git a/extension/v1.2.0/enhance-kit-support/package.json b/extension/v1.2.0/enhance-kit-support/package.json new file mode 100644 index 00000000..9795ef8f --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/package.json @@ -0,0 +1,16 @@ +{ + "name": "enhance-kit", + "version": "1.2.0", + "description": "This extension provides support for cocos enhance kit.", + "author": "SmallMain", + "main": "main.js", + "runtime-resource": { + "path": "resources", + "name": "resources" + }, + "reload": { + "ignore": [ + "resources/**/*" + ] + } +} diff --git a/extension/v1.2.0/enhance-kit-support/resources/sp.meta b/extension/v1.2.0/enhance-kit-support/resources/sp.meta new file mode 100644 index 00000000..cdcd6b2b --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/resources/sp.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.2", + "uuid": "74663d94-6782-4dee-9db9-26127ee8b265", + "isBundle": true, + "bundleName": "", + "priority": 1, + "compressionType": {}, + "optimizeHotUpdate": {}, + "inlineSpriteFrames": {}, + "isRemoteBundle": {}, + "subMetas": {} +} \ No newline at end of file diff --git a/extension/v1.2.0/enhance-kit-support/resources/sp/effects.meta b/extension/v1.2.0/enhance-kit-support/resources/sp/effects.meta new file mode 100644 index 00000000..81bd1d8b --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/resources/sp/effects.meta @@ -0,0 +1,12 @@ +{ + "ver": "1.1.2", + "uuid": "8ee63b7e-0ac8-4cb5-95f0-85278bfd748a", + "isBundle": false, + "bundleName": "", + "priority": 1, + "compressionType": {}, + "optimizeHotUpdate": {}, + "inlineSpriteFrames": {}, + "isRemoteBundle": {}, + "subMetas": {} +} \ No newline at end of file diff --git a/extension/v1.2.0/enhance-kit-support/resources/sp/effects/multi-2d-universal.effect b/extension/v1.2.0/enhance-kit-support/resources/sp/effects/multi-2d-universal.effect new file mode 100644 index 00000000..8354ecb8 --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/resources/sp/effects/multi-2d-universal.effect @@ -0,0 +1,152 @@ +// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + +CCEffect %{ + techniques: + - passes: + - vert: vs + frag: fs + blendState: + targets: + - blend: true + rasterizerState: + cullMode: none + properties: + texture: { value: white } + texture2: { value: white } + texture3: { value: white } + texture4: { value: white } + texture5: { value: white } + texture6: { value: white } + texture7: { value: white } + texture8: { value: white } + alphaThreshold: { value: 0.5 } +}% + + +CCProgram vs %{ + precision highp float; + + #include + #include + + in vec3 a_position; + in vec4 a_color; + out vec4 v_color; + + #if USE_TINT + in vec4 a_color0; + out vec4 v_color0; + #endif + + #if USE_TEXTURE + in vec2 a_uv0; + out vec2 v_uv0; + + #if USE_MULTI_TEXTURE + in float a_texId; + out float v_texId; + #endif + + #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; + + #if USE_MULTI_TEXTURE + v_texId = a_texId; + #endif + + #endif + + v_color = a_color; + #if USE_TINT + v_color0 = a_color0; + #endif + + gl_Position = pos; + } +}% + + +CCProgram fs %{ + precision highp float; + + #include + #include + + in vec4 v_color; + + #if USE_TINT + in vec4 v_color0; + #endif + + #if USE_TEXTURE + in vec2 v_uv0; + uniform sampler2D texture; + + #if USE_MULTI_TEXTURE + in float v_texId; + uniform sampler2D texture2; + uniform sampler2D texture3; + uniform sampler2D texture4; + uniform sampler2D texture5; + uniform sampler2D texture6; + uniform sampler2D texture7; + uniform sampler2D texture8; + #endif + + #endif + + void main () { + vec4 o = vec4(1, 1, 1, 1); + + #if USE_TEXTURE + #if USE_MULTI_TEXTURE + if(v_texId < 1.0){ + CCTexture(texture, v_uv0, o); + } else if(v_texId < 2.0){ + CCTexture(texture2, v_uv0, o); + } else if(v_texId < 3.0){ + CCTexture(texture3, v_uv0, o); + } else if(v_texId < 4.0){ + CCTexture(texture4, v_uv0, o); + } else if(v_texId < 5.0){ + CCTexture(texture5, v_uv0, o); + } else if(v_texId < 6.0){ + CCTexture(texture6, v_uv0, o); + } else if(v_texId < 7.0){ + CCTexture(texture7, v_uv0, o); + } else { + CCTexture(texture8, v_uv0, o); + } + #else + CCTexture(texture, v_uv0, o); + #endif + #endif + + #if USE_TINT + vec4 finalColor; + finalColor.a = v_color.a * o.a; + finalColor.rgb = ((o.a - 1.0) * v_color0.a + 1.0 - o.rgb) * v_color0.rgb + o.rgb * v_color.rgb; + + ALPHA_TEST(finalColor); + + gl_FragColor = finalColor; + #else + o *= v_color; + + ALPHA_TEST(o); + + gl_FragColor = o; + #endif + } +}% diff --git a/extension/v1.2.0/enhance-kit-support/resources/sp/effects/multi-2d-universal.effect.meta b/extension/v1.2.0/enhance-kit-support/resources/sp/effects/multi-2d-universal.effect.meta new file mode 100644 index 00000000..300f4f02 --- /dev/null +++ b/extension/v1.2.0/enhance-kit-support/resources/sp/effects/multi-2d-universal.effect.meta @@ -0,0 +1,17 @@ +{ + "ver": "1.0.25", + "uuid": "5dcffc18-b913-460e-a0d9-5d74f4cda12b", + "compiledShaders": [ + { + "glsl1": { + "vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\nattribute float a_texId;\nvarying float v_texId;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n v_texId = a_texId;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nvarying float v_texId;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nuniform sampler2D texture6;\nuniform sampler2D texture7;\nuniform sampler2D texture8;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n if(v_texId < 1.0){\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n } else if(v_texId < 2.0){\n vec4 texture2_tmp = texture2D(texture2, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture2\n texture2_tmp.a *= texture2D(texture2, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture2_tmp.rgb * texture2_tmp.rgb);\n o.a *= texture2_tmp.a;\n #else\n o *= texture2_tmp;\n #endif\n } else if(v_texId < 3.0){\n vec4 texture3_tmp = texture2D(texture3, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture3\n texture3_tmp.a *= texture2D(texture3, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture3_tmp.rgb * texture3_tmp.rgb);\n o.a *= texture3_tmp.a;\n #else\n o *= texture3_tmp;\n #endif\n } else if(v_texId < 4.0){\n vec4 texture4_tmp = texture2D(texture4, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture4\n texture4_tmp.a *= texture2D(texture4, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture4_tmp.rgb * texture4_tmp.rgb);\n o.a *= texture4_tmp.a;\n #else\n o *= texture4_tmp;\n #endif\n } else if(v_texId < 5.0){\n vec4 texture5_tmp = texture2D(texture5, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture5\n texture5_tmp.a *= texture2D(texture5, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture5_tmp.rgb * texture5_tmp.rgb);\n o.a *= texture5_tmp.a;\n #else\n o *= texture5_tmp;\n #endif\n } else if(v_texId < 6.0){\n vec4 texture6_tmp = texture2D(texture6, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture6\n texture6_tmp.a *= texture2D(texture6, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture6_tmp.rgb * texture6_tmp.rgb);\n o.a *= texture6_tmp.a;\n #else\n o *= texture6_tmp;\n #endif\n } else if(v_texId < 7.0){\n vec4 texture7_tmp = texture2D(texture7, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture7\n texture7_tmp.a *= texture2D(texture7, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture7_tmp.rgb * texture7_tmp.rgb);\n o.a *= texture7_tmp.a;\n #else\n o *= texture7_tmp;\n #endif\n } else {\n vec4 texture8_tmp = texture2D(texture8, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture8\n texture8_tmp.a *= texture2D(texture8, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture8_tmp.rgb * texture8_tmp.rgb);\n o.a *= texture8_tmp.a;\n #else\n o *= texture8_tmp;\n #endif\n }\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}" + }, + "glsl3": { + "vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\nin float a_texId;\nout float v_texId;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n v_texId = a_texId;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}", + "frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nin float v_texId;\nuniform sampler2D texture;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nuniform sampler2D texture6;\nuniform sampler2D texture7;\nuniform sampler2D texture8;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n if(v_texId < 1.0){\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n } else if(v_texId < 2.0){\n vec4 texture2_tmp = texture(texture2, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture2\n texture2_tmp.a *= texture(texture2, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture2_tmp.rgb * texture2_tmp.rgb);\n o.a *= texture2_tmp.a;\n #else\n o *= texture2_tmp;\n #endif\n } else if(v_texId < 3.0){\n vec4 texture3_tmp = texture(texture3, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture3\n texture3_tmp.a *= texture(texture3, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture3_tmp.rgb * texture3_tmp.rgb);\n o.a *= texture3_tmp.a;\n #else\n o *= texture3_tmp;\n #endif\n } else if(v_texId < 4.0){\n vec4 texture4_tmp = texture(texture4, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture4\n texture4_tmp.a *= texture(texture4, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture4_tmp.rgb * texture4_tmp.rgb);\n o.a *= texture4_tmp.a;\n #else\n o *= texture4_tmp;\n #endif\n } else if(v_texId < 5.0){\n vec4 texture5_tmp = texture(texture5, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture5\n texture5_tmp.a *= texture(texture5, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture5_tmp.rgb * texture5_tmp.rgb);\n o.a *= texture5_tmp.a;\n #else\n o *= texture5_tmp;\n #endif\n } else if(v_texId < 6.0){\n vec4 texture6_tmp = texture(texture6, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture6\n texture6_tmp.a *= texture(texture6, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture6_tmp.rgb * texture6_tmp.rgb);\n o.a *= texture6_tmp.a;\n #else\n o *= texture6_tmp;\n #endif\n } else if(v_texId < 7.0){\n vec4 texture7_tmp = texture(texture7, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture7\n texture7_tmp.a *= texture(texture7, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture7_tmp.rgb * texture7_tmp.rgb);\n o.a *= texture7_tmp.a;\n #else\n o *= texture7_tmp;\n #endif\n } else {\n vec4 texture8_tmp = texture(texture8, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture8\n texture8_tmp.a *= texture(texture8, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture8_tmp.rgb * texture8_tmp.rgb);\n o.a *= texture8_tmp.a;\n #else\n o *= texture8_tmp;\n #endif\n }\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}" + } + } + ], + "subMetas": {} +} \ No newline at end of file