@galacean/engine-spine 4.2.0-beta.1 → 4.2.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/main.js +12168 -1
  3. package/dist/main.js.map +1 -1
  4. package/dist/miniprogram.js +12169 -1
  5. package/dist/module.js +12056 -1
  6. package/dist/module.js.map +1 -1
  7. package/package.json +5 -4
  8. package/types/example/outline.d.ts +11 -0
  9. package/types/loader/AdaptiveTexture.d.ts +13 -0
  10. package/types/loader/SpineAtlasLoader.d.ts +7 -0
  11. package/types/loader/SpineResource.d.ts +33 -0
  12. package/types/loader/SpineTexture.d.ts +13 -0
  13. package/types/loader/index.d.ts +4 -0
  14. package/types/renderer/SpineAnimationRenderer.d.ts +177 -0
  15. package/types/renderer/SpineGenerator.d.ts +35 -0
  16. package/types/renderer/SpineMaterial.d.ts +6 -0
  17. package/types/renderer/index.d.ts +2 -0
  18. package/types/spine-core/Animation.d.ts +378 -0
  19. package/types/spine-core/AnimationState.d.ts +365 -0
  20. package/types/spine-core/AnimationStateData.d.ts +23 -0
  21. package/types/spine-core/AssetManager.d.ts +36 -0
  22. package/types/spine-core/AtlasAttachmentLoader.d.ts +23 -0
  23. package/types/spine-core/BlendMode.d.ts +7 -0
  24. package/types/spine-core/Bone.d.ts +110 -0
  25. package/types/spine-core/BoneData.d.ts +44 -0
  26. package/types/spine-core/ConstraintData.d.ts +7 -0
  27. package/types/spine-core/Event.d.ts +16 -0
  28. package/types/spine-core/EventData.d.ts +13 -0
  29. package/types/spine-core/IkConstraint.d.ts +38 -0
  30. package/types/spine-core/IkConstraintData.d.ts +26 -0
  31. package/types/spine-core/PathConstraint.d.ts +46 -0
  32. package/types/spine-core/PathConstraintData.d.ts +52 -0
  33. package/types/spine-core/SharedAssetManager.d.ts +19 -0
  34. package/types/spine-core/Skeleton.d.ts +134 -0
  35. package/types/spine-core/SkeletonBinary.d.ts +49 -0
  36. package/types/spine-core/SkeletonBounds.d.ts +48 -0
  37. package/types/spine-core/SkeletonClipping.d.ts +22 -0
  38. package/types/spine-core/SkeletonData.d.ts +89 -0
  39. package/types/spine-core/SkeletonJson.d.ts +34 -0
  40. package/types/spine-core/Skin.d.ts +43 -0
  41. package/types/spine-core/Slot.d.ts +42 -0
  42. package/types/spine-core/SlotData.d.ts +23 -0
  43. package/types/spine-core/Texture.d.ts +43 -0
  44. package/types/spine-core/TextureAtlas.d.ts +30 -0
  45. package/types/spine-core/TransformConstraint.d.ts +36 -0
  46. package/types/spine-core/TransformConstraintData.d.ts +34 -0
  47. package/types/spine-core/Triangulator.d.ts +14 -0
  48. package/types/spine-core/Updatable.d.ts +9 -0
  49. package/types/spine-core/Utils.d.ts +124 -0
  50. package/types/spine-core/VertexEffect.d.ts +7 -0
  51. package/types/spine-core/attachments/Attachment.d.ts +43 -0
  52. package/types/spine-core/attachments/AttachmentLoader.d.ts +25 -0
  53. package/types/spine-core/attachments/AttachmentType.d.ts +9 -0
  54. package/types/spine-core/attachments/BoundingBoxAttachment.d.ts +12 -0
  55. package/types/spine-core/attachments/ClippingAttachment.d.ts +14 -0
  56. package/types/spine-core/attachments/MeshAttachment.d.ts +46 -0
  57. package/types/spine-core/attachments/PathAttachment.d.ts +19 -0
  58. package/types/spine-core/attachments/PointAttachment.d.ts +20 -0
  59. package/types/spine-core/attachments/RegionAttachment.d.ts +88 -0
  60. package/types/spine-core/index.d.ts +45 -0
  61. package/types/spine-core/polyfills.d.ts +1 -0
  62. package/types/spine-core/vertexeffects/JitterEffect.d.ts +11 -0
  63. package/types/spine-core/vertexeffects/SwirlEffect.d.ts +16 -0
  64. package/types/src/SpineAnimationRenderer.d.ts +197 -0
  65. package/types/src/SpineGenerator.d.ts +34 -0
  66. package/types/src/index.d.ts +9 -0
  67. package/types/src/loader/SpineLoader.d.ts +29 -0
  68. package/types/src/loader/SpineResource.d.ts +33 -0
  69. package/types/util/AttachmentTools.d.ts +24 -0
  70. package/types/util/index.d.ts +1 -0
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.2.0-beta.1",
2
+ "version": "4.2.0-beta.3",
3
3
  "description": "galacean spine runtime",
