@galacean/engine-design 2.0.0-alpha.6 → 2.0.0-alpha.61

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 (62) hide show
  1. package/dist/main.js +1094 -0
  2. package/dist/main.js.map +1 -0
  3. package/dist/module.js +1081 -0
  4. package/dist/module.js.map +1 -0
  5. package/package.json +3 -2
  6. package/types/index.d.ts +2 -2
  7. package/types/physics/ICollider.d.ts +6 -3
  8. package/types/physics/ICollision.d.ts +6 -3
  9. package/types/physics/IDynamicCollider.d.ts +20 -8
  10. package/types/physics/IPhysics.d.ts +6 -16
  11. package/types/physics/IPhysicsEvents.d.ts +25 -0
  12. package/types/physics/IPhysicsMaterial.d.ts +10 -0
  13. package/types/physics/IPhysicsScene.d.ts +84 -23
  14. package/types/physics/IStaticCollider.d.ts +10 -0
  15. package/types/physics/index.d.ts +2 -1
  16. package/types/physics/joints/IJoint.d.ts +1 -1
  17. package/types/physics/shape/IColliderShape.d.ts +5 -0
  18. package/types/physics/shape/IMeshColliderShape.d.ts +4 -5
  19. package/types/shader-compiler/ICondition.d.ts +131 -0
  20. package/types/shader-compiler/IPrecompiledShader.d.ts +20 -0
  21. package/types/shader-compiler/IShaderCompiler.d.ts +33 -0
  22. package/types/shader-compiler/IShaderProgramSource.d.ts +14 -0
  23. package/types/shader-compiler/PreprocessorExpression.d.ts +174 -0
  24. package/types/shader-compiler/ShaderIncludePath.d.ts +7 -0
  25. package/types/shader-compiler/index.d.ts +12 -0
  26. package/types/shader-compiler/shaderSource/IShaderPassSource.d.ts +34 -0
  27. package/types/spine/ISpineAnimation.d.ts +4 -0
  28. package/types/spine/ISpineAnimationState.d.ts +17 -0
  29. package/types/spine/ISpineAnimationStateData.d.ts +5 -0
  30. package/types/spine/ISpineAnimationStateListener.d.ts +10 -0
  31. package/types/spine/ISpineBone.d.ts +21 -0
  32. package/types/spine/ISpineBoneData.d.ts +3 -0
  33. package/types/spine/ISpineConstraint.d.ts +5 -0
  34. package/types/spine/ISpineConstraintData.d.ts +3 -0
  35. package/types/spine/ISpineEvent.d.ts +9 -0
  36. package/types/spine/ISpineGeometry.d.ts +17 -0
  37. package/types/spine/ISpinePhysics.d.ts +7 -0
  38. package/types/spine/ISpinePhysicsConstraint.d.ts +11 -0
  39. package/types/spine/ISpineRuntime.d.ts +52 -0
  40. package/types/spine/ISpineSkeleton.d.ts +21 -0
  41. package/types/spine/ISpineSkeletonData.d.ts +15 -0
  42. package/types/spine/ISpineSkin.d.ts +5 -0
  43. package/types/spine/ISpineSlot.d.ts +9 -0
  44. package/types/spine/ISpineTextureAtlas.d.ts +6 -0
  45. package/types/spine/ISpineTrackEntry.d.ts +23 -0
  46. package/types/spine/SpineCapability.d.ts +8 -0
  47. package/types/spine/index.d.ts +21 -0
  48. package/types/xr/IXRDevice.d.ts +3 -4
  49. package/types/xr/IXRSession.d.ts +7 -7
  50. package/types/renderingHardwareInterface/IHardwareRenderer.d.ts +0 -6
  51. package/types/renderingHardwareInterface/IPlatformPrimitive.d.ts +0 -5
  52. package/types/renderingHardwareInterface/IPlatformShaderProgram.d.ts +0 -4
  53. package/types/renderingHardwareInterface/index.d.ts +0 -3
  54. package/types/shader-lab/IShaderLab.d.ts +0 -22
  55. package/types/shader-lab/IShaderProgramSource.d.ts +0 -4
  56. package/types/shader-lab/index.d.ts +0 -8
  57. package/types/shader-lab/shaderSource/IShaderPassSource.d.ts +0 -13
  58. /package/types/{shader-lab → shader-compiler}/shaderSource/IRenderStates.d.ts +0 -0
  59. /package/types/{shader-lab → shader-compiler}/shaderSource/IShaderPosition.d.ts +0 -0
  60. /package/types/{shader-lab → shader-compiler}/shaderSource/IShaderSource.d.ts +0 -0
  61. /package/types/{shader-lab → shader-compiler}/shaderSource/IStatement.d.ts +0 -0
  62. /package/types/{shader-lab → shader-compiler}/shaderSource/ISubShaderSource.d.ts +0 -0
