@galacean/engine-spine 4.2.2 → 4.2.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 (63) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/main.js +617 -241
  3. package/dist/main.js.map +1 -1
  4. package/dist/miniprogram.js +617 -241
  5. package/dist/module.js +618 -242
  6. package/dist/module.js.map +1 -1
  7. package/package.json +3 -2
  8. package/types/renderer/SpineAnimationRenderer.d.ts +18 -7
  9. package/types/renderer/SpineGenerator.d.ts +3 -4
  10. package/types/renderer/SpineMaterial.d.ts +23 -1
  11. package/types/SpineAnimation.d.ts +0 -48
  12. package/types/SpineLoader.d.ts +0 -32
  13. package/types/SpineMaterial.d.ts +0 -6
  14. package/types/SpineRenderer.d.ts +0 -38
  15. package/types/core/MeshGenerator.d.ts +0 -43
  16. package/types/core/SpineMesh.d.ts +0 -11
  17. package/types/spine-core/Animation.d.ts +0 -378
  18. package/types/spine-core/AnimationState.d.ts +0 -365
  19. package/types/spine-core/AnimationStateData.d.ts +0 -23
  20. package/types/spine-core/AssetManager.d.ts +0 -36
  21. package/types/spine-core/AtlasAttachmentLoader.d.ts +0 -23
  22. package/types/spine-core/BlendMode.d.ts +0 -7
  23. package/types/spine-core/Bone.d.ts +0 -110
  24. package/types/spine-core/BoneData.d.ts +0 -44
  25. package/types/spine-core/ConstraintData.d.ts +0 -7
  26. package/types/spine-core/Event.d.ts +0 -16
  27. package/types/spine-core/EventData.d.ts +0 -13
  28. package/types/spine-core/IkConstraint.d.ts +0 -38
  29. package/types/spine-core/IkConstraintData.d.ts +0 -26
  30. package/types/spine-core/PathConstraint.d.ts +0 -46
  31. package/types/spine-core/PathConstraintData.d.ts +0 -52
  32. package/types/spine-core/SharedAssetManager.d.ts +0 -19
  33. package/types/spine-core/Skeleton.d.ts +0 -134
  34. package/types/spine-core/SkeletonBinary.d.ts +0 -49
  35. package/types/spine-core/SkeletonBounds.d.ts +0 -48
  36. package/types/spine-core/SkeletonClipping.d.ts +0 -22
  37. package/types/spine-core/SkeletonData.d.ts +0 -89
  38. package/types/spine-core/SkeletonJson.d.ts +0 -34
  39. package/types/spine-core/Skin.d.ts +0 -43
  40. package/types/spine-core/Slot.d.ts +0 -42
  41. package/types/spine-core/SlotData.d.ts +0 -23
  42. package/types/spine-core/Texture.d.ts +0 -46
  43. package/types/spine-core/TextureAtlas.d.ts +0 -30
  44. package/types/spine-core/TransformConstraint.d.ts +0 -36
  45. package/types/spine-core/TransformConstraintData.d.ts +0 -34
  46. package/types/spine-core/Triangulator.d.ts +0 -14
  47. package/types/spine-core/Updatable.d.ts +0 -9
  48. package/types/spine-core/Utils.d.ts +0 -124
  49. package/types/spine-core/VertexEffect.d.ts +0 -7
  50. package/types/spine-core/attachments/Attachment.d.ts +0 -43
  51. package/types/spine-core/attachments/AttachmentLoader.d.ts +0 -25
  52. package/types/spine-core/attachments/AttachmentType.d.ts +0 -9
  53. package/types/spine-core/attachments/BoundingBoxAttachment.d.ts +0 -12
  54. package/types/spine-core/attachments/ClippingAttachment.d.ts +0 -14
  55. package/types/spine-core/attachments/MeshAttachment.d.ts +0 -46
  56. package/types/spine-core/attachments/PathAttachment.d.ts +0 -19
  57. package/types/spine-core/attachments/PointAttachment.d.ts +0 -20
  58. package/types/spine-core/attachments/RegionAttachment.d.ts +0 -88
  59. package/types/spine-core/polyfills.d.ts +0 -3
  60. package/types/spine-core/vertexeffects/JitterEffect.d.ts +0 -11
  61. package/types/spine-core/vertexeffects/SwirlEffect.d.ts +0 -16
  62. package/types/types.d.ts +0 -4
  63. package/types/util/BlendMode.d.ts +0 -4
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
- "version": "4.2.2",
2
+ "version": "4.2.3",
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
+ "packageManager": "pnpm@9.3.0",
8
9
  "dependencies": {
9
10
  "@esotericsoftware/spine-core": "~4.2.66"
10
11
  },
@@ -128,4 +129,4 @@
128
129
  },
