75 Commits

Author SHA1 Message Date
Davide Tantillo
6cfe4cb1a5 [ts] Fix webglcontextlost/restored not correctly bound. Close #2938. 2025-09-29 11:41:55 +02:00
Davide Tantillo
0f91c7554b [ts] Formatting. 2025-07-18 11:24:39 +02:00
Davide Tantillo
351b2c6164 [ts][webgl][player] Dispose ManagedWebGLRenderingContext. 2025-07-18 10:30:51 +02:00
Davide Tantillo
6c46fcbbc6 [ts][webcomponents] Sharable cache for AssetManager. 2025-07-08 16:41:17 +02:00
Mario Zechner
97d49b37b7 License header update 2025-05-26 13:24:06 +02:00
Davide
c9b040f797
[ts] Add spine-webcomponents package
* [ts] poc wegl overlay

* [ts] poc wegl overlay

* canvas4

* overlay 4

* overlay

* overlay fix scroll cut

* Zoom fix - WIP horizontal scroll bug see comment at line 495

* Scroll should be resolved

* web component

* Loading

* mostly work - when overflow top/bottom...are > 0, widgets slightly jump on up and down fast scroll.

* Renamed

* Add OffScreenUpdateBehaviour

* Fixed loading spinner example

* Translate is done each frame through requestAnimationFrame.

* Added clip.

* Removed SpineCanvasApp dependency.

* Removed code duplication for clipping into div

* Refactor drag logic. Drag works with clip too.

* WIP - Doc before refactor

* WIP - Refactor + animation and skin attribute change will reinit the widget

* Modified export script to copy chibi

* Fix zoom bug due to screen size remaining the same at different zoom level.

* Removed useless changes on other classes.

* Removed custom LoadingSpinnerWindget class. Added a new specific method in LoadingSpinner.

* Fix 1 pixel misalignment in non clip mode.

* Cleaned webcomponent example.

* Made span fps display configurable.

* Made some changes to make it work on old browsers.

* Manage lifecycle for Input and SpineWebComponentOverlay. Missing SpineWebComponentWidget.

* Managed lifecycle for SpineWebComponentWidget.

* Fixed input remove listener. Run tsfmt.

* Fixed infinite requestAnimationFrame calls.

* Fix x-axis and y-axis not working in clip mode.

* Fix widget using overlay before overlay webcomponent is fully upgraded.

* Restore resize observer since the window resize event does not fire on body resize, but on window resize. It's supported by 93% of the browsers.

* Add padding attributes/properties.

* Exposed parameters to set bounds.
Deeply changed how bounds work, especially for the fact that they are not auto recalculated anymore if the animation is changed (unless autoRecalculateBounds is set to true).

* Changes to make the widget more dynamic while changing attributes. See now webcomponent-gui.html.

* Initial support of spine-widget into scrollable containers, and overlay-id for multiple spine-overlay.
working

* WIP - Added/Changed:
- overlay loading: now overlay is moved as the last element from where it is inserted to avoid widgets covered by backgrounds of html elements after it.
- default overlayId
- widget position in overlay coordinates (worldX, worldY) (experimental)
- cursor position on widget world (cursorWorldX, cursorWorldY) (experimental)
- jsonSkeletonKey: allow to load a specific skeleton in json containing multiple skeletons
- onViewportManualStart: start the widget when in manual-start and enters the viewport the first time
- overlayAssignedPromise: a promise that resolves when the overlay is assigned to the widget. Reads the comment on it
- appendTo: to append the widget created using js and wait for the overlayAssignedPromise to resolve
- changed how loadingPromise works
- added cursorCanvasX, cursorCanvasY, cursorWorldX, cursorWorldY to overlay (experimental)

* Docs and minor fixes.

* Fixed example.

* Allow multiple widgets for the same HTMLElement

* Simplified clip to div by using scissor rather than changing viewport+camera.
In this way we can treat coordinates equally for cliped and not clipped widgets!

* Simplified drag calculation and drag debug removing an additional div.

* WIP - Add interactivity events. isdraggable is currently broken.

* Add interactivity events.

* Fixed a bug where an infinite loop occurred in Firefox when compareDocumentPosition results in DOCUMENT_POSITION_DISCONNECTED.

In both Chrome and Firefox, when an element is inside a webcomponent the comparison results in DOCUMENT_POSITION_DISCONNECTED. But in Firefox the element result in DOCUMENT_POSITION_FOLLOWING too, leading to an infinite loop.

* Fix physicsTranslate y opposite direction while dragging.

* Add followSlot method

* Add animations, animations-bound and default-mix attributes.

* Original event is passed to bounds and slot callbacks.