4
4
  "name": "@galacean/engine-spine",
5
5
  "main": "dist/main.js",
@@ -9,7 +9,7 @@
9
9
  "@esotericsoftware/spine-core": "~4.2.1"
10
10
  },
11
11
  "peerDependencies": {
12
- "@galacean/engine": ">=1.3.0-alpha.0"
12
+ "@galacean/engine": ">=1.3.20"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@babel/core": "^7.22.5",
@@ -107,11 +107,12 @@
107
107
  "e2e": "cypress run --browser chrome --headless",
108
108
  "e2e:debug": "cypress open",
109
109
  "dev": "rollup -cw",
110
- "build": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c",
110
+ "build": "cross-env BUILD_TYPE=ALL rollup -c",
111
111
  "build:watch": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c --watch",
112
112
  "ci": "npm run lint && npm run test-cov",
113
113
  "lint": "eslint src --fix --ext .ts,.tsx",
114
- "b:types": "tsc --emitDeclarationOnly"
114
+ "b:types": "tsc --emitDeclarationOnly",
115
+ "b:all": "npm run b:types && npm run build"
115
116
  },
116
117
  "types": "types/index.d.ts",
117
118
  "repository": "https://github.com/johanzhu/engine-spine.git"
@@ -0,0 +1,11 @@
1
+ import { Entity, MeshRenderer, Camera } from '@galacean/engine';
2
+ export default class BoundingBoxLine extends MeshRenderer {
3
+ private attachedEntity;
4
+ private renderers;
5
+ private boundingBox;
6
+ constructor(entity: Entity);
7
+ updateBoundingBox(): void;
8
+ attachToEntity(entity: Entity): void;
9
+ private updateVertices;
10
+ _render(camera: Camera): void;
11
+ }
@@ -0,0 +1,13 @@
1
+ import { Texture, TextureFilter, TextureWrap } from "@esotericsoftware/spine-core";
2
+ import { Texture2D } from "@galacean/engine";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare class AdaptiveTexture extends Texture {
7
+ constructor(image: Texture2D);
8
+ getImage(): Texture2D;
9
+ setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
10
+ setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
11
+ dispose(): void;
12
+ private _convertWrapMode;
13
+ }
@@ -0,0 +1,7 @@
1
+ import { TextureAtlas } from "@esotericsoftware/spine-core";
2
+ import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine";
3
+ export declare class SpineAtlasLoader extends Loader<TextureAtlas> {
4
+ private static _groupAssetsByExtension;
5
+ private static _assignSpineAtlas;
6
+ load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<TextureAtlas>;
7
+ }
@@ -0,0 +1,33 @@
1
+ import { AnimationStateData, SkeletonData } from "@esotericsoftware/spine-core";
2
+ import { Engine, Entity, ReferResource } from "@galacean/engine";
3
+ /**
4
+ * Represents a resource that manages Spine animation data, textures, and entity templates for the Galacean engine.
5
+ *
6
+ */
7
+ export declare class SpineResource extends ReferResource {
8
+ /** The url of spine resource. */
9
+ readonly url: string;
10
+ private _texturesInSpineAtlas;
11
+ private _skeletonData;
12
+ private _stateData;
13
+ private _template;
14
+ constructor(engine: Engine, skeletonData: SkeletonData, url?: string);
15
+ /**
16
+ * The skeleton data associated with this Spine resource.
17
+ */
18
+ get skeletonData(): SkeletonData;
19
+ /**
20
+ * The animation state data associated with this Spine resource.
21
+ */
22
+ get stateData(): AnimationStateData;
23
+ /**
24
+ * Creates and returns a new instance of the spine entity template.
25
+ * @returns A instance of the spine entity template
26
+ */
27
+ instantiate(): Entity;
28
+ protected _onDestroy(): void;
29
+ private _createTemplate;
30
+ private _associationTextureInSkeletonData;
31
+ private _disassociationSuperResource;
32
+ private _extractFileName;
33
+ }
@@ -0,0 +1,13 @@
1
+ import { Texture, TextureFilter, TextureWrap } from "@esotericsoftware/spine-core";
2
+ import { Texture2D } from "@galacean/engine";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare class SpineTexture extends Texture {
7
+ constructor(image: Texture2D);
8
+ getImage(): Texture2D;
9
+ setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
10
+ setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
11
+ dispose(): void;
12
+ private _convertWrapMode;
13
+ }
@@ -0,0 +1,4 @@
1
+ import "./SpineLoader";
2
+ import "./SpineAtlasLoader";
3
+ export { SpineResource } from "./SpineResource";
4
+ export { LoaderUtils } from "./LoaderUtils";
@@ -0,0 +1,177 @@
1
+ import { AnimationState, Skeleton } from "@esotericsoftware/spine-core";
2
+ import { BoundingBox, Buffer, Engine, Entity, Material, Primitive, Renderer, SubPrimitive } from "@galacean/engine";
3
+ import { SpineResource } from "../loader/SpineResource";
4
+ /**
5
+ * Spine animation renderer, capable of rendering spine animations and providing functions for animation and skeleton manipulation.
6
+ */
7
+ export declare class SpineAnimationRenderer extends Renderer {
8
+ private static _defaultMaterial;
9
+ private static _spineGenerator;
10
+ private static _positionVertexElement;
11
+ private static _colorVertexElement;
12
+ private static _uvVertexElement;
13
+ /** @internal */
14
+ static _materialCache: Map<string, Material>;
15
+ /** @internal */
16
+ static _getDefaultMaterial(engine: Engine): Material;
17
+ /**
18
+ * The spacing between z layers.
19
+ */
20
+ zSpacing: number;
21
+ /**
22
+ * Whether to use premultiplied alpha mode for rendering.
23
+ * When enabled, vertex color values are multiplied by the alpha channel.
24
+ * @remarks
25
+ If this option is enabled, the Spine editor must export textures with "Premultiply Alpha" checked.
26
+ */
27
+ premultipliedAlpha: boolean;
28
+ /**
29
+ * Default state for spine animation.
30
+ * Contains the default animation name to be played, whether this animation should loop, the default skin name.
31
+ */
32
+ readonly defaultConfig: SpineAnimationDefaultConfig;
33
+ /** @internal */
34
+ _primitive: Primitive;
35
+ /** @internal */
36
+ _subPrimitives: SubPrimitive[];
37
+ /** @internal */
38
+ _indexBuffer: Buffer;
39
+ /** @internal */
40
+ _vertexBuffer: Buffer;
41
+ /** @internal */
42
+ _vertices: Float32Array<ArrayBuffer>;
43
+ /** @internal */
44
+ _indices: Uint16Array<ArrayBuffer>;
45
+ /** @internal */
46
+ _needResizeBuffer: boolean;
47
+ /** @internal */
48
+ _vertexCount: number;
49
+ /** @internal */
50
+ _resource: SpineResource;
51
+ /** @internal */
52
+ _localBounds: BoundingBox;
53
+ private _skeleton;
54
+ private _state;
55
+ /**
56
+ * The Spine.AnimationState object of this SpineAnimationRenderer.
57
+ * Manage, blend, and transition between multiple simultaneous animations effectively.
58
+ */
59
+ get state(): AnimationState;
60
+ /**
61
+ * The Spine.Skeleton object of this SpineAnimationRenderer.
62
+ * Manipulate bone positions, rotations, scaling
63
+ * and change spine attachment to customize character appearances dynamically during runtime.
64
+ */
65
+ get skeleton(): Skeleton;
66
+ /**
67
+ * @internal
68
+ */
69
+ constructor(entity: Entity);
70
+ /**
71
+ * @internal
72
+ */
73
+ _onEnable(): void;
74
+ /**
75
+ * @internal
76
+ */
77
+ update(delta: number): void;
78
+ /**
79
+ * @internal
80
+ */
81
+ _render(context: any): void;
82
+ /**
83
+ * @internal
84
+ */
85
+ _updateBounds(worldBounds: BoundingBox): void;
86
+ /**
87
+ * @internal
88
+ */
89
+ _setSkeleton(skeleton: Skeleton): void;
90
+ /**
91
+ * @internal
92
+ */
93
+ _setState(state: AnimationState): void;
94
+ /**
95
+ * @internal
96
+ */
97
+ _cloneTo(target: SpineAnimationRenderer): void;
98
+ /**
99
+ * @internal
100
+ */
101
+ _onDestroy(): void;
102
+ /**
103
+ * @internal
104
+ */
105
+ _createAndBindBuffer(vertexCount: number): void;
106
+ /**
107
+ * @internal
108
+ */
109
+ _addSubPrimitive(subPrimitive: SubPrimitive): void;
110
+ /**
111
+ * @internal
112
+ */
113
+ _clearSubPrimitives(): void;
114
+ private _clearMaterialCache;
115
+ private _applyDefaultConfig;
116
+ /**
117
+ * * @deprecated This property is deprecated and will be removed in future releases.
118
+ * Spine resource of current spine animation.
119
+ */
120
+ get resource(): SpineResource;
121
+ /**
122
+ * * @deprecated This property is deprecated and will be removed in future releases.
123
+ * Sets the Spine resource for the current animation. This property allows switching to a different `SpineResource`.
124
+ *
125
+ * @param value - The new `SpineResource` to be used for the current animation
126
+ */
127
+ set resource(value: SpineResource);
128
+ }
129
+ /**
130
+ * @internal
131
+ */
132
+ export declare enum SpineAnimationUpdateFlags {
133
+ /** On Animation change */
134
+ Animation = 2
135
+ }
136
+ /**
137
+ * @internal
138
+ */
139
+ export declare enum RendererUpdateFlags {
140
+ /** Include world position and world bounds. */
141
+ WorldVolume = 1
142
+ }
143
+ /**
144
+ * Default state for spine animation.
145
+ * Contains the default animation name to be played, whether this animation should loop,
146
+ * the default skin name, and the default scale of the skeleton.
147
+ */
148
+ export declare class SpineAnimationDefaultConfig {
149
+ /**
150
+ * Whether the default animation should loop @defaultValue `true. The default animation should loop`
151
+ */
152
+ loop: boolean;
153
+ /**
154
+ * The name of the default animation @defaultValue `null. Do not play any animation by default`
155
+ */
156
+ animationName: string | null;
157
+ /**
158
+ * The name of the default skin @defaultValue `default`
159
+ */
160
+ skinName: string;
161
+ /**
162
+ * Creates an instance of default config
163
+ */
164
+ constructor(
165
+ /**
166
+ * Whether the default animation should loop @defaultValue `true. The default animation should loop`
167
+ */
168
+ loop?: boolean,
169
+ /**
170
+ * The name of the default animation @defaultValue `null. Do not play any animation by default`
171
+ */
172
+ animationName?: string | null,
173
+ /**
174
+ * The name of the default skin @defaultValue `default`
175
+ */
176
+ skinName?: string);
177
+ }
@@ -0,0 +1,35 @@
1
+ import { BlendMode, Color, Skeleton } from "@esotericsoftware/spine-core";
2
+ import { SubPrimitive, Texture2D } from "@galacean/engine";
3
+ import { SpineAnimationRenderer } from "./SpineAnimationRenderer";
4
+ import { ClearablePool } from "../util/ClearablePool";
5
+ import { ReturnablePool } from "../util/ReturnablePool";
6
+ declare class SubRenderItem {
7
+ subPrimitive: SubPrimitive;
8
+ blendMode: BlendMode;
9
+ texture: any;
10
+ slotName?: string;
11
+ }
12
+ /**
13
+ * @internal
14
+ */
15
+ export declare class SpineGenerator {
16
+ static VERTEX_SIZE: number;
17
+ static VERTEX_STRIDE: number;
18
+ static tempDark: Color;
19
+ static tempColor: Color;
20
+ static tempVerts: any[];
21
+ static QUAD_TRIANGLES: number[];
22
+ static subPrimitivePool: ReturnablePool<SubPrimitive>;
23
+ static subRenderItemPool: ClearablePool<SubRenderItem>;
24
+ private _separateSlots;
25
+ private _subRenderItems;
26
+ private _clipper;
27
+ private _separateSlotTextureMap;
28
+ buildPrimitive(skeleton: Skeleton, renderer: SpineAnimationRenderer): void;
29
+ addSeparateSlot(slotName: string): void;
30
+ addSeparateSlotTexture(slotName: string, texture: Texture2D): void;
31
+ private _createMaterialForTexture;
32
+ private _createRenderItem;
33
+ private _expandBounds;
34
+ }
35
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Engine, Material } from "@galacean/engine";
2
+ export declare class SpineMaterial extends Material {
3
+ private static _spineVS;
4
+ private static _spineFS;
5
+ constructor(engine: Engine);
6
+ }
@@ -0,0 +1,2 @@
1
+ export { SpineAnimationRenderer } from "./SpineAnimationRenderer";
2
+ export { SpineMaterial } from "./SpineMaterial";