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

Support GUI #2375

Merged
merged 279 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 218 commits
Commits
Show all changes
279 commits
Select commit Hold shift + click to select a range
08214c2
refactor(2d-render-pipeline): add MeshBuffer
singlecoder Feb 22, 2024
094b5e6
refactor(2d-render-pipeline): complete sprite renderer and sprite mask
singlecoder Mar 5, 2024
04eb47c
refactor(2d-render-pipeline): complete sprite renderer draw mode
singlecoder Mar 5, 2024
650b135
refactor(2d-render-pipeline): complete text renderer
singlecoder Mar 5, 2024
3f0cfa0
refactor(2d-render-pipeline): fix conflicts from dev/1.2
singlecoder Mar 15, 2024
7e33812
refactor(2d-render-pipeline): fix conflicts from dev/1.2
singlecoder Mar 15, 2024
c265204
Merge branch 'main' into refactor/2d-render-pipeline
singlecoder Mar 28, 2024
d442be2
refactor(2d-render-pipeline): fix conflicts from dev/1.3
singlecoder Apr 10, 2024
7a09c01
refactor(2d-render-pipeline): delete IBatcher
singlecoder Apr 11, 2024
901ba13
refactor(2d-render-pipeline): move IPoolElement to Pool
singlecoder Apr 11, 2024
b256155
refactor(2d-render-pipeline): replace CharRenderDataPool with Pool
singlecoder Apr 11, 2024
10bb95b
refactor(2d-render-pipeline): create mesh buffer support custom size
singlecoder Apr 12, 2024
b62df3a
refactor(2d-render-pipeline): opt code
singlecoder Apr 18, 2024
0dbad8d
refactor(2d-render-pipeline): opt code
singlecoder Apr 18, 2024
9e50d30
refactor(2d-render-pipeline): opt text renderer upload texture
singlecoder Apr 19, 2024
ebd27df
feat(ui-init): init ui package
singlecoder Apr 24, 2024
c98748f
feat(ui-init): add basic class
singlecoder Apr 24, 2024
7649de4
refactor(2d-render-pipeline): rename the rendering order function of …
singlecoder Apr 25, 2024
68657e8
refactor(2d-render-pipeline): fix test
singlecoder Apr 25, 2024
c95c0c2
refactor(2d-render-pipeline): fix test error
singlecoder Apr 26, 2024
8f36498
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Apr 26, 2024
10fc066
refactor(2d-render-pipeline): fix chunk error
singlecoder Apr 26, 2024
c9ac2a5
refactor(2d-render-pipeline): opt code
singlecoder Apr 28, 2024
5dc393d
refactor(2d-render-pipeline): opt code
singlecoder Apr 28, 2024
d667d99
refactor(2d-render-pipeline): opt code
singlecoder Apr 29, 2024
caa0a38
refactor(2d-render-pipeline): fix 2d sort error
singlecoder Apr 29, 2024
8f77a72
refactor(2d-render-pipeline): change 2d batch structure
singlecoder Apr 30, 2024
f08d477
refactor(2d-render-pipeline): opt code
singlecoder Apr 30, 2024
7f4a460
refactor(2d-render-pipeline): opt code
singlecoder May 6, 2024
cfe01a5
refactor(2d-render-pipeline): opt code
singlecoder May 6, 2024
83cbf4a
refactor(2d-render-pipeline): fix sprite draw mode tiled error
singlecoder May 6, 2024
c353ee3
refactor(2d-render-pipeline): rename CharRenderData to CharRenderInfo
singlecoder May 6, 2024
fbf6ed1
refactor(2d-render-pipeline): opt code
singlecoder May 6, 2024
997f29f
refactor(2d-render-pipeline): fix render queue sort error
singlecoder May 7, 2024
68f8993
refactor(2d-render-pipeline): fix render queue sort error
singlecoder May 7, 2024
96e9621
refactor(2d-render-pipeline): opt code
singlecoder May 7, 2024
f9e67ec
refactor(2d-render-pipeline): opt performance for render queue sort
singlecoder May 7, 2024
48bcccf
refactor(2d-render-pipeline): opt performance for render queue sort
singlecoder May 7, 2024
c65299a
refactor(2d-render-pipeline): opt performance for 2d
singlecoder May 7, 2024
0acf868
refactor(2d-render-pipeline): opt code
singlecoder May 8, 2024
5871137
refactor(2d-render-pipeline): opt code
singlecoder May 9, 2024
999e348
refactor(2d-render-pipeline): opt code
singlecoder May 9, 2024
fa5a17f
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder May 10, 2024
8fae435
feat(ui): rename resolution adaptation strategy
singlecoder May 10, 2024
332ff64
feat(ui): add ui canvas and ui renderer
singlecoder May 10, 2024
3710d41
Merge branch 'dev/1.3' into refactor/2d-render-pipeline
singlecoder May 10, 2024
1714428
refactor(2d-render-pipeline): fix shadow error
singlecoder May 11, 2024
8bcde48
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder May 13, 2024
a0e2dc5
feat(ui): init ui canvas
singlecoder May 13, 2024
f232172
feat(ui): add get set for ui canvas
singlecoder May 21, 2024
09e975c
refactor(2d-render-pipeline): opt code for simple assembler
singlecoder May 21, 2024
bfb78bc
refactor(2d-render-pipeline): opt code for sprite assemble
singlecoder May 21, 2024
a35fc8f
refactor(2d-render-pipeline): opt code
singlecoder May 21, 2024
169f3eb
refactor(2d-render-pipeline): opt code
singlecoder May 21, 2024
436d4b1
refactor(2d-render-pipeline): opt code
singlecoder May 21, 2024
ae911ae
refactor(2d-render-pipeline): opt code
singlecoder May 22, 2024
2621b7e
refactor(2d-render-pipeline): opt code for batch
singlecoder May 22, 2024
0b2b12d
refactor(2d-render-pipeline): rename SpriteRenderData to RenderData2D
singlecoder May 24, 2024
239feed
refactor(2d-render-pipeline): use primitive to change buffer mesh in …
singlecoder May 31, 2024
8388166
refactor(2d-render-pipeline): opt code
singlecoder Jun 3, 2024
520da7b
refactor(2d-render-pipeline): clean render queue
singlecoder Jun 3, 2024
54ff8f1
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 4, 2024
d8393e8
refactor(2d-render-pipeline): opt code
singlecoder Jun 4, 2024
836e752
refactor(2d-render-pipeline): opt code
singlecoder Jun 4, 2024
169aa09
refactor(2d-render-pipeline): opt code
singlecoder Jun 4, 2024
c09d5e7
refactor(2d-render-pipeline): opt code
singlecoder Jun 4, 2024
df3b5f8
refactor(2d-render-pipeline): fix conflicts
singlecoder Jun 4, 2024
3ada1f6
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 4, 2024
6edbf7b
refactor(2d-render-pipeline): opt code
singlecoder Jun 4, 2024
fbaa8aa
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 4, 2024
26b3b94
refactor(2d-render-pipeline): add comment for export TextUtils
singlecoder Jun 5, 2024
bae7a9a
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 5, 2024
7f613d9
feat(ui): ui canvas
singlecoder Jun 6, 2024
271a77c
test(primitive): test one-to-one 2D renderer and primitive
singlecoder Jun 7, 2024
9575b36
test(primitive): buffer add alloc and free sub buffer
singlecoder Jun 7, 2024
054ded6
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 11, 2024
cef8757
feat(ui): add temp code
singlecoder Jun 11, 2024
1772f93
refactor(2d-render-pipeline): opt code
singlecoder Jun 11, 2024
a1969c3
refactor(2d-render-pipeline): opt code
singlecoder Jun 11, 2024
78059b3
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 11, 2024
7d57894
feat(ui): temp code
singlecoder Jun 11, 2024
59d5c86
refactor(2d-render-pipeline): opt chunk
singlecoder Jun 11, 2024
531e2b3
refactor(2d-render-pipeline): revert code
singlecoder Jun 11, 2024
67eea0f
refactor(2d-render-pipeline): opt code
singlecoder Jun 11, 2024
41401e4
refactor(2d-render-pipeline): opt code
singlecoder Jun 11, 2024
0e48dbb
refactor(2d-render-pipeline): opt object pool
singlecoder Jun 11, 2024
4cb99c8
refactor(2d-render-pipeline): opt code for dynamic geometry data
singlecoder Jun 11, 2024
e2a74ca
refactor(2d-render-pipeline): opt code
singlecoder Jun 11, 2024
ef592f6
refactor(2d-render-pipeline): opt code
singlecoder Jun 11, 2024
80e88c8
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 12, 2024
edc5953
refactor(2d-render-pipeline): fix import error
singlecoder Jun 12, 2024
6a0962e
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 12, 2024
b4748af
refactor(2d-render-pipeline): opt code
singlecoder Jun 12, 2024
3d8cbc2
refactor(2d-render-pipeline): fix test error
singlecoder Jun 12, 2024
c880f70
refactor(2d-render-pipeline): refactor mask
singlecoder Jun 12, 2024
0455188
refactor(2d-render-pipeline): opt upload buffer
singlecoder Jun 12, 2024
44447f3
refactor(2d-render-pipeline): opt code
singlecoder Jun 12, 2024
98e7887
refactor(2d-render-pipeline): add sub render element and sub render data
singlecoder Jun 13, 2024
4b5dc36
refactor(2d-render-pipeline): opt dynamic update shader data for rend…
singlecoder Jun 13, 2024
7f6798d
refactor(2d-render-pipeline): fix text render error
singlecoder Jun 13, 2024
7347e62
refactor(2d-render-pipeline): fix mesh renderer error
singlecoder Jun 13, 2024
59ce725
refactor(2d-render-pipeline): opt code
singlecoder Jun 13, 2024
c502f6d
refactor(2d-render-pipeline): delete unused class
singlecoder Jun 13, 2024
e0e85c6
refactor(2d-render-pipeline): clean render element
singlecoder Jun 13, 2024
70cc80d
refactor(2d-render-pipeline): opt code
singlecoder Jun 13, 2024
8ca4efb
refactor(2d-render-pipeline): opt code for push render data
singlecoder Jun 13, 2024
ba35d56
refactor(2d-render-pipeline): opt code
singlecoder Jun 13, 2024
10d4bf5
refactor(2d-render-pipeline): opt code
singlecoder Jun 13, 2024
c100342
refactor(2d-render-pipeline): delete render data usage
singlecoder Jun 13, 2024
e51478c
refactor(2d-render-pipeline): opt code
singlecoder Jun 14, 2024
bbbc3ff
refactor(2d-render-pipeline): opt text renderer
singlecoder Jun 14, 2024
4c9794b
refactor(2d-render-pipeline): add textSubRenderElementPool for text r…
singlecoder Jun 14, 2024
30348f1
refactor(2d-render-pipeline): opt code for mask
singlecoder Jun 14, 2024
8583bf9
refactor(2d-render-pipeline): opt code for mask
singlecoder Jun 14, 2024
43687db
refactor(2d-render-pipeline): opt text renderer
singlecoder Jun 14, 2024
754a7f4
refactor(2d-render-pipeline): opt code
singlecoder Jun 14, 2024
8332c31
refactor(2d-render-pipeline): opt code
singlecoder Jun 14, 2024
6b07a12
refactor(2d-render-pipeline): opt code
singlecoder Jun 14, 2024
1bf8334
refactor(2d-render-pipeline): opt upload buffer
singlecoder Jun 14, 2024
3f46739
refactor(2d-render-pipeline): opt upload buffer
singlecoder Jun 14, 2024
dc293bd
refactor(2d-render-pipeline): rename dynamic geometry data
singlecoder Jun 14, 2024
9860e71
refactor(2d-render-pipeline): rename dynamic geometry data
singlecoder Jun 14, 2024
2ab14d6
refactor(2d-render-pipeline): rename dynamic geometry data
singlecoder Jun 14, 2024
beb3593
refactor(2d-render-pipeline): opt code
singlecoder Jun 14, 2024
aa0d174
refactor(2d-render-pipeline): opt code
singlecoder Jun 14, 2024
af0f2d7
refactor(2d-render-pipeline): opt code
singlecoder Jun 14, 2024
0b45a7f
refactor(2d-render-pipeline): opt code
singlecoder Jun 14, 2024
7cb710c
refactor(2d-render-pipeline): opt code
singlecoder Jun 14, 2024
e4f0d93
refactor(2d-render-pipeline): fix test error
singlecoder Jun 14, 2024
854410d
Test0 (#10)
GuoLei1990 Jun 17, 2024
5cb8b48
refactor(2d-render-pipeline): opt code
singlecoder Jun 17, 2024
ce13c8e
refactor(2d-render-pipeline): fix conflict from dev/1.3
singlecoder Jun 17, 2024
e9f2bee
refactor(2d-render-pipeline): fix upload buffer error
singlecoder Jun 17, 2024
38edcbf
refactor(2d-renderpip): fix show errofffffffffffffffffffffff
singlecoder Jun 17, 2024
9d407d2
feat(ui): merge from refactor 2d render pipeline and fix conflicts
singlecoder Jun 18, 2024
043d9fa
refactor(2d-render-pipeline): opt code
singlecoder Jun 18, 2024
0aa5514
refactor(2d-render-pipeline): opt code
singlecoder Jun 18, 2024
6475f15
fix(e2e): fix e2e error
singlecoder Jun 18, 2024
6a7bf93
refactor(2d-render-pipeline): fix conflicts
singlecoder Jun 18, 2024
0b99f79
refactor(2d-render-pipeline): opt code
singlecoder Jun 18, 2024
75bc0c1
refactor(2d-render-pipeline): fix conflicts
singlecoder Jun 19, 2024
beb506b
refactor(2d-render-pipeline): fix e2e error
singlecoder Jun 19, 2024
fdca466
refactor(2d-render-pipeline): opt code
singlecoder Jun 19, 2024
e3f0aae
refactor(2d-render-pipeline): fix e2e screen shot error
singlecoder Jun 19, 2024
37359f0
refactor(2d-render-pipeline): opt code
singlecoder Jun 19, 2024
31529a9
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 19, 2024
1203df7
refactor(2d-render-pipeline): opt code
singlecoder Jun 19, 2024
42dcd13
Merge branch 'refactor/2d-render-pipeline' into feature/ui-init
singlecoder Jun 19, 2024
5fef2a1
Merge branch 'dev/1.3' into feature/ui-init
singlecoder Jun 20, 2024
78add14
feat: ui transform (#9)
cptbtptpbcptdtptp Jun 20, 2024
fd2dc9d
Merge remote-tracking branch 'chengkong/feature/ui-init' into feature…
singlecoder Jun 20, 2024
c9177bf
Merge branch 'dev/1.3' into feature/ui-init
singlecoder Jun 25, 2024
e71a6da
feat(ui): fix conflicts from dev/1.3
singlecoder Jul 4, 2024
1457cdd
UI Canvas (#11)
singlecoder Jul 16, 2024
c9b3157
feat(ui): fix conflicts from dev/1.3
singlecoder Jul 16, 2024
477af1f
feat(ui): opt code for ui canvas
singlecoder Jul 17, 2024
7ccffd3
Merge branch 'dev/1.3' into feature/ui-init
singlecoder Jul 17, 2024
11691f6
feat(ui): opt code
singlecoder Jul 18, 2024
4934498
feat(ui): opt code
singlecoder Jul 18, 2024
f0ebdd0
feat(ui): opt cde
singlecoder Jul 18, 2024
fa07ecd
feat(ui): fix conflicts from dev/1.3
singlecoder Jul 23, 2024
7ae6558
Merge branch 'dev/1.3' into feature/ui-init
singlecoder Jul 30, 2024
52c0d28
feat(ui): add overlay camera add and remove when need
singlecoder Jul 30, 2024
5931066
feat(gui): merge main
singlecoder Aug 13, 2024
a197c1e
Merge code (#12)
cptbtptpbcptdtptp Aug 29, 2024
189a1e7
fix: shaderlab code
Aug 9, 2024
aa6aff8
fix: shaderlab code
Aug 9, 2024
077e163
fix: sprite mask clone bug (#2327)
cptbtptpbcptdtptp Aug 12, 2024
40d926f
Fix animator play backwards error and onStateExit not triggered when …
luzhuang Aug 13, 2024
334bd4a
Fix CharactorController move not effect with transform changed in upd…
luzhuang Aug 13, 2024
8d0ee7a
"v1.3.6"
GuoLei1990 Aug 13, 2024
fc9302b
doc: fix english version of canvas
MrKou47 Aug 13, 2024
2dce250
Feat/add spine doc (#2334)
johanzhu Aug 14, 2024
4e83314
Update README.md
GuoLei1990 Aug 18, 2024
012b61e
Update README.md
GuoLei1990 Aug 18, 2024
f7dacdc
Fix particleRenderer enable startFrame (#2333)
JujieX Aug 20, 2024
41075e6
"v1.3.7"
GuoLei1990 Aug 20, 2024
2f4ce0f
fix(demo): fix video demo error in ios, video will show full screen (…
singlecoder Aug 20, 2024
04bb5b3
Change image in spine doc (#2356)
johanzhu Aug 21, 2024
f237f6a
feat(gui): merge code from dev 1.4
singlecoder Aug 29, 2024
20a1d30
Init UI Input (#13)
cptbtptpbcptdtptp Sep 12, 2024
5279a74
Merge branch 'dev/1.4' into feature/ui-init
singlecoder Sep 12, 2024
6a87332
feat(gui): opt code
singlecoder Oct 10, 2024
a5e0642
feat(gui): opt code
singlecoder Oct 11, 2024
d88532f
Add bubble event. (#16)
cptbtptpbcptdtptp Oct 11, 2024
6904c05
Add UI culling. (#17)
cptbtptpbcptdtptp Oct 21, 2024
d6c03fa
Modify the ui logic as suggested. (#18)
cptbtptpbcptdtptp Oct 22, 2024
f702b2b
feat(ui): fix conflicts
singlecoder Oct 22, 2024
bc8a8d4
Update ui code (#19)
cptbtptpbcptdtptp Oct 24, 2024
53d136e
Add `UIImage.alphaHitTestMinimumThreshold` (#20)
cptbtptpbcptdtptp Oct 28, 2024
15b8e6c
feat(ui): add ui text
singlecoder Nov 1, 2024
4b2487d
Add ui button. (#21)
cptbtptpbcptdtptp Nov 5, 2024
ae63b66
Add UI (#22)
cptbtptpbcptdtptp Nov 6, 2024
8094d8a
feat(ui): fix text bug
singlecoder Nov 6, 2024
3a29609
Separate ui package (#23)
cptbtptpbcptdtptp Nov 20, 2024
8a7073a
Merge branch 'dev/1.4' into feature/ui-init
singlecoder Nov 20, 2024
b8bb449
feat(ui): fix package version
singlecoder Nov 20, 2024
5d4af60
feat(ui): fix lint error
singlecoder Nov 20, 2024
c4ace76
Fix lint error (#24)
cptbtptpbcptdtptp Nov 20, 2024
d73f8f5
Fix pnpm lock (#25)
cptbtptpbcptdtptp Nov 20, 2024
237230d
Delete mini program (#2433)
singlecoder Nov 20, 2024
2511b08
chore: release v1.4.0-alpha.0
GuoLei1990 Nov 26, 2024
14008ad
feat(ui): add implements ITextRenderer for TextRenderer and Label
singlecoder Dec 5, 2024
c3a7089
feat(ui): opt code
singlecoder Dec 6, 2024
a10bb1b
feat(ui): opt code
singlecoder Dec 10, 2024
e300764
feat(ui): fix conflicts from dev/1.4
singlecoder Dec 10, 2024
47a9a97
feat(ui): fix conflicts from dev/1.4
singlecoder Dec 12, 2024
ecbf411
Update GUI code (#26)
cptbtptpbcptdtptp Dec 17, 2024
d984227
feat(ui): fix TextUtils test
singlecoder Dec 17, 2024
c05a6fc
feat(ui): fix conflicts from dev/1.4
singlecoder Dec 17, 2024
923bc96
Merge branch 'dev/1.4' into feature/ui-init
singlecoder Dec 17, 2024
81389df
feat(ui): add test for label
singlecoder Dec 17, 2024
d1592ac
feat(ui): prettier
singlecoder Dec 17, 2024
bb3b3e8
feat(ui): prettier
singlecoder Dec 17, 2024
3929d73
Update gui code (#27)
cptbtptpbcptdtptp Dec 19, 2024
f91d08b
Update gui code. (#28)
cptbtptpbcptdtptp Dec 19, 2024
0bbe7eb
Opt gui code. (#29)
cptbtptpbcptdtptp Dec 23, 2024
b404109
feat(ui): fix conflicts from dev/1.4
singlecoder Dec 24, 2024
9fda417
Replace ui shader (#30)
cptbtptpbcptdtptp Dec 24, 2024
847a1c9
Update gui code. (#31)
cptbtptpbcptdtptp Dec 24, 2024
3ef755a
Delete local bounds (#32)
cptbtptpbcptdtptp Dec 25, 2024
79413fc
feat(ui): merge dev/1.4
singlecoder Dec 25, 2024
e467333
feat(ui): fix label bounding box and support pivot
singlecoder Dec 26, 2024
edf432f
delete: delete alphaHitTestMinimumThreshold
cptbtptpbcptdtptp Dec 30, 2024
ca5306c
Update GUI code (#34)
cptbtptpbcptdtptp Dec 31, 2024
66aa974
Opt: opt code
cptbtptpbcptdtptp Dec 31, 2024
185c659
Update GUI (#36)
cptbtptpbcptdtptp Dec 31, 2024
152368f
Add `referenceResolutionPerUnit` and fix hierarchy dirty bug (#37)
cptbtptpbcptdtptp Jan 2, 2025
ab7cf58
Merge branch 'dev/1.4' into feature/ui-init
singlecoder Jan 6, 2025
be1d389
Adopt suggestions in CR. (#38)
cptbtptpbcptdtptp Jan 7, 2025
a63f4c4
Improve `ReadMe` (#39)
cptbtptpbcptdtptp Jan 7, 2025
3563bc0
Refactor `PostProcessParameter` to strong type (#2487)
zhuxudong Jan 6, 2025
c19f8cc
Support parse method result (#2485)
zhuxudong Jan 6, 2025
7a9d1ec
feat: spine support git clone branch (#2488)
singlecoder Jan 6, 2025
3bca5af
Update release.yml
MrKou47 Jan 7, 2025
b338f12
Update release.yml
MrKou47 Jan 7, 2025
46734a0
Remove unused physX function (#2490)
luzhuang Jan 7, 2025
fcc6c1c
fix Iridescence name (#2489)
hhhhkrx Jan 7, 2025
bd0e4e1
Fix ci e2e error (#2492)
Sway007 Jan 7, 2025
fd267ba
更新 vitest.config.ts
GuoLei1990 Jan 7, 2025
374b4d0
built-in prefiltered lut (#2463)
zhuxudong Jan 8, 2025
dcdfc1a
Update physX wasm without assertions (#2493)
luzhuang Jan 8, 2025
8ffb614
Merge code and fix unit test error (#40)
cptbtptpbcptdtptp Jan 8, 2025
5a43240
`UIRenderer.raycastEnable` -> `UIRenderer.raycastEnabled` (#41)
cptbtptpbcptdtptp Jan 8, 2025
406b95a
Fix conflicts
cptbtptpbcptdtptp Jan 9, 2025
0da25b5
fix: fix conflicts
singlecoder Jan 9, 2025
a289bbc
Merge code. (#44)
cptbtptpbcptdtptp Jan 9, 2025
674ff50
Merge branch 'dev/1.4' into feature/ui-init
singlecoder Jan 9, 2025
c81cefe
fix: fix conflicts
singlecoder Jan 9, 2025
d05c9f3
feat(ui): support platform
singlecoder Jan 9, 2025
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
12 changes: 10 additions & 2 deletions packages/core/src/2d/assembler/ISpriteAssembler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { Vector2 } from "@galacean/engine-math";
import { Renderer } from "../../Renderer";

/**
* @internal
*/
export interface ISpriteAssembler {
resetData(renderer: Renderer, vertexCount?: number): void;
updatePositions?(renderer: Renderer): void;
updatePositions?(
cptbtptpbcptdtptp marked this conversation as resolved.
Show resolved Hide resolved
renderer: Renderer,
width: number,
height: number,
pivot: Vector2,
flipX?: boolean,
flipY?: boolean
): void;
updateUVs?(renderer: Renderer): void;
updateColor?(renderer: Renderer): void;
updateColor?(renderer: Renderer, alpha?: number): void;
}
29 changes: 18 additions & 11 deletions packages/core/src/2d/assembler/SimpleSpriteAssembler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BoundingBox, Matrix } from "@galacean/engine-math";
import { Matrix, Vector2 } from "@galacean/engine-math";
import { StaticInterfaceImplement } from "../../base/StaticInterfaceImplement";
import { UIImage } from "../../ui";
import { SpriteMask } from "../sprite";
import { SpriteRenderer } from "../sprite/SpriteRenderer";
import { ISpriteAssembler } from "./ISpriteAssembler";
Expand All @@ -12,7 +13,7 @@ export class SimpleSpriteAssembler {
static _rectangleTriangles = [0, 1, 2, 2, 1, 3];
static _worldMatrix = new Matrix();

static resetData(renderer: SpriteRenderer | SpriteMask): void {
static resetData(renderer: SpriteRenderer | SpriteMask | UIImage): void {
const manager = renderer._getChunkManager();
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that we now have three related types (SpriteRenderer, SpriteMask, and UIImage). To improve readability and maintainability, would it be better to define a single type for these renderable components, such as Renderable? This way, we can avoid redundancy and make future updates easier.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, you should try to pr

const lastSubChunk = renderer._subChunk;
lastSubChunk && manager.freeSubChunk(lastSubChunk);
Expand All @@ -21,16 +22,23 @@ export class SimpleSpriteAssembler {
renderer._subChunk = subChunk;
}

static updatePositions(renderer: SpriteRenderer | SpriteMask): void {
const { width, height, sprite } = renderer;
const { x: pivotX, y: pivotY } = sprite.pivot;
static updatePositions(
renderer: SpriteRenderer | SpriteMask | UIImage,
width: number,
height: number,
pivot: Vector2,
flipX: boolean = false,
flipY: boolean = false
): void {
Copy link
Member

Choose a reason for hiding this comment

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

Delete default value

Copy link
Collaborator

Choose a reason for hiding this comment

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

Done.

const { sprite } = renderer;
const { x: pivotX, y: pivotY } = pivot;
// Renderer's worldMatrix
const worldMatrix = SimpleSpriteAssembler._worldMatrix;
const { elements: wE } = worldMatrix;
// Parent's worldMatrix
const { elements: pWE } = renderer.entity.transform.worldMatrix;
const sx = renderer.flipX ? -width : width;
const sy = renderer.flipY ? -height : height;
const sx = flipX ? -width : width;
const sy = flipY ? -height : height;
(wE[0] = pWE[0] * sx), (wE[1] = pWE[1] * sx), (wE[2] = pWE[2] * sx);
GuoLei1990 marked this conversation as resolved.
Show resolved Hide resolved
(wE[4] = pWE[4] * sy), (wE[5] = pWE[5] * sy), (wE[6] = pWE[6] * sy);
(wE[8] = pWE[8]), (wE[9] = pWE[9]), (wE[10] = pWE[10]);
Expand All @@ -53,8 +61,6 @@ export class SimpleSpriteAssembler {
vertices[o + 1] = wE[1] * x + wE[5] * y + wE[13];
vertices[o + 2] = wE[2] * x + wE[6] * y + wE[14];
}

BoundingBox.transform(sprite._getBounds(), worldMatrix, renderer._bounds);
}

static updateUVs(renderer: SpriteRenderer | SpriteMask): void {
Expand All @@ -74,15 +80,16 @@ export class SimpleSpriteAssembler {
vertices[offset + 28] = top;
}

static updateColor(renderer: SpriteRenderer): void {
static updateColor(renderer: SpriteRenderer, alpha: number = 1): void {
const subChunk = renderer._subChunk;
const { r, g, b, a } = renderer.color;
const finalAlpha = a * alpha;
const vertices = subChunk.chunk.vertices;
Copy link
Contributor

Choose a reason for hiding this comment

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

Above three lines and following line can be optimized using destructuring to reduce redundancy and improve readability. Here’s an optimized version:

const { _subChunk: { chunk: { vertices } }, color: { r, g, b, a } } = renderer;
const finalAlpha = a * alpha;

for (let i = 0, o = subChunk.vertexArea.start + 5; i < 4; ++i, o += 9) {
vertices[o] = r;
vertices[o + 1] = g;
vertices[o + 2] = b;
vertices[o + 3] = a;
vertices[o + 3] = finalAlpha;
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add parameter validation for alpha value.

The alpha parameter should be validated to ensure it's within the valid range [0, 1]:

 static updateColor(renderer: SpriteRenderer, alpha: number = 1): void {
+  if (alpha < 0 || alpha > 1) {
+    throw new Error("Alpha value must be between 0 and 1");
+  }
   const subChunk = renderer._subChunk;
   const { r, g, b, a } = renderer.color;
   const finalAlpha = a * alpha;
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
static updateColor(renderer: SpriteRenderer, alpha: number = 1): void {
const subChunk = renderer._subChunk;
const { r, g, b, a } = renderer.color;
const finalAlpha = a * alpha;
const vertices = subChunk.chunk.vertices;
for (let i = 0, o = subChunk.vertexArea.start + 5; i < 4; ++i, o += 9) {
vertices[o] = r;
vertices[o + 1] = g;
vertices[o + 2] = b;
vertices[o + 3] = a;
vertices[o + 3] = finalAlpha;
static updateColor(renderer: SpriteRenderer, alpha: number = 1): void {
if (alpha < 0 || alpha > 1) {
throw new Error("Alpha value must be between 0 and 1");
}
const subChunk = renderer._subChunk;
const { r, g, b, a } = renderer.color;
const finalAlpha = a * alpha;
const vertices = subChunk.chunk.vertices;
for (let i = 0, o = subChunk.vertexArea.start + 5; i < 4; ++i, o += 9) {
vertices[o] = r;
vertices[o + 1] = g;
vertices[o + 2] = b;
vertices[o + 3] = finalAlpha;

}
}
39 changes: 22 additions & 17 deletions packages/core/src/2d/assembler/SlicedSpriteAssembler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Matrix } from "@galacean/engine-math";
import { Matrix, Vector2 } from "@galacean/engine-math";
import { StaticInterfaceImplement } from "../../base/StaticInterfaceImplement";
import { UIImage } from "../../ui";
import { SpriteMask } from "../sprite";
import { SpriteRenderer } from "../sprite/SpriteRenderer";
import { ISpriteAssembler } from "./ISpriteAssembler";

Expand All @@ -14,7 +16,7 @@ export class SlicedSpriteAssembler {
];
static _worldMatrix = new Matrix();

static resetData(renderer: SpriteRenderer): void {
static resetData(renderer: SpriteRenderer | UIImage): void {
const manager = renderer._getChunkManager();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as the previous comment regarding SpriteRenderer | SpriteMask | UIImage. To avoid redundancy, consider using the same Renderable type here as well. See the comment in packages/core/src/2d/assembler/SimpleSpriteAssembler.ts

const lastSubChunk = renderer._subChunk;
lastSubChunk && manager.freeSubChunk(lastSubChunk);
Expand All @@ -23,8 +25,15 @@ export class SlicedSpriteAssembler {
renderer._subChunk = subChunk;
}

static updatePositions(renderer: SpriteRenderer): void {
const { width, height, sprite } = renderer;
static updatePositions(
renderer: SpriteRenderer | SpriteMask | UIImage,
cptbtptpbcptdtptp marked this conversation as resolved.
Show resolved Hide resolved
width: number,
height: number,
pivot: Vector2,
flipX: boolean = false,
flipY: boolean = false
): void {
const { sprite } = renderer;
const { border } = sprite;
// Update local positions.
cptbtptpbcptdtptp marked this conversation as resolved.
Show resolved Hide resolved
const spritePositions = sprite._getPositions();
Expand Down Expand Up @@ -73,16 +82,16 @@ export class SlicedSpriteAssembler {
}

// Update renderer's worldMatrix.
const { x: pivotX, y: pivotY } = renderer.sprite.pivot;
const localTransX = renderer.width * pivotX;
const localTransY = renderer.height * pivotY;
const { x: pivotX, y: pivotY } = pivot;
const localTransX = width * pivotX;
const localTransY = height * pivotY;
// Renderer's worldMatrix.
const worldMatrix = SlicedSpriteAssembler._worldMatrix;
const { elements: wE } = worldMatrix;
// Parent's worldMatrix.
const { elements: pWE } = renderer.entity.transform.worldMatrix;
const sx = renderer.flipX ? -1 : 1;
const sy = renderer.flipY ? -1 : 1;
const sx = flipX ? -1 : 1;
const sy = flipY ? -1 : 1;
(wE[0] = pWE[0] * sx), (wE[1] = pWE[1] * sx), (wE[2] = pWE[2] * sx);
(wE[4] = pWE[4] * sy), (wE[5] = pWE[5] * sy), (wE[6] = pWE[6] * sy);
(wE[8] = pWE[8]), (wE[9] = pWE[9]), (wE[10] = pWE[10]);
Expand Down Expand Up @@ -111,14 +120,9 @@ export class SlicedSpriteAssembler {
vertices[o + 2] = wE[2] * rowValue + wE[6] * columnValue + wE[14];
}
}

const { min, max } = renderer._bounds;
min.set(row[0], column[0], 0);
max.set(row[3], column[3], 0);
renderer._bounds.transform(worldMatrix);
}

static updateUVs(renderer: SpriteRenderer): void {
static updateUVs(renderer: SpriteRenderer | UIImage): void {
const subChunk = renderer._subChunk;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as commented above.
we have renderer: SpriteRenderer | UIImage, which includes only two classes.
If we anticipate this pattern expanding or being reused in the future, it might still be beneficial to define a type like Renderable for consistency and maintainability, even though there are currently only two classes. However, if this combination is unique to this specific case, leaving it as-is might be more straightforward.

const vertices = subChunk.chunk.vertices;
const spriteUVs = renderer.sprite._getUVs();
Expand All @@ -131,15 +135,16 @@ export class SlicedSpriteAssembler {
}
}

static updateColor(renderer: SpriteRenderer): void {
static updateColor(renderer: SpriteRenderer | UIImage, alpha: number = 1): void {
const subChunk = renderer._subChunk;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as commented above.
we have renderer: SpriteRenderer | UIImage, which includes only two classes.
If we anticipate this pattern expanding or being reused in the future, it might still be beneficial to define a type like Renderable for consistency and maintainability, even though there are currently only two classes. However, if this combination is unique to this specific case, leaving it as-is might be more straightforward.

const { r, g, b, a } = renderer.color;
const finalAlpha = a * alpha;
const vertices = subChunk.chunk.vertices;
cptbtptpbcptdtptp marked this conversation as resolved.
Show resolved Hide resolved
for (let i = 0, o = subChunk.vertexArea.start + 5; i < 16; ++i, o += 9) {
vertices[o] = r;
vertices[o + 1] = g;
vertices[o + 2] = b;
vertices[o + 3] = a;
vertices[o + 3] = finalAlpha;
}
}
}
40 changes: 22 additions & 18 deletions packages/core/src/2d/assembler/TiledSpriteAssembler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { MathUtil, Matrix } from "@galacean/engine-math";
import { MathUtil, Matrix, Vector2 } from "@galacean/engine-math";
import { Logger } from "../../base";
import { StaticInterfaceImplement } from "../../base/StaticInterfaceImplement";
import { UIImage } from "../../ui";
import { DisorderedArray } from "../../utils/DisorderedArray";
import { SpriteTileMode } from "../enums/SpriteTileMode";
import { Sprite } from "../sprite";
import { SpriteRenderer } from "../sprite/SpriteRenderer";
import { ISpriteAssembler } from "./ISpriteAssembler";
import { DisorderedArray } from "../../utils/DisorderedArray";

/**
* @internal
Expand All @@ -18,7 +19,7 @@ export class TiledSpriteAssembler {
static _uvRow = new DisorderedArray<number>();
static _uvColumn = new DisorderedArray<number>();

static resetData(renderer: SpriteRenderer, vertexCount: number): void {
static resetData(renderer: SpriteRenderer | UIImage, vertexCount: number): void {
if (vertexCount) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as commented above.
we have renderer: SpriteRenderer | UIImage, which includes only two classes.
If we anticipate this pattern expanding or being reused in the future, it might still be beneficial to define a type like Renderable for consistency and maintainability, even though there are currently only two classes. However, if this combination is unique to this specific case, leaving it as-is might be more straightforward.

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider creating a shared interface for renderer types.

Since multiple methods use the union type SpriteRenderer | UIImage, consider extracting this to a shared interface or type alias to improve maintainability and ensure consistency.

type Renderable = SpriteRenderer | UIImage;

static resetData(renderer: Renderable, vertexCount: number): void {

const manager = renderer._getChunkManager();
const lastSubChunk = renderer._subChunk;
Expand All @@ -33,8 +34,15 @@ export class TiledSpriteAssembler {
}
}

static updatePositions(renderer: SpriteRenderer): void {
const { width, height, sprite, tileMode, tiledAdaptiveThreshold: threshold } = renderer;
static updatePositions(
renderer: SpriteRenderer | UIImage,
cptbtptpbcptdtptp marked this conversation as resolved.
Show resolved Hide resolved
width: number,
height: number,
pivot: Vector2,
flipX: boolean = false,
flipY: boolean = false
): void {
const { sprite, tileMode, tiledAdaptiveThreshold: threshold } = renderer;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider encapsulating parameters into an object for better maintainability

The updatePositions method now accepts multiple parameters (width, height, pivot, flipX, flipY), which can make the method signature lengthy and harder to maintain. Consider encapsulating these related parameters into a single object or interface. This approach enhances readability and makes it easier to manage changes to these parameters in the future.

// Calculate row and column
const { _posRow: posRow, _posColumn: posColumn, _uvRow: uvRow, _uvColumn: uvColumn } = TiledSpriteAssembler;
const maxVertexCount = renderer._getChunkManager().maxVertexCount;
Expand Down Expand Up @@ -64,16 +72,16 @@ export class TiledSpriteAssembler {
);
TiledSpriteAssembler.resetData(renderer, vertexCount);
// Update renderer's worldMatrix
const { x: pivotX, y: pivotY } = renderer.sprite.pivot;
const localTransX = renderer.width * pivotX;
const localTransY = renderer.height * pivotY;
const { x: pivotX, y: pivotY } = pivot;
const localTransX = width * pivotX;
const localTransY = height * pivotY;
// Renderer's worldMatrix
const { _worldMatrix: worldMatrix } = TiledSpriteAssembler;
const { elements: wE } = worldMatrix;
// Parent's worldMatrix
const { elements: pWE } = renderer.entity.transform.worldMatrix;
const sx = renderer.flipX ? -1 : 1;
const sy = renderer.flipY ? -1 : 1;
const sx = flipX ? -1 : 1;
const sy = flipY ? -1 : 1;
let wE0: number, wE1: number, wE2: number;
let wE4: number, wE5: number, wE6: number;
(wE0 = wE[0] = pWE[0] * sx), (wE1 = wE[1] = pWE[1] * sx), (wE2 = wE[2] = pWE[2] * sx);
Expand Down Expand Up @@ -132,14 +140,9 @@ export class TiledSpriteAssembler {
o += 36;
}
}

const { min, max } = renderer._bounds;
min.set(posRow.get(0), posColumn.get(0), 0);
max.set(posRow.get(rowLength), posColumn.get(columnLength), 0);
renderer._bounds.transform(worldMatrix);
}

static updateUVs(renderer: SpriteRenderer): void {
static updateUVs(renderer: SpriteRenderer | UIImage): void {
const { _posRow: posRow, _posColumn: posColumn, _uvRow: uvRow, _uvColumn: uvColumn } = TiledSpriteAssembler;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as commented above.
we have renderer: SpriteRenderer | UIImage, which includes only two classes.
If we anticipate this pattern expanding or being reused in the future, it might still be beneficial to define a type like Renderable for consistency and maintainability, even though there are currently only two classes. However, if this combination is unique to this specific case, leaving it as-is might be more straightforward.

const rowLength = posRow.length - 1;
const columnLength = posColumn.length - 1;
Expand Down Expand Up @@ -173,16 +176,17 @@ export class TiledSpriteAssembler {
}
}

static updateColor(renderer: SpriteRenderer): void {
static updateColor(renderer: SpriteRenderer | UIImage, alpha: number = 1): void {
const subChunk = renderer._subChunk;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as commented above.
we have renderer: SpriteRenderer | UIImage, which includes only two classes.
If we anticipate this pattern expanding or being reused in the future, it might still be beneficial to define a type like Renderable for consistency and maintainability, even though there are currently only two classes. However, if this combination is unique to this specific case, leaving it as-is might be more straightforward.

const { r, g, b, a } = renderer.color;
const finalAlpha = a * alpha;
const vertices = subChunk.chunk.vertices;
const vertexArea = subChunk.vertexArea;
Copy link
Contributor

Choose a reason for hiding this comment

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

Above four lines can be optimized using destructuring to reduce redundancy and improve readability. Here’s an optimized version:

const { _subChunk: { chunk: { vertices } }, color: { r, g, b, a } } = renderer;
const finalAlpha = a * alpha;

Copy link
Member Author

Choose a reason for hiding this comment

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

Destructuring assignment is a concise syntax that is suitable for shallow objects and simple property extraction. It is the recommended approach, especially when dealing with properties that are certain to exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

👌 Thanks for the insight! Since destructuring is a subjective choice, let’s keep the original approach as it aligns with your style.

for (let i = 0, o = vertexArea.start + 5, n = vertexArea.size / 9; i < n; ++i, o += 9) {
vertices[o] = r;
vertices[o + 1] = g;
vertices[o + 2] = b;
vertices[o + 3] = a;
vertices[o + 3] = finalAlpha;
}
}

Expand Down
22 changes: 6 additions & 16 deletions packages/core/src/2d/sprite/Sprite.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { BoundingBox, MathUtil, Rect, Vector2, Vector4 } from "@galacean/engine-math";
import { MathUtil, Rect, Vector2, Vector4 } from "@galacean/engine-math";
import { Engine } from "../../Engine";
import { UpdateFlagManager } from "../../UpdateFlagManager";
import { ReferResource } from "../../asset/ReferResource";
import { ignoreClone } from "../../clone/CloneManager";
import { Texture2D } from "../../texture/Texture2D";
import { SpriteModifyFlags } from "../enums/SpriteModifyFlags";
import { SpriteAtlas } from "../atlas/SpriteAtlas";
import { SpriteModifyFlags } from "../enums/SpriteModifyFlags";

/**
* 2D sprite.
Expand All @@ -20,7 +21,6 @@ export class Sprite extends ReferResource {

private _positions: Vector2[] = [new Vector2(), new Vector2(), new Vector2(), new Vector2()];
private _uvs: Vector2[] = [new Vector2(), new Vector2(), new Vector2(), new Vector2()];
private _bounds: BoundingBox = new BoundingBox();

private _texture: Texture2D = null;
private _atlasRotated: boolean = false;
Expand Down Expand Up @@ -248,14 +248,6 @@ export class Sprite extends ReferResource {
return this._uvs;
}

/**
* @internal
*/
_getBounds(): BoundingBox {
this._dirtyUpdateFlag & SpriteUpdateFlags.positions && this._updatePositions();
Copy link
Member

Choose a reason for hiding this comment

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

Revert!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Done.

return this._bounds;
}

/**
* @internal
*/
Expand All @@ -279,7 +271,6 @@ export class Sprite extends ReferResource {
this._region = null;
this._pivot = null;
this._border = null;
this._bounds = null;
this._atlas = null;
this._texture = null;
this._updateFlagManager = null;
Expand Down Expand Up @@ -324,10 +315,6 @@ export class Sprite extends ReferResource {
positions[1].set(right, bottom);
positions[2].set(left, top);
positions[3].set(right, top);

const { min, max } = this._bounds;
min.set(left, bottom, 0);
max.set(right, top, 0);
this._dirtyUpdateFlag &= ~SpriteUpdateFlags.positions;
}

Expand Down Expand Up @@ -382,6 +369,7 @@ export class Sprite extends ReferResource {
this._updateFlagManager.dispatch(type);
}

@ignoreClone
private _onRegionChange(): void {
const { _region: region } = this;
// @ts-ignore
Expand All @@ -397,10 +385,12 @@ export class Sprite extends ReferResource {
region._onValueChanged = this._onRegionChange;
}

@ignoreClone
private _onPivotChange(): void {
this._dispatchSpriteChange(SpriteModifyFlags.pivot);
}

@ignoreClone
private _onBorderChange(): void {
const { _border: border } = this;
// @ts-ignore
Expand Down
Loading
Loading