129
130
  "types": "types/index.d.ts",
130
131
  "repository": "https://github.com/johanzhu/engine-spine.git"
131
- }
132
+ }
@@ -1,19 +1,18 @@
1
- import { AnimationState, Skeleton } from "@esotericsoftware/spine-core";
2
- import { BoundingBox, Buffer, Engine, Entity, Material, Primitive, Renderer, SubPrimitive } from "@galacean/engine";
1
+ import { AnimationState, Skeleton, BlendMode } from "@esotericsoftware/spine-core";
2
+ import { BoundingBox, Buffer, Entity, Material, Primitive, Renderer, SubPrimitive, Texture2D } from "@galacean/engine";
3
3
  import { SpineResource } from "../loader/SpineResource";
4
+ import { SpineMaterial } from "./SpineMaterial";
4
5
  /**
5
6
  * Spine animation renderer, capable of rendering spine animations and providing functions for animation and skeleton manipulation.
6
7
  */
7
8
  export declare class SpineAnimationRenderer extends Renderer {
8
- private static _defaultMaterial;
9
9
  private static _spineGenerator;
10
10
  private static _positionVertexElement;
11
- private static _colorVertexElement;
11
+ private static _lightColorVertexElement;
12
12
  private static _uvVertexElement;
13
+ private static _darkColorVertexElement;
13
14
  /** @internal */
14
- static _materialCache: Map<string, Material>;
15
- /** @internal */
16
- static _getDefaultMaterial(engine: Engine): Material;
15
+ static _materialCacheMap: Map<string, SpineMaterial>;
17
16
  /**
18
17
  * The spacing between z layers in world units.
19
18
  */
@@ -25,6 +24,14 @@ export declare class SpineAnimationRenderer extends Renderer {
25
24
  If this option is enabled, the Spine editor must export textures with "Premultiply Alpha" checked.
26
25
  */
27
26
  premultipliedAlpha: boolean;
27
+ private _tintBlack;
28
+ /**
29
+ * Whether to enable tint black feature for dark color tinting.
30
+ *
31
+ * @remarks Should be enabled when using "Tint Black" feature in Spine editor.
32
+ */
33
+ get tintBlack(): boolean;
34
+ set tintBlack(value: boolean);
28
35
  /**
29
36
  * Default state for spine animation.
30
37
  * Contains the default animation name to be played, whether this animation should loop, the default skin name.
@@ -111,6 +118,10 @@ export declare class SpineAnimationRenderer extends Renderer {
111
118
  * @internal
112
119
  */
113
120
  _clearSubPrimitives(): void;
121
+ /**
122
+ * @internal
123
+ */
124
+ _getMaterial(texture: Texture2D, blendMode: BlendMode): Material;
114
125
  private _clearMaterialCache;
115
126
  private _applyDefaultConfig;
116
127
  /**
@@ -1,8 +1,8 @@
1
1
  import { BlendMode, Color, Skeleton } from "@esotericsoftware/spine-core";
2
2
  import { SubPrimitive, Texture2D } from "@galacean/engine";
3
- import { SpineAnimationRenderer } from "./SpineAnimationRenderer";
4
3
  import { ClearablePool } from "../util/ClearablePool";
5
4
  import { ReturnablePool } from "../util/ReturnablePool";
5
+ import { SpineAnimationRenderer } from "./SpineAnimationRenderer";
6
6
  declare class SubRenderItem {
7
7
  subPrimitive: SubPrimitive;
8
8
  blendMode: BlendMode;
@@ -13,8 +13,8 @@ declare class SubRenderItem {
13
13
  * @internal
14
14
  */
15
15
  export declare class SpineGenerator {
16
- static VERTEX_SIZE: number;
17
- static VERTEX_STRIDE: number;
16
+ static vertexStrideWithoutTint: number;
17
+ static vertexStrideWithTint: number;
18
18
  static tempDark: Color;
19
19
  static tempColor: Color;
20
20
  static tempVerts: any[];
@@ -28,7 +28,6 @@ export declare class SpineGenerator {
28
28
  buildPrimitive(skeleton: Skeleton, renderer: SpineAnimationRenderer): void;
29
29
  addSeparateSlot(slotName: string): void;
30
30
  addSeparateSlotTexture(slotName: string, texture: Texture2D): void;
31
- private _createMaterialForTexture;
32
31
  private _createRenderItem;
33
32
  private _expandBounds;
34
33
  }
@@ -1,6 +1,28 @@
1
- import { Engine, Material } from "@galacean/engine";
1
+ import { Engine, Material, Texture2D } from "@galacean/engine";
2
+ import { BlendMode } from "@esotericsoftware/spine-core";
2
3
  export declare class SpineMaterial extends Material {
4
+ private _blendMode;
3
5
  private static _spineVS;
4
6
  private static _spineFS;
7
+ /**
8
+ * @internal
9
+ */
10
+ _setTintBlack(enabled: boolean): void;
11
+ /**
12
+ * @internal
13
+ */
14
+ _setPremultipliedAlpha(enabled: boolean): void;
15
+ /**
16
+ * @internal
17
+ */
18
+ _setTexture(value: Texture2D): void;
5
19
  constructor(engine: Engine);
20
+ /**
21
+ * @internal
22
+ */
23
+ _setBlendMode(blendMode: BlendMode, premultipliedAlpha: boolean): void;
24
+ /**
25
+ * @internal
26
+ */
27
+ _getBlendMode(): BlendMode;
6
28
  }
@@ -1,48 +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
- /** @internal */
12
- _heldTextures: Texture2D[];
13
- private _skeletonData;
14
- private _skeleton;
15
- private _state;
16
- private _tempOffset;
17
- private _tempSize;
18
- private _tempArray;
19
- protected _meshGenerator: MeshGenerator;
20
- setting: SpineRenderSetting;
21
- autoUpdateBounds: boolean;
22
- noPause: boolean;
23
- get skeletonData(): SkeletonData;
24
- get skeleton(): Skeleton;
25
- get state(): AnimationState;
26
- get mesh(): import("@galacean/engine").BufferMesh;
27
- set scale(v: number);
28
- constructor(entity: Entity);
29
- setSkeletonData(skeletonData: SkeletonData, setting?: SpineRenderSetting): void;
30
- /**
31
- * Separate slot by slot name. This will add a new sub mesh, and new materials.
32
- */
33
- addSeparateSlot(slotName: string): void;
34
- /**
35
- * Change texture of a separated slot by name.
36
- */
37
- hackSeparateSlotTexture(slotName: string, texture: Texture2D): void;
38
- onUpdate(delta: number): void;
39
- updateGeometry(): void;
40
- updateBounds(): void;
41
- /**
42
- * Spine animation custom clone.
43
- */
44
- _cloneTo(target: SpineAnimation): void;
45
- private _disposeCurrentSkeleton;
46
- private _disposeTextures;
47
- onDestroy(): void;
48
- }
@@ -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 };
@@ -1,6 +0,0 @@
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
- }
@@ -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
- }
@@ -1,43 +0,0 @@
1
- import { Engine, Entity, SubMesh, Texture2D } from "@galacean/engine";
2
- import { Skeleton } from "../spine-core/Skeleton";
3
- import { SkeletonData } from "../spine-core/SkeletonData";
4
- import { Color } from "../spine-core/Utils";
5
- import { SpineRenderSetting } from "../types";
6
- import { BlendMode } from "../spine-core/BlendMode";
7
- type SubMeshItem = {
8
- subMesh: SubMesh;
9
- blendMode: BlendMode;
10
- texture: any;
11
- slotName?: string;
12
- };
13
- export declare class MeshGenerator {
14
- static QUAD_TRIANGLES: number[];
15
- static VERTEX_SIZE: number;
16
- static VERTEX_STRIDE: number;
17
- static tempColor: Color;
18
- static tempBlendMode: BlendMode | null;
19
- private _setting;
20
- private _engine;
21
- private _entity;
22
- private _clipper;
23
- private _spineMesh;
24
- private _vertexCount;
25
- private _vertices;
26
- private _verticesWithZ;
27
- private _indices;
28
- private _needResize;
29
- private _meshRenderer;
30
- private _subMeshItems;
31
- readonly separateSlots: string[];
32
- readonly separateSlotTextureMap: Map<string, Texture2D>;
33
- get mesh(): import("@galacean/engine").BufferMesh;
34
- get subMeshItems(): SubMeshItem[];
35
- constructor(engine: Engine, entity: Entity);
36
- initialize(skeletonData: SkeletonData, setting?: SpineRenderSetting): void;
37
- buildMesh(skeleton: Skeleton): void;
38
- addSeparateSlot(slotName: string): void;
39
- addSeparateSlotTexture(slotName: string, texture: Texture2D): void;
40
- private _prepareBufferData;
41
- private setBlendMode;
42
- }
43
- export {};
@@ -1,11 +0,0 @@
1
- import { BufferMesh, Engine, Buffer } from '@galacean/engine';
2
- export declare class SpineMesh {
3
- private _mesh;
4
- private _indexBuffer;
5
- private _vertexBuffer;
6
- get mesh(): BufferMesh;
7
- get indexBuffer(): Buffer;
8
- get vertexBuffer(): Buffer;
9
- initialize(engine: Engine, vertexCount: number): void;
10
- changeBuffer(engine: Engine, vertexCount: number): void;
11
- }