@needle-tools/engine 4.11.1 → 4.11.3-next.ccd3ad6
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/CHANGELOG.md +8 -0
- package/dist/{needle-engine.bundle-BSk8yk3v.min.js → needle-engine.bundle-B5jHHYAr.min.js} +93 -93
- package/dist/{needle-engine.bundle-6yF8G5KJ.js → needle-engine.bundle-BzhDhLwp.js} +980 -956
- package/dist/{needle-engine.bundle-DPVYipMl.umd.cjs → needle-engine.bundle-DN-okHp8.umd.cjs} +82 -82
- package/dist/needle-engine.js +2 -2
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/rapier-BqdcSmKY.umd.cjs +1 -0
- package/dist/rapier-Cg3w3nFI.min.js +1 -0
- package/dist/rapier-sU12SWAs.js +5217 -0
- package/dist/{vendor-DWGd3dEf.min.js → vendor-BahM12Xj.min.js} +1 -1
- package/dist/{vendor-DJBpoQcM.js → vendor-Becub4o1.js} +1 -1
- package/dist/{vendor-CAWj5cBK.umd.cjs → vendor-H-9KkM5B.umd.cjs} +1 -1
- package/lib/engine-components/Animation.d.ts +1 -1
- package/lib/engine-components/Animation.js +2 -2
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/SeeThrough.js +5 -1
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +5 -5
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +16 -13
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +0 -1
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +8 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +24 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
- package/lib/engine-components/splines/SplineWalker.js +3 -2
- package/lib/engine-components/splines/SplineWalker.js.map +1 -1
- package/lib/engine-components/web/Clickthrough.js.map +1 -1
- package/package.json +3 -3
- package/plugins/types/userconfig.d.ts +7 -0
- package/plugins/vite/build-pipeline.js +15 -7
- package/src/engine-components/Animation.ts +3 -2
- package/src/engine-components/SeeThrough.ts +5 -1
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +27 -15
- package/src/engine-components/export/usdz/USDZExporter.ts +0 -1
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +28 -0
- package/src/engine-components/splines/SplineWalker.ts +3 -2
- package/src/engine-components/web/Clickthrough.ts +1 -0
- package/dist/rapier-BIeDFw5K.umd.cjs +0 -1
- package/dist/rapier-DQM98oaj.min.js +0 -1
- package/dist/rapier-DpcIWXum.js +0 -5217
|
@@ -39,9 +39,10 @@ import * as fflate from 'three/examples/jsm/libs/fflate.module.js';
|
|
|
39
39
|
import { VERSION } from "../../../engine/engine_constants.js";
|
|
40
40
|
import type { OffscreenCanvasExt } from '../../../engine/engine_shims.js';
|
|
41
41
|
import { Progress } from '../../../engine/engine_time_utils.js';
|
|
42
|
-
import { BehaviorExtension } from '../../api.js';
|
|
42
|
+
// import { BehaviorExtension } from '../../api.js';
|
|
43
43
|
import type { IUSDExporterExtension } from './Extension.js';
|
|
44
44
|
import type { AnimationExtension } from './extensions/Animation.js';
|
|
45
|
+
import { BehaviorExtension } from './extensions/behavior/Behaviour.js';
|
|
45
46
|
import type { PhysicsExtension } from './extensions/behavior/PhysicsExtension.js';
|
|
46
47
|
import {buildNodeMaterial} from './extensions/NodeMaterialConverter.js';
|
|
47
48
|
|
|
@@ -622,13 +623,13 @@ class USDZExporterContext {
|
|
|
622
623
|
output: string;
|
|
623
624
|
animations: AnimationClip[];
|
|
624
625
|
|
|
625
|
-
constructor( root: Object3D | undefined, exporter: USDZExporter, options: {
|
|
626
|
+
constructor( root: Object3D | null | undefined, exporter: USDZExporter, options: {
|
|
626
627
|
extensions?: Array<IUSDExporterExtension>,
|
|
627
628
|
quickLookCompatible: boolean,
|
|
628
629
|
exportInvisible: boolean,
|
|
629
630
|
} ) {
|
|
630
631
|
|
|
631
|
-
this.root = root;
|
|
632
|
+
this.root = root || undefined;
|
|
632
633
|
this.exporter = exporter;
|
|
633
634
|
this.quickLookCompatible = options.quickLookCompatible;
|
|
634
635
|
this.exportInvisible = options.exportInvisible;
|
|
@@ -656,18 +657,28 @@ export type Anchoring = "plane" | "image" | "face" | "none"
|
|
|
656
657
|
/**[documentation](https://developer.apple.com/documentation/arkit/usdz_schemas_for_ar/preliminary_anchoringapi/preliminary_planeanchoring_alignment) */
|
|
657
658
|
export type Alignment = "horizontal" | "vertical" | "any";
|
|
658
659
|
|
|
659
|
-
|
|
660
|
+
type USDZExporterOptions = {
|
|
660
661
|
ar: {
|
|
661
662
|
anchoring: { type: Anchoring },
|
|
662
663
|
planeAnchoring: { alignment: Alignment },
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
664
|
+
}
|
|
665
|
+
quickLookCompatible: boolean;
|
|
666
|
+
extensions: Array<IUSDExporterExtension>;
|
|
667
|
+
maxTextureSize: number;
|
|
668
|
+
exportInvisible: boolean;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
const getDefaultExporterOptions : () => USDZExporterOptions = () => {
|
|
672
|
+
return {
|
|
673
|
+
ar: {
|
|
674
|
+
anchoring: { type: 'plane' },
|
|
675
|
+
planeAnchoring: { alignment: 'horizontal' }
|
|
676
|
+
},
|
|
677
|
+
quickLookCompatible: false,
|
|
678
|
+
extensions: [],
|
|
679
|
+
maxTextureSize: 4096,
|
|
680
|
+
exportInvisible: false
|
|
681
|
+
}
|
|
671
682
|
}
|
|
672
683
|
|
|
673
684
|
// #region USDZExporter
|
|
@@ -675,7 +686,7 @@ class USDZExporterOptions {
|
|
|
675
686
|
class USDZExporter {
|
|
676
687
|
debug: boolean;
|
|
677
688
|
pruneUnusedNodes: boolean;
|
|
678
|
-
sceneAnchoringOptions: USDZExporterOptions =
|
|
689
|
+
sceneAnchoringOptions: USDZExporterOptions = getDefaultExporterOptions();
|
|
679
690
|
extensions: Array<IUSDExporterExtension> = [];
|
|
680
691
|
keepObject?: (object: Object3D) => boolean;
|
|
681
692
|
beforeWritingDocument?: () => void;
|
|
@@ -687,9 +698,10 @@ class USDZExporter {
|
|
|
687
698
|
|
|
688
699
|
}
|
|
689
700
|
|
|
690
|
-
async parse(scene: Object3D | undefined, options: USDZExporterOptions =
|
|
701
|
+
async parse(scene: Object3D | null | undefined, options: USDZExporterOptions = getDefaultExporterOptions()) {
|
|
691
702
|
|
|
692
|
-
options
|
|
703
|
+
// clone options to avoid modifying the original object
|
|
704
|
+
options = Object.assign({}, options );
|
|
693
705
|
|
|
694
706
|
this.sceneAnchoringOptions = options;
|
|
695
707
|
const context = new USDZExporterContext( scene, this, options );
|
|
@@ -58,6 +58,13 @@ export class ChangeTransformOnClick extends Behaviour implements IPointerClickHa
|
|
|
58
58
|
ensureRaycaster(this.gameObject);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
onPointerEnter() {
|
|
62
|
+
this.context.input.setCursor("pointer");
|
|
63
|
+
}
|
|
64
|
+
onPointerExit() {
|
|
65
|
+
this.context.input.unsetCursor("pointer");
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
onPointerClick(args: PointerEventData) {
|
|
62
69
|
args.use();
|
|
63
70
|
if (this.coroutine) this.stopCoroutine(this.coroutine);
|
|
@@ -380,6 +387,13 @@ export class SetActiveOnClick extends Behaviour implements IPointerClickHandler,
|
|
|
380
387
|
ensureRaycaster(this.gameObject);
|
|
381
388
|
}
|
|
382
389
|
|
|
390
|
+
onPointerEnter() {
|
|
391
|
+
this.context.input.setCursor("pointer");
|
|
392
|
+
}
|
|
393
|
+
onPointerExit() {
|
|
394
|
+
this.context.input.unsetCursor("pointer");
|
|
395
|
+
}
|
|
396
|
+
|
|
383
397
|
onPointerClick(args: PointerEventData) {
|
|
384
398
|
args.use();
|
|
385
399
|
|
|
@@ -703,6 +717,13 @@ export class PlayAudioOnClick extends Behaviour implements IPointerClickHandler,
|
|
|
703
717
|
}
|
|
704
718
|
}
|
|
705
719
|
|
|
720
|
+
|
|
721
|
+
onPointerEnter() {
|
|
722
|
+
this.context.input.setCursor("pointer");
|
|
723
|
+
}
|
|
724
|
+
onPointerExit() {
|
|
725
|
+
this.context.input.unsetCursor("pointer");
|
|
726
|
+
}
|
|
706
727
|
onPointerClick(args: PointerEventData) {
|
|
707
728
|
args.use();
|
|
708
729
|
|
|
@@ -810,6 +831,13 @@ export class PlayAnimationOnClick extends Behaviour implements IPointerClickHand
|
|
|
810
831
|
ensureRaycaster(this.gameObject);
|
|
811
832
|
}
|
|
812
833
|
|
|
834
|
+
|
|
835
|
+
onPointerEnter() {
|
|
836
|
+
this.context.input.setCursor("pointer");
|
|
837
|
+
}
|
|
838
|
+
onPointerExit() {
|
|
839
|
+
this.context.input.unsetCursor("pointer");
|
|
840
|
+
}
|
|
813
841
|
onPointerClick(args: PointerEventData) {
|
|
814
842
|
args.use();
|
|
815
843
|
if (!this.target) return;
|
|
@@ -114,12 +114,13 @@ export class SplineWalker extends Behaviour {
|
|
|
114
114
|
/** @internal */
|
|
115
115
|
onEnable(): void {
|
|
116
116
|
window.addEventListener("pointerdown", this.onUserInput, { passive: true });
|
|
117
|
-
|
|
117
|
+
// TODO: wheel event is also triggered for touch and it interrupts spline pull if it's an actual site scroll
|
|
118
|
+
this.context.domElement.addEventListener("wheel", this.onUserInput, { passive: true });
|
|
118
119
|
}
|
|
119
120
|
/** @internal */
|
|
120
121
|
onDisable(): void {
|
|
121
122
|
window.removeEventListener("pointerdown", this.onUserInput);
|
|
122
|
-
|
|
123
|
+
this.context.domElement.removeEventListener("wheel", this.onUserInput);
|
|
123
124
|
}
|
|
124
125
|
private onUserInput = () => {
|
|
125
126
|
if (this.object?.contains(this.context.mainCamera)) {
|