@needle-tools/engine 4.4.0-beta → 4.4.0-beta.10
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 +65 -2
- package/dist/assets/generateMeshBVH.worker-b7788939.js +25 -0
- package/dist/needle-engine.bundle.js +6808 -6645
- package/dist/needle-engine.bundle.light.js +7071 -6908
- package/dist/needle-engine.bundle.light.min.js +169 -139
- package/dist/needle-engine.bundle.light.umd.cjs +173 -143
- package/dist/needle-engine.bundle.min.js +169 -139
- package/dist/needle-engine.bundle.umd.cjs +172 -142
- package/dist/needle-engine.d.ts +0 -9
- package/dist/needle-engine.js +468 -467
- package/dist/needle-engine.light.d.ts +0 -9
- package/dist/needle-engine.light.js +468 -467
- 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/dist/postprocessing.js +1673 -1527
- package/dist/postprocessing.light.js +1673 -1527
- package/dist/postprocessing.light.min.js +80 -66
- package/dist/postprocessing.light.umd.cjs +83 -69
- package/dist/postprocessing.min.js +80 -66
- package/dist/postprocessing.umd.cjs +83 -69
- package/dist/vendor.js +5109 -5123
- package/dist/vendor.light.js +5109 -5123
- package/dist/vendor.light.min.js +84 -84
- package/dist/vendor.light.umd.cjs +78 -78
- package/dist/vendor.min.js +84 -84
- package/dist/vendor.umd.cjs +78 -78
- package/lib/engine/codegen/register_types.js +2 -0
- package/lib/engine/codegen/register_types.js.map +1 -1
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_components.js +3 -1
- package/lib/engine/engine_components.js.map +1 -1
- package/lib/engine/engine_context.d.ts +10 -1
- package/lib/engine/engine_context.js +33 -12
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_element.js +12 -10
- package/lib/engine/engine_element.js.map +1 -1
- package/lib/engine/engine_gameobject.js +5 -0
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_license.d.ts +2 -0
- package/lib/engine/engine_license.js +103 -62
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_networking_blob.js +40 -24
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_physics_rapier.js +10 -9
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_serialization_core.js +6 -2
- package/lib/engine/engine_serialization_core.js.map +1 -1
- package/lib/engine/engine_utils_screenshot.js +1 -1
- package/lib/engine/engine_utils_screenshot.js.map +1 -1
- package/lib/engine/js-extensions/RGBAColor.d.ts +1 -0
- package/lib/engine/js-extensions/RGBAColor.js +48 -0
- package/lib/engine/js-extensions/RGBAColor.js.map +1 -1
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +4 -3
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +6 -6
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +4 -0
- package/lib/engine/webcomponents/needle menu/needle-menu.js +13 -2
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/xr/NeedleXRController.js +2 -3
- package/lib/engine/xr/NeedleXRController.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.js +12 -12
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine-components/AudioSource.js +7 -0
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/Camera.js +18 -12
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CameraUtils.js +8 -14
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/GroundProjection.js +1 -1
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/NeedleMenu.js +1 -1
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/OrbitControls.js +3 -1
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +1 -0
- package/lib/engine-components/ReflectionProbe.js +16 -9
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.js +28 -7
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/SyncedTransform.d.ts +6 -0
- package/lib/engine-components/SyncedTransform.js +10 -5
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +1 -0
- package/lib/engine-components/codegen/components.js +1 -0
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/USDZUI.js +2 -1
- package/lib/engine-components/export/usdz/extensions/USDZUI.js.map +1 -1
- package/lib/engine-components/ui/BaseUIComponent.d.ts +0 -1
- package/lib/engine-components/ui/BaseUIComponent.js +1 -1
- package/lib/engine-components/ui/BaseUIComponent.js.map +1 -1
- package/lib/engine-components/ui/EventSystem.js +1 -1
- package/lib/engine-components/ui/EventSystem.js.map +1 -1
- package/lib/engine-components/ui/Graphic.js +1 -0
- package/lib/engine-components/ui/Graphic.js.map +1 -1
- package/lib/engine-components/ui/RaycastUtils.js +1 -1
- package/lib/engine-components/ui/RaycastUtils.js.map +1 -1
- package/lib/engine-components/ui/RectTransform.d.ts +2 -2
- package/lib/engine-components/ui/RectTransform.js +9 -6
- package/lib/engine-components/ui/RectTransform.js.map +1 -1
- package/lib/engine-components/ui/Symbols.d.ts +1 -0
- package/lib/engine-components/ui/Symbols.js +2 -0
- package/lib/engine-components/ui/Symbols.js.map +1 -0
- package/lib/engine-components/ui/Utils.js +1 -1
- package/lib/engine-components/ui/Utils.js.map +1 -1
- package/lib/engine-components/utils/EnvironmentScene.d.ts +1 -1
- package/lib/engine-components/utils/EnvironmentScene.js +1 -1
- package/lib/engine-components/utils/EnvironmentScene.js.map +1 -1
- package/package.json +3 -3
- package/plugins/common/buildinfo.js +1 -0
- package/plugins/common/cloud.js +2 -0
- package/plugins/common/license.js +174 -33
- package/plugins/types/userconfig.d.ts +5 -0
- package/plugins/vite/build-pipeline.js +4 -3
- package/plugins/vite/dependencies.js +17 -7
- package/plugins/vite/facebook-instant-games.js +7 -4
- package/plugins/vite/index.js +1 -1
- package/src/engine/codegen/register_types.ts +2 -0
- package/src/engine/engine_addressables.ts +3 -2
- package/src/engine/engine_components.ts +2 -1
- package/src/engine/engine_context.ts +36 -12
- package/src/engine/engine_element.ts +10 -9
- package/src/engine/engine_gameobject.ts +7 -0
- package/src/engine/engine_license.ts +116 -67
- package/src/engine/engine_networking_blob.ts +47 -26
- package/src/engine/engine_physics_rapier.ts +10 -12
- package/src/engine/engine_serialization_core.ts +6 -1
- package/src/engine/engine_utils_screenshot.ts +1 -1
- package/src/engine/js-extensions/RGBAColor.ts +50 -0
- package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +6 -6
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +6 -6
- package/src/engine/webcomponents/needle menu/needle-menu.ts +13 -2
- package/src/engine/xr/NeedleXRController.ts +2 -3
- package/src/engine/xr/NeedleXRSession.ts +12 -12
- package/src/engine-components/AudioSource.ts +8 -3
- package/src/engine-components/Camera.ts +34 -22
- package/src/engine-components/CameraUtils.ts +8 -16
- package/src/engine-components/GroundProjection.ts +1 -1
- package/src/engine-components/NeedleMenu.ts +1 -1
- package/src/engine-components/OrbitControls.ts +2 -1
- package/src/engine-components/ReflectionProbe.ts +15 -8
- package/src/engine-components/SceneSwitcher.ts +28 -11
- package/src/engine-components/SyncedTransform.ts +11 -6
- package/src/engine-components/codegen/components.ts +1 -0
- package/src/engine-components/export/usdz/extensions/USDZUI.ts +2 -2
- package/src/engine-components/ui/BaseUIComponent.ts +1 -1
- package/src/engine-components/ui/EventSystem.ts +1 -1
- package/src/engine-components/ui/Graphic.ts +1 -1
- package/src/engine-components/ui/RaycastUtils.ts +1 -1
- package/src/engine-components/ui/RectTransform.ts +10 -7
- package/src/engine-components/ui/Symbols.ts +2 -0
- package/src/engine-components/ui/Utils.ts +2 -1
- package/src/engine-components/utils/EnvironmentScene.ts +1 -1
|
@@ -107,6 +107,15 @@ export class SyncedTransform extends Behaviour {
|
|
|
107
107
|
this._model.requestOwnership();
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Free ownership of this object on the network.
|
|
112
|
+
* You need to be connected to a room for this to work.
|
|
113
|
+
* This will also be called automatically when the component is disabled.
|
|
114
|
+
*/
|
|
115
|
+
public freeOwnership() {
|
|
116
|
+
this._model?.freeOwnership();
|
|
117
|
+
}
|
|
118
|
+
|
|
110
119
|
/**
|
|
111
120
|
* Checks if this client has ownership of the object
|
|
112
121
|
* @returns true if this client has ownership, false if not, undefined if ownership state is unknown
|
|
@@ -312,8 +321,7 @@ export class SyncedTransform extends Behaviour {
|
|
|
312
321
|
|
|
313
322
|
if (this._model && !this._model.hasOwnership && this._model.isOwned) {
|
|
314
323
|
if (this._receivedDataBefore) {
|
|
315
|
-
const
|
|
316
|
-
const t = factor;//Mathf.clamp01(this.context.time.deltaTime * factor);
|
|
324
|
+
const t = this._receivedFastUpdate || this.fastMode ? .05 : .3;
|
|
317
325
|
let requireMarkDirty = false;
|
|
318
326
|
if (this.interpolatePosition && this._targetPosition) {
|
|
319
327
|
const pos = this.worldPosition;
|
|
@@ -366,13 +374,10 @@ export class SyncedTransform extends Behaviour {
|
|
|
366
374
|
FAST_ACTIVE_SYNCTRANSFORMS++;
|
|
367
375
|
if (fastUpdate && FAST_INTERVAL > 0 && this.context.time.frameCount % FAST_INTERVAL !== 0) return;
|
|
368
376
|
|
|
369
|
-
if (debug)
|
|
370
|
-
console.log("send update", this.context.connection.connectionId, this.guid, this.gameObject.name, this.gameObject.guid);
|
|
377
|
+
if (debug) console.debug("[SyncedTransform] Send update", this.context.connection.connectionId, this.guid, this.gameObject.name, this.gameObject.guid);
|
|
371
378
|
|
|
372
379
|
this._needsUpdate = false;
|
|
373
380
|
const st = createTransformModel(this.guid, this, fastUpdate ? true : false);
|
|
374
|
-
// this._state.update(this, this.rb);
|
|
375
|
-
// this._state.fast = fastUpdate ? true : false;
|
|
376
381
|
this.context.connection.sendBinary(st);
|
|
377
382
|
}
|
|
378
383
|
}
|
|
@@ -194,6 +194,7 @@ export { Rect } from "../ui/RectTransform.js";
|
|
|
194
194
|
export { RectTransform } from "../ui/RectTransform.js";
|
|
195
195
|
export { SpatialHtml } from "../ui/SpatialHtml.js";
|
|
196
196
|
export { Text } from "../ui/Text.js";
|
|
197
|
+
export { EnvironmentScene } from "../utils/EnvironmentScene.js";
|
|
197
198
|
export { LookAt } from "../utils/LookAt.js";
|
|
198
199
|
export { OpenURL } from "../utils/OpenURL.js";
|
|
199
200
|
export { VideoPlayer } from "../VideoPlayer.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Color, Mesh, MeshBasicMaterial, Object3D } from "three";
|
|
2
2
|
|
|
3
3
|
import { GameObject } from "../../../Component.js";
|
|
4
|
-
import {
|
|
5
|
-
import { $shadowDomOwner, BaseUIComponent } from "../../../ui/BaseUIComponent.js";
|
|
4
|
+
import { BaseUIComponent } from "../../../ui/BaseUIComponent.js";
|
|
6
5
|
import { Canvas } from "../../../ui/Canvas.js";
|
|
7
6
|
import { RenderMode } from "../../../ui/Canvas.js";
|
|
8
7
|
import { CanvasGroup } from "../../../ui/CanvasGroup.js";
|
|
9
8
|
import { RectTransform } from "../../../ui/RectTransform.js";
|
|
9
|
+
import { $shadowDomOwner } from "../../../ui/Symbols.js";
|
|
10
10
|
import { Text } from "../../../ui/Text.js";
|
|
11
11
|
import type { IUSDExporterExtension } from "../Extension.js";
|
|
12
12
|
import { USDObject, USDZExporterContext } from "../ThreeUSDZExporter.js";
|
|
@@ -8,6 +8,7 @@ import { getParam } from '../../engine/engine_utils.js';
|
|
|
8
8
|
import { Behaviour, GameObject } from "../Component.js";
|
|
9
9
|
import { EventSystem } from "./EventSystem.js";
|
|
10
10
|
import type { ICanvas } from './Interfaces.js';
|
|
11
|
+
import { $shadowDomOwner } from './Symbols.js';
|
|
11
12
|
export const includesDir = "./include";
|
|
12
13
|
|
|
13
14
|
const debug = getParam("debugshadowcomponents");
|
|
@@ -24,7 +25,6 @@ ThreeMeshUI.Block.prototype["interactable"] = {
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export const $shadowDomOwner = Symbol("shadowDomOwner");
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Derive from this class if you want to implement your own UI components.
|
|
@@ -9,11 +9,11 @@ import { Context } from "../../engine/engine_setup.js";
|
|
|
9
9
|
import { HideFlags, type IComponent } from "../../engine/engine_types.js";
|
|
10
10
|
import { getParam } from "../../engine/engine_utils.js";
|
|
11
11
|
import { Behaviour, GameObject } from "../Component.js";
|
|
12
|
-
import { $shadowDomOwner } from "./BaseUIComponent.js";
|
|
13
12
|
import type { ICanvasGroup } from "./Interfaces.js";
|
|
14
13
|
import { hasPointerEventComponent, type IPointerEventHandler, type IPointerUpHandler, PointerEventData } from "./PointerEvents.js";
|
|
15
14
|
import { ObjectRaycaster, Raycaster } from "./Raycaster.js";
|
|
16
15
|
import { UIRaycastUtils } from "./RaycastUtils.js";
|
|
16
|
+
import { $shadowDomOwner } from "./Symbols.js";
|
|
17
17
|
import { isUIObject } from "./Utils.js";
|
|
18
18
|
|
|
19
19
|
const debug = getParam("debugeventsystem");
|
|
@@ -98,6 +98,7 @@ export class Graphic extends BaseUIComponent implements IGraphic, IRectTransform
|
|
|
98
98
|
super.__internalNewInstanceCreated(init);
|
|
99
99
|
this._rect = null;
|
|
100
100
|
this.uiObject = null;
|
|
101
|
+
this._stateManager = null;
|
|
101
102
|
if (this._color) this._color = this._color.clone();
|
|
102
103
|
return this;
|
|
103
104
|
}
|
|
@@ -114,7 +115,6 @@ export class Graphic extends BaseUIComponent implements IGraphic, IRectTransform
|
|
|
114
115
|
setupState(state: object) {
|
|
115
116
|
this.makePanel();
|
|
116
117
|
if (this.uiObject) {
|
|
117
|
-
|
|
118
118
|
// @marwie : v7.x now have a concurrent state management in core mimicking html/css
|
|
119
119
|
// ie : (::firstChild::hover::disabled) where firstchild, hover and disabled are all on different channels
|
|
120
120
|
// In order to keep needle Raycaster and EventSystem intact, I added in v7 a SimpleStateBehavior, which acts as previously
|
|
@@ -2,8 +2,8 @@ import { Object3D } from "three";
|
|
|
2
2
|
|
|
3
3
|
import { foreachComponent } from "../../engine/engine_gameobject.js";
|
|
4
4
|
import { type IComponent } from "../../engine/engine_types.js";
|
|
5
|
-
import { $shadowDomOwner } from "./BaseUIComponent.js";
|
|
6
5
|
import { type ICanvasGroup, type IGraphic } from "./Interfaces.js";
|
|
6
|
+
import { $shadowDomOwner } from "./Symbols.js";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export class UIRaycastUtils {
|
|
@@ -106,20 +106,25 @@ export class RectTransform extends BaseUIComponent implements IRectTransform, IR
|
|
|
106
106
|
private rectBlock!: Object3D;
|
|
107
107
|
private _transformNeedsUpdate: boolean = false;
|
|
108
108
|
private _initialPosition!: Vector3;
|
|
109
|
+
private _parentRectTransform?: RectTransform;
|
|
110
|
+
private _lastUpdateFrame: number = -1;
|
|
109
111
|
|
|
110
112
|
awake() {
|
|
111
113
|
super.awake();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this._anchoredPosition = new Vector2();
|
|
114
|
+
this._lastUpdateFrame = -1;
|
|
115
|
+
this._parentRectTransform = undefined;
|
|
115
116
|
|
|
116
|
-
this.lastMatrix = new Matrix4();
|
|
117
117
|
this.rectBlock = new Object3D();
|
|
118
118
|
this.rectBlock.name = this.name;
|
|
119
|
-
|
|
119
|
+
this.lastMatrix = new Matrix4();
|
|
120
|
+
this._lastAnchoring = null!;
|
|
120
121
|
// TODO: get rid of the initial position
|
|
121
122
|
this._initialPosition = this.gameObject.position.clone();
|
|
122
123
|
this._initialPosition.z = 0;
|
|
124
|
+
// this is required if an animator animated the transform anchoring
|
|
125
|
+
if (!this._anchoredPosition) this._anchoredPosition = new Vector2();
|
|
126
|
+
|
|
127
|
+
|
|
123
128
|
|
|
124
129
|
// TODO: we need to replace this with the watch that e.g. Rigibody is using (or the one in utils?)
|
|
125
130
|
// perhaps we can also just manually check the few properties in the update loops?
|
|
@@ -184,8 +189,6 @@ export class RectTransform extends BaseUIComponent implements IRectTransform, IR
|
|
|
184
189
|
}
|
|
185
190
|
}
|
|
186
191
|
|
|
187
|
-
private _parentRectTransform?: RectTransform;
|
|
188
|
-
private _lastUpdateFrame: number = -1;
|
|
189
192
|
|
|
190
193
|
private canUpdate() {
|
|
191
194
|
return this._transformNeedsUpdate && this.activeAndEnabled && this._lastUpdateFrame !== this.context.time.frame;
|
|
@@ -4,7 +4,8 @@ import ThreeMeshUI from "three-mesh-ui";
|
|
|
4
4
|
|
|
5
5
|
import { FrameEvent } from "../../engine/engine_setup.js";
|
|
6
6
|
import { Behaviour } from "../Component.js";
|
|
7
|
-
import {
|
|
7
|
+
import { BaseUIComponent } from "./BaseUIComponent.js";
|
|
8
|
+
import { $shadowDomOwner } from "./Symbols.js";
|
|
8
9
|
|
|
9
10
|
export function tryGetUIComponent(obj: Object3D): BaseUIComponent | null {
|
|
10
11
|
const owner = obj[$shadowDomOwner];
|