@galacean/engine-spine 0.0.0-experimental-engine-spine-20250613-2 → 0.0.0-experimental-engine-spine-20250624

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.0-experimental-engine-spine-20250613-2",
2
+ "version": "0.0.0-experimental-engine-spine-20250624",
3
3
  "description": "galacean spine runtime",
4
4
  "name": "@galacean/engine-spine",
5
5
  "main": "dist/main.js",
@@ -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,16 +24,17 @@ 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
+ /**
28
+ * Whether to enable dark color tint for your spine animation.
29
+ * When your Spine animation uses "Tint Black" feature in the Spine editor, enable this to ensure
30
+ * the rendered result matches the Spine editor preview.
31
+ */
32
+ tintBlack: boolean;
28
33
  /**
29
34
  * Default state for spine animation.
30
35
  * Contains the default animation name to be played, whether this animation should loop, the default skin name.
31
36
  */
32
37
  readonly defaultConfig: SpineAnimationDefaultConfig;
33
- /**
34
- * Hook function called after animation applied and before building render primitive.
35
- * This allows custom logic to be executed after animation state is applied but before buffer upload.
36
- */
37
- onBeforeBuildPrimitive?: () => void;
38
38
  /** @internal */
39
39
  _primitive: Primitive;
40
40
  /** @internal */
@@ -116,6 +116,10 @@ export declare class SpineAnimationRenderer extends Renderer {
116
116
  * @internal
117
117
  */
118
118
  _clearSubPrimitives(): void;
119
+ /**
120
+ * @internal
121
+ */
122
+ _getMaterial(texture: Texture2D, blendMode: BlendMode): Material;
119
123
  private _clearMaterialCache;
120
124
  private _applyDefaultConfig;
121
125
  /**
@@ -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
  }