@galacean/engine-spine 1.1.0-alpha.3 → 1.1.0-alpha.5
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 +1 -1
- package/dist/browser.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/SpineAnimation.d.ts +4 -39
- package/types/SpineRenderer.d.ts +33 -29
- package/types/core/MeshGenerator.d.ts +5 -1
- package/types/index.d.ts +3 -1
- package/types/loader/LoaderUtils.d.ts +18 -0
- package/types/loader/SpineLoader.d.ts +19 -0
- package/types/spine-core/AssetManager.d.ts +1 -1
- package/types/spine-core/Texture.d.ts +3 -6
- package/types/spine-core/TextureAtlas.d.ts +1 -1
- package/dist/miniprogram.js +0 -1
- package/types/SpineLoader.d.ts +0 -32
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.1.0-alpha.
|
|
2
|
+
"version": "1.1.0-alpha.5",
|
|
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": {},
|
|
9
8
|
"peerDependencies": {
|
|
10
|
-
"@galacean/engine": "
|
|
9
|
+
"@galacean/engine": "latest"
|
|
11
10
|
},
|
|
12
11
|
"devDependencies": {
|
|
13
12
|
"@babel/core": "^7.22.5",
|
|
@@ -55,6 +54,7 @@
|
|
|
55
54
|
"test-cov": "jest --coverage",
|
|
56
55
|
"dev": "rollup -cw",
|
|
57
56
|
"build": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c",
|
|
57
|
+
"build:watch": "npm run b:types && cross-env BUILD_TYPE=ALL rollup -c --watch",
|
|
58
58
|
"ci": "npm run lint && npm run test-cov",
|
|
59
59
|
"lint": "eslint src --fix --ext .ts,.tsx",
|
|
60
60
|
"b:types": "tsc --emitDeclarationOnly"
|
|
@@ -1,46 +1,11 @@
|
|
|
1
|
-
import { Skeleton } from "./spine-core/Skeleton";
|
|
2
1
|
import { SkeletonData } from "./spine-core/SkeletonData";
|
|
3
2
|
import { AnimationState } from "./spine-core/AnimationState";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
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;
|
|
3
|
+
import { Entity } from "@galacean/engine";
|
|
4
|
+
import { SpineRenderer } from "./SpineRenderer";
|
|
5
|
+
export declare class SpineAnimation extends SpineRenderer {
|
|
13
6
|
private _state;
|
|
14
|
-
private _tempOffset;
|
|
15
|
-
private _tempSize;
|
|
16
|
-
private _tempArray;
|
|
17
|
-
protected _meshGenerator: MeshGenerator;
|
|
18
|
-
setting: SpineRenderSetting;
|
|
19
|
-
autoUpdate: boolean;
|
|
20
|
-
autoUpdateBounds: boolean;
|
|
21
|
-
get skeletonData(): SkeletonData;
|
|
22
|
-
get skeleton(): Skeleton;
|
|
23
7
|
get state(): AnimationState;
|
|
24
|
-
get mesh(): import("@galacean/engine").BufferMesh;
|
|
25
|
-
set scale(v: number);
|
|
26
8
|
constructor(entity: Entity);
|
|
27
|
-
|
|
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;
|
|
9
|
+
initialize(skeletonData: SkeletonData): void;
|
|
36
10
|
onUpdate(delta: number): void;
|
|
37
|
-
updateState(deltaTime: number): void;
|
|
38
|
-
updateGeometry(): void;
|
|
39
|
-
updateBounds(): void;
|
|
40
|
-
/**
|
|
41
|
-
* Spine animation custom clone.
|
|
42
|
-
*/
|
|
43
|
-
_cloneTo(target: SpineAnimation): void;
|
|
44
|
-
private _disposeCurrentSkeleton;
|
|
45
|
-
onDestroy(): void;
|
|
46
11
|
}
|
package/types/SpineRenderer.d.ts
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Skeleton } from "./spine-core/Skeleton";
|
|
2
|
+
import { SkeletonData } from "./spine-core/SkeletonData";
|
|
3
|
+
import { MeshGenerator } from "./core/MeshGenerator";
|
|
4
|
+
import { SpineRenderSetting } from "./types";
|
|
5
|
+
import { Script, Entity, Texture2D, Material, Engine } from "@galacean/engine";
|
|
3
6
|
export declare class SpineRenderer extends Script {
|
|
4
|
-
private
|
|
5
|
-
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
7
|
+
private static _defaultMaterial;
|
|
8
|
+
static getDefaultMaterial(engine: Engine): Material;
|
|
9
|
+
private _skeletonData;
|
|
10
|
+
protected _skeleton: Skeleton;
|
|
11
|
+
private _tempOffset;
|
|
12
|
+
private _tempSize;
|
|
13
|
+
private _tempArray;
|
|
14
|
+
protected _meshGenerator: MeshGenerator;
|
|
15
|
+
setting: SpineRenderSetting;
|
|
16
|
+
autoUpdateBounds: boolean;
|
|
17
|
+
get skeleton(): Skeleton;
|
|
18
|
+
constructor(entity: Entity);
|
|
19
|
+
initialize(skeletonData: SkeletonData, setting?: SpineRenderSetting): void;
|
|
20
|
+
/**
|
|
21
|
+
* Separate slot by slot name. This will add a new sub mesh, and new materials.
|
|
22
|
+
*/
|
|
23
|
+
addSeparateSlot(slotName: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Change texture of a separated slot by name.
|
|
26
|
+
*/
|
|
27
|
+
hackSeparateSlotTexture(slotName: string, texture: Texture2D): void;
|
|
28
|
+
onLateUpdate(): void;
|
|
29
|
+
updateBounds(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Spine animation custom clone.
|
|
32
|
+
*/
|
|
30
33
|
_cloneTo(target: SpineRenderer): void;
|
|
31
|
-
private
|
|
34
|
+
private _disposeCurrentSkeleton;
|
|
35
|
+
onDestroy(): void;
|
|
32
36
|
}
|
|
@@ -4,10 +4,12 @@ import { SkeletonData } from "../spine-core/SkeletonData";
|
|
|
4
4
|
import { Color } from "../spine-core/Utils";
|
|
5
5
|
import { SpineRenderSetting } from "../types";
|
|
6
6
|
import { BlendMode } from "../spine-core/BlendMode";
|
|
7
|
+
import { AdaptiveTexture } from "../loader/LoaderUtils";
|
|
7
8
|
type SubMeshItem = {
|
|
8
9
|
subMesh: SubMesh;
|
|
9
10
|
blendMode: BlendMode;
|
|
10
11
|
texture: any;
|
|
12
|
+
slotName?: string;
|
|
11
13
|
};
|
|
12
14
|
export declare class MeshGenerator {
|
|
13
15
|
static QUAD_TRIANGLES: number[];
|
|
@@ -15,12 +17,14 @@ export declare class MeshGenerator {
|
|
|
15
17
|
static VERTEX_STRIDE: number;
|
|
16
18
|
static tempColor: Color;
|
|
17
19
|
static tempBlendMode: BlendMode | null;
|
|
20
|
+
static tempTexture: AdaptiveTexture | null;
|
|
18
21
|
private _setting;
|
|
19
22
|
private _engine;
|
|
20
23
|
private _entity;
|
|
21
24
|
private _clipper;
|
|
22
25
|
private _spineMesh;
|
|
23
26
|
private _vertexCount;
|
|
27
|
+
private _triangleCount;
|
|
24
28
|
private _vertices;
|
|
25
29
|
private _verticesWithZ;
|
|
26
30
|
private _indices;
|
|
@@ -28,7 +32,7 @@ export declare class MeshGenerator {
|
|
|
28
32
|
private _meshRenderer;
|
|
29
33
|
private _subMeshItems;
|
|
30
34
|
readonly separateSlots: string[];
|
|
31
|
-
readonly
|
|
35
|
+
readonly separateSlotTextureMap: Map<string, Texture2D>;
|
|
32
36
|
get mesh(): import("@galacean/engine").BufferMesh;
|
|
33
37
|
get subMeshItems(): SubMeshItem[];
|
|
34
38
|
constructor(engine: Engine, entity: Entity);
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./SpineLoader";
|
|
1
|
+
import "./loader/SpineLoader";
|
|
2
2
|
export { SpineRenderer } from "./SpineRenderer";
|
|
3
3
|
export { SpineAnimation } from "./SpineAnimation";
|
|
4
4
|
export { AssetManager } from "./spine-core/AssetManager";
|
|
@@ -7,4 +7,6 @@ export { TextureAtlas } from "./spine-core/TextureAtlas";
|
|
|
7
7
|
export { AtlasAttachmentLoader } from "./spine-core/AtlasAttachmentLoader";
|
|
8
8
|
export { SkeletonJson } from "./spine-core/SkeletonJson";
|
|
9
9
|
export { SkeletonBinary } from "./spine-core/SkeletonBinary";
|
|
10
|
+
export { SkeletonData } from "./spine-core/SkeletonData";
|
|
11
|
+
export { generateTextureAtlas } from "./loader/LoaderUtils";
|
|
10
12
|
export declare const version = "__buildVersion";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Engine, Texture2D } from "@galacean/engine";
|
|
2
|
+
import { TextureAtlas } from "../spine-core/TextureAtlas";
|
|
3
|
+
import { Texture, TextureFilter, TextureWrap } from "../spine-core/Texture";
|
|
4
|
+
import { SkeletonData } from "../spine-core/SkeletonData";
|
|
5
|
+
import { SpineAssetBundle } from "./SpineLoader";
|
|
6
|
+
export declare function loadAndCreateSpineSkeletonData(bundle: SpineAssetBundle, engine: Engine): Promise<SkeletonData>;
|
|
7
|
+
export declare function generateTextureAtlas(atlasText: string, texturesMap: Record<string, Texture2D>): TextureAtlas;
|
|
8
|
+
export declare function getBaseUrl(url: string): string;
|
|
9
|
+
export declare class AdaptiveTexture extends Texture {
|
|
10
|
+
texture: Texture2D;
|
|
11
|
+
constructor(image: HTMLImageElement | ImageBitmap, texture: Texture2D);
|
|
12
|
+
getImage(): any;
|
|
13
|
+
setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
14
|
+
setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
private _convertWrapMode;
|
|
17
|
+
}
|
|
18
|
+
export declare function getUrlExtension(url: string, extension?: string): string | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine";
|
|
2
|
+
import { SkeletonData } from "../spine-core/SkeletonData";
|
|
3
|
+
export type SpineAssetBundle = {
|
|
4
|
+
skeletonPath: string;
|
|
5
|
+
skeletonExtension: string;
|
|
6
|
+
atlasPath: string;
|
|
7
|
+
imagePaths: string[];
|
|
8
|
+
imageExtensions: string[];
|
|
9
|
+
};
|
|
10
|
+
type SpineLoaderParams = {
|
|
11
|
+
fileExtensions?: string | string[];
|
|
12
|
+
};
|
|
13
|
+
type SpineLoadItem = LoadItem & {
|
|
14
|
+
params?: SpineLoaderParams;
|
|
15
|
+
};
|
|
16
|
+
declare class SpineLoader extends Loader<SkeletonData> {
|
|
17
|
+
load(item: SpineLoadItem, resourceManager: ResourceManager): AssetPromise<SkeletonData>;
|
|
18
|
+
}
|
|
19
|
+
export { SpineLoader };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AssetType, Engine, Texture2D } from "@galacean/engine";
|
|
2
2
|
import { Disposable, Map } from "./Utils";
|
|
3
3
|
import { TextureAtlas } from "./TextureAtlas";
|
|
4
|
-
import { AdaptiveTexture } from "../
|
|
4
|
+
import { AdaptiveTexture } from "../loader/LoaderUtils";
|
|
5
5
|
export declare class AssetManager implements Disposable {
|
|
6
6
|
private _engine;
|
|
7
7
|
protected pathPrefix: string;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { Texture2D } from "@galacean/engine";
|
|
2
1
|
export declare abstract class Texture {
|
|
3
|
-
protected
|
|
4
|
-
constructor(
|
|
5
|
-
|
|
6
|
-
get height(): number;
|
|
7
|
-
get texture(): Texture2D;
|
|
2
|
+
protected _image: HTMLImageElement | ImageBitmap;
|
|
3
|
+
constructor(image: HTMLImageElement | ImageBitmap);
|
|
4
|
+
getImage(): HTMLImageElement | ImageBitmap;
|
|
8
5
|
abstract setFilters(minFilter: TextureFilter, magFilter: TextureFilter): void;
|
|
9
6
|
abstract setWraps(uWrap: TextureWrap, vWrap: TextureWrap): void;
|
|
10
7
|
abstract dispose(): void;
|
|
@@ -4,7 +4,7 @@ import { TextureWrap, TextureRegion } from "./Texture";
|
|
|
4
4
|
export declare class TextureAtlas implements Disposable {
|
|
5
5
|
pages: TextureAtlasPage[];
|
|
6
6
|
regions: TextureAtlasRegion[];
|
|
7
|
-
constructor(atlasText: string, textureLoader: (path: string
|
|
7
|
+
constructor(atlasText: string, textureLoader: (path: string) => any);
|
|
8
8
|
private load;
|
|
9
9
|
findRegion(name: string): TextureAtlasRegion;
|
|
10
10
|
dispose(): void;
|