* Made overlay canvas size consistent across different browsers. Base size is not anymore the screen size due to browser limitations, but the window size. This will trigger additional canvas resize on window resize.

* Reduce DPI if canvas is too big to avoid page crash - this happen on webpage on mobile with high dpi and missing meta viewport tag with width=device-width.

* Pma properties on atlas is used to detect pma textures.

* Add rawData attribute to pass s stringified JSON object for inline base64 assets.

* format

* Prevent useless resize.

* Prevent error on disconnected callback

* Update tutorial.

* Fixed multiple click events on mobile touches. Add team example.

* Fixed slot interaction issue.

* Resize overlay when follow slot element is added.

* Add interactive widget example.

* Temporarily add windmill only manually to webgl assets

* Move getBounding in scrollable case.

* formatter

* Fixed overlay disconnectedCallback.

* Overlay should load not for DOMContentLoaded event only if document has already complete loading.

* Overlay parent bounding box determined only if necessary.

* Overlay needs to consider border if it's scrollable.

* Fixed issues with slot events on mobile.

* food app and cleanup

* Make overlayAssignedPromise private.

* Change scrollable to appendedToBody, make it private and determine it at dom connect.

* scrollable-tweak-off changed to no-auto-parent-transform.

* Update bounds and slot interaction method names.

* getHTMLElementReference to getHostElement.

* recalculateBounds and autoRecalculateBounds to calculateBounds and autoCalculateBounds.

* dpi to dpr and transform DPR to DevicePixelRatio when needed. Add @internal tag to internal fields.

* Properties rename.

* Better comments and variable names for canvas resize related stuff.

* callbacks renamed consistently.

* for each to for of.

* Update other names.

* onScreenManualStart to startWhenVisible. startWhenVisible set manualStart to true.

* fix return to continue in for of.

* Refcounter for asset manager and gl resources disposal for webcomponent.

* Fixes to asset manager ref counter.

* Add dispose example.

* Fix overlay init not completed in some scenario.
DOMContentLoaded is invoked only when document.readyState is interactive.

* Cleaned up examples.

* spinner to no-spinner.

* Move webcomponent to spine-widget folder.

* start won't reset bounds.

* Remove test file.

* Moved team example in its own page.

* Improved tutorial explanations.

* Moved some examples in their own pages.

* Formatter.

* Widgets dragged can be dragged even if host is offscreen.

* General refactor. spine-widget to spine-skeleton.

* spine-widget package renamed to spine-webcomponents.

* Moved assets to a single assets folder.

* Run formatter.

* Add beta notice.

* Changed widget occurrences to webcomponents.
2025-05-09 15:59:00 +02:00
Davide Tantillo
b4d61790f7 [ts] Port of earlier clipping cleanup commit 485de74: SkeletonClipping.ClipTriangles clean up. 2024-06-11 15:18:26 +02:00
Davide Tantillo
f3097222f9 [ts] Skeleton.getBounds() applies clipping, see #2515. Port of commits b043e5c, 637321a and 2049bed. 2024-05-03 10:42:25 +02:00
Mario Zechner
944ccdce3e Merge branch '4.1' into 4.2-beta
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-phaser/package.json
#	spine-ts/spine-pixi/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2023-11-06 12:47:46 +01:00
Mario Zechner
9d4d86ced3 [ts] Attempt to fix incompatibility with Node's ESM implementation. See #2407 2023-11-06 12:42:00 +01:00
Mario Zechner
087b2688db [c] Closes #2394, double free of sequences in mesh attachments. 2023-10-11 11:44:36 +02:00
Nathan Sweet
351d42f511 [ts] Source whitespace. 2023-10-06 14:08:04 -04:00
Mario Zechner
1e657e8cac Merge branch '4.1' into 4.2-beta
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-phaser/package.json
#	spine-ts/spine-pixi/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2023-09-22 16:06:38 +02:00
Mario Zechner
c198203695 [ts] Closes #2370, added SpineCanvas.dispose and callback. 2023-09-22 15:55:59 +02:00
Mario Zechner
4e7c4a9159 Merge branch '4.1' into 4.2-beta 2023-09-14 13:13:02 +02:00
Mario Zechner
b5c5fb6bde Formatting. 2023-09-14 13:12:53 +02:00
Mario Zechner
b33c6c58cc Merge branch '4.1' into 4.2-beta
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-phaser/package.json
#	spine-ts/spine-pixi/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2023-09-13 22:29:16 +02:00
Mario Zechner
a397b8fe3f [webgl] Fix blend modes, see #2025, #2347 2023-09-13 22:26:27 +02:00
Mario Zechner
d5326a9823 Revert "split webgl blendmodes into separate destination color/alpha values (#2347)"
This reverts commit 07c05431bf8754415736052046123a97ab475d2c.

