Skip to content

Commit

Permalink
Merge pull request #56 from galacean/main
Browse files Browse the repository at this point in the history
Merge origin/main into origin/dev
  • Loading branch information
liuxi150 authored Dec 20, 2023
2 parents e493738 + dae9252 commit 145168f
Show file tree
Hide file tree
Showing 17 changed files with 276 additions and 252 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
- 主版本号:含有破坏性更新和新特性,不在发布周期内。

---
## 1.1.2

`2023-12-19`

- Fix: Render bugs caused by diff algorithm and pre-comp. [#53](https://github.com/galacean/effects-runtime/pull/53) @RGCHN

## 1.1.1

`2023-12-14`
Expand Down
5 changes: 5 additions & 0 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

![](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png)

<h3>所见 · 即所得</h3>
<img height="320" src="https://mdn.alipayobjects.com/huamei_klifp9/afts/img/A*BrMIQqkmbKEAAAAAAAAAAAAADvV6AQ/original">
<img height="320" src="https://mdn.alipayobjects.com/huamei_klifp9/afts/img/A*VHMAR6Vq_8wAAAAAAAAAAAAADvV6AQ/original">
<img height="320" src="https://mdn.alipayobjects.com/huamei_klifp9/afts/img/A*UwMWT4uY6jsAAAAAAAAAAAAADvV6AQ/original">

[github-issues-url]: https://github.com/galacean/effects-runtime/issues
</div>

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ It can load and render cool animation effects, The APIs provided by effects-core

![](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png)

<h3>What you see is what you get</h3>
<img height="320" src="https://mdn.alipayobjects.com/huamei_klifp9/afts/img/A*BrMIQqkmbKEAAAAAAAAAAAAADvV6AQ/original">
<img height="320" src="https://mdn.alipayobjects.com/huamei_klifp9/afts/img/A*VHMAR6Vq_8wAAAAAAAAAAAAADvV6AQ/original">
<img height="320" src="https://mdn.alipayobjects.com/huamei_klifp9/afts/img/A*UwMWT4uY6jsAAAAAAAAAAAAADvV6AQ/original">

[github-issues-url]: https://github.com/galacean/effects-runtime/issues
</div>

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@commitlint/config-conventional": "^18.4.3",
"@manypkg/get-packages": "^2.2.0",
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-inject": "^5.0.5",
Expand Down Expand Up @@ -61,10 +61,10 @@
"rollup-plugin-typescript2": "^0.34.1",
"simple-git": "^3.19.1",
"tslib": "^2.6.2",
"typedoc": "^0.25.3",
"typedoc": "^0.25.4",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite-plugin-externals": "^0.6.2",
"vite-tsconfig-paths": "^4.2.0"
"vite-tsconfig-paths": "^4.2.2"
}
}
2 changes: 1 addition & 1 deletion packages/effects-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects-core",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects runtime core for the web",
"module": "./dist/index.mjs",
"main": "./dist/index.js",
Expand Down
33 changes: 21 additions & 12 deletions packages/effects-core/src/composition-source-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class CompositionSourceManager implements Disposable {
imgUsage: Record<string, number[]>;
textures: Texture[];
jsonScene?: spec.JSONScene;
mask: number;
mask = 0;
textureOptions: Record<string, any>[];

constructor (
Expand Down Expand Up @@ -76,7 +76,6 @@ export class CompositionSourceManager implements Disposable {
this.totalTime = totalTime ?? 0;
this.imgUsage = imgUsage ?? {};
this.textures = cachedTextures;
this.mask = 0;
listOrder = 0;
this.textureOptions = textureOptions;
this.sourceContent = this.getContent(this.composition);
Expand All @@ -103,7 +102,7 @@ export class CompositionSourceManager implements Disposable {

private assembleItems (composition: spec.Composition) {
const items: any[] = [];
let mask = this.mask;
let mask = this.mask++;

if (isNaN(mask)) {
mask = 0;
Expand Down Expand Up @@ -131,13 +130,7 @@ export class CompositionSourceManager implements Disposable {
renderContent.renderer = this.changeTex(renderContent.renderer);

if (!renderContent.renderer.mask) {
const maskMode = renderContent.renderer.maskMode;

if (maskMode === spec.MaskMode.MASK) {
renderContent.renderer.mask = ++mask;
} else if (maskMode === spec.MaskMode.OBSCURED || maskMode === spec.MaskMode.REVERSE_OBSCURED) {
renderContent.renderer.mask = mask;
}
this.processMask(renderContent.renderer, this.mask);
}

const split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
Expand Down Expand Up @@ -185,18 +178,21 @@ export class CompositionSourceManager implements Disposable {

// 处理预合成的渲染顺序
if (option.type === spec.ItemType.composition) {
const maskRef = ++this.mask;
const refId = (item.content as spec.CompositionContent).options.refId;

if (!this.refCompositions.get(refId)) {
throw new Error('Invalid Ref Composition id: ' + refId);
}
const ref = this.getContent(this.refCompositions.get(refId)!);

if (!this.refCompositionProps.has(refId)) {
this.refCompositionProps.set(refId, this.getContent(this.refCompositions.get(refId)!) as unknown as VFXItemProps);
this.refCompositionProps.set(refId, ref as unknown as VFXItemProps);
}
const ref = this.refCompositionProps.get(refId)!;

ref.items.forEach((item: Record<string, any>) => {
item.listIndex = listOrder++;
this.processMask(item.content, maskRef);
});
option.items = ref.items;

Expand Down Expand Up @@ -240,6 +236,19 @@ export class CompositionSourceManager implements Disposable {
}
}

/**
* 处理蒙版和遮挡关系写入 stencil 的 ref 值
*/
private processMask (renderer: Record<string, number>, maskRef: number) {
if (!renderer.mask) {
const maskMode: spec.MaskMode = renderer.maskMode;

if (maskMode !== spec.MaskMode.NONE) {
renderer.mask = maskRef;
}
}
}

dispose (): void {
this.textureOptions = [];
this.textures = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/effects-helper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects-helper",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects runtime helper for the web",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/effects-threejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects-threejs",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects runtime threejs plugin for the web",
"module": "./dist/index.mjs",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/effects-webgl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects-webgl",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects runtime webgl for the web",
"types": "./dist/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/effects/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects runtime player for the web",
"module": "./dist/index.mjs",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion plugin-packages/alipay-downgrade/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects-plugin-alipay-downgrade",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects player downgrade plugin for Alipay",
"module": "./dist/index.mjs",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion plugin-packages/editor-gizmo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects-plugin-editor-gizmo",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects player editor gizmo plugin",
"module": "./dist/index.mjs",
"main": "./dist/index.js",
Expand Down
6 changes: 3 additions & 3 deletions plugin-packages/model/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects-plugin-model",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects player model plugin",
"module": "./dist/index.mjs",
"main": "./dist/index.js",
Expand Down Expand Up @@ -50,8 +50,8 @@
"@galacean/effects": "workspace:*",
"@galacean/effects-plugin-editor-gizmo": "workspace:*",
"@vvfx/resource-detection": "0.4.2-alpha.22",
"@types/hammerjs": "^2.0.41",
"@types/hammerjs": "^2.0.45",
"fpsmeter": "^0.3.1",
"hammerjs": "^2.0.6"
"hammerjs": "^2.0.8"
}
}
2 changes: 1 addition & 1 deletion plugin-packages/orientation-transformer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects-plugin-orientation-transformer",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects player orientation transformer plugin",
"module": "./dist/index.mjs",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion plugin-packages/spine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galacean/effects-plugin-spine",
"version": "1.1.1",
"version": "1.1.2",
"description": "Galacean Effects player spine plugin",
"module": "./dist/index.mjs",
"main": "./dist/index.js",
Expand Down
Loading

0 comments on commit 145168f

Please sign in to comment.