@jdultra/threedtiles 14.0.20 → 14.0.21

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/dist/entry.d.ts CHANGED
@@ -2,6 +2,8 @@ export { OcclusionCullingService } from "./tileset/OcclusionCullingService";
2
2
  export { TileLoader } from "./tileset/TileLoader";
3
3
  export { InstancedOGC3DTile } from "./tileset/instanced/InstancedOGC3DTile.js";
4
4
  export { InstancedTileLoader } from "./tileset/instanced/InstancedTileLoader.js";
5
+ export { Physics } from "./simulation/physics.js";
6
+ export { ColliderShape } from "./simulation/ColliderShape.js";
5
7
  export { OBB } from "./geometry/obb.js";
6
8
  export { OGC3DTile, getOGC3DTilesCopyrightInfo } from "./tileset/OGC3DTile";
7
9
  export { splatsVertexShader, splatsFragmentShader, SplatsMesh } from "./splats/SplatsMesh.js";
@@ -1,10 +1,24 @@
1
- export function createBall(radius: any): {
1
+ export namespace ColliderShape {
2
+ export { createBall };
3
+ export { createCuboid };
4
+ export { createBox };
5
+ export { createRoundCuboid };
6
+ export { createCapsule };
7
+ export { createCone };
8
+ export { createCylinder };
9
+ export { createSegment };
10
+ export { createTriangle };
11
+ export { createPolyline };
12
+ export { createConvexHull };
13
+ export { createHeightfield };
14
+ }
15
+ declare function createBall(radius: any): {
2
16
  kind: string;
3
17
  params: {
4
18
  radius: number;
5
19
  };
6
20
  };
7
- export function createCuboid(hx: any, hy: any, hz: any): {
21
+ declare function createCuboid(hx: any, hy: any, hz: any): {
8
22
  kind: string;
9
23
  params: {
10
24
  hx: number;
@@ -12,7 +26,7 @@ export function createCuboid(hx: any, hy: any, hz: any): {
12
26
  hz: number;
13
27
  };
14
28
  };
15
- export function createBox(hx: any, hy: any, hz: any): {
29
+ declare function createBox(hx: any, hy: any, hz: any): {
16
30
  kind: string;
17
31
  params: {
18
32
  hx: number;
@@ -20,7 +34,7 @@ export function createBox(hx: any, hy: any, hz: any): {
20
34
  hz: number;
21
35
  };
22
36
  };
23
- export function createRoundCuboid(hx: any, hy: any, hz: any, radius: any): {
37
+ declare function createRoundCuboid(hx: any, hy: any, hz: any, radius: any): {
24
38
  kind: string;
25
39
  params: {
26
40
  hx: number;
@@ -29,35 +43,35 @@ export function createRoundCuboid(hx: any, hy: any, hz: any, radius: any): {
29
43
  radius: number;
30
44
  };
31
45
  };
32
- export function createCapsule(halfHeight: any, radius: any): {
46
+ declare function createCapsule(halfHeight: any, radius: any): {
33
47
  kind: string;
34
48
  params: {
35
49
  halfHeight: number;
36
50
  radius: number;
37
51
  };
38
52
  };
39
- export function createCone(halfHeight: any, radius: any): {
53
+ declare function createCone(halfHeight: any, radius: any): {
40
54
  kind: string;
41
55
  params: {
42
56
  halfHeight: number;
43
57
  radius: number;
44
58
  };
45
59
  };
46
- export function createCylinder(halfHeight: any, radius: any): {
60
+ declare function createCylinder(halfHeight: any, radius: any): {
47
61
  kind: string;
48
62
  params: {
49
63
  halfHeight: number;
50
64
  radius: number;
51
65
  };
52
66
  };
53
- export function createSegment(a: any, b: any): {
67
+ declare function createSegment(a: any, b: any): {
54
68
  kind: string;
55
69
  params: {
56
70
  a: any;
57
71
  b: any;
58
72
  };
59
73
  };
60
- export function createTriangle(a: any, b: any, c: any): {
74
+ declare function createTriangle(a: any, b: any, c: any): {
61
75
  kind: string;
62
76
  params: {
63
77
  a: any;
@@ -65,20 +79,20 @@ export function createTriangle(a: any, b: any, c: any): {
65
79
  c: any;
66
80
  };
67
81
  };
68
- export function createPolyline(vertices: any, indices: any): {
82
+ declare function createPolyline(vertices: any, indices: any): {
69
83
  kind: string;
70
84
  params: {
71
85
  vertices: any;
72
86
  indices: any;
73
87
  };
74
88
  };
75
- export function createConvexHull(vertices: any): {
89
+ declare function createConvexHull(vertices: any): {
76
90
  kind: string;
77
91
  params: {
78
92
  vertices: any;
79
93
  };
80
94
  };
81
- export function createHeightfield(rows: any, cols: any, heights: any, scale?: {
95
+ declare function createHeightfield(rows: any, cols: any, heights: any, scale?: {
82
96
  x: number;
83
97
  y: number;
84
98
  z: number;
@@ -95,18 +109,4 @@ export function createHeightfield(rows: any, cols: any, heights: any, scale?: {
95
109
  };
96
110
  };
97
111
  };
98
- export default ColliderShape;
99
- declare namespace ColliderShape {
100
- export { createBall };
101
- export { createCuboid };
102
- export { createBox };
103
- export { createRoundCuboid };
104
- export { createCapsule };
105
- export { createCone };
106
- export { createCylinder };
107
- export { createSegment };
108
- export { createTriangle };
109
- export { createPolyline };
110
- export { createConvexHull };
111
- export { createHeightfield };
112
- }
112
+ export {};
@@ -22,10 +22,14 @@ export class Physics {
22
22
  };
23
23
  autoStart: boolean;
24
24
  sharedMemorySupported: boolean;
25
- worker: Worker;
25
+ worker: any;
26
26
  _msgId: number;
27
27
  _pending: Map<any, any>;
28
28
  _onWorkerMessage(ev: any): void;
29
+ helperWorker: any;
30
+ _helperMsgId: number;
31
+ _helperPending: Map<any, any>;
32
+ _onHelperMessage(ev: any): void;
29
33
  _paused: boolean;
30
34
  _lastTickTime: number;
31
35
  _lastState: any;
@@ -63,6 +67,20 @@ export class Physics {
63
67
  localRotation: any;
64
68
  localScale: any;
65
69
  }): Promise<null> | Promise<string>;
70
+ /**
71
+ * addConvexHullCollider({ bodyId, geometry?, positions?, indices?, localPosition?, localRotation?, localScale? }) => Promise<string colliderId>
72
+ * Computes a convex hull in a helper worker (with non-uniform scale baked in) and attaches it as a collider.
73
+ * Positions/indices are duplicated on the main thread and their ArrayBuffers are transferred to the helper worker.
74
+ */
75
+ addConvexHullCollider({ bodyId, geometry, positions, indices, localPosition, localRotation, localScale }: {
76
+ bodyId: any;
77
+ geometry: any;
78
+ positions: any;
79
+ indices: any;
80
+ localPosition: any;
81
+ localRotation: any;
82
+ localScale: any;
83
+ }): Promise<string | null>;
66
84
  /**
67
85
  * attachShapeCollider({ bodyId, shape, localPosition?, localRotation? }) => Promise<string colliderId>
68
86
  * Creates a primitive/analytic collider (via engine-agnostic shape descriptor) and attaches it to the body.
@@ -149,6 +167,8 @@ export class Physics {
149
167
  dispose(): void;
150
168
  _scheduleNextTick(): void;
151
169
  _onTick(): void;
170
+ _ensureHelperWorker(): void;
171
+ _helperPost(msg: any, transfer?: any[]): Promise<any>;
152
172
  _post(msg: any, transfer?: any[]): Promise<any>;
153
173
  on(type: any, fn: any): () => void;
154
174
  off(type: any, fn: any): void;
@@ -0,0 +1,6 @@
1
+ declare function ack(id: any, result?: null, transfer?: any[]): void;
2
+ declare function nack(id: any, error: any): void;
3
+ declare function computeHullFromPositions(positions: any, scale: any): {
4
+ hullVertices: Float32Array<ArrayBufferLike>;
5
+ hullIndices: null;
6
+ };