@galacean/engine-spine 1.2.0 → 4.2.0-beta.1
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.
- package/README.md +8 -6
- package/dist/browser.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -0
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +65 -11
- package/types/SpineAnimationRenderer.d.ts +213 -0
- package/types/SpineGenerator.d.ts +38 -0
- package/types/index.d.ts +6 -9
- package/types/loader/EditorSpineAtlasLoader.d.ts +6 -0
- package/types/loader/LoaderUtils.d.ts +18 -0
- package/types/loader/SkeletonDataResource.d.ts +12 -0
- package/types/loader/SpineLoader.d.ts +29 -0
- package/types/util/BlendMode.d.ts +4 -0
- package/types/util/BufferReader.d.ts +10 -0
- package/types/util/ClearablePool.d.ts +8 -0
- package/types/util/ReturnablePool.d.ts +8 -0
- package/types/AntGSpineLoader.d.ts +0 -22
- package/types/SpineAnimation.d.ts +0 -45
- package/types/SpineLoader.d.ts +0 -32
- package/types/SpineRenderer.d.ts +0 -38
- package/types/core/MeshGenerator.d.ts +0 -43
- package/types/core/SpineMesh.d.ts +0 -11
- package/types/spine-core/Animation.d.ts +0 -378
- package/types/spine-core/AnimationState.d.ts +0 -365
- package/types/spine-core/AnimationStateData.d.ts +0 -23
- package/types/spine-core/AssetManager.d.ts +0 -36
- package/types/spine-core/AtlasAttachmentLoader.d.ts +0 -23
- package/types/spine-core/BlendMode.d.ts +0 -7
- package/types/spine-core/Bone.d.ts +0 -110
- package/types/spine-core/BoneData.d.ts +0 -44
- package/types/spine-core/ConstraintData.d.ts +0 -7
- package/types/spine-core/Event.d.ts +0 -16
- package/types/spine-core/EventData.d.ts +0 -13
- package/types/spine-core/IkConstraint.d.ts +0 -38
- package/types/spine-core/IkConstraintData.d.ts +0 -26
- package/types/spine-core/PathConstraint.d.ts +0 -46
- package/types/spine-core/PathConstraintData.d.ts +0 -52
- package/types/spine-core/SharedAssetManager.d.ts +0 -19
- package/types/spine-core/Skeleton.d.ts +0 -134
- package/types/spine-core/SkeletonBinary.d.ts +0 -49
- package/types/spine-core/SkeletonBounds.d.ts +0 -48
- package/types/spine-core/SkeletonClipping.d.ts +0 -22
- package/types/spine-core/SkeletonData.d.ts +0 -89
- package/types/spine-core/SkeletonJson.d.ts +0 -34
- package/types/spine-core/Skin.d.ts +0 -43
- package/types/spine-core/Slot.d.ts +0 -42
- package/types/spine-core/SlotData.d.ts +0 -23
- package/types/spine-core/Texture.d.ts +0 -46
- package/types/spine-core/TextureAtlas.d.ts +0 -30
- package/types/spine-core/TransformConstraint.d.ts +0 -36
- package/types/spine-core/TransformConstraintData.d.ts +0 -34
- package/types/spine-core/Triangulator.d.ts +0 -14
- package/types/spine-core/Updatable.d.ts +0 -9
- package/types/spine-core/Utils.d.ts +0 -124
- package/types/spine-core/VertexEffect.d.ts +0 -7
- package/types/spine-core/attachments/Attachment.d.ts +0 -43
- package/types/spine-core/attachments/AttachmentLoader.d.ts +0 -25
- package/types/spine-core/attachments/AttachmentType.d.ts +0 -9
- package/types/spine-core/attachments/BoundingBoxAttachment.d.ts +0 -12
- package/types/spine-core/attachments/ClippingAttachment.d.ts +0 -14
- package/types/spine-core/attachments/MeshAttachment.d.ts +0 -46
- package/types/spine-core/attachments/PathAttachment.d.ts +0 -19
- package/types/spine-core/attachments/PointAttachment.d.ts +0 -20
- package/types/spine-core/attachments/RegionAttachment.d.ts +0 -88
- package/types/spine-core/polyfills.d.ts +0 -3
- package/types/spine-core/vertexeffects/JitterEffect.d.ts +0 -11
- package/types/spine-core/vertexeffects/SwirlEffect.d.ts +0 -16
- package/types/types.d.ts +0 -4
package/package.json
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "4.2.0-beta.1",
|
|
3
3
|
"description": "galacean spine runtime",
|
|
4
4
|
"name": "@galacean/engine-spine",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"browser": "dist/browser.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
|
-
"dependencies": {
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@esotericsoftware/spine-core": "~4.2.1"
|
|
10
|
+
},
|
|
9
11
|
"peerDependencies": {
|
|
10
|
-
"@galacean/engine": ">=1.
|
|
12
|
+
"@galacean/engine": ">=1.3.0-alpha.0"
|
|
11
13
|
},
|
|
12
14
|
"devDependencies": {
|
|
13
15
|
"@babel/core": "^7.22.5",
|
|
14
16
|
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
|
15
17
|
"@babel/plugin-proposal-decorators": "^7.12.1",
|
|
16
18
|
"@babel/plugin-proposal-optional-chaining": "^7.12.1",
|
|
19
|
+
"@babel/plugin-transform-class-properties": "^7.24.7",
|
|
17
20
|
"@babel/plugin-transform-object-assign": "^7.12.1",
|
|
18
|
-
"@babel/preset-env": "^7.
|
|
19
|
-
"@babel/preset-typescript": "^7.
|
|
20
|
-
"@galacean/engine": "^1.
|
|
21
|
-
"@galacean/engine-toolkit": "
|
|
21
|
+
"@babel/preset-env": "^7.24.8",
|
|
22
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
23
|
+
"@galacean/engine": "^1.3.0-alpha.3",
|
|
24
|
+
"@galacean/engine-toolkit": "beta",
|
|
22
25
|
"@rollup/plugin-babel": "^5.2.1",
|
|
23
26
|
"@rollup/plugin-commonjs": "^16.0.0",
|
|
24
27
|
"@rollup/plugin-inject": "^4.0.2",
|
|
@@ -27,10 +30,26 @@
|
|
|
27
30
|
"@rollup/plugin-terser": "^0.4.3",
|
|
28
31
|
"@swc/core": "^1.3.32",
|
|
29
32
|
"@swc/helpers": "^0.5",
|
|
30
|
-
"
|
|
33
|
+
"@types/chai": "^4.3.16",
|
|
34
|
+
"@types/jest": "^29.5.12",
|
|
35
|
+
"@types/node": "^20.14.10",
|
|
36
|
+
"@vitejs/plugin-basic-ssl": "^1.1.0",
|
|
37
|
+
"babel-core": "^6.26.3",
|
|
38
|
+
"babel-jest": "^29.7.0",
|
|
39
|
+
"chai": "^4.3.6",
|
|
40
|
+
"chai-spies": "^1.0.0",
|
|
41
|
+
"cross-env": "^5.2.1",
|
|
42
|
+
"cypress": "^13.13.0",
|
|
43
|
+
"cypress-recurse": "^1.35.3",
|
|
31
44
|
"dat.gui": "^0.7.9",
|
|
45
|
+
"jest": "^29.7.0",
|
|
46
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
47
|
+
"jest-webgl-canvas-mock": "^2.5.3",
|
|
48
|
+
"nock": "^13.5.4",
|
|
49
|
+
"odiff-bin": "^3.0.1",
|
|
32
50
|
"react": "^16.14.0",
|
|
33
51
|
"react-dom": "^16.14.0",
|
|
52
|
+
"regenerator-runtime": "^0.14.1",
|
|
34
53
|
"rollup": "^2.32.0",
|
|
35
54
|
"rollup-plugin-glslify": "^1.2.0",
|
|
36
55
|
"rollup-plugin-modify": "^3.0.0",
|
|
@@ -38,8 +57,13 @@
|
|
|
38
57
|
"rollup-plugin-swc3": "^0.8.0",
|
|
39
58
|
"rollup-plugin-terser": "^7.0.2",
|
|
40
59
|
"rollup-plugin-version-injector": "^1.3.3",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
60
|
+
"sass": "^1.77.8",
|
|
61
|
+
"sinon": "^18.0.0",
|
|
62
|
+
"ts-jest": "^29.2.2",
|
|
63
|
+
"ts-node": "^10.9.2",
|
|
64
|
+
"tsconfig-paths": "^4.2.0",
|
|
65
|
+
"typescript": "^5.5.3",
|
|
66
|
+
"vite": "^5.3.4"
|
|
43
67
|
},
|
|
44
68
|
"ci": {
|
|
45
69
|
"type": "aci",
|
|
@@ -49,12 +73,42 @@
|
|
|
49
73
|
"types",
|
|
50
74
|
"dist"
|
|
51
75
|
],
|
|
76
|
+
"jest": {
|
|
77
|
+
"runner": "jest-runner",
|
|
78
|
+
"testEnvironment": "jsdom",
|
|
79
|
+
"testEnvironmentOptions": {
|
|
80
|
+
"url": "https://mdn.alipayobjects.com/",
|
|
81
|
+
"userAgent": "Agent/007"
|
|
82
|
+
},
|
|
83
|
+
"preset": "ts-jest",
|
|
84
|
+
"collectCoverage": true,
|
|
85
|
+
"testRegex": "(/tests/.*\\.(test|spec))\\.ts?$",
|
|
86
|
+
"collectCoverageFrom": [
|
|
87
|
+
"src/**/*.ts"
|
|
88
|
+
],
|
|
89
|
+
"transform": {
|
|
90
|
+
"^.+\\.js$": "babel-jest",
|
|
91
|
+
"^.+\\.ts$": "ts-jest"
|
|
92
|
+
},
|
|
93
|
+
"transformIgnorePatterns": [
|
|
94
|
+
"node_modules/(?!(.*@esotericsoftware/spine-core.*))"
|
|
95
|
+
],
|
|
96
|
+
"setupFilesAfterEnv": [
|
|
97
|
+
"./jest.setup.ts",
|
|
98
|
+
"jest-webgl-canvas-mock"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
52
101
|
"scripts": {
|
|
53
102
|
"example": "vite",
|
|
54
103
|
"test": "jest",
|
|
55
|
-
"test
|
|
104
|
+
"test:cov": "jest --coverage",
|
|
105
|
+
"test:debug": "cross-env DEBUG_MODE=1 jest",
|
|
106
|
+
"e2e:case": "vite serve ./e2e/.dev --config ./e2e/.dev/vite.config.js",
|
|
107
|
+
"e2e": "cypress run --browser chrome --headless",
|
|
108
|
+
"e2e:debug": "cypress open",
|
|
56
109
|
"dev": "rollup -cw",
|
|
57
110
|
"build": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c",
|
|
111
|
+
"build:watch": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c --watch",
|
|
58
112
|
"ci": "npm run lint && npm run test-cov",
|
|
59
113
|
"lint": "eslint src --fix --ext .ts,.tsx",
|
|
60
114
|
"b:types": "tsc --emitDeclarationOnly"
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { Skeleton, SkeletonData, AnimationState, AnimationStateData } from "@esotericsoftware/spine-core";
|
|
2
|
+
import { Buffer, Renderer, Entity, Material, Engine, BoundingBox, Primitive, SubPrimitive } from "@galacean/engine";
|
|
3
|
+
import { SkeletonDataResource } from "./loader/SkeletonDataResource";
|
|
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 _animationDataCache: Map<SkeletonData, AnimationStateData>;
|
|
17
|
+
/** @internal */
|
|
18
|
+
static _getDefaultMaterial(engine: Engine): Material;
|
|
19
|
+
/** Render setting for spine rendering. */
|
|
20
|
+
setting: SpineRenderSetting;
|
|
21
|
+
/**
|
|
22
|
+
* Default state for spine animation.
|
|
23
|
+
* Contains the default animation name to be played, whether this animation should loop,
|
|
24
|
+
* the default skin name, and the default scale of the skeleton.
|
|
25
|
+
*/
|
|
26
|
+
defaultState: DefaultState;
|
|
27
|
+
/** @internal */
|
|
28
|
+
_primitive: Primitive;
|
|
29
|
+
/** @internal */
|
|
30
|
+
_subPrimitives: SubPrimitive[];
|
|
31
|
+
/** @internal */
|
|
32
|
+
_indexBuffer: Buffer;
|
|
33
|
+
/** @internal */
|
|
34
|
+
_vertexBuffer: Buffer;
|
|
35
|
+
/** @internal */
|
|
36
|
+
_vertices: Float32Array;
|
|
37
|
+
/** @internal */
|
|
38
|
+
_indices: Uint16Array;
|
|
39
|
+
/** @internal */
|
|
40
|
+
_needResizeBuffer: boolean;
|
|
41
|
+
/** @internal */
|
|
42
|
+
_vertexCount: number;
|
|
43
|
+
/** @internal */
|
|
44
|
+
_resource: SkeletonDataResource;
|
|
45
|
+
private _skeleton;
|
|
46
|
+
private _state;
|
|
47
|
+
/**
|
|
48
|
+
* Spine resource of current spine animation.This property allows you to switch between different animations at runtime.
|
|
49
|
+
*/
|
|
50
|
+
get resource(): SkeletonDataResource;
|
|
51
|
+
set resource(value: SkeletonDataResource);
|
|
52
|
+
/**
|
|
53
|
+
* Provides access to `AnimationState` which controls animation playback on a skeleton.
|
|
54
|
+
* You can use its API to manage, blend, and transition between multiple simultaneous animations effectively.
|
|
55
|
+
*/
|
|
56
|
+
get state(): AnimationState;
|
|
57
|
+
/**
|
|
58
|
+
* Provides access to `Skeleton`, which defines the structure of a Spine model.
|
|
59
|
+
* Through its API, users can manipulate bone positions, rotations, scaling
|
|
60
|
+
* and change spine attachment to customize character appearances dynamically during runtime.
|
|
61
|
+
*/
|
|
62
|
+
get skeleton(): Skeleton;
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
constructor(entity: Entity);
|
|
67
|
+
/**
|
|
68
|
+
* Separate slot by slot name. This will add a new sub primitive, and new materials.
|
|
69
|
+
*/
|
|
70
|
+
addSeparateSlot(slotName: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
_onEnable(): void;
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
update(delta: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
_render(context: any): void;
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
_updateBounds(worldBounds: BoundingBox): void;
|
|
87
|
+
/**
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
_calculateGeneratorBounds(worldBounds: BoundingBox): void;
|
|
91
|
+
/**
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
_cloneTo(target: SpineAnimationRenderer): void;
|
|
95
|
+
/**
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
_onDestroy(): void;
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
_createBuffer(vertexCount: number): void;
|
|
103
|
+
/**
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
_addSubPrimitive(subPrimitive: SubPrimitive): void;
|
|
107
|
+
/**
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
_clearSubPrimitives(): void;
|
|
111
|
+
/**
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
_isContainDirtyFlag(type: number): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
_setDirtyFlagFalse(type: number): void;
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
_onWorldVolumeChanged(): void;
|
|
123
|
+
private _onAnimationStart;
|
|
124
|
+
private _onAnimationComplete;
|
|
125
|
+
private _clearMaterialCache;
|
|
126
|
+
private _initializeDefaultState;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
131
|
+
export declare enum SpineAnimationUpdateFlags {
|
|
132
|
+
/** On World Transform Changed */
|
|
133
|
+
TransformVolume = 1,
|
|
134
|
+
/** On Animation start play */
|
|
135
|
+
AnimationVolume = 2,
|
|
136
|
+
/** On skeleton data asset changed */
|
|
137
|
+
InitialVolume = 4
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
142
|
+
export declare enum RendererUpdateFlags {
|
|
143
|
+
/** Include world position and world bounds. */
|
|
144
|
+
WorldVolume = 1
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Render setting for spine rendering.
|
|
148
|
+
*/
|
|
149
|
+
export declare class SpineRenderSetting {
|
|
150
|
+
/**
|
|
151
|
+
* The spacing between z layers @defaultValue `0.01`
|
|
152
|
+
*/
|
|
153
|
+
zSpacing: number;
|
|
154
|
+
/**
|
|
155
|
+
* Whether to use clipping @defaultValue `true`
|
|
156
|
+
*/
|
|
157
|
+
useClipping: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Creates an instance of SpineRenderSetting.
|
|
160
|
+
*/
|
|
161
|
+
constructor(
|
|
162
|
+
/**
|
|
163
|
+
* The spacing between z layers @defaultValue `0.01`
|
|
164
|
+
*/
|
|
165
|
+
zSpacing?: number,
|
|
166
|
+
/**
|
|
167
|
+
* Whether to use clipping @defaultValue `true`
|
|
168
|
+
*/
|
|
169
|
+
useClipping?: boolean);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Default state for spine animation.
|
|
173
|
+
* Contains the default animation name to be played, whether this animation should loop,
|
|
174
|
+
* the default skin name, and the default scale of the skeleton.
|
|
175
|
+
*/
|
|
176
|
+
export declare class DefaultState {
|
|
177
|
+
/**
|
|
178
|
+
* The default scale of the animation @defaultValue `1`
|
|
179
|
+
*/
|
|
180
|
+
scale: number;
|
|
181
|
+
/**
|
|
182
|
+
* Whether the default animation should loop @defaultValue `true. The default animation should loop`
|
|
183
|
+
*/
|
|
184
|
+
loop: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* The name of the default animation @defaultValue `null. Do not play any animation by default`
|
|
187
|
+
*/
|
|
188
|
+
animationName: string | null;
|
|
189
|
+
/**
|
|
190
|
+
* The name of the default skin @defaultValue `default`
|
|
191
|
+
*/
|
|
192
|
+
skinName: string;
|
|
193
|
+
/**
|
|
194
|
+
* Creates an instance of DefaultState
|
|
195
|
+
*/
|
|
196
|
+
constructor(
|
|
197
|
+
/**
|
|
198
|
+
* The default scale of the animation @defaultValue `1`
|
|
199
|
+
*/
|
|
200
|
+
scale?: number,
|
|
201
|
+
/**
|
|
202
|
+
* Whether the default animation should loop @defaultValue `true. The default animation should loop`
|
|
203
|
+
*/
|
|
204
|
+
loop?: boolean,
|
|
205
|
+
/**
|
|
206
|
+
* The name of the default animation @defaultValue `null. Do not play any animation by default`
|
|
207
|
+
*/
|
|
208
|
+
animationName?: string | null,
|
|
209
|
+
/**
|
|
210
|
+
* The name of the default skin @defaultValue `default`
|
|
211
|
+
*/
|
|
212
|
+
skinName?: string);
|
|
213
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Texture2D, SubPrimitive, BoundingBox } from "@galacean/engine";
|
|
2
|
+
import { Skeleton, Color, BlendMode, SkeletonData } from "@esotericsoftware/spine-core";
|
|
3
|
+
import { SpineAnimationRenderer } from "./SpineAnimationRenderer";
|
|
4
|
+
import { AdaptiveTexture } from "./loader/LoaderUtils";
|
|
5
|
+
import { ReturnablePool } from "./util/ReturnablePool";
|
|
6
|
+
import { ClearablePool } from "./util/ClearablePool";
|
|
7
|
+
declare class SubRenderItem {
|
|
8
|
+
subPrimitive: SubPrimitive;
|
|
9
|
+
blendMode: BlendMode;
|
|
10
|
+
texture: any;
|
|
11
|
+
slotName?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class SpineGenerator {
|
|
14
|
+
static QUAD_TRIANGLES: number[];
|
|
15
|
+
static VERTEX_SIZE: number;
|
|
16
|
+
static VERTEX_STRIDE: number;
|
|
17
|
+
static tempDark: Color;
|
|
18
|
+
static tempColor: Color;
|
|
19
|
+
static tempVerts: any[];
|
|
20
|
+
static tempBlendMode: BlendMode | null;
|
|
21
|
+
static tempTexture: AdaptiveTexture | null;
|
|
22
|
+
static subPrimitivePool: ReturnablePool<SubPrimitive>;
|
|
23
|
+
static subRenderItemPool: ClearablePool<SubRenderItem>;
|
|
24
|
+
static bounds: BoundingBox;
|
|
25
|
+
private _clipper;
|
|
26
|
+
private _subRenderItems;
|
|
27
|
+
private _separateSlots;
|
|
28
|
+
private _separateSlotTextureMap;
|
|
29
|
+
getMaxVertexCount(skeletonData: SkeletonData): number;
|
|
30
|
+
buildPrimitive(skeleton: Skeleton, renderer: SpineAnimationRenderer): void;
|
|
31
|
+
addSeparateSlot(slotName: string): void;
|
|
32
|
+
addSeparateSlotTexture(slotName: string, texture: Texture2D): void;
|
|
33
|
+
private _createMaterialForTexture;
|
|
34
|
+
private _expandByPoint;
|
|
35
|
+
private _collectUniqueAttachments;
|
|
36
|
+
private _calculateTotalVertexCount;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import "./SpineLoader";
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
7
|
-
export { AtlasAttachmentLoader } from "./spine-core/AtlasAttachmentLoader";
|
|
8
|
-
export { SkeletonJson } from "./spine-core/SkeletonJson";
|
|
9
|
-
export { SkeletonBinary } from "./spine-core/SkeletonBinary";
|
|
1
|
+
import "./loader/SpineLoader";
|
|
2
|
+
import "./loader/EditorSpineAtlasLoader";
|
|
3
|
+
export { SpineAnimationRenderer } from "./SpineAnimationRenderer";
|
|
4
|
+
export { SkeletonDataResource } from "./loader/SkeletonDataResource";
|
|
5
|
+
export { createTextureAtlas } from "./loader/LoaderUtils";
|
|
6
|
+
export * from "@esotericsoftware/spine-core";
|
|
10
7
|
export declare const version = "__buildVersion";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AssetPromise, Loader, ResourceManager, LoadItem } from "@galacean/engine";
|
|
2
|
+
import { TextureAtlas } from "@esotericsoftware/spine-core";
|
|
3
|
+
declare class EditorSpineAtlasLoader extends Loader<TextureAtlas> {
|
|
4
|
+
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<TextureAtlas>;
|
|
5
|
+
}
|
|
6
|
+
export { EditorSpineAtlasLoader };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AssetPromise, Engine, Texture2D } from "@galacean/engine";
|
|
2
|
+
import { TextureAtlas, SkeletonData, Texture, TextureFilter, TextureWrap } from "@esotericsoftware/spine-core";
|
|
3
|
+
export declare function createSkeletonData(textureAtlas: TextureAtlas, skeletonTextData: string | ArrayBuffer, skeletonFileType: 'json' | 'skel'): SkeletonData;
|
|
4
|
+
export declare function loadTexturesByPath(imagePaths: string[], imageExtensions: string[], engine: Engine): Promise<Texture2D[]>;
|
|
5
|
+
export declare function loadTextureAtlas(atlasPath: string, engine: Engine): Promise<TextureAtlas>;
|
|
6
|
+
export declare function createTextureAtlas(atlasText: string, textures: Texture2D[]): TextureAtlas;
|
|
7
|
+
export declare function loadTexture(url: string, engine: Engine, imageLoaderType?: string): AssetPromise<Texture2D>;
|
|
8
|
+
export declare function createAdaptiveTexture(texture: Texture2D): AdaptiveTexture;
|
|
9
|
+
export declare function getBaseUrl(url: string): string;
|
|
10
|
+
export declare class AdaptiveTexture extends Texture {
|
|
11
|
+
texture: Texture2D;
|
|
12
|
+
constructor(image: HTMLImageElement | ImageBitmap, texture: Texture2D);
|
|
13
|
+
getImage(): any;
|
|
14
|
+
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
15
|
+
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
private _convertWrapMode;
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SkeletonData } from "@esotericsoftware/spine-core";
|
|
2
|
+
import { Engine, ReferResource, Texture2D } from "@galacean/engine";
|
|
3
|
+
export declare class SkeletonDataResource extends ReferResource {
|
|
4
|
+
readonly textures: Texture2D[];
|
|
5
|
+
private _skeletonData;
|
|
6
|
+
get skeletonData(): SkeletonData;
|
|
7
|
+
constructor(engine: Engine, skeletonData: SkeletonData);
|
|
8
|
+
protected _onDestroy(): void;
|
|
9
|
+
private _disassociationSuperResource;
|
|
10
|
+
private _associationTextureInSkeletonData;
|
|
11
|
+
private _clearAttachmentTextures;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine";
|
|
2
|
+
import { SkeletonDataResource } from "./SkeletonDataResource";
|
|
3
|
+
export type SpineAssetBundle = {
|
|
4
|
+
skeletonPath: string;
|
|
5
|
+
skeletonExtension: string;
|
|
6
|
+
skeletonTextData?: string | ArrayBuffer;
|
|
7
|
+
atlasPath: string;
|
|
8
|
+
imagePaths: string[];
|
|
9
|
+
imageExtensions: string[];
|
|
10
|
+
};
|
|
11
|
+
type SpineLoaderParams = {
|
|
12
|
+
fileExtensions?: string | string[];
|
|
13
|
+
};
|
|
14
|
+
type SpineLoadItem = LoadItem & {
|
|
15
|
+
params?: SpineLoaderParams;
|
|
16
|
+
};
|
|
17
|
+
export declare class SpineLoader extends Loader<SkeletonDataResource> {
|
|
18
|
+
static imageExtensions: string[];
|
|
19
|
+
static skeletonExtensions: string[];
|
|
20
|
+
static parseAndAssignSpineAsset(url: string, fileExtension: string | null, bundle: SpineAssetBundle): void;
|
|
21
|
+
static deriveAndAssignSpineAsset(url: string, fileExtension: string | null, bundle: SpineAssetBundle): void;
|
|
22
|
+
static verifyFileExtensions(fileExtensions: string | string[], expectArray: boolean): string | string[] | null;
|
|
23
|
+
static getUrlExtension(url: string, fileExtension: string): string | null;
|
|
24
|
+
load(item: SpineLoadItem, resourceManager: ResourceManager): AssetPromise<SkeletonDataResource>;
|
|
25
|
+
private _handleEditorAsset;
|
|
26
|
+
private _handleOriginAsset;
|
|
27
|
+
private _determineSkeletonDataType;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class BufferReader {
|
|
2
|
+
data: Uint8Array;
|
|
3
|
+
private _dataView;
|
|
4
|
+
private _position;
|
|
5
|
+
constructor(data: Uint8Array, byteOffset?: number, byteLength?: number);
|
|
6
|
+
nextUint16(): number;
|
|
7
|
+
nextStr(): string;
|
|
8
|
+
nextImageData(): Uint8Array;
|
|
9
|
+
private decodeText;
|
|
10
|
+
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AssetPromise, Loader, LoadItem, ResourceManager, TextureWrapMode, Texture2D, Engine, Entity } from '@galacean/engine';
|
|
2
|
-
import { AssetManager } from './spine-core/AssetManager';
|
|
3
|
-
import { Texture } from './spine-core/Texture';
|
|
4
|
-
type SpineOpt = {
|
|
5
|
-
scale: number;
|
|
6
|
-
};
|
|
7
|
-
type SpineLoadItem = LoadItem & SpineOpt;
|
|
8
|
-
declare class SpineLoader extends Loader<Entity> {
|
|
9
|
-
load(item: SpineLoadItem, resourceManager: ResourceManager): AssetPromise<Entity>;
|
|
10
|
-
textureAssetPicker(assetManager: AssetManager, textureFile: string): any;
|
|
11
|
-
createAdaptiveTexture(img: any, engine: any): AdaptiveTexture;
|
|
12
|
-
checkUrl(url: string): boolean;
|
|
13
|
-
getExtFromUrl(url: string): string;
|
|
14
|
-
}
|
|
15
|
-
export declare class AdaptiveTexture extends Texture {
|
|
16
|
-
texture: Texture2D;
|
|
17
|
-
constructor(data: HTMLImageElement, engine: Engine);
|
|
18
|
-
setFilters(minFilter: any, magFilter: any): void;
|
|
19
|
-
setWraps(uWrap: TextureWrapMode, vWrap: TextureWrapMode): void;
|
|
20
|
-
dispose(): void;
|
|
21
|
-
}
|
|
22
|
-
export { SpineLoader };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Skeleton } from "./spine-core/Skeleton";
|
|
2
|
-
import { SkeletonData } from "./spine-core/SkeletonData";
|
|
3
|
-
import { AnimationState } from "./spine-core/AnimationState";
|
|
4
|
-
import { MeshGenerator } from "./core/MeshGenerator";
|
|
5
|
-
import { SpineRenderSetting } from "./types";
|
|
6
|
-
import { Script, Entity, Texture2D, Material, Engine } from "@galacean/engine";
|
|
7
|
-
export declare class SpineAnimation extends Script {
|
|
8
|
-
/** Spine 材质 */
|
|
9
|
-
private static _defaultMaterial;
|
|
10
|
-
static getDefaultMaterial(engine: Engine): Material;
|
|
11
|
-
private _skeletonData;
|
|
12
|
-
private _skeleton;
|
|
13
|
-
private _state;
|
|
14
|
-
private _tempOffset;
|
|
15
|
-
private _tempSize;
|
|
16
|
-
private _tempArray;
|
|
17
|
-
protected _meshGenerator: MeshGenerator;
|
|
18
|
-
setting: SpineRenderSetting;
|
|
19
|
-
autoUpdateBounds: boolean;
|
|
20
|
-
noPause: boolean;
|
|
21
|
-
get skeletonData(): SkeletonData;
|
|
22
|
-
get skeleton(): Skeleton;
|
|
23
|
-
get state(): AnimationState;
|
|
24
|
-
get mesh(): import("@galacean/engine").BufferMesh;
|
|
25
|
-
set scale(v: number);
|
|
26
|
-
constructor(entity: Entity);
|
|
27
|
-
setSkeletonData(skeletonData: SkeletonData, setting?: SpineRenderSetting): void;
|
|
28
|
-
/**
|
|
29
|
-
* Separate slot by slot name. This will add a new sub mesh, and new materials.
|
|
30
|
-
*/
|
|
31
|
-
addSeparateSlot(slotName: string): void;
|
|
32
|
-
/**
|
|
33
|
-
* Change texture of a separated slot by name.
|
|
34
|
-
*/
|
|
35
|
-
hackSeparateSlotTexture(slotName: string, texture: Texture2D): void;
|
|
36
|
-
onUpdate(delta: number): void;
|
|
37
|
-
updateGeometry(): void;
|
|
38
|
-
updateBounds(): void;
|
|
39
|
-
/**
|
|
40
|
-
* Spine animation custom clone.
|
|
41
|
-
*/
|
|
42
|
-
_cloneTo(target: SpineAnimation): void;
|
|
43
|
-
private _disposeCurrentSkeleton;
|
|
44
|
-
onDestroy(): void;
|
|
45
|
-
}
|
package/types/SpineLoader.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AssetPromise, Loader, LoadItem, ResourceManager, TextureWrapMode, Texture2D, Entity, AssetType } from "@galacean/engine";
|
|
2
|
-
import { AssetManager } from "./spine-core/AssetManager";
|
|
3
|
-
import { Texture } from "./spine-core/Texture";
|
|
4
|
-
type SpineResouce = {
|
|
5
|
-
skeletonFile: string;
|
|
6
|
-
atlasFile: string;
|
|
7
|
-
textureFile?: string;
|
|
8
|
-
textureType?: AssetType;
|
|
9
|
-
};
|
|
10
|
-
type SpineOpt = {
|
|
11
|
-
scale: number;
|
|
12
|
-
};
|
|
13
|
-
type SpineLoadItem = LoadItem & SpineOpt;
|
|
14
|
-
declare class SpineLoader extends Loader<Entity> {
|
|
15
|
-
load(item: SpineLoadItem, resourceManager: ResourceManager): AssetPromise<Entity>;
|
|
16
|
-
handleResource(resourceManager: ResourceManager, item: SpineLoadItem, resource: SpineResouce, resolve: any, reject: any): void;
|
|
17
|
-
textureAssetPicker(assetManager: AssetManager, textureFile: string): any;
|
|
18
|
-
createAdaptiveTexture(texture: Texture2D): AdaptiveTexture;
|
|
19
|
-
isBinFile(url: string): boolean;
|
|
20
|
-
checkUrl(url: string): boolean;
|
|
21
|
-
getResouceFromUrl(url: any): SpineResouce;
|
|
22
|
-
checkUrls(urls: string[]): boolean;
|
|
23
|
-
getResouceFromUrls(urls: string[], type?: AssetType): SpineResouce;
|
|
24
|
-
getExtFromUrl(url: string): string;
|
|
25
|
-
}
|
|
26
|
-
export declare class AdaptiveTexture extends Texture {
|
|
27
|
-
constructor(texture: Texture2D);
|
|
28
|
-
setFilters(minFilter: any, magFilter: any): void;
|
|
29
|
-
setWraps(uWrap: TextureWrapMode, vWrap: TextureWrapMode): void;
|
|
30
|
-
dispose(): void;
|
|
31
|
-
}
|
|
32
|
-
export { SpineLoader };
|
package/types/SpineRenderer.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Script, Entity } from "@galacean/engine";
|
|
2
|
-
import { SpineAnimation } from "./SpineAnimation";
|
|
3
|
-
export declare class SpineRenderer extends Script {
|
|
4
|
-
private _priority;
|
|
5
|
-
private _resource;
|
|
6
|
-
private _animationName;
|
|
7
|
-
private _loop;
|
|
8
|
-
private _paused;
|
|
9
|
-
private _autoPlay;
|
|
10
|
-
private _skinName;
|
|
11
|
-
private _scale;
|
|
12
|
-
private _spineAnimation;
|
|
13
|
-
/** @internal */
|
|
14
|
-
_animationNames: Array<string>;
|
|
15
|
-
/** @internal */
|
|
16
|
-
_skinNames: Array<string>;
|
|
17
|
-
get priority(): number;
|
|
18
|
-
set priority(value: number);
|
|
19
|
-
get resource(): Entity | null;
|
|
20
|
-
set resource(value: Entity | null);
|
|
21
|
-
get animationName(): string;
|
|
22
|
-
set animationName(name: string);
|
|
23
|
-
get loop(): boolean;
|
|
24
|
-
set loop(value: boolean);
|
|
25
|
-
get paused(): boolean;
|
|
26
|
-
set paused(value: boolean);
|
|
27
|
-
get autoPlay(): boolean;
|
|
28
|
-
set autoPlay(value: boolean);
|
|
29
|
-
get skinName(): string;
|
|
30
|
-
set skinName(name: string);
|
|
31
|
-
get scale(): number;
|
|
32
|
-
set scale(value: number);
|
|
33
|
-
get spineAnimation(): SpineAnimation;
|
|
34
|
-
onDestroy(): void;
|
|
35
|
-
play(name?: string, loop?: boolean): void;
|
|
36
|
-
_cloneTo(target: SpineRenderer): void;
|
|
37
|
-
private _removeResource;
|
|
38
|
-
}
|