# Conflicts:
#	spine-ts/spine-webgl/src/SkeletonRenderer.ts
2023-09-13 19:43:45 +02:00
Mario Zechner
3b66796bb7 Merge branch '4.1' into 4.2-beta 2023-09-04 10:56:38 +02:00
Mario Zechner
600e43de24 Formatting 2023-09-04 10:56:28 +02:00
Mario Zechner
42959e0e72 Merge branch '4.1' into 4.2-beta
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-phaser/package.json
#	spine-ts/spine-phaser/src/SpinePlugin.ts
#	spine-ts/spine-pixi/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2023-09-04 10:54:21 +02:00
spayton
07c05431bf
split webgl blendmodes into separate destination color/alpha values (#2347) 2023-09-04 10:40:16 +02:00
Mario Zechner
e404d0bede [phaser] Closes #2348, SpineGameObject.willRender() didn't reset state correctly in case an object is inside a container. 2023-09-04 10:23:38 +02:00
Mario Zechner
74b7882efa Merge branch '4.1' into 4.2-beta 2023-07-31 13:29:29 +02:00
Mario Zechner
4047f1ba07 Updated license headers. 2023-07-31 13:29:16 +02:00
Mario Zechner
f1c13462c1 Formatting 2023-04-24 10:15:31 +02:00
Mario Zechner
04d22e1043 [ts][webgl] Fix duplicate case clause. 2023-04-21 14:18:17 +02:00
Mario Zechner
db6f624bc6 Merge branch '4.1' into 4.2-beta
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/publish.sh
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-phaser/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2023-04-17 16:29:45 +02:00
Mario Zechner
98f060b435 [ts] Refactor how textures are stored in texture regions, fix renderers, add custom attachment WebGL example. 2023-04-17 16:12:26 +02:00
Mario Zechner
260c269a1a Merge branch '4.1' into 4.2-beta 2023-04-12 15:13:52 +02:00
Mario Zechner
14219fa609 [phaser] Fix pack file plugin loading, clipping, demos. 2023-04-12 15:13:25 +02:00
Mario Zechner
9cef3b443a Merge branch '4.1' into 4.2-beta 2023-02-17 07:13:59 +01:00
Nathan Sweet
d5cd7f67b1 Don't indent shader code to minify better. 2023-02-16 19:29:27 -04:00
Mario Zechner
fcc5cab7b4 Merge branch '4.1' into 4.2-beta 2023-01-30 12:43:46 +01:00
Mario Zechner
b82e78079a [ts] Fix formatting. 2023-01-30 12:43:38 +01:00
Mario Zechner
594c87c676 Merge branch '4.1' into 4.2-beta
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-phaser/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2023-01-27 19:45:09 +01:00
Mario Zechner
83a8e5d66b [ts][player][webgl] Closes #2227, instead of disabling culling automatically, make it configurable via PolygonBatcher.disableCulling. Off by default. 2023-01-26 15:49:02 +01:00
Mario Zechner
1891d00025 Merge branch '4.1' into 4.2-beta 2023-01-16 14:00:14 +01:00
Mario Zechner
83945e17dc Apply formatter. 2023-01-16 14:00:01 +01:00
Mario Zechner
68a9096049 Merge branch '4.1' into 4.2-beta
# Conflicts:
#	.gitignore
#	spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp
#	spine-ts/package-lock.json
#	spine-ts/package.json
2022-12-27 11:48:02 +01:00
Mario Zechner
7ae9c490d5 [phaser] WebGL and Canvas rendering, fix mixins
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
2022-12-27 11:44:11 +01:00
Mario Zechner
d878e5356b Merge branch '4.1' into 4.2-beta
# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
2022-11-28 09:12:49 +01:00
Mario Zechner
c19194ac7d [ts] Closes #2207, updates threejs to latest. 2022-11-28 09:09:46 +01:00
Wolfgang Kurz
867af5c134
Fix webglConfig check (#2183)
Missing negative operator i guess.
2022-10-22 15:16:15 +02:00
Mario Zechner
0bfeff771e Formatting. 2022-09-03 12:29:40 +02:00
Mario Zechner
d4ef1b7a35 Formatting pass. 2022-08-29 13:48:49 +02:00
Mario Zechner
1a0cb86b52 [ts][webgl] Fixes #2138, mip maps weren't generated in all cases. 2022-08-19 18:02:15 +02:00
Mario Zechner
8973253dc7 [ts] Fixes #2139, incorrect null check. 2022-08-19 17:40:54 +02:00
Mario Zechner
5a9982b2fb [ts] Removed VertexEffect, see #2076 2022-05-30 14:55:29 +02:00