@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.
@@ -46,6 +46,44 @@ export class OGC3DTile extends THREE.Object3D<THREE.Object3DEventMap> {
46
46
  * @param {number} [properties.splatsSaturation = 1.0] - optional saturation multiplier. Typical useful range: 0.0 → 2.0 (1.0 = unchanged).
47
47
  * @param {number} [properties.splatsContrast = 1.0] - optional contrast multiplier. Typical useful range: 0.0 → 2.0 (1.0 = unchanged).
48
48
  * @param {Array|Object} [properties.splatsTempTint = [0.0, 0.0]] - optional temperature and tint pair for simple white-balance adjustment. Values: temperature ∈ [-100,100], tint ∈ [-100,100]. Default [0,0].
49
+ * @param {Object} [properties.physics.sim = undefined] - physics sim helper {@link physics.js}
50
+ * @param {String} [properties.physics.type = fixed] - type: 'dynamic' | 'kinematic' | 'fixed' (default 'fixed')
51
+ * @param {String} [properties.physics.shape = none] - LEGACY single collider shape: 'none' | 'mesh' | 'bounds' | 'hull'. Used only when no advanced collider rules are provided.
52
+ * @param {number} [properties.physics.mass = 1] - mass
53
+ * @param {number} [properties.physics.maxLOD = infinity] - LEGACY global max LOD for constructing colliders. Higher is more accurate and more costly. Only the currently loaded LODs are used.
54
+ * @param {Array|Vector3} [properties.physics.velocity = [0,0,0]] - velocity vector
55
+ * @param {Array|Vector3} [properties.physics.angularVelocity = [0,0,0]] - angular velocity
56
+ *
57
+ * @param {Object} [properties.physics.colliders] - ADVANCED rules to mix different collider types by geometricError or by level (LOD).
58
+ * @param {number} [properties.physics.colliders.maxLOD] - Global LOD cap for colliders. If omitted, falls back to properties.physics.maxLOD, else Infinity.
59
+ * @param {string[]} [properties.physics.colliders.priority=["mesh","hull","bounds"]] - Priority when multiple rules match the same tile. First entry wins.
60
+ * @param {Object[]} [properties.physics.colliders.byGeometricError] - Preferred criterion when provided. Inclusive ranges on geometricError.
61
+ * @param {("mesh"|"hull"|"bounds")} properties.physics.colliders.byGeometricError[].shape - Collider type to use in this range.
62
+ * @param {number} properties.physics.colliders.byGeometricError[].min - Inclusive minimum geometricError for the rule (defaults to -Infinity if omitted).
63
+ * @param {number} properties.physics.colliders.byGeometricError[].max - Exclusive maximum geometricError for the rule (defaults to +Infinity if omitted).
64
+ * @param {Object[]} [properties.physics.colliders.byLevel] - Fallback criterion when byGeometricError is absent/empty. Inclusive ranges on integer level (LOD).
65
+ * @param {("mesh"|"hull"|"bounds")} properties.physics.colliders.byLevel[].shape - Collider type to use in this LOD interval.
66
+ * @param {number} properties.physics.colliders.byLevel[].min - Inclusive minimum LOD (integer).
67
+ * @param {number} properties.physics.colliders.byLevel[].max - Inclusive maximum LOD (integer).
68
+ * @param {("mesh"|"hull"|"bounds")} [properties.physics.colliders.defaultShape] - Optional fallback shape when no rule matches. If omitted, legacy properties.physics.shape is used. If neither present, no collider is created.
69
+ *
70
+ * Selection rules:
71
+ * - If colliders.byGeometricError has entries, it is used exclusively. Otherwise, byLevel is used when present.
72
+ * - If multiple rules match, the first in colliders.priority is chosen (default priority is ["mesh","hull","bounds"]).
73
+ * - If no rule matches, defaultShape is used; if absent, falls back to legacy properties.physics.shape; otherwise no collider is created.
74
+ * - The colliders.maxLOD (or legacy maxLOD) acts as a global cap. Tiles with level > maxLOD never get colliders.
75
+ * - When a tile becomes invisible, existing colliders at level === maxLOD are retained if the tile has children (as a fallback for deeper LODs), identical to legacy behavior.
76
+ * e.g. (physics.colliders):
77
+ * {
78
+ * "maxLOD": 4,
79
+ * "priority": ["mesh", "hull", "bounds"],
80
+ * "byLevel": [
81
+ * { "shape": "mesh", "min": 4, "max": 4 },
82
+ * { "shape": "hull", "min": 3, "max": 3 },
83
+ * { "shape": "bounds", "min": 0, "max": 2 }
84
+ * ],
85
+ * "defaultShape": "bounds"
86
+ * }
49
87
  */
50
88
  constructor(properties?: {
51
89
  url?: string | undefined;
@@ -85,6 +123,7 @@ export class OGC3DTile extends THREE.Object3D<THREE.Object3DEventMap> {
85
123
  splatsContrast?: number | undefined;
86
124
  splatsTempTint?: Object | any[] | undefined;
87
125
  });
126
+ physics: any;
88
127
  splatsMesh: any;
89
128
  oldUltraMeshSplats: any;
90
129
  iosCompatibility: any;
@@ -243,6 +282,21 @@ export class OGC3DTile extends THREE.Object3D<THREE.Object3DEventMap> {
243
282
  _isReady(): boolean;
244
283
  _isReadyImmediate(): boolean;
245
284
  _changeContentVisibility(visibility: any): void;
285
+ /**
286
+ * Set the world-space pose of this tileset.
287
+ *
288
+ * IMPORTANT: When a physics simulation is attached (this.physics && this.physics.sim && this.physics.rigidBodyID),
289
+ * you MUST use this method to transform the object. Do NOT modify transforms using THREE.Object3D core methods
290
+ * (e.g. position.set, quaternion.set, applyQuaternion, setRotationFromEuler, etc.) because the physics engine
291
+ * is authoritative for the object's transform. This method keeps the physics rigid body in sync and updates colliders.
292
+ *
293
+ * @param {THREE.Vector3} position - New world-space position. Must be an instance of THREE.Vector3.
294
+ * @param {THREE.Euler|THREE.Quaternion} rotation - Rotation can be either a THREE.Euler or a THREE.Quaternion.
295
+ * @param {THREE.Vector3} scale - New scale. Must be an instance of THREE.Vector3.
296
+ * @throws {TypeError} If position or scale are not THREE.Vector3, or if rotation is not THREE.Euler/THREE.Quaternion.
297
+ */
298
+ setPose(position: THREE.Vector3, rotation: THREE.Euler | THREE.Quaternion, scale: THREE.Vector3): void;
299
+ _updateCollider(): void;
246
300
  _calculateUpdateMetric(camera: any, frustum: any): number;
247
301
  _getSiblings(): any[];
248
302
  _calculateDistanceToCamera(camera: any): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jdultra/threedtiles",
3
- "version": "14.0.19",
3
+ "version": "14.0.21",
4
4
  "author": "Emeric Beaufays",
5
5
  "description": "An OGC 3DTiles viewer for Three.js",
6
6
  "main": "dist/threedtiles.cjs.js",
@@ -32,6 +32,7 @@
32
32
  "three": "^0.180.0"
33
33
  },
34
34
  "dependencies": {
35
+ "@dimforge/rapier3d-compat": "^0.19.2",
35
36
  "@haragei/dag": "^1.1.0",
36
37
  "@spz-loader/core": "^0.3.0",
37
38
  "data-structure-typed": "^2.0.4",
@@ -56,6 +57,8 @@
56
57
  "typescript": "^5.9.2",
57
58
  "vite": "^7.1.6",
58
59
  "vite-plugin-static-copy": "^3.1.0",
59
- "vitest": "^3.2.4"
60
+ "vitest": "^3.2.4",
61
+ "vite-plugin-top-level-await": "^1.3.0",
62
+ "vite-plugin-wasm": "^3.2.1"
60
63
  }
61
64
  }
@@ -1,16 +0,0 @@
1
- export class OBB {
2
- constructor(values: any);
3
- center: Vector3;
4
- halfWidth: number;
5
- halfHeight: number;
6
- halfDepth: number;
7
- aabb: Box3;
8
- sphere: Sphere;
9
- matrixToOBBCoordinateSystem: Matrix3;
10
- inFrustum(frustum: any): any;
11
- distanceToPoint(point: any): number;
12
- }
13
- import { Vector3 } from "three";
14
- import { Box3 } from "three";
15
- import { Sphere } from "three";
16
- import { Matrix3 } from "three";