@needle-tools/engine 4.11.0-beta.1 → 4.11.0-next.687516a
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/components.needle.json +1 -1
- package/dist/{gltf-progressive-CXVECA3a.js → gltf-progressive-BvlZQAkt.js} +3 -3
- package/dist/{gltf-progressive-D4Z_Khp3.min.js → gltf-progressive-CftVUJy3.min.js} +1 -1
- package/dist/{gltf-progressive-CHeORqEv.umd.cjs → gltf-progressive-GwdQV1Qx.umd.cjs} +1 -1
- package/dist/{needle-engine.bundle-CFc4UIqz.umd.cjs → needle-engine.bundle-COautGiS.umd.cjs} +142 -142
- package/dist/{needle-engine.bundle-6j5gE-aQ.min.js → needle-engine.bundle-RxTD8sUI.min.js} +142 -142
- package/dist/{needle-engine.bundle-BDZ09xyt.js → needle-engine.bundle-vaRDfJpp.js} +6211 -6145
- package/dist/needle-engine.d.ts +6 -0
- package/dist/needle-engine.js +4 -4
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-DQ2pynXW.js → postprocessing-CJC0Npcd.js} +2 -2
- package/dist/{postprocessing-BsnRNRRS.umd.cjs → postprocessing-DrM4PWU3.umd.cjs} +1 -1
- package/dist/{postprocessing-BHMVuZQ1.min.js → postprocessing-l7zsdO_Q.min.js} +1 -1
- package/dist/{three-qw28ZtTy.min.js → three-BDW9I486.min.js} +13 -13
- package/dist/{three-CJSAehtG.js → three-MHVqtJYj.js} +1 -0
- package/dist/{three-examples-Doq0rvFU.js → three-examples-C5Ht-QFN.js} +1 -1
- package/dist/{three-examples-Deqc1bNw.umd.cjs → three-examples-CgwGHSgz.umd.cjs} +1 -1
- package/dist/{three-examples-BivkhnvN.min.js → three-examples-fvEPSC8L.min.js} +1 -1
- package/dist/{three-B-jwTHao.umd.cjs → three-iFaDq9U3.umd.cjs} +13 -13
- package/dist/{three-mesh-ui-CktOi6oI.js → three-mesh-ui-BjWTTk1R.js} +1 -1
- package/dist/{three-mesh-ui-CsHwj9cJ.umd.cjs → three-mesh-ui-Bm32sS2a.umd.cjs} +1 -1
- package/dist/{three-mesh-ui-DhYXcXZe.min.js → three-mesh-ui-CLdkp21K.min.js} +1 -1
- package/dist/{vendor-BcsPRUmt.umd.cjs → vendor-C-oI7A4Z.umd.cjs} +2 -2
- package/dist/{vendor-CyfN5nor.js → vendor-D4AePCCt.js} +609 -599
- package/dist/{vendor-DyavoogU.min.js → vendor-DlEKkX1e.min.js} +25 -25
- package/lib/engine/js-extensions/Object3D.d.ts +6 -0
- package/lib/engine/js-extensions/Object3D.js +15 -0
- package/lib/engine/js-extensions/Object3D.js.map +1 -1
- package/lib/engine-components/Collider.d.ts +26 -0
- package/lib/engine-components/Collider.js +26 -0
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/ContactShadows.d.ts +11 -2
- package/lib/engine-components/ContactShadows.js +11 -2
- package/lib/engine-components/ContactShadows.js.map +1 -1
- package/lib/engine-components/DropListener.d.ts +3 -0
- package/lib/engine-components/DropListener.js +40 -19
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/Duplicatable.d.ts +2 -2
- package/lib/engine-components/Duplicatable.js +2 -2
- package/lib/engine-components/EventList.d.ts +18 -1
- package/lib/engine-components/EventList.js +18 -1
- package/lib/engine-components/EventList.js.map +1 -1
- package/lib/engine-components/GroundProjection.d.ts +3 -0
- package/lib/engine-components/GroundProjection.js +3 -0
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/Interactable.d.ts +4 -0
- package/lib/engine-components/Interactable.js +4 -0
- package/lib/engine-components/Interactable.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +4 -2
- package/lib/engine-components/OrbitControls.js +31 -3
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +5 -0
- package/lib/engine-components/RigidBody.js +5 -0
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/SeeThrough.js +20 -0
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +4 -2
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +69 -14
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -1
- package/lib/engine-components/ui/Text.js +6 -1
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/utils/LookAt.d.ts +3 -0
- package/lib/engine-components/utils/LookAt.js +3 -0
- package/lib/engine-components/utils/LookAt.js.map +1 -1
- package/lib/engine-components/utils/OpenURL.d.ts +2 -1
- package/lib/engine-components/utils/OpenURL.js +2 -1
- package/lib/engine-components/utils/OpenURL.js.map +1 -1
- package/lib/engine-components/webxr/WebARCameraBackground.d.ts +2 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js +2 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js.map +1 -1
- package/lib/engine-components/webxr/WebARSessionRoot.d.ts +1 -1
- package/lib/engine-components/webxr/WebARSessionRoot.js +1 -1
- package/lib/engine-components/webxr/WebXR.d.ts +2 -0
- package/lib/engine-components/webxr/WebXR.js +2 -0
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +29 -0
- package/lib/engine-components/webxr/WebXRImageTracking.js +29 -0
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/package.json +3 -3
- package/src/engine/js-extensions/Object3D.ts +24 -0
- package/src/engine-components/Collider.ts +27 -1
- package/src/engine-components/ContactShadows.ts +12 -4
- package/src/engine-components/DropListener.ts +43 -23
- package/src/engine-components/Duplicatable.ts +2 -2
- package/src/engine-components/EventList.ts +18 -1
- package/src/engine-components/GroundProjection.ts +4 -1
- package/src/engine-components/Interactable.ts +4 -1
- package/src/engine-components/OrbitControls.ts +27 -3
- package/src/engine-components/RigidBody.ts +6 -1
- package/src/engine-components/SeeThrough.ts +42 -2
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +117 -17
- package/src/engine-components/ui/Text.ts +11 -2
- package/src/engine-components/utils/LookAt.ts +3 -0
- package/src/engine-components/utils/OpenURL.ts +3 -2
- package/src/engine-components/webxr/WebARCameraBackground.ts +2 -0
- package/src/engine-components/webxr/WebARSessionRoot.ts +1 -1
- package/src/engine-components/webxr/WebXR.ts +2 -0
- package/src/engine-components/webxr/WebXRImageTracking.ts +30 -3
|
@@ -15,8 +15,9 @@ export enum OpenURLMode {
|
|
|
15
15
|
NewWindow = 2
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* OpenURL behaviour opens a URL in a new tab or window.
|
|
18
|
+
/**
|
|
19
|
+
* OpenURL behaviour opens a URL in a new tab or window when the object (or any if it's children) is clicked.
|
|
20
|
+
*
|
|
20
21
|
* @category Interactivity
|
|
21
22
|
* @group Components
|
|
22
23
|
*/
|
|
@@ -24,6 +24,8 @@ const debug = getParam("debugarcamera");
|
|
|
24
24
|
/**
|
|
25
25
|
* WebARCameraBackground is a component that allows to display the camera feed as a background in an AR session to more easily blend the real world with the virtual world or applying effects to the camera feed.
|
|
26
26
|
*
|
|
27
|
+
* - Example: https://samples.needle.tools/ar-camera-background
|
|
28
|
+
*
|
|
27
29
|
* @category XR
|
|
28
30
|
* @group Components
|
|
29
31
|
*/
|
|
@@ -20,7 +20,7 @@ const invertForwardMatrix = new Matrix4().makeRotationY(Math.PI);
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The WebARSessionRoot is the root object for a WebAR session and used to place the scene in AR.
|
|
23
|
-
* It is also responsible for scaling the user in AR.
|
|
23
|
+
* It is also responsible for scaling the user in AR and to define the center of the AR scene. If not present in the scene it will be created automatically by the WebXR component when entering an AR session.
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```ts
|
|
@@ -27,6 +27,8 @@ const debugQuicklook = getParam("debugusdz");
|
|
|
27
27
|
*
|
|
28
28
|
* The WebXR component is a simple to use wrapper around the {@link NeedleXRSession} API and adds some additional features like creating buttons for AR, VR, enabling default movement behaviour ({@link XRControllerMovement}) and controller rendering ({@link XRControllerModel}), as well as handling AR placement and Quicklook USDZ export.
|
|
29
29
|
*
|
|
30
|
+
* - Example: https://samples.needle.tools/collaborative-sandbox
|
|
31
|
+
*
|
|
30
32
|
* @example Enable VR and AR support using code
|
|
31
33
|
* ```ts
|
|
32
34
|
* import { onStart, WebXR } from "@needle-tools/engine";
|
|
@@ -290,6 +290,16 @@ class ImageTrackingExtension implements IUSDExporterExtension {
|
|
|
290
290
|
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
|
+
* Add this component to a object to enable image tracking in WebXR sessions.
|
|
294
|
+
*
|
|
295
|
+
* You need to add at least one {@link WebXRImageTrackingModel} to the `trackedImages` array to define which images to track and which objects to place on top of them.
|
|
296
|
+
*
|
|
297
|
+
* **NOTE:** For Android devices, image tracking currently requires the user to enable the `chrome://flags/#webxr-incubations` flag in Chrome.
|
|
298
|
+
*
|
|
299
|
+
* **NOTE:** For iOS only one image can be tracked at a time. If you have multiple images in the `trackedImages` array, only the first one will be tracked. You can use the {@link setPrimaryImage} method to change which image is tracked before entering the XR session.
|
|
300
|
+
*
|
|
301
|
+
* - Example: https://samples.needle.tools/image-tracking
|
|
302
|
+
*
|
|
293
303
|
* @category XR
|
|
294
304
|
* @group Components
|
|
295
305
|
*/
|
|
@@ -313,7 +323,14 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
313
323
|
|
|
314
324
|
/**
|
|
315
325
|
* Add an image to track. If the image is already in the trackedImages array it won't be added again.
|
|
316
|
-
* Note: that adding images at runtime *while* in AR is not supported.
|
|
326
|
+
* Note: that adding images at runtime *while* in AR is not supported.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* const imageTracking = GameObject.getComponent(myGameObject, WebXRImageTracking);
|
|
331
|
+
* const image = new WebXRImageTrackingModel({ url: "https://example.com/my-marker.png", widthInMeters: 0.2, object: myObject });
|
|
332
|
+
* imageTracking.addImage(image, true); // add and set as primary image
|
|
333
|
+
* ```
|
|
317
334
|
*/
|
|
318
335
|
addImage(image: WebXRImageTrackingModel, asPrimary: boolean = false) {
|
|
319
336
|
if (!this.trackedImages.includes(image)) {
|
|
@@ -324,7 +341,11 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
324
341
|
}
|
|
325
342
|
|
|
326
343
|
|
|
327
|
-
|
|
344
|
+
/**
|
|
345
|
+
* List of images to track in the WebXR session. Use {@link WebXRImageTrackingModel} to define each image and the object to place on top of it.
|
|
346
|
+
*
|
|
347
|
+
* Use the `addImage()` and `setPrimaryImage()` methods to modify this array at runtime.
|
|
348
|
+
*/
|
|
328
349
|
@serializable(WebXRImageTrackingModel)
|
|
329
350
|
readonly trackedImages: WebXRImageTrackingModel[] = [];
|
|
330
351
|
|
|
@@ -339,6 +360,7 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
339
360
|
|
|
340
361
|
private _supported: boolean = true;
|
|
341
362
|
|
|
363
|
+
/** @internal */
|
|
342
364
|
awake(): void {
|
|
343
365
|
if (debug) console.log(this)
|
|
344
366
|
if (!this.trackedImages) return;
|
|
@@ -348,9 +370,11 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
348
370
|
}
|
|
349
371
|
}
|
|
350
372
|
}
|
|
373
|
+
/** @internal */
|
|
351
374
|
onEnable() {
|
|
352
375
|
USDZExporter.beforeExport.addEventListener(this.onBeforeUSDZExport);
|
|
353
376
|
}
|
|
377
|
+
/** @internal */
|
|
354
378
|
onDisable(): void {
|
|
355
379
|
USDZExporter.beforeExport.removeEventListener(this.onBeforeUSDZExport);
|
|
356
380
|
}
|
|
@@ -362,7 +386,7 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
362
386
|
}
|
|
363
387
|
|
|
364
388
|
|
|
365
|
-
|
|
389
|
+
/** @internal */
|
|
366
390
|
onBeforeXR(_mode: XRSessionMode, args: XRSessionInit & { trackedImages: Array<any> }): void {
|
|
367
391
|
// console.log("onXRRequested", args, this.trackedImages)
|
|
368
392
|
if (this.trackedImages) {
|
|
@@ -386,6 +410,7 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
386
410
|
}
|
|
387
411
|
}
|
|
388
412
|
|
|
413
|
+
/** @internal */
|
|
389
414
|
onEnterXR(_args: NeedleXREventArgs): void {
|
|
390
415
|
if (this.trackedImages) {
|
|
391
416
|
for (const trackedImage of this.trackedImages) {
|
|
@@ -408,6 +433,7 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
408
433
|
}
|
|
409
434
|
};
|
|
410
435
|
|
|
436
|
+
/** @internal */
|
|
411
437
|
onLeaveXR(_args: NeedleXREventArgs): void {
|
|
412
438
|
|
|
413
439
|
if (!this.supported && DeviceUtilities.isAndroidDevice()) {
|
|
@@ -440,6 +466,7 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
440
466
|
|
|
441
467
|
private readonly webXRIncubationsWarning = "Image tracking is currently not supported on this device. On Chrome for Android, you can enable the <a target=\"_blank\" href=\"#\" onclick=\"() => console.log('I')\">chrome://flags/#webxr-incubations</a> flag.";
|
|
442
468
|
|
|
469
|
+
/** @internal */
|
|
443
470
|
onUpdateXR(args: NeedleXREventArgs): void {
|
|
444
471
|
this.currentImages.length = 0;
|
|
445
472
|
|