@jdultra/threedtiles 14.0.19 → 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/assets/physicsHelper.worker-Cr8S3sZk.js.map +1 -0
- package/dist/assets/physicsRapier.worker-jgQ9dgLt.js.map +1 -0
- package/dist/assets/rapier-CaKmQPsS.js +5218 -0
- package/dist/assets/rapier-CaKmQPsS.js.map +1 -0
- package/dist/entry.d.ts +2 -0
- package/dist/simulation/ColliderShape.d.ts +112 -0
- package/dist/simulation/physics.d.ts +177 -0
- package/dist/simulation/physicsHelper.worker.d.ts +6 -0
- package/dist/simulation/physicsRapier.worker.d.ts +1 -0
- package/dist/threedtiles.cjs.js +455 -25
- package/dist/threedtiles.cjs.js.map +1 -1
- package/dist/threedtiles.es.js +5861 -5017
- package/dist/threedtiles.es.js.map +1 -1
- package/dist/threedtiles.umd.js +455 -25
- package/dist/threedtiles.umd.js.map +1 -1
- package/dist/tileset/OGC3DTile.d.ts +54 -0
- package/package.json +5 -2
- package/dist/geometry/obb copy.d.ts +0 -16
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";
|
|
@@ -0,0 +1,112 @@
|
|
|
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): {
|
|
16
|
+
kind: string;
|
|
17
|
+
params: {
|
|
18
|
+
radius: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
declare function createCuboid(hx: any, hy: any, hz: any): {
|
|
22
|
+
kind: string;
|
|
23
|
+
params: {
|
|
24
|
+
hx: number;
|
|
25
|
+
hy: number;
|
|
26
|
+
hz: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
declare function createBox(hx: any, hy: any, hz: any): {
|
|
30
|
+
kind: string;
|
|
31
|
+
params: {
|
|
32
|
+
hx: number;
|
|
33
|
+
hy: number;
|
|
34
|
+
hz: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
declare function createRoundCuboid(hx: any, hy: any, hz: any, radius: any): {
|
|
38
|
+
kind: string;
|
|
39
|
+
params: {
|
|
40
|
+
hx: number;
|
|
41
|
+
hy: number;
|
|
42
|
+
hz: number;
|
|
43
|
+
radius: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
declare function createCapsule(halfHeight: any, radius: any): {
|
|
47
|
+
kind: string;
|
|
48
|
+
params: {
|
|
49
|
+
halfHeight: number;
|
|
50
|
+
radius: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
declare function createCone(halfHeight: any, radius: any): {
|
|
54
|
+
kind: string;
|
|
55
|
+
params: {
|
|
56
|
+
halfHeight: number;
|
|
57
|
+
radius: number;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
declare function createCylinder(halfHeight: any, radius: any): {
|
|
61
|
+
kind: string;
|
|
62
|
+
params: {
|
|
63
|
+
halfHeight: number;
|
|
64
|
+
radius: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
declare function createSegment(a: any, b: any): {
|
|
68
|
+
kind: string;
|
|
69
|
+
params: {
|
|
70
|
+
a: any;
|
|
71
|
+
b: any;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
declare function createTriangle(a: any, b: any, c: any): {
|
|
75
|
+
kind: string;
|
|
76
|
+
params: {
|
|
77
|
+
a: any;
|
|
78
|
+
b: any;
|
|
79
|
+
c: any;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
declare function createPolyline(vertices: any, indices: any): {
|
|
83
|
+
kind: string;
|
|
84
|
+
params: {
|
|
85
|
+
vertices: any;
|
|
86
|
+
indices: any;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
declare function createConvexHull(vertices: any): {
|
|
90
|
+
kind: string;
|
|
91
|
+
params: {
|
|
92
|
+
vertices: any;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
declare function createHeightfield(rows: any, cols: any, heights: any, scale?: {
|
|
96
|
+
x: number;
|
|
97
|
+
y: number;
|
|
98
|
+
z: number;
|
|
99
|
+
}): {
|
|
100
|
+
kind: string;
|
|
101
|
+
params: {
|
|
102
|
+
rows: number;
|
|
103
|
+
cols: number;
|
|
104
|
+
heights: any;
|
|
105
|
+
scale: {
|
|
106
|
+
x: number;
|
|
107
|
+
y: number;
|
|
108
|
+
z: number;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export {};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
export class Physics {
|
|
2
|
+
/**
|
|
3
|
+
* constructor(options)
|
|
4
|
+
* - updateIntervalMs: number (default 16). setTimeout tick period on the main thread
|
|
5
|
+
* - fixedDt: number seconds per physics step (default: updateIntervalMs/1000)
|
|
6
|
+
* - gravity: [x,y,z] OR { mode:'vector', vector:[x,y,z] } OR { mode:'geocentric', planetCenter:[x,y,z], intensity:number }
|
|
7
|
+
* - autoStart: boolean (default true)
|
|
8
|
+
*/
|
|
9
|
+
constructor(options?: {});
|
|
10
|
+
updateIntervalMs: any;
|
|
11
|
+
fixedDt: any;
|
|
12
|
+
gravity: {
|
|
13
|
+
mode: string;
|
|
14
|
+
vector: any[];
|
|
15
|
+
planetCenter?: undefined;
|
|
16
|
+
intensity?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
mode: string;
|
|
19
|
+
planetCenter: any[];
|
|
20
|
+
intensity: any;
|
|
21
|
+
vector?: undefined;
|
|
22
|
+
};
|
|
23
|
+
autoStart: boolean;
|
|
24
|
+
sharedMemorySupported: boolean;
|
|
25
|
+
worker: any;
|
|
26
|
+
_msgId: number;
|
|
27
|
+
_pending: Map<any, any>;
|
|
28
|
+
_onWorkerMessage(ev: any): void;
|
|
29
|
+
helperWorker: any;
|
|
30
|
+
_helperMsgId: number;
|
|
31
|
+
_helperPending: Map<any, any>;
|
|
32
|
+
_onHelperMessage(ev: any): void;
|
|
33
|
+
_paused: boolean;
|
|
34
|
+
_lastTickTime: number;
|
|
35
|
+
_lastState: any;
|
|
36
|
+
_currentState: any;
|
|
37
|
+
_interpolationMax: number;
|
|
38
|
+
_nextBodyId: number;
|
|
39
|
+
_nextColliderId: number;
|
|
40
|
+
rigidBodies: Map<any, any>;
|
|
41
|
+
bodyToColliders: Map<any, any>;
|
|
42
|
+
colliderToBody: Map<any, any>;
|
|
43
|
+
_listeners: Map<any, any>;
|
|
44
|
+
_initPromise: Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* addObject({ object, type, mass, position, rotation, velocity, angularVelocity })
|
|
47
|
+
* - object: THREE.Object3D (e.g., OGC3DTile or any Object3D)
|
|
48
|
+
* - type: 'dynamic' | 'kinematic' | 'fixed' (default 'dynamic')
|
|
49
|
+
* - mass: number (default 1)
|
|
50
|
+
* - position: array|Vector3
|
|
51
|
+
* - rotation: Euler|Quaternion|[x,y,z,w]
|
|
52
|
+
* - velocity: array|Vector3 (optional)
|
|
53
|
+
* - angularVelocity: array|Vector3 (optional)
|
|
54
|
+
*/
|
|
55
|
+
addObject(options?: {}): string;
|
|
56
|
+
/**
|
|
57
|
+
* attachTrimeshCollider({ bodyId, geometry?, positions?, indices?, localPosition?, localRotation?, localScale? }) => Promise<string colliderId>
|
|
58
|
+
* Creates a TRIMESH collider with baked non-uniform scale and attaches it to the body.
|
|
59
|
+
* Positions/indices are always duplicated on the main thread and their ArrayBuffers are transferred.
|
|
60
|
+
*/
|
|
61
|
+
attachTrimeshCollider({ bodyId, geometry, positions, indices, localPosition, localRotation, localScale }: {
|
|
62
|
+
bodyId: any;
|
|
63
|
+
geometry: any;
|
|
64
|
+
positions: any;
|
|
65
|
+
indices: any;
|
|
66
|
+
localPosition: any;
|
|
67
|
+
localRotation: any;
|
|
68
|
+
localScale: any;
|
|
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>;
|
|
84
|
+
/**
|
|
85
|
+
* attachShapeCollider({ bodyId, shape, localPosition?, localRotation? }) => Promise<string colliderId>
|
|
86
|
+
* Creates a primitive/analytic collider (via engine-agnostic shape descriptor) and attaches it to the body.
|
|
87
|
+
* Note: Any scale must be baked into the shape's parameters; no scale is applied at runtime.
|
|
88
|
+
*/
|
|
89
|
+
attachShapeCollider({ bodyId, shape, localPosition, localRotation }: {
|
|
90
|
+
bodyId: any;
|
|
91
|
+
shape: any;
|
|
92
|
+
localPosition: any;
|
|
93
|
+
localRotation: any;
|
|
94
|
+
}): string | Promise<null>;
|
|
95
|
+
/**
|
|
96
|
+
* detachCollider({ colliderId })
|
|
97
|
+
*/
|
|
98
|
+
detachCollider({ colliderId }: {
|
|
99
|
+
colliderId: any;
|
|
100
|
+
}): void;
|
|
101
|
+
/**
|
|
102
|
+
* removeObject({ bodyId })
|
|
103
|
+
*/
|
|
104
|
+
removeObject({ bodyId }: {
|
|
105
|
+
bodyId: any;
|
|
106
|
+
}): void;
|
|
107
|
+
/**
|
|
108
|
+
* applyForce({ bodyId, force, worldPoint?, wake = true, impulse = false })
|
|
109
|
+
*/
|
|
110
|
+
applyForce({ bodyId, force, worldPoint, wake, impulse }: {
|
|
111
|
+
bodyId: any;
|
|
112
|
+
force: any;
|
|
113
|
+
worldPoint: any;
|
|
114
|
+
wake?: boolean | undefined;
|
|
115
|
+
impulse?: boolean | undefined;
|
|
116
|
+
}): void;
|
|
117
|
+
/**
|
|
118
|
+
* setGravity(gravityOptions)
|
|
119
|
+
*/
|
|
120
|
+
setGravity(gravityOptions: any): void;
|
|
121
|
+
/**
|
|
122
|
+
* setPose({ bodyId, position?, rotation?, wake = true })
|
|
123
|
+
* Teleport a rigid body to a new pose immediately.
|
|
124
|
+
* - position: [x,y,z] or THREE.Vector3 (optional)
|
|
125
|
+
* - rotation: [x,y,z,w] or THREE.Quaternion/Euler (optional)
|
|
126
|
+
* - wake: boolean (default true)
|
|
127
|
+
*/
|
|
128
|
+
setPose({ bodyId, position, rotation, wake }: {
|
|
129
|
+
bodyId: any;
|
|
130
|
+
position: any;
|
|
131
|
+
rotation: any;
|
|
132
|
+
wake?: boolean | undefined;
|
|
133
|
+
}): void;
|
|
134
|
+
/**
|
|
135
|
+
* raycast({ origin, direction, maxToi = 1e6, filter? }) => Promise<hits[]>
|
|
136
|
+
*/
|
|
137
|
+
raycast({ origin, direction, maxToi, filter }: {
|
|
138
|
+
origin: any;
|
|
139
|
+
direction: any;
|
|
140
|
+
maxToi?: number | undefined;
|
|
141
|
+
filter: any;
|
|
142
|
+
}): Promise<any>;
|
|
143
|
+
/**
|
|
144
|
+
* pause / resume
|
|
145
|
+
*/
|
|
146
|
+
pause(): void;
|
|
147
|
+
resume(): void;
|
|
148
|
+
/**
|
|
149
|
+
* setUpdateInterval(ms: number)
|
|
150
|
+
*/
|
|
151
|
+
setUpdateInterval(ms: any): void;
|
|
152
|
+
/**
|
|
153
|
+
* stepOnce(dtSeconds?: number)
|
|
154
|
+
* Requests a single physics integration step on worker.
|
|
155
|
+
*/
|
|
156
|
+
stepOnce(dtSeconds: any): Promise<any>;
|
|
157
|
+
/**
|
|
158
|
+
* update()
|
|
159
|
+
* Interpolates between the last two physics snapshots and applies transforms to linked THREE.Object3D.
|
|
160
|
+
* This is automatically called on a setTimeout loop by the constructor, but can also be called manually.
|
|
161
|
+
*/
|
|
162
|
+
update(): void;
|
|
163
|
+
/**
|
|
164
|
+
* dispose()
|
|
165
|
+
* Terminates the worker and clears all registries.
|
|
166
|
+
*/
|
|
167
|
+
dispose(): void;
|
|
168
|
+
_scheduleNextTick(): void;
|
|
169
|
+
_onTick(): void;
|
|
170
|
+
_ensureHelperWorker(): void;
|
|
171
|
+
_helperPost(msg: any, transfer?: any[]): Promise<any>;
|
|
172
|
+
_post(msg: any, transfer?: any[]): Promise<any>;
|
|
173
|
+
on(type: any, fn: any): () => void;
|
|
174
|
+
off(type: any, fn: any): void;
|
|
175
|
+
_emit(type: any, payload: any): void;
|
|
176
|
+
}
|
|
177
|
+
export default Physics;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|