@needle-tools/engine 4.4.6 → 4.5.0-alpha.1
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 +6 -0
- package/dist/{needle-engine.bundle-0359367a.js → needle-engine.bundle-3d05185b.js} +4960 -4918
- package/dist/{needle-engine.bundle-381aaeb9.light.min.js → needle-engine.bundle-b2e17f0e.light.min.js} +162 -162
- package/dist/{needle-engine.bundle-545dcd43.light.js → needle-engine.bundle-c44e02c7.light.js} +4959 -4917
- package/dist/{needle-engine.bundle-7919deac.light.umd.cjs → needle-engine.bundle-d7d53476.light.umd.cjs} +144 -144
- package/dist/{needle-engine.bundle-bd6721d2.min.js → needle-engine.bundle-e4ae93a2.min.js} +162 -162
- package/dist/{needle-engine.bundle-cb4d28f2.umd.cjs → needle-engine.bundle-f496c70e.umd.cjs} +143 -143
- package/dist/needle-engine.js +438 -438
- package/dist/needle-engine.light.js +438 -438
- package/dist/needle-engine.light.min.js +1 -1
- package/dist/needle-engine.light.umd.cjs +1 -1
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/api.d.ts +4 -4
- package/lib/engine/api.js +4 -4
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_application.d.ts +5 -0
- package/lib/engine/engine_application.js +11 -11
- package/lib/engine/engine_application.js.map +1 -1
- package/lib/engine/engine_context.js +14 -3
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_hot_reload.d.ts +1 -0
- package/lib/engine/engine_hot_reload.js +16 -3
- package/lib/engine/engine_hot_reload.js.map +1 -1
- package/lib/engine/engine_lifecycle_api.d.ts +2 -1
- package/lib/engine/engine_lifecycle_api.js +2 -1
- package/lib/engine/engine_lifecycle_api.js.map +1 -1
- package/lib/engine/webcomponents/buttons.d.ts +15 -3
- package/lib/engine/webcomponents/buttons.js +32 -6
- package/lib/engine/webcomponents/buttons.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.ar-overlay.d.ts +21 -0
- package/lib/engine/webcomponents/needle-engine.ar-overlay.js +167 -0
- package/lib/engine/webcomponents/needle-engine.ar-overlay.js.map +1 -0
- package/lib/engine/webcomponents/needle-engine.attributes.d.ts +72 -0
- package/lib/engine/webcomponents/needle-engine.attributes.js +2 -0
- package/lib/engine/webcomponents/needle-engine.attributes.js.map +1 -0
- package/lib/engine/webcomponents/needle-engine.d.ts +113 -0
- package/lib/engine/webcomponents/needle-engine.extras.d.ts +6 -0
- package/lib/engine/webcomponents/needle-engine.extras.js +14 -0
- package/lib/engine/webcomponents/needle-engine.extras.js.map +1 -0
- package/lib/engine/webcomponents/needle-engine.js +832 -0
- package/lib/engine/webcomponents/needle-engine.js.map +1 -0
- package/lib/engine/webcomponents/needle-engine.loading.d.ts +44 -0
- package/lib/engine/webcomponents/needle-engine.loading.js +350 -0
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -0
- package/lib/engine/xr/NeedleXRSession.js +21 -0
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/Component.js +5 -0
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.js +1 -1
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/Skybox.js +1 -1
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/ui/EventSystem.js +1 -0
- package/lib/engine-components/ui/EventSystem.js.map +1 -1
- package/lib/needle-engine.d.ts +1 -1
- package/lib/needle-engine.js +1 -1
- package/lib/needle-engine.js.map +1 -1
- package/package.json +1 -1
- package/plugins/vite/reload.js +8 -20
- package/src/engine/api.ts +4 -4
- package/src/engine/engine_application.ts +11 -11
- package/src/engine/engine_context.ts +16 -3
- package/src/engine/engine_hot_reload.ts +16 -4
- package/src/engine/engine_lifecycle_api.ts +2 -1
- package/src/engine/webcomponents/buttons.ts +37 -8
- package/src/engine/{engine_element_overlay.ts → webcomponents/needle-engine.ar-overlay.ts} +2 -2
- package/src/engine/{engine_element_extras.ts → webcomponents/needle-engine.extras.ts} +1 -1
- package/src/engine/{engine_element_loading.ts → webcomponents/needle-engine.loading.ts} +6 -6
- package/src/engine/{engine_element.ts → webcomponents/needle-engine.ts} +15 -16
- package/src/engine/xr/NeedleXRSession.ts +26 -2
- package/src/engine-components/CameraUtils.ts +1 -1
- package/src/engine-components/Component.ts +51 -48
- package/src/engine-components/SceneSwitcher.ts +1 -1
- package/src/engine-components/Skybox.ts +1 -1
- package/src/engine-components/ui/EventSystem.ts +1 -0
- package/src/needle-engine.ts +1 -1
- /package/src/engine/{engine_element_attributes.ts → webcomponents/needle-engine.attributes.ts} +0 -0
|
@@ -11,6 +11,7 @@ import { Context, FrameEvent } from "../engine/engine_setup.js";
|
|
|
11
11
|
import * as threeutils from "../engine/engine_three_utils.js";
|
|
12
12
|
import type { Collision, ComponentInit, Constructor, ConstructorConcrete, GuidsMap, ICollider, IComponent, IGameObject, SourceIdentifier } from "../engine/engine_types.js";
|
|
13
13
|
import type { INeedleXRSessionEventReceiver, NeedleXRControllerEventArgs, NeedleXREventArgs } from "../engine/engine_xr.js";
|
|
14
|
+
import { isHotReloadEnabled, registerHotReloadType, unregisterHotReloadType } from "../engine/engine_hot_reload.js";
|
|
14
15
|
import { type IPointerEventHandler, PointerEventData } from "./ui/PointerEvents.js";
|
|
15
16
|
|
|
16
17
|
|
|
@@ -49,7 +50,7 @@ export abstract class GameObject extends Object3D implements Object3D, IGameObje
|
|
|
49
50
|
/** @deprecated Use {@link addComponent} instead */
|
|
50
51
|
// eslint-disable-next-line deprecation/deprecation
|
|
51
52
|
abstract addNewComponent<T extends IComponent>(type: ConstructorConcrete<T>, init?: ComponentInit<T>): T;
|
|
52
|
-
|
|
53
|
+
|
|
53
54
|
/**
|
|
54
55
|
* Creates a new component on this gameObject or adds an existing component instance
|
|
55
56
|
* @param comp Component type constructor or existing component instance
|
|
@@ -57,28 +58,28 @@ export abstract class GameObject extends Object3D implements Object3D, IGameObje
|
|
|
57
58
|
* @returns The newly created or added component
|
|
58
59
|
*/
|
|
59
60
|
abstract addComponent<T extends IComponent>(comp: T | ConstructorConcrete<T>, init?: ComponentInit<T>): T;
|
|
60
|
-
|
|
61
|
+
|
|
61
62
|
/**
|
|
62
63
|
* Removes a component from this GameObject
|
|
63
64
|
* @param comp Component instance to remove
|
|
64
65
|
* @returns The removed component
|
|
65
66
|
*/
|
|
66
67
|
abstract removeComponent<T extends IComponent>(comp: T): T;
|
|
67
|
-
|
|
68
|
+
|
|
68
69
|
/**
|
|
69
70
|
* Gets an existing component of the specified type or adds a new one if it doesn't exist
|
|
70
71
|
* @param typeName Constructor of the component type to get or add
|
|
71
72
|
* @returns The existing or newly added component
|
|
72
73
|
*/
|
|
73
74
|
abstract getOrAddComponent<T>(typeName: ConstructorConcrete<T> | null): T;
|
|
74
|
-
|
|
75
|
+
|
|
75
76
|
/**
|
|
76
77
|
* Gets a component of the specified type attached to this GameObject
|
|
77
78
|
* @param type Constructor of the component type to get
|
|
78
79
|
* @returns The component if found, otherwise null
|
|
79
80
|
*/
|
|
80
81
|
abstract getComponent<T>(type: Constructor<T>): T | null;
|
|
81
|
-
|
|
82
|
+
|
|
82
83
|
/**
|
|
83
84
|
* Gets all components of the specified type attached to this GameObject
|
|
84
85
|
* @param type Constructor of the component type to get
|
|
@@ -86,14 +87,14 @@ export abstract class GameObject extends Object3D implements Object3D, IGameObje
|
|
|
86
87
|
* @returns Array of components
|
|
87
88
|
*/
|
|
88
89
|
abstract getComponents<T>(type: Constructor<T>, arr?: T[]): Array<T>;
|
|
89
|
-
|
|
90
|
+
|
|
90
91
|
/**
|
|
91
92
|
* Gets a component of the specified type in this GameObject's children hierarchy
|
|
92
93
|
* @param type Constructor of the component type to get
|
|
93
94
|
* @returns The first matching component if found, otherwise null
|
|
94
95
|
*/
|
|
95
96
|
abstract getComponentInChildren<T>(type: Constructor<T>): T | null;
|
|
96
|
-
|
|
97
|
+
|
|
97
98
|
/**
|
|
98
99
|
* Gets all components of the specified type in this GameObject's children hierarchy
|
|
99
100
|
* @param type Constructor of the component type to get
|
|
@@ -101,14 +102,14 @@ export abstract class GameObject extends Object3D implements Object3D, IGameObje
|
|
|
101
102
|
* @returns Array of components
|
|
102
103
|
*/
|
|
103
104
|
abstract getComponentsInChildren<T>(type: Constructor<T>, arr?: T[]): Array<T>;
|
|
104
|
-
|
|
105
|
+
|
|
105
106
|
/**
|
|
106
107
|
* Gets a component of the specified type in this GameObject's parent hierarchy
|
|
107
108
|
* @param type Constructor of the component type to get
|
|
108
109
|
* @returns The first matching component if found, otherwise null
|
|
109
110
|
*/
|
|
110
111
|
abstract getComponentInParent<T>(type: Constructor<T>): T | null;
|
|
111
|
-
|
|
112
|
+
|
|
112
113
|
/**
|
|
113
114
|
* Gets all components of the specified type in this GameObject's parent hierarchy
|
|
114
115
|
* @param type Constructor of the component type to get
|
|
@@ -123,19 +124,19 @@ export abstract class GameObject extends Object3D implements Object3D, IGameObje
|
|
|
123
124
|
*/
|
|
124
125
|
abstract get worldPosition(): Vector3
|
|
125
126
|
abstract set worldPosition(val: Vector3);
|
|
126
|
-
|
|
127
|
+
|
|
127
128
|
/**
|
|
128
129
|
* The rotation of this GameObject in world space as a quaternion
|
|
129
130
|
*/
|
|
130
131
|
abstract set worldQuaternion(val: Quaternion);
|
|
131
132
|
abstract get worldQuaternion(): Quaternion;
|
|
132
|
-
|
|
133
|
+
|
|
133
134
|
/**
|
|
134
135
|
* The rotation of this GameObject in world space in euler angles (degrees)
|
|
135
136
|
*/
|
|
136
137
|
abstract set worldRotation(val: Vector3);
|
|
137
138
|
abstract get worldRotation(): Vector3;
|
|
138
|
-
|
|
139
|
+
|
|
139
140
|
/**
|
|
140
141
|
* The scale of this GameObject in world space
|
|
141
142
|
*/
|
|
@@ -146,12 +147,12 @@ export abstract class GameObject extends Object3D implements Object3D, IGameObje
|
|
|
146
147
|
* The forward direction vector of this GameObject in world space
|
|
147
148
|
*/
|
|
148
149
|
abstract get worldForward(): Vector3;
|
|
149
|
-
|
|
150
|
+
|
|
150
151
|
/**
|
|
151
152
|
* The right direction vector of this GameObject in world space
|
|
152
153
|
*/
|
|
153
154
|
abstract get worldRight(): Vector3;
|
|
154
|
-
|
|
155
|
+
|
|
155
156
|
/**
|
|
156
157
|
* The up direction vector of this GameObject in world space
|
|
157
158
|
*/
|
|
@@ -577,7 +578,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
577
578
|
get isComponent(): boolean { return true; }
|
|
578
579
|
|
|
579
580
|
private __context: Context | undefined;
|
|
580
|
-
|
|
581
|
+
|
|
581
582
|
/**
|
|
582
583
|
* The context this component belongs to, providing access to the runtime environment
|
|
583
584
|
* including physics, timing utilities, camera, and scene
|
|
@@ -588,7 +589,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
588
589
|
set context(context: Context) {
|
|
589
590
|
this.__context = context;
|
|
590
591
|
}
|
|
591
|
-
|
|
592
|
+
|
|
592
593
|
/**
|
|
593
594
|
* Shorthand accessor for the current scene from the context
|
|
594
595
|
* @returns The scene this component belongs to
|
|
@@ -624,7 +625,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
624
625
|
this.__name = str;
|
|
625
626
|
}
|
|
626
627
|
}
|
|
627
|
-
|
|
628
|
+
|
|
628
629
|
/**
|
|
629
630
|
* The tag of the GameObject this component is attached to
|
|
630
631
|
* Used for categorizing objects and efficient lookup
|
|
@@ -638,7 +639,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
638
639
|
this.gameObject.userData.tag = str;
|
|
639
640
|
}
|
|
640
641
|
}
|
|
641
|
-
|
|
642
|
+
|
|
642
643
|
/**
|
|
643
644
|
* Indicates whether the GameObject is marked as static
|
|
644
645
|
* Static objects typically don't move and can be optimized by the engine
|
|
@@ -678,7 +679,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
678
679
|
private get __isActive(): boolean {
|
|
679
680
|
return this.gameObject.visible;
|
|
680
681
|
}
|
|
681
|
-
|
|
682
|
+
|
|
682
683
|
private get __isActiveInHierarchy(): boolean {
|
|
683
684
|
if (!this.gameObject) return false;
|
|
684
685
|
const res = this.gameObject[activeInHierarchyFieldName];
|
|
@@ -696,13 +697,13 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
696
697
|
* This is a three.js Object3D with additional GameObject functionality
|
|
697
698
|
*/
|
|
698
699
|
gameObject!: GameObject;
|
|
699
|
-
|
|
700
|
+
|
|
700
701
|
/**
|
|
701
702
|
* Unique identifier for this component instance,
|
|
702
703
|
* used for finding and tracking components
|
|
703
704
|
*/
|
|
704
705
|
guid: string = "invalid";
|
|
705
|
-
|
|
706
|
+
|
|
706
707
|
/**
|
|
707
708
|
* Identifier for the source asset that created this component.
|
|
708
709
|
* For example, URL to the glTF file this component was loaded from
|
|
@@ -720,19 +721,19 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
720
721
|
* This is the first lifecycle callback to be invoked
|
|
721
722
|
*/
|
|
722
723
|
awake() { }
|
|
723
|
-
|
|
724
|
+
|
|
724
725
|
/**
|
|
725
726
|
* Called every time the component becomes enabled or active in the hierarchy.
|
|
726
727
|
* Invoked after {@link awake} and before {@link start}.
|
|
727
728
|
*/
|
|
728
729
|
onEnable() { }
|
|
729
|
-
|
|
730
|
+
|
|
730
731
|
/**
|
|
731
732
|
* Called every time the component becomes disabled or inactive in the hierarchy.
|
|
732
733
|
* Invoked when the component or any parent GameObject becomes invisible
|
|
733
734
|
*/
|
|
734
735
|
onDisable() { }
|
|
735
|
-
|
|
736
|
+
|
|
736
737
|
/**
|
|
737
738
|
* Called when the component is destroyed.
|
|
738
739
|
* Use for cleanup operations like removing event listeners
|
|
@@ -740,7 +741,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
740
741
|
onDestroy() {
|
|
741
742
|
this.__destroyed = true;
|
|
742
743
|
}
|
|
743
|
-
|
|
744
|
+
|
|
744
745
|
/**
|
|
745
746
|
* Called when a field decorated with @validate() is modified.
|
|
746
747
|
* @param prop The name of the field that was changed
|
|
@@ -759,31 +760,31 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
759
760
|
* Use for initialization that requires other components to be awake.
|
|
760
761
|
*/
|
|
761
762
|
start?(): void;
|
|
762
|
-
|
|
763
|
+
|
|
763
764
|
/**
|
|
764
765
|
* Called at the beginning of each frame before regular updates.
|
|
765
766
|
* Use for logic that needs to run before standard update callbacks.
|
|
766
767
|
*/
|
|
767
768
|
earlyUpdate?(): void;
|
|
768
|
-
|
|
769
|
+
|
|
769
770
|
/**
|
|
770
771
|
* Called once per frame during the main update loop.
|
|
771
772
|
* The primary location for frame-based game logic.
|
|
772
773
|
*/
|
|
773
774
|
update?(): void;
|
|
774
|
-
|
|
775
|
+
|
|
775
776
|
/**
|
|
776
777
|
* Called after all update functions have been called.
|
|
777
778
|
* Use for calculations that depend on other components being updated first.
|
|
778
779
|
*/
|
|
779
780
|
lateUpdate?(): void;
|
|
780
|
-
|
|
781
|
+
|
|
781
782
|
/**
|
|
782
783
|
* Called immediately before the scene is rendered.
|
|
783
784
|
* @param frame Current XRFrame if in an XR session, null otherwise
|
|
784
785
|
*/
|
|
785
786
|
onBeforeRender?(frame: XRFrame | null): void;
|
|
786
|
-
|
|
787
|
+
|
|
787
788
|
/**
|
|
788
789
|
* Called after the scene has been rendered.
|
|
789
790
|
* Use for post-processing or UI updates that should happen after rendering
|
|
@@ -795,13 +796,13 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
795
796
|
* @param col Information about the collision that occurred
|
|
796
797
|
*/
|
|
797
798
|
onCollisionEnter?(col: Collision);
|
|
798
|
-
|
|
799
|
+
|
|
799
800
|
/**
|
|
800
801
|
* Called when this component's collider stops colliding with another collider.
|
|
801
802
|
* @param col Information about the collision that ended
|
|
802
803
|
*/
|
|
803
804
|
onCollisionExit?(col: Collision);
|
|
804
|
-
|
|
805
|
+
|
|
805
806
|
/**
|
|
806
807
|
* Called each frame while this component's collider is colliding with another collider
|
|
807
808
|
* @param col Information about the ongoing collision
|
|
@@ -813,13 +814,13 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
813
814
|
* @param col The collider that entered this trigger
|
|
814
815
|
*/
|
|
815
816
|
onTriggerEnter?(col: ICollider);
|
|
816
|
-
|
|
817
|
+
|
|
817
818
|
/**
|
|
818
819
|
* Called each frame while another collider is inside this component's trigger collider
|
|
819
820
|
* @param col The collider that is inside this trigger
|
|
820
821
|
*/
|
|
821
822
|
onTriggerStay?(col: ICollider);
|
|
822
|
-
|
|
823
|
+
|
|
823
824
|
/**
|
|
824
825
|
* Called when another collider exits this component's trigger collider
|
|
825
826
|
* @param col The collider that exited this trigger
|
|
@@ -832,7 +833,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
832
833
|
* @returns True if the component supports the specified mode
|
|
833
834
|
*/
|
|
834
835
|
supportsXR?(mode: XRSessionMode): boolean;
|
|
835
|
-
|
|
836
|
+
|
|
836
837
|
/**
|
|
837
838
|
* Called before an XR session is requested
|
|
838
839
|
* Use to modify session initialization parameters
|
|
@@ -840,32 +841,32 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
840
841
|
* @param args The session initialization parameters that can be modified
|
|
841
842
|
*/
|
|
842
843
|
onBeforeXR?(mode: XRSessionMode, args: XRSessionInit): void;
|
|
843
|
-
|
|
844
|
+
|
|
844
845
|
/**
|
|
845
846
|
* Called when this component joins an XR session or becomes active in a running session
|
|
846
847
|
* @param args Event data for the XR session
|
|
847
848
|
*/
|
|
848
849
|
onEnterXR?(args: NeedleXREventArgs): void;
|
|
849
|
-
|
|
850
|
+
|
|
850
851
|
/**
|
|
851
852
|
* Called each frame while this component is active in an XR session
|
|
852
853
|
* @param args Event data for the current XR frame
|
|
853
854
|
*/
|
|
854
855
|
onUpdateXR?(args: NeedleXREventArgs): void;
|
|
855
|
-
|
|
856
|
+
|
|
856
857
|
/**
|
|
857
858
|
* Called when this component exits an XR session or becomes inactive during a session
|
|
858
859
|
* @param args Event data for the XR session
|
|
859
860
|
*/
|
|
860
861
|
onLeaveXR?(args: NeedleXREventArgs): void;
|
|
861
|
-
|
|
862
|
+
|
|
862
863
|
/**
|
|
863
864
|
* Called when an XR controller is connected or when this component becomes active
|
|
864
865
|
* in a session with existing controllers
|
|
865
866
|
* @param args Event data for the controller that was added
|
|
866
867
|
*/
|
|
867
868
|
onXRControllerAdded?(args: NeedleXRControllerEventArgs): void;
|
|
868
|
-
|
|
869
|
+
|
|
869
870
|
/**
|
|
870
871
|
* Called when an XR controller is disconnected or when this component becomes inactive
|
|
871
872
|
* during a session with controllers
|
|
@@ -878,31 +879,31 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
878
879
|
* @param args Data about the pointer event
|
|
879
880
|
*/
|
|
880
881
|
onPointerEnter?(args: PointerEventData);
|
|
881
|
-
|
|
882
|
+
|
|
882
883
|
/**
|
|
883
884
|
* Called when a pointer moves while over this component's GameObject
|
|
884
885
|
* @param args Data about the pointer event
|
|
885
886
|
*/
|
|
886
887
|
onPointerMove?(args: PointerEventData);
|
|
887
|
-
|
|
888
|
+
|
|
888
889
|
/**
|
|
889
890
|
* Called when a pointer exits this component's GameObject
|
|
890
891
|
* @param args Data about the pointer event
|
|
891
892
|
*/
|
|
892
893
|
onPointerExit?(args: PointerEventData);
|
|
893
|
-
|
|
894
|
+
|
|
894
895
|
/**
|
|
895
896
|
* Called when a pointer button is pressed while over this component's GameObject
|
|
896
897
|
* @param args Data about the pointer event
|
|
897
898
|
*/
|
|
898
899
|
onPointerDown?(args: PointerEventData);
|
|
899
|
-
|
|
900
|
+
|
|
900
901
|
/**
|
|
901
902
|
* Called when a pointer button is released while over this component's GameObject
|
|
902
903
|
* @param args Data about the pointer event
|
|
903
904
|
*/
|
|
904
905
|
onPointerUp?(args: PointerEventData);
|
|
905
|
-
|
|
906
|
+
|
|
906
907
|
/**
|
|
907
908
|
* Called when a pointer completes a click interaction with this component's GameObject
|
|
908
909
|
* @param args Data about the pointer event
|
|
@@ -944,7 +945,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
944
945
|
startCoroutine(routine: Generator, evt: FrameEvent = FrameEvent.Update): Generator {
|
|
945
946
|
return this.context.registerCoroutineUpdate(this, routine, evt);
|
|
946
947
|
}
|
|
947
|
-
|
|
948
|
+
|
|
948
949
|
/**
|
|
949
950
|
* Stops a coroutine that was previously started with startCoroutine
|
|
950
951
|
* @param routine The routine to be stopped
|
|
@@ -997,6 +998,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
997
998
|
this.__isEnabled = undefined;
|
|
998
999
|
this.__destroyed = false;
|
|
999
1000
|
this._internalInit(init as ComponentInit<this>);
|
|
1001
|
+
if (isHotReloadEnabled()) registerHotReloadType(this);
|
|
1000
1002
|
}
|
|
1001
1003
|
|
|
1002
1004
|
/** @internal */
|
|
@@ -1092,6 +1094,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
1092
1094
|
this.dispatchEvent(new CustomEvent("destroyed", { detail: this }));
|
|
1093
1095
|
}
|
|
1094
1096
|
destroyComponentInstance(this as any);
|
|
1097
|
+
if(isHotReloadEnabled()) unregisterHotReloadType(this);
|
|
1095
1098
|
}
|
|
1096
1099
|
|
|
1097
1100
|
/**
|
|
@@ -1160,7 +1163,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
1160
1163
|
get worldQuaternion(): Quaternion {
|
|
1161
1164
|
return threeutils.getWorldQuaternion(this.gameObject);
|
|
1162
1165
|
}
|
|
1163
|
-
|
|
1166
|
+
|
|
1164
1167
|
/**
|
|
1165
1168
|
* Sets the rotation of this component's GameObject in world space using a quaternion
|
|
1166
1169
|
* @param val The world rotation quaternion to set
|
|
@@ -1168,7 +1171,7 @@ export abstract class Component implements IComponent, EventTarget,
|
|
|
1168
1171
|
set worldQuaternion(val: Quaternion) {
|
|
1169
1172
|
threeutils.setWorldQuaternion(this.gameObject, val);
|
|
1170
1173
|
}
|
|
1171
|
-
|
|
1174
|
+
|
|
1172
1175
|
/**
|
|
1173
1176
|
* Sets the rotation of this component's GameObject in world space using quaternion components
|
|
1174
1177
|
* @param x X component of the quaternion
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { EquirectangularReflectionMapping, Object3D, Scene, Texture } from "three";
|
|
2
2
|
|
|
3
3
|
import { AssetReference } from "../engine/engine_addressables.js";
|
|
4
|
-
import { registerObservableAttribute } from "../engine/engine_element_extras.js";
|
|
5
4
|
import { destroy } from "../engine/engine_gameobject.js";
|
|
6
5
|
import { InputEvents } from "../engine/engine_input.js";
|
|
7
6
|
import { isLocalNetwork } from "../engine/engine_networking_utils.js";
|
|
8
7
|
import { serializable } from "../engine/engine_serialization.js";
|
|
9
8
|
import { getParam, setParamWithoutReload } from "../engine/engine_utils.js";
|
|
9
|
+
import { registerObservableAttribute } from "../engine/webcomponents/needle-engine.extras.js";
|
|
10
10
|
import { Behaviour, GameObject } from "./Component.js";
|
|
11
11
|
import { EventList } from "./EventList.js";
|
|
12
12
|
|
|
@@ -6,11 +6,11 @@ import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader.js';
|
|
|
6
6
|
|
|
7
7
|
import { disposeObjectResources, setDisposable } from "../engine/engine_assetdatabase.js";
|
|
8
8
|
import { ContextEvent, ContextRegistry } from "../engine/engine_context_registry.js";
|
|
9
|
-
import { registerObservableAttribute } from "../engine/engine_element_extras.js";
|
|
10
9
|
import { syncField } from "../engine/engine_networking_auto.js";
|
|
11
10
|
import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
12
11
|
import { type IContext } from "../engine/engine_types.js";
|
|
13
12
|
import { addAttributeChangeCallback, getParam, PromiseAllWithErrors, removeAttributeChangeCallback } from "../engine/engine_utils.js";
|
|
13
|
+
import { registerObservableAttribute } from "../engine/webcomponents/needle-engine.extras.js";
|
|
14
14
|
import { Camera, ClearFlags } from "./Camera.js";
|
|
15
15
|
import { Behaviour, GameObject } from "./Component.js";
|
|
16
16
|
|
|
@@ -86,6 +86,7 @@ export class EventSystem extends Behaviour {
|
|
|
86
86
|
// We only want ONE eventsystem on the root scene
|
|
87
87
|
// as long as this component is not implemented in core we need to check this here
|
|
88
88
|
if (this.gameObject as Object3D !== this.context.scene) {
|
|
89
|
+
console.debug(`[Needle Engine] EventSystem is only allowed on the scene root. Disabling EventSystem on '${this.gameObject.name}'`);
|
|
89
90
|
this.enabled = false;
|
|
90
91
|
}
|
|
91
92
|
}
|
package/src/needle-engine.ts
CHANGED
/package/src/engine/{engine_element_attributes.ts → webcomponents/needle-engine.attributes.ts}
RENAMED
|
File without changes
|