Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge origin/main into origin/dev #56

Merged
merged 19 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
daec425
docs: add product preview (#43)
yiiqii Dec 18, 2023
6163433
build: 替换 pnpm-lock 中的 registry
yiiqii Dec 18, 2023
9ac9aac
Merge pull request #46 from galacean/build/npm-registry
yiiqii Dec 18, 2023
0acf9ed
build(deps-dev): bump typedoc from 0.25.3 to 0.25.4
dependabot[bot] Dec 18, 2023
7cbf490
build(deps-dev): bump hammerjs and @types/hammerjs
dependabot[bot] Dec 18, 2023
0f4ce98
build(deps-dev): bump rimraf from 3.0.2 to 5.0.5
dependabot[bot] Dec 18, 2023
ff6c570
build(deps-dev): bump vite-tsconfig-paths from 4.2.0 to 4.2.2
dependabot[bot] Dec 18, 2023
ae556a0
build(deps-dev): bump @commitlint/config-conventional
dependabot[bot] Dec 18, 2023
394af8e
Merge pull request #48 from galacean/dependabot/npm_and_yarn/typedoc-…
yiiqii Dec 18, 2023
4434a78
Merge pull request #49 from galacean/dependabot/npm_and_yarn/hammerjs…
yiiqii Dec 18, 2023
52261df
Merge pull request #50 from galacean/dependabot/npm_and_yarn/rimraf-5…
yiiqii Dec 18, 2023
a93af8e
Merge pull request #51 from galacean/dependabot/npm_and_yarn/vite-tsc…
yiiqii Dec 18, 2023
9248cc1
Merge pull request #52 from galacean/dependabot/npm_and_yarn/commitli…
yiiqii Dec 18, 2023
a245207
fix: render bugs caused by diff algorithm and pre-comp (#53)
RGCHN Dec 19, 2023
74ef6c7
docs: changelog 1.1.2
yiiqii Dec 19, 2023
35a94cf
Merge pull request #54 from galacean/docs/changelog-1.1.2
yiiqii Dec 19, 2023
a630241
Revert "build(deps-dev): bump rimraf from 3.0.2 to 5.0.5"
yiiqii Dec 19, 2023
0e2d537
Merge pull request #55 from galacean/revert-50-dependabot/npm_and_yar…
yiiqii Dec 19, 2023
dae9252
Merge branch 'dev' into main
yiiqii Dec 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Comment on lines +105 to 108
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider incrementing mask after the isNaN check to ensure it's only incremented when it has a valid number value.

- let mask = this.mask++;
+ let mask = this.mask;
  if (isNaN(mask)) {
    mask = 0;
  } else {
+   this.mask++;
  }

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
let mask = this.mask++;
if (isNaN(mask)) {
mask = 0;
let mask = this.mask;
if (isNaN(mask)) {
mask = 0;
} else {
this.mask++;
}

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
24 changes: 10 additions & 14 deletions packages/effects-core/src/plugins/sprite/sprite-mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,20 @@ export class SpriteMesh {
const uSizeStart = start + 4;
const uQuatStart = start + 8;
const uColorStart = start + 12;

if (!selfData.visible && !init) {
mainDataArray[uSizeStart + 2] = -1;

return;
}

const uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];

// if (selfData.startSize) {
// selfData.transform.scaleBy(1 / selfData.startSize[0], 1 / selfData.startSize[1], 1);
// }

const tempPos = new Vector3();
const tempQuat = new Quaternion();
const tempScale = new Vector3();
const uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];

selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
if (selfData.visible) {
selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
} else {
if (!init) {
mainDataArray[uSizeStart + 2] = -1;

return;
}
}

const uPos = [...tempPos.toArray(), 0];
const uSize = [...tempScale.toArray(), 0];
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