@@ -0,0 +1,52 @@
1
+ import type { ISpineGeometry } from "./ISpineGeometry";
2
+ import type { ISpineSkin } from "./ISpineSkin";
3
+ import type { ISpineSkeletonData } from "./ISpineSkeletonData";
4
+ import type { ISpineSkeleton } from "./ISpineSkeleton";
5
+ import type { ISpineAnimationStateData } from "./ISpineAnimationStateData";
6
+ import type { ISpineAnimationState } from "./ISpineAnimationState";
7
+ import type { SpineCapability } from "./SpineCapability";
8
+ import type { ISpinePhysics } from "./ISpinePhysics";
9
+ import type { ISpineTextureAtlas } from "./ISpineTextureAtlas";
10
+ /**
11
+ * The version-specific spine runtime backend.
12
+ *
13
+ * @remarks
14
+ * Parses assets, creates animation objects, updates poses and builds geometry for one Spine version.
15
+ * The texture type is supplied by the integration layer.
16
+ */
17
+ export interface ISpineRuntime<TTexture> {
18
+ /** Export major.minor supported by this backend. */
19
+ readonly version: string;
20
+ /** All textures referenced by attachments, including inactive skins and sequences. */
21
+ getTextures(skeletonData: ISpineSkeletonData): TTexture[];
22
+ /** Query once when an instance is created; no per-frame wrapper allocation. */
23
+ getPhysics(skeleton: ISpineSkeleton): SpineCapability<ISpinePhysics>;
24
+ /** Create an empty skin for composition using attachments from this resource. */
25
+ createSkin(name: string): ISpineSkin;
26
+ /**
27
+ * Build an atlas from canonical straight-alpha textures in atlas page order.
28
+ * The shared loader resolves page names and validates straight-alpha input before calling the backend.
29
+ */
30
+ createTextureAtlas(atlasText: string, textures: TTexture[]): ISpineTextureAtlas;
31
+ /** Parse skeleton data (json or binary) against an atlas. */
32
+ createSkeletonData(skeletonRawData: string | ArrayBuffer, textureAtlas: ISpineTextureAtlas, skeletonDataScale: number): ISpineSkeletonData;
33
+ /** Create the shared animation state data for a skeleton data. */
34
+ createAnimationStateData(skeletonData: ISpineSkeletonData): ISpineAnimationStateData;
35
+ /** Create a skeleton instance. */
36
+ createSkeleton(skeletonData: ISpineSkeletonData): ISpineSkeleton;
37
+ /** Create an animation state instance. */
38
+ createAnimationState(stateData: ISpineAnimationStateData): ISpineAnimationState;
39
+ /** Finish a playback command before dispatching its events. Nested calls preserve the current dispatch. */
40
+ batchAnimationStateEvents<T>(state: ISpineAnimationState, command: () => T): T;
41
+ /** Advance animation and skeleton time without applying the animation or solving the pose. */
42
+ advanceState(skeleton: ISpineSkeleton, state: ISpineAnimationState, delta: number): void;
43
+ /** Apply the current animation to the skeleton's local pose. */
44
+ applyState(skeleton: ISpineSkeleton, state: ISpineAnimationState): void;
45
+ /**
46
+ * Solve bone world transforms and constraints. When advancePhysics is false, apply the existing
47
+ * physics pose without advancing the simulation; this permits world-space-driven pose edits.
48
+ */
49
+ updateWorldTransform(skeleton: ISpineSkeleton, advancePhysics: boolean): void;
50
+ /** Write CPU geometry for the current pose. GPU resources remain owned by the shared renderer. */
51
+ buildGeometry(skeleton: ISpineSkeleton, target: ISpineGeometry<TTexture>): void;
52
+ }
@@ -0,0 +1,21 @@
1
+ import type { ISpineBone } from "./ISpineBone";
2
+ import type { ISpineSkin } from "./ISpineSkin";
3
+ import type { ISpineSkeletonData } from "./ISpineSkeletonData";
4
+ import type { ISpineSlot } from "./ISpineSlot";
5
+ /** Per-instance pose. World-transform evaluation is owned by the backend. */
6
+ export interface ISpineSkeleton {
7
+ readonly data: ISpineSkeletonData;
8
+ readonly bones: readonly ISpineBone[];
9
+ readonly slots: readonly ISpineSlot[];
10
+ readonly skin?: ISpineSkin | null;
11
+ x: number;
12
+ y: number;
13
+ scaleX: number;
14
+ scaleY: number;
15
+ setSkinByName(name: string): void;
16
+ setSkin(skin: ISpineSkin | null): void;
17
+ setAttachment(slotName: string, attachmentName: string | null): void;
18
+ setToSetupPose(): void;
19
+ setBonesToSetupPose(): void;
20
+ setSlotsToSetupPose(): void;
21
+ }
@@ -0,0 +1,15 @@
1
+ import type { ISpineSkin } from "./ISpineSkin";
2
+ import type { ISpineAnimation } from "./ISpineAnimation";
3
+ /** Shared setup pose, skins and animations. */
4
+ export interface ISpineSkeletonData {
5
+ readonly name?: string | null;
6
+ readonly version?: string | null;
7
+ readonly skins: readonly ISpineSkin[];
8
+ readonly animations: readonly ISpineAnimation[];
9
+ readonly defaultSkin?: ISpineSkin | null;
10
+ readonly x: number;
11
+ readonly y: number;
12
+ readonly width: number;
13
+ readonly height: number;
14
+ findSkin(name: string): ISpineSkin | null;
15
+ }
@@ -0,0 +1,5 @@
1
+ /** Shared skin definitions. Mutations affect every instance using this skin. */
2
+ export interface ISpineSkin {
3
+ readonly name: string;
4
+ addSkin(skin: ISpineSkin): void;
5
+ }
@@ -0,0 +1,9 @@
1
+ import type { ISpineBone } from "./ISpineBone";
2
+ /** Per-instance attachment slot. Materials are owned by the renderer. */
3
+ export interface ISpineSlot {
4
+ readonly data: {
5
+ readonly name: string;
6
+ };
7
+ readonly bone: ISpineBone;
8
+ setToSetupPose(): void;
9
+ }
@@ -0,0 +1,6 @@
1
+ /** Backend-owned atlas handle; it is never interpreted by the shared renderer. */
2
+ export interface ISpineTextureAtlas {
3
+ readonly pages: readonly {
4
+ readonly name: string;
5
+ }[];
6
+ }
@@ -0,0 +1,23 @@
1
+ import type { ISpineAnimation } from "./ISpineAnimation";
2
+ import type { ISpineAnimationStateListener } from "./ISpineAnimationStateListener";
3
+ /** A playback entry is pooled by the runtime. Do not retain it after its dispose event. */
4
+ export interface ISpineTrackEntry {
5
+ readonly animation: ISpineAnimation | null;
6
+ readonly trackIndex: number;
7
+ readonly next?: ISpineTrackEntry | null;
8
+ readonly mixingFrom?: ISpineTrackEntry | null;
9
+ readonly mixingTo?: ISpineTrackEntry | null;
10
+ listener?: ISpineAnimationStateListener | null;
11
+ loop: boolean;
12
+ delay: number;
13
+ trackTime: number;
14
+ trackEnd: number;
15
+ timeScale: number;
16
+ alpha: number;
17
+ animationStart: number;
18
+ animationEnd: number;
19
+ mixTime: number;
20
+ mixDuration: number;
21
+ getAnimationTime(): number;
22
+ isComplete(): boolean;
23
+ }
@@ -0,0 +1,8 @@
1
+ /** Version-specific capabilities are explicit, including on versions that do not support them. */
2
+ export type SpineCapability<T> = {
3
+ readonly supported: true;
4
+ readonly value: T;
5
+ } | {
6
+ readonly supported: false;
7
+ readonly reason: string;
8
+ };
@@ -0,0 +1,21 @@
1
+ /** Version-independent Spine contracts. Shared data and per-instance state have separate interfaces. */
2
+ export type { ISpineBoneData } from "./ISpineBoneData";
3
+ export type { ISpineBone } from "./ISpineBone";
4
+ export type { ISpineSlot } from "./ISpineSlot";
5
+ export type { ISpineSkin } from "./ISpineSkin";
6
+ export type { ISpineAnimation } from "./ISpineAnimation";
7
+ export type { ISpineConstraintData } from "./ISpineConstraintData";
8
+ export type { ISpineConstraint } from "./ISpineConstraint";
9
+ export type { ISpineSkeletonData } from "./ISpineSkeletonData";
10
+ export type { ISpineSkeleton } from "./ISpineSkeleton";
11
+ export type { ISpineAnimationStateData } from "./ISpineAnimationStateData";
12
+ export type { ISpineEvent } from "./ISpineEvent";
13
+ export type { ISpineAnimationStateListener } from "./ISpineAnimationStateListener";
14
+ export type { ISpineTrackEntry } from "./ISpineTrackEntry";
15
+ export type { ISpineAnimationState } from "./ISpineAnimationState";
16
+ export type { SpineCapability } from "./SpineCapability";
17
+ export type { ISpinePhysicsConstraint } from "./ISpinePhysicsConstraint";
18
+ export type { ISpinePhysics } from "./ISpinePhysics";
19
+ export type { ISpineTextureAtlas } from "./ISpineTextureAtlas";
20
+ export type { ISpineRuntime } from "./ISpineRuntime";
21
+ export type { ISpineGeometry } from "./ISpineGeometry";
@@ -1,4 +1,3 @@
1
- import { IHardwareRenderer } from "../renderingHardwareInterface";
2
1
  import { IXRSession } from "./IXRSession";
