更新文档到 2.4.9-v1.0.0

This commit is contained in:
SmallMain
2022-07-05 18:10:58 +08:00
parent b89bb48ce7
commit 746d9ce5cd
267 changed files with 8506 additions and 5284 deletions

View File

@@ -42,8 +42,6 @@ description: "需掌握一定的自定义引擎知识。"
如果你的项目不需要在原生平台上运行,则只定制 JavaScript 引擎即可。
如果你的项目需要在原生模拟器中预览,可能需要编译模拟器,更多详情可阅读官方的 [自定义引擎](https://docs.cocos.com/creator/2.4/manual/zh/advanced-topics/engine-customization.html) 文档。
:::
### 2.安装引擎扩展
@@ -60,7 +58,7 @@ description: "需掌握一定的自定义引擎知识。"
服务包需要使用名为 `sp` 的 AssetBundle 存放资源,如果你的项目有使用 AssetBundle请**确保该名称未被占用**。
没有必要将这个 Asset Bundle 设为远程包或者 Zip 压缩,里面只是一个多纹理 Effect 着色器资源。
没有必要将这个 Asset Bundle 设为远程包或者 Zip 压缩,里面只 Effect 着色器资源。
更多详情可阅读官方的 [安装扩展](https://docs.cocos.com/creator/2.4/manual/zh/extension/install-and-share.html) 文档。

View File

@@ -25,10 +25,25 @@ hide_title: true
## 重要特性
- **支持多纹理渲染**(多纹理材质、多纹理合批)
![demo1](/demo-imgs/demo1.png)
- **支持高 DPI 文本渲染**Label、RichText 组件)
![demo4](/demo-imgs/demo4.png)
- **重构动态合图**(支持自动多纹理合批、优化算法、复用废弃空间等特性)
![demo2](/demo-imgs/demo2.png)
- **重构 Label 组件的 CHAR 缓存模式**(支持自动多纹理合批、多图集、复用废弃空间等特性)
![demo3](/demo-imgs/demo3.png)
- **Spine 组件支持与其它组件合批、合入动态图集与 SpriteFrame 换装**
![demo5](/demo-imgs/demo5.png)
## 功能演示
[Web Desktop 演示项目](https://smallmain.github.io/cocos-service-pack/demo/v1.0.0/web-desktop/index.html)
[Web Mobile 演示项目](https://smallmain.github.io/cocos-service-pack/demo/v1.0.0/web-mobile/index.html)(请将设备横屏)
:::note 提示
@@ -36,12 +51,6 @@ hide_title: true
:::
## 功能演示
[Web Desktop 演示项目](https://smallmain.github.io/cocos-service-pack/demo/v1.0.0-alpha/web-desktop/index.html)
[Web Mobile 演示项目](https://smallmain.github.io/cocos-service-pack/demo/v1.0.0-alpha/web-mobile/index.html)(请将设备横屏)
## 使用方法
请阅读文档的 [安装指南](./installation-guide/installation-intro.mdx) 与 [入门教程](./start-guide/start-guide-intro.mdx)。
@@ -93,4 +102,4 @@ hide_title: true
### 启动 Cocos Creator 报 Error: Can not parse this input:undefined 错误
没有找到服务包的内置资源,请记得安装配套的引擎扩展
这是你可能忘记安装配套的引擎扩展,所以没有找到服务包的内置资源导致的报错

View File

@@ -31,19 +31,19 @@ cc.sp.labelRetinaScale = 2; // 渲染文本时纹理的缩放倍数,默认
官方文档中介绍了替换 attachment 对象进行换装的方法,但如果动画中有切换 attachment 的关键帧,这种方法就失效了。
还有一种方法是替换 attachment 的 region 对象来进行换装,但这种方法引擎没有直接支持,所以服务包对其进行了完善
还有一种方法是修改 attachment 的 region 对象来进行换装,但这种方法引擎没有直接支持,所以服务包对其进行了支持
只需要一句代码即可使用 cc.SpriteFrame 替换指定 attachment 的 region 对象:
只需要一句代码即可使用 cc.SpriteFrame 的数据修改 attachment 的 region 对象数据
```js
this.skel.setRegion('head', 'head', sp.SkeletonData.createRegion(spriteFrame));
skeletonComponent.setRegionData('Head', 'Head', new sp.RegionData(spriteFrame));
```
![changespine](./assets/changespine.png)
> 图片中是被换头的小男孩。
这样做是直接替换了 SkeletonData 的数据,一般情况下所有使用该数据的 Spine 组件都会受到影响,但我们提供了克隆 SkeletonData 数据的接口,可前往 [Spine](../user-guide/spine/spine-intro.mdx) 文档了解更多详情。
这样做是直接修改了 SkeletonData 的数据,所有使用该数据的 Spine 组件都会受到影响(被换头),但我们提供了克隆 SkeletonData 数据的接口,可前往 [Spine](../user-guide/spine/spine-intro.mdx) 文档了解更多详情。
:::tip 提示

View File

@@ -11,7 +11,7 @@ toc_max_heading_level: 5
---
## 创建多纹理材质
你可以正常创建一个材质文件Effect 选择内置的多纹理 Effect 着色器 `multi-2d-sprite` 即可。
你可以正常创建一个材质文件Effect 选择内置的多纹理 Effect 着色器 `multi-2d-universal` 即可。
![material-settings](./assets/material-settings.png)
@@ -44,8 +44,6 @@ toc_max_heading_level: 5
Spine 组件使用多纹理材质时会强制勾选 `enableBatch`,因为不开启就不能合批,那也就没必要使用多纹理材质。
并且使用多纹理材质时暂时不支持染色效果,会强制关闭 `useTint` 选项。
:::
---
@@ -55,7 +53,7 @@ Spine 组件使用多纹理材质时会强制勾选 `enableBatch`,因为不开
除了直接在内置着色器的基础上修改之外,任何着色器中如果存在一个宏 `USE_MULTI_TEXTURE = true`,则会被认为是多纹理材质。
[演示项目](https://smallmain.github.io/cocos-service-pack/demo/v1.0.0-alpha/web-desktop/index.html) 中有自定义材质的示范代码。
[演示项目](https://smallmain.github.io/cocos-service-pack/demo/v1.0.0/web-desktop/index.html) 中有自定义材质的示范代码。
:::tip 提示

View File

@@ -1,8 +1,14 @@
---
sidebar_position: 2
description: "随心所欲地控制动态合图的使用。"
description: "像其它渲染组件一样在 Spine 组件上使用动态合图。"
---
# 动态合图
你可以像其它渲染组件一样在 Spine 组件上使用动态合图,如果想了解有关动态合图的更多详情,可以阅读 [动态合图](../dynamic-batcher/dynamic-batcher-intro.mdx) 文档。
:::caution 注意
由于引擎实现差异,在原生平台上 Spine 暂不支持与其它组件合批。
:::

View File

@@ -12,3 +12,11 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
你可以阅读下面的文档了解详情:
<DocCardList items={useCurrentSidebarCategory().items}/>
:::caution 注意
由于引擎这部分的 C++ 实现与 JavaScript 实现在一些细节上不太一样,比如一些内部函数的执行时机。
所以当你在 Web 平台上测试得出的一些结论请不要想当然地以为在原生平台上也一样,具体实现差异请阅读 Spine 的原理文档。
:::

View File

@@ -1,83 +1,91 @@
---
sidebar_position: 2
description: "随心所欲地控制动态合图的使用。"
description: "随心所欲地更换 Spine 动画的部份纹理。"
---
# SpriteFrame 换装
引擎提供了一个替换插槽的 attachment 对象进行换装的方法,可以在 [Spine 组件参考](https://docs.cocos.com/creator/2.4/manual/zh/components/spine.html) 官方文档进行了解。
但是这种方法比较绕,并且 Spine 动画中有切换 attachment 的关键帧时会导致失效
但是使用替换插槽的 attachment 对象这种方法比较绕,并且 Spine 动画中有切换 attachment 的关键帧时这种方法就没用了
而 attachment 对象持有一个 region 对象,region 对象有点类似引擎的 SpriteFrame所以我们可以通过更换 region 对象来进行换装。
而 attachment 对象持有一个 region 对象,这个对象类似引擎的 SpriteFrame所以我们可以通过修改 region 对象的数据来进行换装。
---
## Region 与 SpriteFrame 互转
## 认识 RegionData
首先服务包提供了 Region 与 SpriteFrame 对象相互转换的接口
请勿混淆 RegionData 与 regionRegionData 主要作为 SpriteFrame 和 region 对象之间的桥梁,实现两者的相互转换。
SpriteFrame 转为 Region
SpriteFrame 转为 RegionData
```js
const region = sp.SkeletonData.createRegion(spriteFrame);
const regionData = new sp.RegionData(spriteFrame);
```
Region 转为 SpriteFrame
RegionData为 SpriteFrame
```js
const spriteFrame = sp.SkeletonData.createSpriteFrame(region);
const spriteFrame = regionData.toSpriteFrame();
```
将 attachment 对象的 region 数据转换为 RegionData
```js
const regionData = new sp.RegionData(attachment);
```
将 RegionData 数据更新到 attachment 对象上:
```js
regionData.assignToAttachment(attachment);
```
:::caution 注意
Spine 的 Region 支持 `0``90``180``270` 四种旋转角度,而 Cocos Creator 的 SpriteFrame 只支持 `0``270` 两种旋转角度,所以如果是 Region 转为 SpriteFrame 则可能导致方向不同的问题**要进行换装的话使用的是 SpriteFrame 转为 Region所以不用担心这个问题。**
Spine 的 Region 支持 `0``90``180``270` 四种旋转角度,而 Cocos Creator 的 SpriteFrame 只支持 `0``270` 两种旋转角度,所以如果是 RegionData 转为 SpriteFrame 则可能导致方向不同的问题
**要进行换装的话使用的是 SpriteFrame 转为 RegionData所以不用担心这个问题。**
:::
---
## 替换 Region 对象
## 使用 SpriteFrame 修改 Region 数据
使用上面的接口将 SpriteFrame 转为 Region 后,就可以调用服务包提供的设置 Region 接口来进行换装了。
虽然使用上面的 RegionData 即可实现使用 SpriteFrame 换装的需求,但我们还在 Spine 组件上提供了两个更方便的接口:
这个接口在 Spine 组件上:
只使用 `regionData.assignToAttachment(attachment)` 只会修改 SkeletonData 的数据,但不会触发 Spine 组件的渲染更新。
推荐直接使用:
```js
spine.setRegion(slotName, attachmentName, region);
skeletonComponent.setRegionData('Head', 'Head', new sp.RegionData(spriteFrame));
```
还有一个获取 Region 对象的接口:
在修改的同时刷新组件的渲染实现换装,并且不会打断当前正在播放的动画。
还提供了一个通过 attachment 名称获取 RegionData 的接口:
```js
a.getRegion(slotName, attachmentName);
```
将转换与设置的代码结合,你就可以使用一行代码进行换装了。
```
spine.setRegion('head', 'head', sp.SkeletonData.createRegion(spriteFrame));
```
效果就像这样:
---
## 注意事项
### 多实例问题
替换 Region 对象实际上是在 Spine 组件所使用 SkeletonData 上进行替换的,所以所有使用这个 SkeletonData 进行渲染的组件都会被替换
由于是直接修改 Spine 组件所使用 SkeletonData 的 attachment 数据,所以所有 Spine 组件都会受到影响
如果你只想替换其中一个组件的显示,那么就可以让所有组件都使用不同的 SkeletonData 进行渲染。
如果你只想替换其中一个组件,那么就可以克隆这个 SkeletonData 让每个组件都使用不同的 SkeletonData 实例进行渲染。
服务包提供了一个克隆接口来实现这个需求,你可以使用
服务包提供了一个克隆数据的接口来实现这个需求:
```js
const clonedSkeletonData = skeletonData.clone();
```
克隆 SkeletonData,然后再进行换装,赋值给 Spine 组件。
使用以上代码克隆 SkeletonData 后再进行换装,赋值给 Spine 组件,那么替换操作就只会对这个 Spine 组件生效
---
以上所有用法你可以在 [演示项目](https://smallmain.github.io/cocos-service-pack/demo/v1.0.0-alpha/web-desktop/index.html) 中找到示范代码。
以上所有用法你可以在 [演示项目](https://smallmain.github.io/cocos-service-pack/demo/v1.0.0/web-desktop/index.html) 中找到示范代码。

View File

@@ -36,7 +36,7 @@ cc.sp.charAtlasAutoResetBeforeSceneLoad = false;
const material = cc.Label._shareAtlas.material;
```
获取修改该材质。
获取修改或替换该材质。
渲染时内部会先判断当前所使用的是否为多纹理材质,是的话判断是否能在材质纹理插槽中找到字符图集纹理,如果有一个判断不满足则会将组件的材质设为内部维护的材质。

View File

@@ -7,7 +7,7 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Cocos Service Pack',
tagline: ' Cocos Creator 加点料',
tagline: '提供 Cocos Creator 引擎特性增强、修复与优化的开源非官方服务包',
url: 'https://smallmain.github.io',
baseUrl: '/cocos-service-pack/',
onBrokenLinks: 'throw',
@@ -93,51 +93,6 @@ const config = {
},
],
},
footer: {
style: 'dark',
links: [
// {
// title: 'Docs',
// items: [
// {
// label: 'Tutorial',
// to: '/docs/intro',
// },
// ],
// },
// {
// title: 'Community',
// items: [
// {
// label: 'Stack Overflow',
// href: 'https://stackoverflow.com/questions/tagged/docusaurus',
// },
// {
// label: 'Discord',
// href: 'https://discordapp.com/invite/docusaurus',
// },
// {
// label: 'Twitter',
// href: 'https://twitter.com/docusaurus',
// },
// ],
// },
// {
// title: 'More',
// items: [
// // {
// // label: 'Blog',
// // to: '/blog',
// // },
// {
// label: 'GitHub',
// href: 'https://github.com/facebook/docusaurus',
// },
// ],
// },
],
copyright: `Copyright © ${new Date().getFullYear()} Cocos Service Pack.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,

View File

@@ -10,32 +10,34 @@ type FeatureItem = {
const FeatureList: FeatureItem[] = [
{
title: 'Easy to Use',
Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default,
title: '性能提升',
description: (
<>
Docusaurus was designed from the ground up to be easily installed and
used to get your website up and running quickly.
</>
),
},
{
title: 'Focus on What Matters',
Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
title: '完全开源',
description: (
<>
Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go
ahead and move your docs into the <code>docs</code> directory.
JavaScript
</>
),
},
{
title: 'Powered by React',
Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
title: '原生体验',
description: (
<>
Extend or customize your website layout by reusing React. Docusaurus can
be extended while reusing the same header and footer.
使
</>
),
},
{
title: '增强特性',
description: (
<>
DPI Spine
</>
),
},
@@ -43,10 +45,10 @@ const FeatureList: FeatureItem[] = [
function Feature({title, Svg, description}: FeatureItem) {
return (
<div className={clsx('col col--4')}>
<div className="text--center">
<div className={clsx('col col--3')}>
{/* <div className="text--center">
<Svg className={styles.featureSvg} role="img" />
</div>
</div> */}
<div className="text--center padding-horiz--md">
<h3>{title}</h3>
<p>{description}</p>

View File

@@ -19,6 +19,6 @@
.buttons {
display: flex;
align-items: center;
margin-top: 60px;
margin-top: 70px;
/* justify-content: center; */
}

View File

@@ -11,59 +11,36 @@ function HomepageHeader() {
const { siteConfig } = useDocusaurusContext();
return (
//
<header className={clsx('hero', styles.heroBanner)} style={{ height: "80vh" }}>
<header className={clsx('hero', styles.heroBanner)} style={{ height: "60vh" }}>
<div className="container">
<div className="row">
<div className="col col--8">
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline + ""}</p>
<div>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}>2D </span>
</p>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}>2D </span>
DPI
</p>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}></span>
</p>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}>Label </span>
Char
</p>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}>Spine </span>
SpriteFrame
</p>
</div>
<div className={styles.buttons}>
<Link
className="button button--primary button--lg"
to="/docs/intro"
style={{ marginRight: 20 }}
>
使
</Link>
<Link
className="button button--outline button--primary button--lg"
href='https://smallmain.github.io/cocos-service-pack/demo/v1.0.0-alpha/web-desktop/index.html'
style={{ marginRight: 20 }}
>
</Link>
<Link
className="button button--secondary button--lg"
href='https://github.com/smallmain/cocos-service-pack'>
<svg style={{ marginRight: 8, marginBottom: -4 }} stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 496 512" className="GithubIcon_3htU" height="1.2em" width="1.2em" xmlns="http://www.w3.org/2000/svg"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg>
GitHub
</Link>
</div>
</div>
<div className="col col--4">
<Rocket width={'30rem'} height={'26rem'} className='banner-img' />
<div class="row" style={{ justifyContent: "center" }}>
<h1 className="hero__title" style={{ marginLeft: 0, fontWeight: "500", letterSpacing: 3 }}>{siteConfig.title}</h1>
</div>
<div class="row" style={{ justifyContent: "center" }}>
<p className="hero__subtitle" style={{ fontSize: "18px" }}>{siteConfig.tagline}</p>
</div>
<div class="row" style={{ justifyContent: "center" }}>
<div className={styles.buttons}>
<Link
className="button button--primary button--lg"
to="/docs/intro"
style={{ marginRight: 20 }}
>
使
</Link>
<Link
className="button button--outline button--primary button--lg"
href='https://smallmain.github.io/cocos-service-pack/demo/v1.0.0-alpha/web-desktop/index.html'
style={{ marginRight: 20 }}
>
</Link>
<Link
className="button button--secondary button--lg"
href='https://github.com/smallmain/cocos-service-pack'>
<svg style={{ marginRight: 8, marginBottom: -4 }} stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 496 512" className="GithubIcon_3htU" height="1.2em" width="1.2em" xmlns="http://www.w3.org/2000/svg"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg>
GitHub
</Link>
</div>
</div>
</div>
@@ -79,7 +56,7 @@ export default function Home(): JSX.Element {
description="Description will go into a meta tag in <head />">
<HomepageHeader />
<main>
{/* <HomepageFeatures /> */}
<HomepageFeatures />
</main>
</Layout>
);

BIN
docs/static/demo-imgs/demo1.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

BIN
docs/static/demo-imgs/demo2.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
docs/static/demo-imgs/demo3.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

BIN
docs/static/demo-imgs/demo4.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 KiB

BIN
docs/static/demo-imgs/demo5.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 880 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,321 +0,0 @@
[
1,
0,
0,
[
[
"cc.EffectAsset",
[
"_name",
"shaders",
"techniques"
],
0
]
],
[
[
0,
0,
1,
2,
4
]
],
[
[
0,
"multi-2d-sprite",
[
{
"hash": 3894394603,
"record": null,
"name": "multi-2d-sprite|vs|fs",
"glsl3": {
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#if USE_MULTI_TEXTURE\nin float a_texId;\nout float v_texId;\n#endif\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 #if USE_MULTI_TEXTURE\n v_texId = a_texId;\n #endif\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#if USE_MULTI_TEXTURE\nin float v_texId;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nuniform sampler2D texture6;\nuniform sampler2D texture7;\nuniform sampler2D texture8;\n#endif\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n #if USE_MULTI_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 #else\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 #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
},
"glsl1": {
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#if USE_MULTI_TEXTURE\nattribute float a_texId;\nvarying float v_texId;\n#endif\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 #if USE_MULTI_TEXTURE\n v_texId = a_texId;\n #endif\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#if USE_MULTI_TEXTURE\nvarying float v_texId;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nuniform sampler2D texture6;\nuniform sampler2D texture7;\nuniform sampler2D texture8;\n#endif\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n #if USE_MULTI_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 #else\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 #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
},
"builtins": {
"globals": {
"blocks": [
{
"name": "CCGlobal",
"defines": []
}
],
"samplers": []
},
"locals": {
"blocks": [
{
"name": "CCLocal",
"defines": []
}
],
"samplers": []
}
},
"defines": [
{
"name": "USE_TEXTURE",
"type": "boolean",
"defines": []
},
{
"name": "USE_MULTI_TEXTURE",
"type": "boolean",
"defines": [
"USE_TEXTURE"
]
},
{
"name": "CC_USE_MODEL",
"type": "boolean",
"defines": []
},
{
"name": "USE_ALPHA_TEST",
"type": "boolean",
"defines": []
},
{
"name": "CC_USE_ALPHA_ATLAS_texture",
"type": "boolean",
"defines": [
"USE_TEXTURE"
]
},
{
"name": "INPUT_IS_GAMMA",
"type": "boolean",
"defines": [
"USE_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture2",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture3",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture4",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture5",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture6",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture7",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture8",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
}
],
"blocks": [
{
"name": "ALPHA_TEST",
"binding": 0,
"members": [
{
"name": "alphaThreshold",
"type": 13,
"count": 1
}
],
"defines": [
"USE_ALPHA_TEST"
]
}
],
"samplers": [
{
"name": "texture",
"type": 29,
"count": 1,
"binding": 30,
"defines": [
"USE_TEXTURE"
]
},
{
"name": "texture2",
"type": 29,
"count": 1,
"binding": 31,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture3",
"type": 29,
"count": 1,
"binding": 32,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture4",
"type": 29,
"count": 1,
"binding": 33,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture5",
"type": 29,
"count": 1,
"binding": 34,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture6",
"type": 29,
"count": 1,
"binding": 35,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture7",
"type": 29,
"count": 1,
"binding": 36,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture8",
"type": 29,
"count": 1,
"binding": 37,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
}
]
}
],
[
{
"passes": [
{
"program": "multi-2d-sprite|vs|fs",
"blendState": {
"targets": [
{
"blend": true
}
]
},
"rasterizerState": {
"cullMode": 0
},
"properties": {
"texture": {
"value": "white",
"type": 29
},
"texture2": {
"value": "white",
"type": 29
},
"texture3": {
"value": "white",
"type": 29
},
"texture4": {
"value": "white",
"type": 29
},
"texture5": {
"value": "white",
"type": 29
},
"texture6": {
"value": "white",
"type": 29
},
"texture7": {
"value": "white",
"type": 29
},
"texture8": {
"value": "white",
"type": 29
},
"alphaThreshold": {
"type": 13,
"value": [
0.5
]
}
}
}
]
}
]
]
],
0,
0,
[],
[],
[]
]

View File

@@ -1 +0,0 @@
{"version":3,"sources":["assets/spine/skin/spine-skin.ts"],"names":["_a","cc","_decorator","ccclass","property","SpineSkin","_super","__extends","_this","apply","this","arguments","addBoyBtn","removeBoyBtn","randomChangeBtn","boy","heads","boys","prototype","start","boySpine","getComponentInChildren","sp","Skeleton","newSkeletonData","skeletonData","clone","animation","push","on","newBoy","instantiate","newBoySpine","parent","addChild","setPosition","length","position","x","setAnimationCacheMode","AnimationCacheMode","PRIVATE_CACHE","Label","string","destroy","setRegion","SkeletonData","createRegion","Math","floor","random","__decorate","Node","SpriteFrame","Component","exports","default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAM,IAAAA,KAAAC,GAAAC,YAAAC,UAAAH,GAAAG,SAAAC,WAAAJ,GAAAI;IAGN,IAAAC,YAAA,SAAAC;MAAuCC,UAAAF,WAAAC;MAAvC,SAAAD;QAAA,IAAAG,QAAA,SAAAF,UAAAA,OAAAG,MAAAC,MAAAC,cAAAD;QAGIF,MAAAI,YAAA;QAGAJ,MAAAK,eAAA;QAGAL,MAAAM,kBAAA;QAGAN,MAAAO,MAAA;QAGAP,MAAAQ,QAAA;QAEAR,MAAAS,OAAA;;;MAEUZ,UAAAa,UAAAC,QAAA;QAAV,IAAAX,QAAAE;QACI,IAAAU,WAAAV,KAAAK,IAAAM,uBAAAC,GAAAC;QACA,IAAAC,kBAAAJ,SAAAK,aAAAC;QACAN,SAAAK,eAAAD;QACAJ,SAAAO,YAAA;QAEAjB,KAAAO,KAAAW,KAAAlB,KAAAK;QAEAL,KAAAE,UAAAiB,GAAA,SAAA;UACI,IAAAC,SAAA7B,GAAA8B,YAAAvB,MAAAO;UACA,IAAAiB,cAAAF,OAAAT,uBAAAC,GAAAC;UACAS,YAAAP,eAAAL,SAAAK,aAAAC;UACAM,YAAAL,YAAA;UAEAnB,MAAAO,IAAAkB,OAAAC,SAAAJ;UACAA,OAAAK,YAAA3B,MAAAS,KAAAT,MAAAS,KAAAmB,SAAA,GAAAC;UACAP,OAAAQ,KAAA;UACA,IAAA9B,MAAAS,KAAAmB,SAAA,MAAA,GAAA;YACIN,OAAAT,uBAAAC,GAAAC,UAAAgB,sBAAAjB,GAAAC,SAAAiB,mBAAAC;YACAX,OAAAT,uBAAApB,GAAAyC,OAAAC,SAAA;;UAEJnC,MAAAS,KAAAW,KAAAE;;QAGJpB,KAAAG,aAAAgB,GAAA,SAAA;UACI,IAAArB,MAAAS,KAAAmB,SAAA,GAAA;YACI5B,MAAAS,KAAAT,MAAAS,KAAAmB,SAAA,GAAAQ;YACApC,MAAAS,KAAAmB,UAAA;;;QAIR1B,KAAAI,gBAAAe,GAAA,SAAA;UACI,IAAAd,MAAAP,MAAAS,KAAAT,MAAAS,KAAAmB,SAAA,GAAAf,uBAAAC,GAAAC;UACAR,IAAA8B,UAAA,QAAA,QAAAvB,GAAAwB,aAAAC,aAAAvC,MAAAQ,MAAAgC,KAAAC,MAAAD,KAAAE,WAAA1C,MAAAQ,MAAA;;;MAjDRmC,WAAA,EADC/C,SAAAH,GAAAmD,SACyB/C,UAAAa,WAAA,kBAAA;MAG1BiC,WAAA,EADC/C,SAAAH,GAAAmD,SAC4B/C,UAAAa,WAAA,qBAAA;MAG7BiC,WAAA,EADC/C,SAAAH,GAAAmD,SAC+B/C,UAAAa,WAAA,wBAAA;MAGhCiC,WAAA,EADC/C,SAAAH,GAAAmD,SACmB/C,UAAAa,WAAA,YAAA;MAGpBiC,WAAA,EADC/C,SAAA,EAAAH,GAAAoD,kBAC4BhD,UAAAa,WAAA,cAAA;MAfZb,YAAA8C,WAAA,EADpBhD,WACoBE;MAwDrB,OAAAA;KAxDA,CAAAJ,GAAAqD;IAAqBC,QAAAC,UAAAnD","sourcesContent":["const { ccclass, property } = cc._decorator;\n\n@ccclass\nexport default class SpineSkin extends cc.Component {\n\n @property(cc.Node)\n addBoyBtn: cc.Node = null;\n\n @property(cc.Node)\n removeBoyBtn: cc.Node = null;\n\n @property(cc.Node)\n randomChangeBtn: cc.Node = null;\n\n @property(cc.Node)\n boy: cc.Node = null;\n\n @property([cc.SpriteFrame])\n heads: cc.SpriteFrame[] = [];\n\n boys: cc.Node[] = [];\n\n protected start(): void {\n const boySpine = this.boy.getComponentInChildren(sp.Skeleton);\n const newSkeletonData = boySpine.skeletonData.clone();\n boySpine.skeletonData = newSkeletonData;\n boySpine.animation = 'attack';\n\n this.boys.push(this.boy);\n\n this.addBoyBtn.on('click', () => {\n const newBoy = cc.instantiate(this.boy);\n const newBoySpine = newBoy.getComponentInChildren(sp.Skeleton);\n newBoySpine.skeletonData = boySpine.skeletonData.clone();\n newBoySpine.animation = 'attack';\n\n this.boy.parent.addChild(newBoy);\n newBoy.setPosition(this.boys[this.boys.length - 1].position);\n newBoy.x += 100;\n if (this.boys.length % 2 === 1) {\n newBoy.getComponentInChildren(sp.Skeleton).setAnimationCacheMode(sp.Skeleton.AnimationCacheMode.PRIVATE_CACHE);\n newBoy.getComponentInChildren(cc.Label).string = `Spine - Cache`;\n }\n this.boys.push(newBoy);\n });\n\n this.removeBoyBtn.on('click', () => {\n if (this.boys.length > 1) {\n this.boys[this.boys.length - 1].destroy();\n this.boys.length -= 1;\n }\n });\n\n this.randomChangeBtn.on('click', () => {\n const boy = this.boys[this.boys.length - 1].getComponentInChildren(sp.Skeleton);\n boy.setRegion('Head', 'Head', sp.SkeletonData.createRegion(this.heads[Math.floor(Math.random() * (this.heads.length))]));\n });\n }\n\n}\n"],"file":"index.js"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,321 +0,0 @@
[
1,
0,
0,
[
[
"cc.EffectAsset",
[
"_name",
"shaders",
"techniques"
],
0
]
],
[
[
0,
0,
1,
2,
4
]
],
[
[
0,
"multi-2d-sprite",
[
{
"hash": 3894394603,
"record": null,
"name": "multi-2d-sprite|vs|fs",
"glsl3": {
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#if USE_MULTI_TEXTURE\nin float a_texId;\nout float v_texId;\n#endif\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 #if USE_MULTI_TEXTURE\n v_texId = a_texId;\n #endif\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#if USE_MULTI_TEXTURE\nin float v_texId;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nuniform sampler2D texture6;\nuniform sampler2D texture7;\nuniform sampler2D texture8;\n#endif\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n #if USE_MULTI_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 #else\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 #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
},
"glsl1": {
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#if USE_MULTI_TEXTURE\nattribute float a_texId;\nvarying float v_texId;\n#endif\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 #if USE_MULTI_TEXTURE\n v_texId = a_texId;\n #endif\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#if USE_MULTI_TEXTURE\nvarying float v_texId;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nuniform sampler2D texture6;\nuniform sampler2D texture7;\nuniform sampler2D texture8;\n#endif\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n #if USE_MULTI_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 #else\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 #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
},
"builtins": {
"globals": {
"blocks": [
{
"name": "CCGlobal",
"defines": []
}
],
"samplers": []
},
"locals": {
"blocks": [
{
"name": "CCLocal",
"defines": []
}
],
"samplers": []
}
},
"defines": [
{
"name": "USE_TEXTURE",
"type": "boolean",
"defines": []
},
{
"name": "USE_MULTI_TEXTURE",
"type": "boolean",
"defines": [
"USE_TEXTURE"
]
},
{
"name": "CC_USE_MODEL",
"type": "boolean",
"defines": []
},
{
"name": "USE_ALPHA_TEST",
"type": "boolean",
"defines": []
},
{
"name": "CC_USE_ALPHA_ATLAS_texture",
"type": "boolean",
"defines": [
"USE_TEXTURE"
]
},
{
"name": "INPUT_IS_GAMMA",
"type": "boolean",
"defines": [
"USE_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture2",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture3",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture4",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture5",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture6",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture7",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture8",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
}
],
"blocks": [
{
"name": "ALPHA_TEST",
"binding": 0,
"members": [
{
"name": "alphaThreshold",
"type": 13,
"count": 1
}
],
"defines": [
"USE_ALPHA_TEST"
]
}
],
"samplers": [
{
"name": "texture",
"type": 29,
"count": 1,
"binding": 30,
"defines": [
"USE_TEXTURE"
]
},
{
"name": "texture2",
"type": 29,
"count": 1,
"binding": 31,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture3",
"type": 29,
"count": 1,
"binding": 32,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture4",
"type": 29,
"count": 1,
"binding": 33,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture5",
"type": 29,
"count": 1,
"binding": 34,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture6",
"type": 29,
"count": 1,
"binding": 35,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture7",
"type": 29,
"count": 1,
"binding": 36,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture8",
"type": 29,
"count": 1,
"binding": 37,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
}
]
}
],
[
{
"passes": [
{
"program": "multi-2d-sprite|vs|fs",
"blendState": {
"targets": [
{
"blend": true
}
]
},
"rasterizerState": {
"cullMode": 0
},
"properties": {
"texture": {
"value": "white",
"type": 29
},
"texture2": {
"value": "white",
"type": 29
},
"texture3": {
"value": "white",
"type": 29
},
"texture4": {
"value": "white",
"type": 29
},
"texture5": {
"value": "white",
"type": 29
},
"texture6": {
"value": "white",
"type": 29
},
"texture7": {
"value": "white",
"type": 29
},
"texture8": {
"value": "white",
"type": 29
},
"alphaThreshold": {
"type": 13,
"value": [
0.5
]
}
}
}
]
}
]
]
],
0,
0,
[],
[],
[]
]

View File

@@ -1 +0,0 @@
{"version":3,"sources":["assets/spine/skin/spine-skin.ts"],"names":["_a","cc","_decorator","ccclass","property","SpineSkin","_super","__extends","_this","apply","this","arguments","addBoyBtn","removeBoyBtn","randomChangeBtn","boy","heads","boys","prototype","start","boySpine","getComponentInChildren","sp","Skeleton","newSkeletonData","skeletonData","clone","animation","push","on","newBoy","instantiate","newBoySpine","parent","addChild","setPosition","length","position","x","setAnimationCacheMode","AnimationCacheMode","PRIVATE_CACHE","Label","string","destroy","setRegion","SkeletonData","createRegion","Math","floor","random","__decorate","Node","SpriteFrame","Component","exports","default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAM,IAAAA,KAAAC,GAAAC,YAAAC,UAAAH,GAAAG,SAAAC,WAAAJ,GAAAI;IAGN,IAAAC,YAAA,SAAAC;MAAuCC,UAAAF,WAAAC;MAAvC,SAAAD;QAAA,IAAAG,QAAA,SAAAF,UAAAA,OAAAG,MAAAC,MAAAC,cAAAD;QAGIF,MAAAI,YAAA;QAGAJ,MAAAK,eAAA;QAGAL,MAAAM,kBAAA;QAGAN,MAAAO,MAAA;QAGAP,MAAAQ,QAAA;QAEAR,MAAAS,OAAA;;;MAEUZ,UAAAa,UAAAC,QAAA;QAAV,IAAAX,QAAAE;QACI,IAAAU,WAAAV,KAAAK,IAAAM,uBAAAC,GAAAC;QACA,IAAAC,kBAAAJ,SAAAK,aAAAC;QACAN,SAAAK,eAAAD;QACAJ,SAAAO,YAAA;QAEAjB,KAAAO,KAAAW,KAAAlB,KAAAK;QAEAL,KAAAE,UAAAiB,GAAA,SAAA;UACI,IAAAC,SAAA7B,GAAA8B,YAAAvB,MAAAO;UACA,IAAAiB,cAAAF,OAAAT,uBAAAC,GAAAC;UACAS,YAAAP,eAAAL,SAAAK,aAAAC;UACAM,YAAAL,YAAA;UAEAnB,MAAAO,IAAAkB,OAAAC,SAAAJ;UACAA,OAAAK,YAAA3B,MAAAS,KAAAT,MAAAS,KAAAmB,SAAA,GAAAC;UACAP,OAAAQ,KAAA;UACA,IAAA9B,MAAAS,KAAAmB,SAAA,MAAA,GAAA;YACIN,OAAAT,uBAAAC,GAAAC,UAAAgB,sBAAAjB,GAAAC,SAAAiB,mBAAAC;YACAX,OAAAT,uBAAApB,GAAAyC,OAAAC,SAAA;;UAEJnC,MAAAS,KAAAW,KAAAE;;QAGJpB,KAAAG,aAAAgB,GAAA,SAAA;UACI,IAAArB,MAAAS,KAAAmB,SAAA,GAAA;YACI5B,MAAAS,KAAAT,MAAAS,KAAAmB,SAAA,GAAAQ;YACApC,MAAAS,KAAAmB,UAAA;;;QAIR1B,KAAAI,gBAAAe,GAAA,SAAA;UACI,IAAAd,MAAAP,MAAAS,KAAAT,MAAAS,KAAAmB,SAAA,GAAAf,uBAAAC,GAAAC;UACAR,IAAA8B,UAAA,QAAA,QAAAvB,GAAAwB,aAAAC,aAAAvC,MAAAQ,MAAAgC,KAAAC,MAAAD,KAAAE,WAAA1C,MAAAQ,MAAA;;;MAjDRmC,WAAA,EADC/C,SAAAH,GAAAmD,SACyB/C,UAAAa,WAAA,kBAAA;MAG1BiC,WAAA,EADC/C,SAAAH,GAAAmD,SAC4B/C,UAAAa,WAAA,qBAAA;MAG7BiC,WAAA,EADC/C,SAAAH,GAAAmD,SAC+B/C,UAAAa,WAAA,wBAAA;MAGhCiC,WAAA,EADC/C,SAAAH,GAAAmD,SACmB/C,UAAAa,WAAA,YAAA;MAGpBiC,WAAA,EADC/C,SAAA,EAAAH,GAAAoD,kBAC4BhD,UAAAa,WAAA,cAAA;MAfZb,YAAA8C,WAAA,EADpBhD,WACoBE;MAwDrB,OAAAA;KAxDA,CAAAJ,GAAAqD;IAAqBC,QAAAC,UAAAnD","sourcesContent":["const { ccclass, property } = cc._decorator;\n\n@ccclass\nexport default class SpineSkin extends cc.Component {\n\n @property(cc.Node)\n addBoyBtn: cc.Node = null;\n\n @property(cc.Node)\n removeBoyBtn: cc.Node = null;\n\n @property(cc.Node)\n randomChangeBtn: cc.Node = null;\n\n @property(cc.Node)\n boy: cc.Node = null;\n\n @property([cc.SpriteFrame])\n heads: cc.SpriteFrame[] = [];\n\n boys: cc.Node[] = [];\n\n protected start(): void {\n const boySpine = this.boy.getComponentInChildren(sp.Skeleton);\n const newSkeletonData = boySpine.skeletonData.clone();\n boySpine.skeletonData = newSkeletonData;\n boySpine.animation = 'attack';\n\n this.boys.push(this.boy);\n\n this.addBoyBtn.on('click', () => {\n const newBoy = cc.instantiate(this.boy);\n const newBoySpine = newBoy.getComponentInChildren(sp.Skeleton);\n newBoySpine.skeletonData = boySpine.skeletonData.clone();\n newBoySpine.animation = 'attack';\n\n this.boy.parent.addChild(newBoy);\n newBoy.setPosition(this.boys[this.boys.length - 1].position);\n newBoy.x += 100;\n if (this.boys.length % 2 === 1) {\n newBoy.getComponentInChildren(sp.Skeleton).setAnimationCacheMode(sp.Skeleton.AnimationCacheMode.PRIVATE_CACHE);\n newBoy.getComponentInChildren(cc.Label).string = `Spine - Cache`;\n }\n this.boys.push(newBoy);\n });\n\n this.removeBoyBtn.on('click', () => {\n if (this.boys.length > 1) {\n this.boys[this.boys.length - 1].destroy();\n this.boys.length -= 1;\n }\n });\n\n this.randomChangeBtn.on('click', () => {\n const boy = this.boys[this.boys.length - 1].getComponentInChildren(sp.Skeleton);\n boy.setRegion('Head', 'Head', sp.SkeletonData.createRegion(this.heads[Math.floor(Math.random() * (this.heads.length))]));\n });\n }\n\n}\n"],"file":"index.js"}

File diff suppressed because one or more lines are too long

View File

@@ -8,28 +8,28 @@
"fonts/SFNSMonoItalic",
"cc.TTFFont"
],
"80AR/OlBFOoajT99htLYeJ": [
"fonts/normalFont",
"cc.BitmapFont"
],
"45vlnzVlVDaZ6fRVyB0t3Z": [
"fonts/normalFont",
"cc.Texture2D"
],
"80AR/OlBFOoajT99htLYeJ": [
"fonts/normalFont",
"cc.BitmapFont"
],
"92aqwImq1Ik7GrBSFnKTF2": [
"fonts/normalFont",
"cc.SpriteFrame",
1
],
"c1Hf3Sl8ZAnJwP/fpoHxap": [
"images/1655112479313",
"cc.Texture2D"
],
"a7ZscqX+JCIZRS157bMyhq": [
"images/1655112479313",
"cc.SpriteFrame",
1
],
"c1Hf3Sl8ZAnJwP/fpoHxap": [
"images/1655112479313",
"cc.Texture2D"
],
"62MQQadaVK8qQN8n6UmJAa": [
"images/1655112514006",
"cc.Texture2D"
@@ -39,17 +39,13 @@
"cc.SpriteFrame",
1
],
"39jYWzSTREwI2OOBK5nwFe": [
"images/1655112526123",
"cc.Texture2D"
],
"09o3P/9gBP/Yc7AnxUBZ+Q": [
"images/1655112526123",
"cc.SpriteFrame",
1
],
"d0bST/wYpJQIL5T+PCq46W": [
"images/1655112538161",
"39jYWzSTREwI2OOBK5nwFe": [
"images/1655112526123",
"cc.Texture2D"
],
"70VXjGE0JMUqGli0jmCmTF": [
@@ -57,6 +53,10 @@
"cc.SpriteFrame",
1
],
"d0bST/wYpJQIL5T+PCq46W": [
"images/1655112538161",
"cc.Texture2D"
],
"68Q/ALDvRLfKrAQu5CY15V": [
"images/1655112548981",
"cc.Texture2D"
@@ -84,15 +84,15 @@
"cc.SpriteFrame",
1
],
"a97PGbCjtNjr/hYUBJUJ3p": [
"images/1655799093442",
"cc.Texture2D"
],
"34Wm35ZlJBApgKytyVFWhX": [
"images/1655799093442",
"cc.SpriteFrame",
1
],
"a97PGbCjtNjr/hYUBJUJ3p": [
"images/1655799093442",
"cc.Texture2D"
],
"2cDGL4OAVN0ZbEl3w2urT8": [
"materials/custom-2d-sprite",
"cc.Material"
@@ -101,19 +101,40 @@
"spines/huatuo",
"cc.Asset"
],
"93dM6KrkZCf5dgNpQwf7T6": [
"spines/huatuo",
"sp.SkeletonData"
],
"80ThG1v09KeKxKhEPnFmvh": [
"spines/huatuo",
"cc.Texture2D"
],
"93dM6KrkZCf5dgNpQwf7T6": [
"spines/huatuo",
"sp.SkeletonData"
],
"b5ObM0rx1GDKGN3k5VlH0s": [
"spines/huatuo",
"cc.SpriteFrame",
1
],
"07GcDk8RNGZbcrHAq5lPag": [
"spines/shengxing_kuang",
"cc.SpriteFrame",
1
],
"3479J6IuROz7rZhiZpn63y": [
"spines/shengxing_kuang",
"sp.SkeletonData"
],
"37/FrRNqBAiadz9TDqSpRx": [
"spines/shengxing_kuang",
"cc.Asset"
],
"aaYr2KZ+xPDqeLsRHUKxRA": [
"spines/shengxing_kuang",
"cc.Texture2D"
],
"b6OkwTsm1LK5cvRTwFehiy": [
"spines/spineboy",
"cc.TextAsset"
],
"bc2ZOJo5NCbrI0FXxitEvE": [
"spines/spineboy",
"sp.SkeletonData"
@@ -126,54 +147,57 @@
"spines/spineboy",
"cc.SpriteFrame",
1
],
"b6OkwTsm1LK5cvRTwFehiy": [
"spines/spineboy",
"cc.TextAsset"
]
},
"uuids": [
"3e30KyALhNkZttyuW0A6EU",
"80AR/OlBFOoajT99htLYeJ",
"45vlnzVlVDaZ6fRVyB0t3Z",
"92aqwImq1Ik7GrBSFnKTF2",
"e8ql4cBzBOvoGh5/oNub59",
"c1Hf3Sl8ZAnJwP/fpoHxap",
"a7ZscqX+JCIZRS157bMyhq",
"62MQQadaVK8qQN8n6UmJAa",
"85yTK+9shIo7RQfQ1TDEUi",
"39jYWzSTREwI2OOBK5nwFe",
"07GcDk8RNGZbcrHAq5lPag",
"09o3P/9gBP/Yc7AnxUBZ+Q",
"d0bST/wYpJQIL5T+PCq46W",
"70VXjGE0JMUqGli0jmCmTF",
"68Q/ALDvRLfKrAQu5CY15V",
"87/8ZHBEVIkKeNxmalrn9r",
"70JFWsm5JN17FDywI0Lb5I",
"d0Bu8c2MBCKJc+mKBWzjsJ",
"1cijzBpFJCdoSNK98w5oUq",
"8029xEf4FHy49dWo6NK8c7",
"a97PGbCjtNjr/hYUBJUJ3p",
"34Wm35ZlJBApgKytyVFWhX",
"2cDGL4OAVN0ZbEl3w2urT8",
"34Wm35ZlJBApgKytyVFWhX",
"3479J6IuROz7rZhiZpn63y",
"37/FrRNqBAiadz9TDqSpRx",
"39jYWzSTREwI2OOBK5nwFe",
"3e30KyALhNkZttyuW0A6EU",
"45vlnzVlVDaZ6fRVyB0t3Z",
"62MQQadaVK8qQN8n6UmJAa",
"68Q/ALDvRLfKrAQu5CY15V",
"69Fj/0+E5NeI6nlG9iAH/N",
"93dM6KrkZCf5dgNpQwf7T6",
"6eBWFz0oVHPLIGQKf/9Thu",
"70JFWsm5JN17FDywI0Lb5I",
"70VXjGE0JMUqGli0jmCmTF",
"80AR/OlBFOoajT99htLYeJ",
"80ThG1v09KeKxKhEPnFmvh",
"8029xEf4FHy49dWo6NK8c7",
"85yTK+9shIo7RQfQ1TDEUi",
"87/8ZHBEVIkKeNxmalrn9r",
"92aqwImq1Ik7GrBSFnKTF2",
"93dM6KrkZCf5dgNpQwf7T6",
"a7ZscqX+JCIZRS157bMyhq",
"a97PGbCjtNjr/hYUBJUJ3p",
"aaYr2KZ+xPDqeLsRHUKxRA",
"b5ObM0rx1GDKGN3k5VlH0s",
"bc2ZOJo5NCbrI0FXxitEvE",
"d9xFMK7wVFwbAS60aG9McP",
"f2P0YcCjtHDqebnuMp4CMZ",
"b6OkwTsm1LK5cvRTwFehiy",
"6eBWFz0oVHPLIGQKf/9Thu"
"bc2ZOJo5NCbrI0FXxitEvE",
"c1Hf3Sl8ZAnJwP/fpoHxap",
"d0Bu8c2MBCKJc+mKBWzjsJ",
"d0bST/wYpJQIL5T+PCq46W",
"d9xFMK7wVFwbAS60aG9McP",
"e8ql4cBzBOvoGh5/oNub59",
"f2P0YcCjtHDqebnuMp4CMZ"
],
"scenes": {},
"redirect": [],
"deps": [],
"packs": {
"0472ad032": [
"01d612a1e": [
"07GcDk8RNGZbcrHAq5lPag",
"09o3P/9gBP/Yc7AnxUBZ+Q",
"1cijzBpFJCdoSNK98w5oUq",
"2cDGL4OAVN0ZbEl3w2urT8",
"34Wm35ZlJBApgKytyVFWhX",
"3479J6IuROz7rZhiZpn63y",
"37/FrRNqBAiadz9TDqSpRx",
"39jYWzSTREwI2OOBK5nwFe",
"3e30KyALhNkZttyuW0A6EU",
"45vlnzVlVDaZ6fRVyB0t3Z",
@@ -192,6 +216,7 @@
"93dM6KrkZCf5dgNpQwf7T6",
"a7ZscqX+JCIZRS157bMyhq",
"a97PGbCjtNjr/hYUBJUJ3p",
"aaYr2KZ+xPDqeLsRHUKxRA",
"b5ObM0rx1GDKGN3k5VlH0s",
"b6OkwTsm1LK5cvRTwFehiy",
"bc2ZOJo5NCbrI0FXxitEvE",
@@ -211,12 +236,14 @@
"encrypted": false,
"versions": {
"import": [
"0472ad032",
"4b502"
"01d612a1e",
"92a17"
],
"native": [
"1cijzBpFJCdoSNK98w5oUq",
"91637",
"37/FrRNqBAiadz9TDqSpRx",
"6e46c",
"39jYWzSTREwI2OOBK5nwFe",
"2eb47",
"45vlnzVlVDaZ6fRVyB0t3Z",
@@ -235,6 +262,8 @@
"fd38c",
"a97PGbCjtNjr/hYUBJUJ3p",
"0f278",
"aaYr2KZ+xPDqeLsRHUKxRA",
"48cd8",
"c1Hf3Sl8ZAnJwP/fpoHxap",
"d86d7",
"d0bST/wYpJQIL5T+PCq46W",

View File

@@ -1,6 +1,7 @@
[
1,
[
"aaYr2KZ+xPDqeLsRHUKxRA",
"62MQQadaVK8qQN8n6UmJAa",
"80ThG1v09KeKxKhEPnFmvh",
"d9xFMK7wVFwbAS60aG9McP",
@@ -35,32 +36,6 @@
2,
11
],
[
"cc.EffectAsset",
[
"_name",
"shaders",
"techniques"
],
0
],
[
"cc.Asset",
[
"_name",
"_native"
],
1
],
[
"cc.BitmapFont",
[
"_name",
"fontSize",
"_fntConfig"
],
0
],
[
"sp.SkeletonData",
[
@@ -73,6 +48,32 @@
-1,
3
],
[
"cc.Asset",
[
"_name",
"_native"
],
1
],
[
"cc.EffectAsset",
[
"_name",
"shaders",
"techniques"
],
0
],
[
"cc.BitmapFont",
[
"_name",
"fontSize",
"_fntConfig"
],
0
],
[
"cc.TextAsset",
[
@@ -92,7 +93,7 @@
],
[
[
6,
3,
0,
1,
2,
@@ -100,25 +101,18 @@
4,
5
],
[
2,
0,
1,
2
],
[
3,
0,
1,
2,
4
],
[
4,
0,
1,
3
],
[
2,
0,
1,
2
],
[
5,
0,
@@ -126,6 +120,13 @@
2,
4
],
[
6,
0,
1,
2,
4
],
[
7,
0,
@@ -140,6 +141,46 @@
]
],
[
[
[
{
"name": "shengxing_kuang",
"rect": [
2,
2,
176,
347
],
"offset": [
0,
0
],
"originalSize": [
180,
351
],
"capInsets": [
0,
0,
0,
0
]
}
],
[
1
],
0,
[
0
],
[
0
],
[
0
]
],
[
[
{
@@ -177,7 +218,7 @@
0
],
[
3
4
]
],
[
@@ -196,7 +237,7 @@
[
[
[
1,
2,
"custom-2d-sprite",
[
{},
@@ -241,9 +282,9 @@
3
],
[
0,
4,
5
1,
5,
6
]
],
[
@@ -283,9 +324,174 @@
0
],
[
6
7
]
],
[
[
[
0,
"shengxing_kuang",
"\nshengxing_kuang.png\nsize: 180,351\nformat: RGBA8888\nfilter: Linear,Linear\nrepeat: none\nfx_frame_red\n rotate: false\n xy: 2, 2\n size: 176, 347\n orig: 180, 351\n offset: 2, 2\n index: -1\n",
[
"shengxing_kuang.png"
],
{
"skeleton": {
"hash": "X8GrJN5Hvt74DISCwkkMDigOeyA",
"spine": "3.8.99",
"x": -180,
"y": -351,
"width": 360,
"height": 702,
"images": "./images/",
"audio": ""
},
"bones": [
{
"name": "root"
},
{
"name": "fx_frame",
"parent": "root"
}
],
"slots": [
{
"name": "fx_frame",
"bone": "fx_frame",
"color": "ffffff00",
"dark": "000000",
"attachment": "fx_frame_red",
"blend": "additive"
}
],
"skins": [
{
"name": "default",
"attachments": {
"fx_frame": {
"fx_frame_red": {
"scaleX": 2,
"scaleY": 2,
"width": 180,
"height": 351
}
}
}
}
],
"animations": {
"shengxing_kuang_r": {
"slots": {
"fx_frame": {
"twoColor": [
{
"light": "4aff91c6",
"dark": "009a3e",
"curve": 0.25,
"c3": 0.75
},
{
"time": 0.5,
"light": "49ff9100",
"dark": "009a3e"
}
]
}
}
},
"shengxing_kuang_s": {
"slots": {
"fx_frame": {
"twoColor": [
{
"light": "ffffffc6",
"dark": "fc00ff",
"curve": 0.25,
"c3": 0.75
},
{
"time": 0.5,
"light": "ffffff00",
"dark": "fc00ff"
}
]
}
}
},
"shengxing_kuang_sr": {
"slots": {
"fx_frame": {
"twoColor": [
{
"light": "ffffffc6",
"dark": "ff7300",
"curve": 0.25,
"c3": 0.75
},
{
"time": 0.5,
"light": "ffffff00",
"dark": "ff7300"
}
]
}
}
},
"shengxing_kuang_ssr": {
"slots": {
"fx_frame": {
"twoColor": [
{
"light": "ffffffc5",
"dark": "000000",
"curve": 0.25,
"c3": 0.75
},
{
"time": 0.5,
"light": "ffffff00",
"dark": "000000"
}
]
}
}
}
}
},
[
0
]
]
],
0,
0,
[
0
],
[
-1
],
[
0
]
],
[
[
[
1,
"shengxing_kuang",
".atlas"
],
-1
],
0,
0,
[],
[],
[]
],
[
[
"0,9729,9729,33071,33071,0,0,1",
@@ -302,7 +508,7 @@
[
[
[
2,
3,
"custom-2d-sprite",
[
{
@@ -703,7 +909,7 @@
[
[
[
3,
1,
"huatuo",
".atlas"
],
@@ -778,7 +984,7 @@
0
],
[
7
8
]
],
[
@@ -3058,7 +3264,7 @@
4
],
[
8
9
]
],
[
@@ -3111,7 +3317,7 @@
0
],
[
9
10
]
],
[
@@ -3151,7 +3357,7 @@
0
],
[
0
1
]
],
[
@@ -3191,7 +3397,7 @@
0
],
[
10
11
]
],
[
@@ -3231,7 +3437,7 @@
0
],
[
11
12
]
],
[
@@ -17799,7 +18005,7 @@
"L-Thigh": {
"height": 35,
"hull": 11,
"type": "skinnedmesh",
"type": "mesh",
"width": 29,
"edges": [
0,
@@ -18050,7 +18256,7 @@
"R-Thigh": {
"height": 36,
"hull": 12,
"type": "skinnedmesh",
"type": "mesh",
"width": 30,
"edges": [
0,
@@ -18268,7 +18474,7 @@
"beilou": {
"height": 148,
"hull": 18,
"type": "skinnedmesh",
"type": "mesh",
"width": 113,
"edges": [
0,
@@ -18744,7 +18950,7 @@
-1
],
[
1
2
]
],
[
@@ -18784,7 +18990,7 @@
0
],
[
12
13
]
],
[
@@ -18800,6 +19006,19 @@
[],
[]
],
[
[
"0,9729,9729,33071,33071,0,0,1",
-1
],
[
0
],
0,
[],
[],
[]
],
[
[
{
@@ -18837,7 +19056,7 @@
0
],
[
1
2
]
],
[
@@ -25249,7 +25468,7 @@
-1
],
[
2
3
]
],
[
@@ -25302,7 +25521,7 @@
0
],
[
13
14
]
],
[
@@ -25383,7 +25602,7 @@
0
],
[
2
3
]
]
]

View File

@@ -0,0 +1,13 @@
shengxing_kuang.png
size: 180,351
format: RGBA8888
filter: Linear,Linear
repeat: none
fx_frame_red
rotate: false
xy: 2, 2
size: 176, 347
orig: 180, 351
offset: 2, 2
index: -1

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -6,46 +6,46 @@
]
},
"uuids": [
"e3EaADwKFP+ZmDIVTeFF63",
"ecpdLyjvZBwrvm+cedCcQy",
"312JYturtOx74Zjp9UpOqZ",
"e7q6FL+VZEgLJUjVeDLic/",
"02kcE0s9pAmLe145ftvpR/",
"29FYIk+N1GYaeWH/q1NxQO",
"68J8oyAQdFUrqy37MXmbtE",
"90AErWL21A4ZPvtxQ3XG8G",
"312JYturtOx74Zjp9UpOqZ",
"34Wm35ZlJBApgKytyVFWhX",
"7a/QZLET9IDreTiBfRn2PD",
"93dM6KrkZCf5dgNpQwf7T6",
"56fc2Ai/RFNYpaMT8crweK",
"5cO7kybDxGj4ipyMYdRYZB",
"5f5dyqtRNNxaFmVzYns6FZ",
"a2MjXRFdtLlYQ5ouAFv/+R",
"02kcE0s9pAmLe145ftvpR/",
"56fc2Ai/RFNYpaMT8crweK",
"d2kHe6FidKcpV5e1aiNTQM",
"68J8oyAQdFUrqy37MXmbtE",
"71VhFCTINJM6/Ky3oX9nBT",
"73oJA92A5OPKpn+ZlUPAj1"
"73oJA92A5OPKpn+ZlUPAj1",
"7a/QZLET9IDreTiBfRn2PD",
"90AErWL21A4ZPvtxQ3XG8G",
"93dM6KrkZCf5dgNpQwf7T6",
"a2MjXRFdtLlYQ5ouAFv/+R",
"d2kHe6FidKcpV5e1aiNTQM",
"e3EaADwKFP+ZmDIVTeFF63",
"e7q6FL+VZEgLJUjVeDLic/",
"ecpdLyjvZBwrvm+cedCcQy"
],
"scenes": {},
"redirect": [
"ecpdLyjvZBwrvm+cedCcQy",
0,
"34Wm35ZlJBApgKytyVFWhX",
0,
"5cO7kybDxGj4ipyMYdRYZB",
1,
"5f5dyqtRNNxaFmVzYns6FZ",
1,
"7a/QZLET9IDreTiBfRn2PD",
0,
2,
"93dM6KrkZCf5dgNpQwf7T6",
1,
"5cO7kybDxGj4ipyMYdRYZB",
2,
"5f5dyqtRNNxaFmVzYns6FZ",
2,
0,
"a2MjXRFdtLlYQ5ouAFv/+R",
1,
"ecpdLyjvZBwrvm+cedCcQy",
2
],
"deps": [
"internal",
"common",
"main"
"main",
"internal"
],
"packs": {
"025f75dc8": [

View File

@@ -76,6 +76,7 @@ window.__require = function e(t, n, r) {
var _this = this;
this.prefabs = this.objects.children.concat();
this.objects.removeAllChildren(false);
false;
this.objectNumSlider.node.on("slide", function(slider) {
var offset = (_this.nums[1] - _this.nums[0]) * slider.progress;
_this.num = _this.nums[0] + Math.ceil(offset);

File diff suppressed because one or more lines are too long

View File

@@ -70,24 +70,24 @@
]
},
"uuids": [
"30aC+Hnw1PF4pEcoY3kUYb",
"14TDKXr2NJ6LjvHPops74o",
"f1h0LXVtJOta5JLZ1xCzfI",
"02delMVqdBD70a/HSD99FK",
"0ek66qC1NOQLjgYmi04HvX",
"14TDKXr2NJ6LjvHPops74o",
"28dPjdQWxEQIG3VVl1Qm6T",
"2aKWBXJHxKHLvrBUi2yYZQ",
"2afAA24LNP4YmYiaVLiivs",
"c0BAyVxX9JzZy8EjFrc9DU",
"30aC+Hnw1PF4pEcoY3kUYb",
"3ae7efMv1CLq2ilvUY/tQi",
"46bU+b5fROqIXVPG6aZWWK",
"6dkeWRTOBGXICfYQ7JUBnG",
"6fgBCSDDdPMInvyNlggls2",
"a1U5RdJRFMFL57BdJC9H1X",
"3ae7efMv1CLq2ilvUY/tQi",
"e0LYfU5ZlNFoAB4UiRrGUG",
"7a/QZLET9IDreTiBfRn2PD",
"ecpdLyjvZBwrvm+cedCcQy",
"46bU+b5fROqIXVPG6aZWWK",
"a1U5RdJRFMFL57BdJC9H1X",
"c0BAyVxX9JzZy8EjFrc9DU",
"cffgu4qBxEqa150o1DmRAy",
"2aKWBXJHxKHLvrBUi2yYZQ",
"02delMVqdBD70a/HSD99FK"
"e0LYfU5ZlNFoAB4UiRrGUG",
"ecpdLyjvZBwrvm+cedCcQy",
"f1h0LXVtJOta5JLZ1xCzfI"
],
"scenes": {},
"redirect": [],
@@ -123,7 +123,7 @@
"versions": {
"import": [
"0967b326a",
"c3301"
"eef84"
],
"native": [
"02delMVqdBD70a/HSD99FK",

View File

@@ -308,16 +308,16 @@
"builtin-2d-sprite",
[
{
"hash": 3278106612,
"hash": 2440430725,
"record": null,
"name": "builtin-2d-sprite|vs|fs",
"glsl3": {
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\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 #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n 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 #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if USE_BGRA\n gl_FragColor = o.bgra;\n #else\n gl_FragColor = o.rgba;\n #endif\n}"
},
"glsl1": {
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\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 #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n 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 #endif\n o *= v_color;\n ALPHA_TEST(o);\n #if USE_BGRA\n gl_FragColor = o.bgra;\n #else\n gl_FragColor = o.rgba;\n #endif\n}"
},
"builtins": {
"globals": {
@@ -368,6 +368,11 @@
"defines": [
"USE_TEXTURE"
]
},
{
"name": "USE_BGRA",
"type": "boolean",
"defines": []
}
],
"blocks": [
@@ -1592,7 +1597,7 @@
},
"depthStencilState": {
"depthTest": true,
"depthWrite": true
"depthWrite": false
},
"properties": {
"diffuseTexture": {

View File

@@ -1,22 +1,22 @@
{
"paths": {},
"uuids": [
"catK9m3HRBtYgmebOjC6ma",
"ecpdLyjvZBwrvm+cedCcQy",
"a2MjXRFdtLlYQ5ouAFv/+R",
"02delMVqdBD70a/HSD99FK",
"5cO7kybDxGj4ipyMYdRYZB",
"5f5dyqtRNNxaFmVzYns6FZ",
"02delMVqdBD70a/HSD99FK",
"61cyPdEfRN047sDK9rO0W5",
"d608qFRoFHwbXd0Dap056i"
"a2MjXRFdtLlYQ5ouAFv/+R",
"catK9m3HRBtYgmebOjC6ma",
"d608qFRoFHwbXd0Dap056i",
"ecpdLyjvZBwrvm+cedCcQy"
],
"scenes": {
"db://assets/main.fire": "catK9m3HRBtYgmebOjC6ma"
},
"redirect": [
"ecpdLyjvZBwrvm+cedCcQy",
0,
"02delMVqdBD70a/HSD99FK",
0,
"ecpdLyjvZBwrvm+cedCcQy",
0
],
"deps": [

View File

@@ -231,6 +231,8 @@ window.__require = function e(t, n, r) {
}(cc.Component);
exports.default = Main;
cc.sp.labelRetinaScale = 2;
cc.sp.charAtlasAutoBatchCount = 2;
cc.macro.CLEANUP_IMAGE_CACHE = false;
cc.dynamicAtlasManager.maxFrameSize = 2048;
cc._RF.pop();
}, {} ]

File diff suppressed because one or more lines are too long

View File

@@ -18,15 +18,15 @@
"cc.SpriteFrame",
1
],
"ebcqWiiDdPRaJKJIbu9ft4": [
"multi-batcher/images/png",
"cc.Texture2D"
],
"0a5R1NT2lDxqcI2pwtgfb1": [
"multi-batcher/images/png",
"cc.SpriteFrame",
1
],
"ebcqWiiDdPRaJKJIbu9ft4": [
"multi-batcher/images/png",
"cc.Texture2D"
],
"22JHeF7zBLZqnS68r2p/bo": [
"multi-batcher/images/pvrtc2_rgb_a",
"cc.Texture2D"
@@ -63,15 +63,15 @@
"cc.SpriteFrame",
1
],
"7aeIQwZiFL1YbOCVeiFt1p": [
"multi-batcher/images/sheep_run_1",
"cc.Texture2D"
],
"55URLSNf5K3IyZBezfiMKa": [
"multi-batcher/images/sheep_run_1",
"cc.SpriteFrame",
1
],
"7aeIQwZiFL1YbOCVeiFt1p": [
"multi-batcher/images/sheep_run_1",
"cc.Texture2D"
],
"14W7pBGWJJ7q7JCPsVTovy": [
"multi-batcher/multi-batcher",
"cc.Prefab"
@@ -86,83 +86,89 @@
]
},
"uuids": [
"77hE9EwNpMlKl/+sGrhEVR",
"c4+eoUuahAOa4lmC/4Hkdi",
"b6FhIxTWVHXKa7qBmehR6I",
"eahTDGUrZBV4Y+i+JslTuW",
"ebcqWiiDdPRaJKJIbu9ft4",
"0a5R1NT2lDxqcI2pwtgfb1",
"0eAM9yHrBFe4PSAXHMHNl+",
"10Drosz6JPsKWsqV+bRh/A",
"14W7pBGWJJ7q7JCPsVTovy",
"1cijzBpFJCdoSNK98w5oUq",
"22JHeF7zBLZqnS68r2p/bo",
"29FYIk+N1GYaeWH/q1NxQO",
"2cDGL4OAVN0ZbEl3w2urT8",
"2dPOEW20pCTLs79c0WyZVp",
"3479J6IuROz7rZhiZpn63y",
"41Zz922rlJZZmZnFZqPxVK",
"43jA/TdMpFA7K8IIjNbb9M",
"8fHzmU6I5EBqjpHEb0Xl3i",
"10Drosz6JPsKWsqV+bRh/A",
"2dPOEW20pCTLs79c0WyZVp",
"44mZ0YUdFAF56mmNytjs31",
"b48cuQCqRMLaIzf9I1fTbW",
"7aeIQwZiFL1YbOCVeiFt1p",
"55URLSNf5K3IyZBezfiMKa",
"14W7pBGWJJ7q7JCPsVTovy",
"c58wUeG09DhJOcuDi8uPW/",
"0eAM9yHrBFe4PSAXHMHNl+",
"ecpdLyjvZBwrvm+cedCcQy",
"f0BIwQ8D5Ml7nTNQbh1YlS",
"e97GVMl6JHh5Ml5qEDdSGa",
"29FYIk+N1GYaeWH/q1NxQO",
"5cO7kybDxGj4ipyMYdRYZB",
"5f5dyqtRNNxaFmVzYns6FZ",
"a2MjXRFdtLlYQ5ouAFv/+R",
"8c20Sso/ZEn7NUfNSM+EBh",
"8029xEf4FHy49dWo6NK8c7",
"a7ZscqX+JCIZRS157bMyhq",
"80AR/OlBFOoajT99htLYeJ",
"6eBWFz0oVHPLIGQKf/9Thu",
"bc2ZOJo5NCbrI0FXxitEvE",
"2cDGL4OAVN0ZbEl3w2urT8",
"e8Ueib+qJEhL6mXAHdnwbi",
"5dz/wYuRNGDqDZXXT0zaEr",
"c1Hf3Sl8ZAnJwP/fpoHxap",
"1cijzBpFJCdoSNK98w5oUq",
"45vlnzVlVDaZ6fRVyB0t3Z",
"d9xFMK7wVFwbAS60aG9McP",
"55URLSNf5K3IyZBezfiMKa",
"5cO7kybDxGj4ipyMYdRYZB",
"5dz/wYuRNGDqDZXXT0zaEr",
"5f5dyqtRNNxaFmVzYns6FZ",
"6eBWFz0oVHPLIGQKf/9Thu",
"71VhFCTINJM6/Ky3oX9nBT",
"77hE9EwNpMlKl/+sGrhEVR",
"7aeIQwZiFL1YbOCVeiFt1p",
"80AR/OlBFOoajT99htLYeJ",
"8029xEf4FHy49dWo6NK8c7",
"8c20Sso/ZEn7NUfNSM+EBh",
"8fHzmU6I5EBqjpHEb0Xl3i",
"a2MjXRFdtLlYQ5ouAFv/+R",
"a7ZscqX+JCIZRS157bMyhq",
"aaYr2KZ+xPDqeLsRHUKxRA",
"b4P/PCArtIdIH38t6mlw8Y",
"71VhFCTINJM6/Ky3oX9nBT"
"b48cuQCqRMLaIzf9I1fTbW",
"b6FhIxTWVHXKa7qBmehR6I",
"bc2ZOJo5NCbrI0FXxitEvE",
"c1Hf3Sl8ZAnJwP/fpoHxap",
"c4+eoUuahAOa4lmC/4Hkdi",
"c58wUeG09DhJOcuDi8uPW/",
"d9xFMK7wVFwbAS60aG9McP",
"e8Ueib+qJEhL6mXAHdnwbi",
"e97GVMl6JHh5Ml5qEDdSGa",
"eahTDGUrZBV4Y+i+JslTuW",
"ebcqWiiDdPRaJKJIbu9ft4",
"ecpdLyjvZBwrvm+cedCcQy",
"f0BIwQ8D5Ml7nTNQbh1YlS"
],
"scenes": {},
"redirect": [
"ecpdLyjvZBwrvm+cedCcQy",
"1cijzBpFJCdoSNK98w5oUq",
0,
"2cDGL4OAVN0ZbEl3w2urT8",
0,
"3479J6IuROz7rZhiZpn63y",
0,
"45vlnzVlVDaZ6fRVyB0t3Z",
0,
"5cO7kybDxGj4ipyMYdRYZB",
1,
"5f5dyqtRNNxaFmVzYns6FZ",
1,
"6eBWFz0oVHPLIGQKf/9Thu",
0,
"80AR/OlBFOoajT99htLYeJ",
0,
"8029xEf4FHy49dWo6NK8c7",
0,
"a2MjXRFdtLlYQ5ouAFv/+R",
1,
"8029xEf4FHy49dWo6NK8c7",
2,
"a7ZscqX+JCIZRS157bMyhq",
2,
"80AR/OlBFOoajT99htLYeJ",
2,
"6eBWFz0oVHPLIGQKf/9Thu",
2,
0,
"aaYr2KZ+xPDqeLsRHUKxRA",
0,
"bc2ZOJo5NCbrI0FXxitEvE",
2,
"2cDGL4OAVN0ZbEl3w2urT8",
2,
0,
"c1Hf3Sl8ZAnJwP/fpoHxap",
2,
"1cijzBpFJCdoSNK98w5oUq",
2,
"45vlnzVlVDaZ6fRVyB0t3Z",
2,
0,
"d9xFMK7wVFwbAS60aG9McP",
0,
"ecpdLyjvZBwrvm+cedCcQy",
2
],
"deps": [
"internal",
"common",
"main",
"common"
"internal"
],
"packs": {
"03de068c3": [
@@ -204,7 +210,7 @@
"versions": {
"import": [
"03de068c3",
"a5082"
"732a1"
],
"native": [
"10Drosz6JPsKWsqV+bRh/A",

View File

@@ -1,7 +1,7 @@
{
"paths": {
"5dz/wYuRNGDqDZXXT0zaEr": [
"effects/multi-2d-sprite",
"effects/multi-2d-universal",
"cc.EffectAsset"
]
},
@@ -21,7 +21,7 @@
"versions": {
"import": [
"5dz/wYuRNGDqDZXXT0zaEr",
"a50cc"
"d60ab"
],
"native": []
}

View File

@@ -0,0 +1,326 @@
[
1,
0,
0,
[
[
"cc.EffectAsset",
[
"_name",
"shaders",
"techniques"
],
0
]
],
[
[
0,
0,
1,
2,
4
]
],
[
[
0,
"multi-2d-universal",
[
{
"hash": 501441714,
"record": null,
"name": "multi-2d-universal|vs|fs",
"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_TINT\nin vec4 a_color0;\nout vec4 v_color0;\n#endif\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#if USE_MULTI_TEXTURE\nin float a_texId;\nout float v_texId;\n#endif\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 #if USE_MULTI_TEXTURE\n v_texId = a_texId;\n #endif\n #endif\n v_color = a_color;\n #if USE_TINT\n v_color0 = a_color0;\n #endif\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_TINT\nin vec4 v_color0;\n#endif\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#if USE_MULTI_TEXTURE\nin float v_texId;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nuniform sampler2D texture6;\nuniform sampler2D texture7;\nuniform sampler2D texture8;\n#endif\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n #if USE_MULTI_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 #else\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 #endif\n #endif\n #if USE_TINT\n vec4 finalColor;\n finalColor.a = v_color.a * o.a;\n finalColor.rgb = ((o.a - 1.0) * v_color0.a + 1.0 - o.rgb) * v_color0.rgb + o.rgb * v_color.rgb;\n ALPHA_TEST(finalColor);\n gl_FragColor = finalColor;\n #else\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #endif\n}"
},
"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_TINT\nattribute vec4 a_color0;\nvarying vec4 v_color0;\n#endif\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#if USE_MULTI_TEXTURE\nattribute float a_texId;\nvarying float v_texId;\n#endif\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 #if USE_MULTI_TEXTURE\n v_texId = a_texId;\n #endif\n #endif\n v_color = a_color;\n #if USE_TINT\n v_color0 = a_color0;\n #endif\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_TINT\nvarying vec4 v_color0;\n#endif\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#if USE_MULTI_TEXTURE\nvarying float v_texId;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\nuniform sampler2D texture6;\nuniform sampler2D texture7;\nuniform sampler2D texture8;\n#endif\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n #if USE_MULTI_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 #else\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 #endif\n #endif\n #if USE_TINT\n vec4 finalColor;\n finalColor.a = v_color.a * o.a;\n finalColor.rgb = ((o.a - 1.0) * v_color0.a + 1.0 - o.rgb) * v_color0.rgb + o.rgb * v_color.rgb;\n ALPHA_TEST(finalColor);\n gl_FragColor = finalColor;\n #else\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n #endif\n}"
},
"builtins": {
"globals": {
"blocks": [
{
"name": "CCGlobal",
"defines": []
}
],
"samplers": []
},
"locals": {
"blocks": [
{
"name": "CCLocal",
"defines": []
}
],
"samplers": []
}
},
"defines": [
{
"name": "USE_TINT",
"type": "boolean",
"defines": []
},
{
"name": "USE_TEXTURE",
"type": "boolean",
"defines": []
},
{
"name": "USE_MULTI_TEXTURE",
"type": "boolean",
"defines": [
"USE_TEXTURE"
]
},
{
"name": "CC_USE_MODEL",
"type": "boolean",
"defines": []
},
{
"name": "USE_ALPHA_TEST",
"type": "boolean",
"defines": []
},
{
"name": "CC_USE_ALPHA_ATLAS_texture",
"type": "boolean",
"defines": [
"USE_TEXTURE"
]
},
{
"name": "INPUT_IS_GAMMA",
"type": "boolean",
"defines": [
"USE_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture2",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture3",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture4",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture5",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture6",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture7",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "CC_USE_ALPHA_ATLAS_texture8",
"type": "boolean",
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
}
],
"blocks": [
{
"name": "ALPHA_TEST",
"binding": 0,
"members": [
{
"name": "alphaThreshold",
"type": 13,
"count": 1
}
],
"defines": [
"USE_ALPHA_TEST"
]
}
],
"samplers": [
{
"name": "texture",
"type": 29,
"count": 1,
"binding": 30,
"defines": [
"USE_TEXTURE"
]
},
{
"name": "texture2",
"type": 29,
"count": 1,
"binding": 31,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture3",
"type": 29,
"count": 1,
"binding": 32,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture4",
"type": 29,
"count": 1,
"binding": 33,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture5",
"type": 29,
"count": 1,
"binding": 34,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture6",
"type": 29,
"count": 1,
"binding": 35,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture7",
"type": 29,
"count": 1,
"binding": 36,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
},
{
"name": "texture8",
"type": 29,
"count": 1,
"binding": 37,
"defines": [
"USE_TEXTURE",
"USE_MULTI_TEXTURE"
]
}
]
}
],
[
{
"passes": [
{
"program": "multi-2d-universal|vs|fs",
"blendState": {
"targets": [
{
"blend": true
}
]
},
"rasterizerState": {
"cullMode": 0
},
"properties": {
"texture": {
"value": "white",
"type": 29
},
"texture2": {
"value": "white",
"type": 29
},
"texture3": {
"value": "white",
"type": 29
},
"texture4": {
"value": "white",
"type": 29
},
"texture5": {
"value": "white",
"type": 29
},
"texture6": {
"value": "white",
"type": 29
},
"texture7": {
"value": "white",
"type": 29
},
"texture8": {
"value": "white",
"type": 29
},
"alphaThreshold": {
"type": 13,
"value": [
0.5
]
}
}
}
]
}
]
]
],
0,
0,
[],
[],
[]
]

View File

@@ -10,58 +10,58 @@
]
},
"uuids": [
"76ZjeTsCNJMYn7/rwRXCpD",
"03EprhmOVCZKUbb5XyPXQq",
"7a/QZLET9IDreTiBfRn2PD",
"93dM6KrkZCf5dgNpQwf7T6",
"ecpdLyjvZBwrvm+cedCcQy",
"f0BIwQ8D5Ml7nTNQbh1YlS",
"e97GVMl6JHh5Ml5qEDdSGa",
"09o3P/9gBP/Yc7AnxUBZ+Q",
"29FYIk+N1GYaeWH/q1NxQO",
"5cO7kybDxGj4ipyMYdRYZB",
"5f5dyqtRNNxaFmVzYns6FZ",
"70VXjGE0JMUqGli0jmCmTF",
"71VhFCTINJM6/Ky3oX9nBT",
"76ZjeTsCNJMYn7/rwRXCpD",
"7a/QZLET9IDreTiBfRn2PD",
"85yTK+9shIo7RQfQ1TDEUi",
"87/8ZHBEVIkKeNxmalrn9r",
"93dM6KrkZCf5dgNpQwf7T6",
"a2MjXRFdtLlYQ5ouAFv/+R",
"a7ZscqX+JCIZRS157bMyhq",
"85yTK+9shIo7RQfQ1TDEUi",
"09o3P/9gBP/Yc7AnxUBZ+Q",
"70VXjGE0JMUqGli0jmCmTF",
"87/8ZHBEVIkKeNxmalrn9r",
"b4P/PCArtIdIH38t6mlw8Y",
"d0Bu8c2MBCKJc+mKBWzjsJ",
"e8Ueib+qJEhL6mXAHdnwbi",
"71VhFCTINJM6/Ky3oX9nBT",
"b4P/PCArtIdIH38t6mlw8Y"
"e97GVMl6JHh5Ml5qEDdSGa",
"ecpdLyjvZBwrvm+cedCcQy",
"f0BIwQ8D5Ml7nTNQbh1YlS"
],
"scenes": {},
"redirect": [
"7a/QZLET9IDreTiBfRn2PD",
0,
"93dM6KrkZCf5dgNpQwf7T6",
1,
"ecpdLyjvZBwrvm+cedCcQy",
"09o3P/9gBP/Yc7AnxUBZ+Q",
0,
"5cO7kybDxGj4ipyMYdRYZB",
2,
1,
"5f5dyqtRNNxaFmVzYns6FZ",
2,
"a2MjXRFdtLlYQ5ouAFv/+R",
2,
"a7ZscqX+JCIZRS157bMyhq",
1,
"85yTK+9shIo7RQfQ1TDEUi",
1,
"09o3P/9gBP/Yc7AnxUBZ+Q",
1,
"70VXjGE0JMUqGli0jmCmTF",
1,
0,
"7a/QZLET9IDreTiBfRn2PD",
2,
"85yTK+9shIo7RQfQ1TDEUi",
0,
"87/8ZHBEVIkKeNxmalrn9r",
0,
"93dM6KrkZCf5dgNpQwf7T6",
0,
"a2MjXRFdtLlYQ5ouAFv/+R",
1,
"a7ZscqX+JCIZRS157bMyhq",
0,
"d0Bu8c2MBCKJc+mKBWzjsJ",
1
0,
"ecpdLyjvZBwrvm+cedCcQy",
2
],
"deps": [
"internal",
"common",
"main"
"main",
"internal"
],
"packs": {
"05fa2ad10": [
@@ -84,7 +84,7 @@
"versions": {
"import": [
"05fa2ad10",
"ef553"
"b4dad"
],
"native": [
"71VhFCTINJM6/Ky3oX9nBT",

View File

@@ -54,6 +54,20 @@ window.__require = function e(t, n, r) {
if ("object" === typeof Reflect && "function" === typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __values = this && this.__values || function(o) {
var s = "function" === typeof Symbol && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && "number" === typeof o.length) return {
next: function() {
o && i >= o.length && (o = void 0);
return {
value: o && o[i++],
done: !o
};
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", {
value: true
});
@@ -68,6 +82,7 @@ window.__require = function e(t, n, r) {
_this.boy = null;
_this.heads = [];
_this.boys = [];
_this.datas = [];
return _this;
}
SpineSkin.prototype.start = function() {
@@ -76,6 +91,7 @@ window.__require = function e(t, n, r) {
var newSkeletonData = boySpine.skeletonData.clone();
boySpine.skeletonData = newSkeletonData;
boySpine.animation = "attack";
this.datas.push(newSkeletonData);
this.boys.push(this.boy);
this.addBoyBtn.on("click", function() {
var newBoy = cc.instantiate(_this.boy);
@@ -89,19 +105,41 @@ window.__require = function e(t, n, r) {
newBoy.getComponentInChildren(sp.Skeleton).setAnimationCacheMode(sp.Skeleton.AnimationCacheMode.PRIVATE_CACHE);
newBoy.getComponentInChildren(cc.Label).string = "Spine - Cache";
}
_this.datas.push(newBoySpine.skeletonData);
_this.boys.push(newBoy);
});
this.removeBoyBtn.on("click", function() {
if (_this.boys.length > 1) {
_this.datas[_this.datas.length - 1].destroy();
_this.boys[_this.boys.length - 1].destroy();
_this.datas.length -= 1;
_this.boys.length -= 1;
}
});
this.randomChangeBtn.on("click", function() {
var boy = _this.boys[_this.boys.length - 1].getComponentInChildren(sp.Skeleton);
boy.setRegion("Head", "Head", sp.SkeletonData.createRegion(_this.heads[Math.floor(Math.random() * _this.heads.length)]));
boy.setRegionData("Head", "Head", new sp.RegionData(_this.heads[Math.floor(Math.random() * _this.heads.length)]));
});
};
SpineSkin.prototype.onDestroy = function() {
var e_1, _a;
try {
for (var _b = __values(this.datas), _c = _b.next(); !_c.done; _c = _b.next()) {
var data = _c.value;
data.destroy();
}
} catch (e_1_1) {
e_1 = {
error: e_1_1
};
} finally {
try {
_c && !_c.done && (_a = _b.return) && _a.call(_b);
} finally {
if (e_1) throw e_1.error;
}
}
};
__decorate([ property(cc.Node) ], SpineSkin.prototype, "addBoyBtn", void 0);
__decorate([ property(cc.Node) ], SpineSkin.prototype, "removeBoyBtn", void 0);
__decorate([ property(cc.Node) ], SpineSkin.prototype, "randomChangeBtn", void 0);

File diff suppressed because one or more lines are too long

View File

@@ -10,27 +10,27 @@
]
},
"uuids": [
"f4jvTRdINIaICWEVrgQxx2",
"e2Z8EqOaxB256X3o4ZbClt",
"ecpdLyjvZBwrvm+cedCcQy",
"5cO7kybDxGj4ipyMYdRYZB",
"5f5dyqtRNNxaFmVzYns6FZ",
"a2MjXRFdtLlYQ5ouAFv/+R"
"a2MjXRFdtLlYQ5ouAFv/+R",
"e2Z8EqOaxB256X3o4ZbClt",
"ecpdLyjvZBwrvm+cedCcQy",
"f4jvTRdINIaICWEVrgQxx2"
],
"scenes": {},
"redirect": [
"ecpdLyjvZBwrvm+cedCcQy",
0,
"5cO7kybDxGj4ipyMYdRYZB",
1,
0,
"5f5dyqtRNNxaFmVzYns6FZ",
1,
0,
"a2MjXRFdtLlYQ5ouAFv/+R",
0,
"ecpdLyjvZBwrvm+cedCcQy",
1
],
"deps": [
"internal",
"main"
"main",
"internal"
],
"packs": {
"0dccb646b": [

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More