@galacean/engine-design 2.0.0-alpha.57 → 2.0.0-alpha.59

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-design",
3
- "version": "2.0.0-alpha.57",
3
+ "version": "2.0.0-alpha.59",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "types": "types/index.d.ts",
20
20
  "dependencies": {
21
- "@galacean/engine-math": "2.0.0-alpha.57"
21
+ "@galacean/engine-math": "2.0.0-alpha.59"
22
22
  },
23
23
  "scripts": {
24
24
  "b:types": "tsc"
package/types/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export type { IClone } from "./IClone";
2
2
  export * from "./input/index";
3
3
  export * from "./physics/index";
4
- export * from "./renderingHardwareInterface/index";
5
4
  export * from "./shader-compiler/index";
6
5
  export * from "./xr/index";
7
6
  export * from "./spine/index";
@@ -7,8 +7,10 @@ export interface ICollider {
7
7
  * Attaches a shape and initializes its collision layer.
8
8
  * @param shape - Shape to attach
9
9
  * @param layer - Collision layer index, from 0 to 31
10
+ * @returns Whether the shape was accepted
11
+ * @remarks On failure, returns false and leaves the collider unchanged.
10
12
  */
11
- addShape(shape: IColliderShape, layer: number): void;
13
+ addShape(shape: IColliderShape, layer: number): boolean;
12
14
  /**
13
15
  * Remove collider shape on collider.
14
16
  * @param shape - The collider shape attached
@@ -1,9 +1,19 @@
1
1
  import { Quaternion, Vector3 } from "@galacean/engine-math";
2
2
  import { ICollider } from "./ICollider";
3
+ import { IColliderShape } from "./shape";
3
4
  /**
4
5
  * Interface of physics dynamic collider.
5
6
  */
6
7
  export interface IDynamicCollider extends ICollider {
8
+ /**
9
+ * Atomically replace an attached shape with the same logical identity.
10
+ * @param previousShape - The currently attached shape
11
+ * @param newShape - The replacement shape
12
+ * @param layer - Collision layer index, from 0 to 31
13
+ * @returns Whether the replacement succeeded
14
+ * @remarks On failure, returns false and leaves the previous shape and its event state unchanged.
15
+ */
16
+ replaceShape(previousShape: IColliderShape, newShape: IColliderShape, layer: number): boolean;
7
17
  /**
8
18
  * Set global transform of collider.
9
19
  * @param position - The global position
@@ -3,7 +3,7 @@ import { ICharacterController } from "./ICharacterController";
3
3
  import { ICollider } from "./ICollider";
4
4
  import { IDynamicCollider } from "./IDynamicCollider";
5
5
  import { IPhysicsManager } from "./IPhysicsManager";
6
- import { IPhysicsMaterial } from "./IPhysicsMaterial";
6
+ import { IPhysicsMaterial, IPhysicsMaterialProperties } from "./IPhysicsMaterial";
7
7
  import { IPhysicsScene } from "./IPhysicsScene";
8
8
  import { IStaticCollider } from "./IStaticCollider";
9
9
  import { IFixedJoint, IHingeJoint, ISpringJoint } from "./joints";
@@ -44,13 +44,9 @@ export interface IPhysics {
44
44
  createCharacterController(): ICharacterController;
45
45
  /**
46
46
  * Create physics material.
47
- * @param staticFriction - Static friction
48
- * @param dynamicFriction - Dynamic friction
49
- * @param bounciness - Restitution
50
- * @param frictionCombine - The mode to combine the friction of collider
51
- * @param bounceCombine - The mode to combine the bounce of collider
47
+ * @param properties - Physics material properties
52
48
  */
53
- createPhysicsMaterial(staticFriction: number, dynamicFriction: number, bounciness: number, frictionCombine: number, bounceCombine: number): IPhysicsMaterial;
49
+ createPhysicsMaterial(properties: IPhysicsMaterialProperties): IPhysicsMaterial;
54
50
  /**
55
51
  * Create box collider shape.
56
52
  * @param uniqueID - Shape unique id
@@ -87,8 +83,9 @@ export interface IPhysics {
87
83
  * @param isConvex - Whether to create convex mesh (true) or triangle mesh (false)
88
84
  * @param material - The material of this shape
89
85
  * @param cookingFlags - Cooking flags
86
+ * @param worldScale - World scale of the shape
90
87
  */
91
- createMeshColliderShape(uniqueID: number, positions: Vector3[], indices: Uint8Array | Uint16Array | Uint32Array | null, isConvex: boolean, material: IPhysicsMaterial, cookingFlags: number): IMeshColliderShape | null;
88
+ createMeshColliderShape(uniqueID: number, positions: Vector3[], indices: Uint8Array | Uint16Array | Uint32Array | null, isConvex: boolean, material: IPhysicsMaterial, cookingFlags: number, worldScale: Vector3): IMeshColliderShape | null;
92
89
  /**
93
90
  * Create fixed joint.
94
91
  * @param collider - collider of joint
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Physics material properties supplied by the engine.
3
+ */
4
+ export interface IPhysicsMaterialProperties {
5
+ readonly staticFriction: number;
6
+ readonly dynamicFriction: number;
7
+ readonly bounciness: number;
8
+ readonly frictionCombine: number;
9
+ readonly bounceCombine: number;
10
+ }
1
11
  /**
2
12
  * Interface of physics material.
3
13
  */
@@ -1,9 +1,19 @@
1
1
  import { Quaternion, Vector3 } from "@galacean/engine-math";
2
2
  import { ICollider } from "./ICollider";
3
+ import { IColliderShape } from "./shape";
3
4
  /**
4
5
  * Interface of physics static collider.
5
6
  */
6
7
  export interface IStaticCollider extends ICollider {
8
+ /**
9
+ * Atomically replace an attached shape with the same logical identity.
10
+ * @param previousShape - The currently attached shape
11
+ * @param newShape - The replacement shape
12
+ * @param layer - Collision layer index, from 0 to 31
13
+ * @returns Whether the replacement succeeded
14
+ * @remarks On failure, returns false and leaves the previous shape and its event state unchanged.
15
+ */
16
+ replaceShape(previousShape: IColliderShape, newShape: IColliderShape, layer: number): boolean;
7
17
  /**
8
18
  * Set global transform of collider.
9
19
  * @param position - The global position
@@ -2,7 +2,7 @@ export type { ICharacterController } from "./ICharacterController";
2
2
  export type { ICollider } from "./ICollider";
3
3
  export type { IDynamicCollider } from "./IDynamicCollider";
4
4
  export type { IPhysics } from "./IPhysics";
5
- export type { IPhysicsMaterial } from "./IPhysicsMaterial";
5
+ export type { IPhysicsMaterial, IPhysicsMaterialProperties } from "./IPhysicsMaterial";
6
6
  export type { IPhysicsScene } from "./IPhysicsScene";
7
7
  export type { IPhysicsManager } from "./IPhysicsManager";
8
8
  export type { IStaticCollider } from "./IStaticCollider";
@@ -5,12 +5,11 @@ import { IColliderShape } from "./IColliderShape";
5
5
  */
6
6
  export interface IMeshColliderShape extends IColliderShape {
7
7
  /**
8
- * Set mesh data for this collider shape.
8
+ * Update mesh data without changing the geometry type.
9
9
  * @param positions - Vertex positions
10
- * @param indices - The index array (Uint16Array or Uint32Array), required for triangle mesh
11
- * @param isConvex - Whether to use convex mesh (true) or triangle mesh (false)
10
+ * @param indices - Index array (null for convex mesh)
12
11
  * @param cookingFlags - Cooking flags
13
- * @returns Whether the mesh data was successfully set
12
+ * @returns Whether the update succeeded; failure leaves the shape unchanged
14
13
  */
15
- setMeshData(positions: Vector3[], indices: Uint8Array | Uint16Array | Uint32Array | null, isConvex: boolean, cookingFlags: number): boolean;
14
+ setMeshData(positions: Vector3[], indices: Uint8Array | Uint16Array | Uint32Array | null, cookingFlags: number): boolean;
16
15
  }
@@ -1,4 +1,3 @@
1
- import { IHardwareRenderer } from "../renderingHardwareInterface";
2
1
  import { IXRSession } from "./IXRSession";
3
2
  import { IXRPlatformFeature } from "./feature/IXRPlatformFeature";
4
3
  /**
@@ -23,9 +22,9 @@ export interface IXRDevice {
23
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
  }
@@ -21,10 +21,6 @@ export interface IXRSession {
21
21
  * Returns the frame rate supported by the device.
22
22
  */
23
23
  get supportedFrameRates(): Float32Array | undefined;
24
- /**
25
- * Returns the device's default main framebuffer.
26
- */
27
- get framebuffer(): WebGLFramebuffer;
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
@@ -1,7 +0,0 @@
1
- /**
2
- * Hardware graphics API renderer.
3
- */
4
- export interface IHardwareRenderer {
5
- readonly maxUniformBlockSize: number;
6
- [key: string]: any;
7
- }
@@ -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";