3
2
  import { IXRPlatformFeature } from "./feature/IXRPlatformFeature";
4
3
  /**
@@ -20,12 +19,12 @@ export interface IXRDevice {
20
19
  * @param engine - The engine.
21
20
  * @param type - The type of the feature.
22
21
  */
23
- createPlatformFeature(type: number, ...args: any[]): IXRPlatformFeature;
22
+ createPlatformFeature(type: number, ...args: any[]): IXRPlatformFeature | null;
24
23
  /**
25
24
  * Request a session.
26
- * @param engine - The engine
25
+ * @param rhi - Backend-specific graphics device handle
27
26
  * @param mode - The mode of the session
28
27
  * @param platformFeatures - The requested platform features
29
28
  */
30
- requestSession(rhi: IHardwareRenderer, mode: number, platformFeatures: IXRPlatformFeature[]): Promise<IXRSession>;
29
+ requestSession(rhi: unknown, mode: number, platformFeatures: IXRPlatformFeature[]): Promise<IXRSession>;
31
30
  }
@@ -16,15 +16,11 @@ export interface IXRSession {
16
16
  /**
17
17
  * Returns the current frame rate.
18
18
  */
19
- get frameRate(): number;
19
+ get frameRate(): number | undefined;
20
20
  /**
21
21
  * Returns the frame rate supported by the device.
22
22
  */
23
- get supportedFrameRates(): Float32Array;
24
- /**
25
- * Returns the device's default main framebuffer.
26
- */
27
- get framebuffer(): WebGLFramebuffer;
23
+ get supportedFrameRates(): Float32Array | undefined;
28
24
  /**
29
25
  * Returns the width of the device's default main framebuffer.
30
26
  */
@@ -33,6 +29,10 @@ export interface IXRSession {
33
29
  * Returns the height of the device's default main framebuffer.
34
30
  */
35
31
  get framebufferHeight(): number;
32
+ /**
33
+ * Synchronize per-frame session state before updating inputs and cameras.
34
+ */
35
+ onUpdate(): void;
36
36
  /**
37
37
  * Set fixed foveation for camera.
38
38
  * @param value - The fixed foveation value
@@ -41,7 +41,7 @@ export interface IXRSession {
41
41
  /**
42
42
  * Return fixed foveation of camera.
43
43
  */
44
- getFixedFoveation(): number;
44
+ getFixedFoveation(): number | undefined;
45
45
  /**
46
46
  * Add event listener for XR session.
47
47
  */
@@ -1,6 +0,0 @@
1
- /**
2
- * Hardware graphics API renderer.
3
- */
4
- export interface IHardwareRenderer {
5
- [key: string]: any;
6
- }
@@ -1,5 +0,0 @@
1
- import { IPlatformShaderProgram } from "./IPlatformShaderProgram";
2
- export interface IPlatformPrimitive {
3
- draw(shaderProgram: IPlatformShaderProgram, subPrimitive: any): void;
4
- destroy(): void;
5
- }
@@ -1,4 +0,0 @@
1
- export interface IPlatformShaderProgram {
2
- readonly id: number;
3
- readonly attributeLocation: Record<string, GLint>;
4
- }
@@ -1,3 +0,0 @@
1
- export type { IHardwareRenderer } from "./IHardwareRenderer";
2
- export type { IPlatformPrimitive } from "./IPlatformPrimitive";
3
- export type { IPlatformShaderProgram } from "./IPlatformShaderProgram";
@@ -1,22 +0,0 @@
1
- import { IShaderProgramSource } from "./IShaderProgramSource";
2
- import { IShaderSource } from "./shaderSource/IShaderSource";
3
- /**
4
- * Shader lab interface.
5
- */
6
- export interface IShaderLab {
7
- /**
8
- * @internal
9
- * Parse shader source code to get the source structure of shader.
10
- */
11
- _parseShaderSource(sourceCode: string): IShaderSource;
12
- /**
13
- * @internal
14
- * Parse shader pass source code.
15
- * @param basePathForIncludeKey the base path to resolve the relative path of `#include` directive. Must follow the specifications of [URL.origin](https://developer.mozilla.org/en-US/docs/Web/API/URL/origin), like: `shaders://root/`
16
- */
17
- _parseShaderPass(shaderPassSource: string, vertexEntry: string, fragmentEntry: string, backend: any, basePathForIncludeKey: string): IShaderProgramSource;
18
- _parseMacros(context: string, macros: Array<{
19
- name: string;
20
- value: string;
21
- }>): string;
22
- }
@@ -1,4 +0,0 @@
1
- export interface IShaderProgramSource {
2
- vertex: string;
3
- fragment: string;
4
- }
@@ -1,8 +0,0 @@
1
- export type { IShaderLab } from "./IShaderLab";
2
- export type { IShaderProgramSource as IShaderInfo } from "./IShaderProgramSource";
3
- export { IRenderStates } from "./shaderSource/IRenderStates";
4
- export { IShaderPassSource } from "./shaderSource/IShaderPassSource";
5
- export { IShaderPosition } from "./shaderSource/IShaderPosition";
6
- export type { IShaderSource } from "./shaderSource/IShaderSource";
7
- export { IStatement } from "./shaderSource/IStatement";
8
- export { ISubShaderSource } from "./shaderSource/ISubShaderSource";
@@ -1,13 +0,0 @@
1
- import { IRenderStates } from "./IRenderStates";
2
- import { IStatement } from "./IStatement";
3
- export interface IShaderPassSource {
4
- name: string;
5
- pendingContents: IStatement[];
6
- isUsePass: boolean;
7
- tags?: Record<string, number | string | boolean>;
8
- renderStates: IRenderStates;
9
- /** ShaderLab code source. */
10
- contents: string;
11
- vertexEntry: string;
12
- fragmentEntry: string;
13
- }