@galacean/engine-physics-physx 1.6.12 → 2.0.0-alpha.0

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-physics-physx",
3
- "version": "1.6.12",
3
+ "version": "2.0.0-alpha.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,11 +26,11 @@
26
26
  "types/**/*"
27
27
  ],
28
28
  "devDependencies": {
29
- "@galacean/engine-design": "1.6.12",
30
- "@galacean/engine": "1.6.12"
29
+ "@galacean/engine-design": "2.0.0-alpha.0",
30
+ "@galacean/engine": "2.0.0-alpha.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@galacean/engine": "1.6.12"
33
+ "@galacean/engine": "2.0.0-alpha.0"
34
34
  },
35
35
  "scripts": {
36
36
  "b:types": "tsc"
@@ -1,5 +1,5 @@
1
1
  import { Quaternion, Vector3 } from "@galacean/engine";
2
- import { IBoxColliderShape, ICapsuleColliderShape, ICharacterController, ICollision, IDynamicCollider, IFixedJoint, IHingeJoint, IPhysics, IPhysicsManager, IPhysicsMaterial, IPhysicsScene, IPlaneColliderShape, ISphereColliderShape, ISpringJoint, IStaticCollider } from "@galacean/engine-design";
2
+ import { IBoxColliderShape, ICapsuleColliderShape, ICharacterController, ICollision, IDynamicCollider, IFixedJoint, IHingeJoint, IMeshColliderShape, IPhysics, IPhysicsManager, IPhysicsMaterial, IPhysicsScene, IPlaneColliderShape, ISphereColliderShape, ISpringJoint, IStaticCollider } from "@galacean/engine-design";
3
3
  import { PhysXCollider } from "./PhysXCollider";
4
4
  import { PhysXPhysicsManager } from "./PhysXPhysicsManager";
5
5
  import { PhysXPhysicsMaterial } from "./PhysXPhysicsMaterial";
@@ -32,6 +32,16 @@ export declare class PhysXPhysics implements IPhysics {
32
32
  * Destroy PhysXPhysics.
33
33
  */
34
34
  destroy(): void;
35
+ /**
36
+ * Set cooking parameters for mesh colliders.
37
+ * @param params - Cooking parameters
38
+ */
39
+ setCookingParams(params: {
40
+ /** Mesh weld tolerance. If mesh welding is enabled, this controls the distance at which vertices are welded. */
41
+ meshWeldTolerance?: number;
42
+ /** Mesh preprocessing flags (bitwise OR of MeshPreprocessingFlag values). */
43
+ meshPreprocessParams?: number;
44
+ }): void;
35
45
  /**
36
46
  * {@inheritDoc IPhysics.createPhysicsManager }
37
47
  */
@@ -72,6 +82,10 @@ export declare class PhysXPhysics implements IPhysics {
72
82
  * {@inheritDoc IPhysics.createCapsuleColliderShape }
73
83
  */
74
84
  createCapsuleColliderShape(uniqueID: number, radius: number, height: number, material: PhysXPhysicsMaterial): ICapsuleColliderShape;
85
+ /**
86
+ * {@inheritDoc IPhysics.createMeshColliderShape }
87
+ */
88
+ createMeshColliderShape(uniqueID: number, vertices: Float32Array, vertexCount: number, indices: Uint16Array | Uint32Array | null, isConvex: boolean, material: PhysXPhysicsMaterial): IMeshColliderShape;
75
89
  /**
76
90
  * {@inheritDoc IPhysics.createFixedJoint }
77
91
  */
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Mesh preprocessing flags for cooking options.
3
+ * @remarks These flags control how the mesh is preprocessed during cooking.
4
+ */
5
+ export declare enum MeshPreprocessingFlag {
6
+ /**
7
+ * When set, mesh welding is performed.
8
+ * Vertices within the meshWeldTolerance distance will be merged.
9
+ * Clean mesh must be enabled for this to work.
10
+ */
11
+ WeldVertices = 1,
12
+ /**
13
+ * When set, mesh cleaning is disabled.
14
+ * This makes cooking faster but requires the input mesh to be valid.
15
+ * When clean mesh is disabled, vertex welding is also disabled.
16
+ */
17
+ DisableCleanMesh = 2,
18
+ /**
19
+ * When set, active edges computation is disabled.
20
+ * This makes cooking faster but may slow down contact generation.
21
+ */
22
+ DisableActiveEdgesPrecompute = 4,
23
+ /**
24
+ * When set, 32-bit indices will always be used regardless of triangle count.
25
+ * By default, 16-bit indices are used for meshes with <= 65535 triangles.
26
+ */
27
+ Force32BitIndices = 8
28
+ }
package/types/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { PhysXPhysics } from "./PhysXPhysics";
2
2
  export { PhysXRuntimeMode } from "./enum/PhysXRuntimeMode";
3
+ export { MeshPreprocessingFlag } from "./enum/MeshPreprocessingFlag";
3
4
  export declare const version = "__buildVersion";
@@ -0,0 +1,44 @@
1
+ import { Vector3 } from "@galacean/engine";
2
+ import { IMeshColliderShape } from "@galacean/engine-design";
3
+ import { PhysXPhysics } from "../PhysXPhysics";
4
+ import { PhysXPhysicsMaterial } from "../PhysXPhysicsMaterial";
5
+ import { PhysXColliderShape } from "./PhysXColliderShape";
6
+ /**
7
+ * Mesh collider shape in PhysX.
8
+ */
9
+ export declare class PhysXMeshColliderShape extends PhysXColliderShape implements IMeshColliderShape {
10
+ private _pxMesh;
11
+ private _isConvex;
12
+ private _doubleSided;
13
+ private _tightBounds;
14
+ private _vertices;
15
+ private _vertexCount;
16
+ private _indices;
17
+ constructor(physXPhysics: PhysXPhysics, uniqueID: number, vertices: Float32Array, vertexCount: number, indices: Uint16Array | Uint32Array | null, isConvex: boolean, material: PhysXPhysicsMaterial);
18
+ /**
19
+ * {@inheritDoc IMeshColliderShape.setMeshData }
20
+ */
21
+ setMeshData(vertices: Float32Array, vertexCount: number, indices: Uint16Array | Uint32Array | null, isConvex: boolean): void;
22
+ /**
23
+ * {@inheritDoc IMeshColliderShape.setDoubleSided }
24
+ */
25
+ setDoubleSided(value: boolean): void;
26
+ /**
27
+ * {@inheritDoc IMeshColliderShape.setTightBounds }
28
+ */
29
+ setTightBounds(value: boolean): void;
30
+ /**
31
+ * {@inheritDoc IColliderShape.setWorldScale }
32
+ */
33
+ setWorldScale(scale: Vector3): void;
34
+ /**
35
+ * {@inheritDoc IColliderShape.destroy }
36
+ */
37
+ destroy(): void;
38
+ private _createMeshAndShape;
39
+ private _createMesh;
40
+ private _allocateVertices;
41
+ private _allocateIndices;
42
+ private _updateGeometry;
43
+ private _releaseMesh;
44
+ }