@needle-tools/engine 4.14.0-next.52fdb13 → 4.14.0
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/{needle-engine.bundle-DJE-Bjpa.umd.cjs → needle-engine.bundle-COL2Bar3.umd.cjs} +120 -128
- package/dist/{needle-engine.bundle-BwfaInTa.min.js → needle-engine.bundle-NolzHLqO.min.js} +129 -137
- package/dist/{needle-engine.bundle-TmE5-_na.js → needle-engine.bundle-Z_gAD7Kg.js} +5214 -5459
- package/dist/needle-engine.d.ts +42 -299
- package/dist/needle-engine.js +569 -570
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/engine_context.d.ts +0 -2
- package/lib/engine/engine_context.js +0 -7
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_materialpropertyblock.d.ts +4 -90
- package/lib/engine/engine_materialpropertyblock.js +7 -97
- package/lib/engine/engine_materialpropertyblock.js.map +1 -1
- package/lib/engine/engine_math.d.ts +1 -34
- package/lib/engine/engine_math.js +1 -34
- package/lib/engine/engine_math.js.map +1 -1
- package/lib/engine/engine_networking.js +1 -1
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_types.d.ts +0 -2
- package/lib/engine/engine_types.js +0 -2
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/webcomponents/icons.js +0 -3
- package/lib/engine/webcomponents/icons.js.map +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +0 -1
- package/lib/engine/webcomponents/logo-element.js +1 -3
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle-button.d.ts +11 -37
- package/lib/engine/webcomponents/needle-button.js +11 -42
- package/lib/engine/webcomponents/needle-button.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +2 -10
- package/lib/engine/webcomponents/needle-engine.js +3 -13
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine-components/Component.d.ts +2 -1
- package/lib/engine-components/Component.js +2 -1
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +0 -1
- package/lib/engine-components/DragControls.js +0 -21
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +0 -2
- package/lib/engine-components/NeedleMenu.js +0 -2
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/Networking.d.ts +3 -28
- package/lib/engine-components/Networking.js +3 -28
- package/lib/engine-components/Networking.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +0 -1
- package/lib/engine-components/ReflectionProbe.js +2 -20
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +0 -15
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +0 -77
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
- package/lib/engine-components/ui/Button.d.ts +0 -1
- package/lib/engine-components/ui/Button.js +0 -11
- package/lib/engine-components/ui/Button.js.map +1 -1
- package/lib/engine-components/ui/Text.d.ts +0 -1
- package/lib/engine-components/ui/Text.js +0 -11
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/package.json +2 -2
- package/src/engine/engine_context.ts +0 -9
- package/src/engine/engine_materialpropertyblock.ts +11 -102
- package/src/engine/engine_math.ts +1 -34
- package/src/engine/engine_networking.ts +1 -1
- package/src/engine/engine_types.ts +0 -5
- package/src/engine/webcomponents/icons.ts +0 -3
- package/src/engine/webcomponents/logo-element.ts +1 -4
- package/src/engine/webcomponents/needle-button.ts +13 -44
- package/src/engine/webcomponents/needle-engine.ts +7 -18
- package/src/engine-components/Component.ts +3 -1
- package/src/engine-components/DragControls.ts +4 -29
- package/src/engine-components/NeedleMenu.ts +3 -5
- package/src/engine-components/Networking.ts +4 -29
- package/src/engine-components/ReflectionProbe.ts +2 -21
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +32 -108
- package/src/engine-components/ui/Button.ts +0 -12
- package/src/engine-components/ui/Text.ts +0 -13
- package/lib/engine/engine_accessibility.d.ts +0 -58
- package/lib/engine/engine_accessibility.js +0 -143
- package/lib/engine/engine_accessibility.js.map +0 -1
- package/src/engine/engine_accessibility.ts +0 -178
|
@@ -254,40 +254,7 @@ class LowPassFilter {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
|
-
*
|
|
258
|
-
* It's particularly useful for smoothing tracking data from XR controllers, hand tracking, or other input devices where the signal contains noise but responsiveness is important.
|
|
259
|
-
*
|
|
260
|
-
* The filter automatically adapts its smoothing strength based on the signal's velocity:
|
|
261
|
-
* - When the signal moves slowly, it applies strong smoothing to reduce jitter
|
|
262
|
-
* - When the signal moves quickly, it reduces smoothing to maintain responsiveness
|
|
263
|
-
*
|
|
264
|
-
* Based on the research paper: [1€ Filter: A Simple Speed-based Low-pass Filter for Noisy Input](http://cristal.univ-lille.fr/~casiez/1euro/)
|
|
265
|
-
*
|
|
266
|
-
* @example Basic usage with timestamp
|
|
267
|
-
* ```ts
|
|
268
|
-
* const filter = new OneEuroFilter(120, 1.0, 0.0);
|
|
269
|
-
*
|
|
270
|
-
* // In your update loop:
|
|
271
|
-
* const smoothedValue = filter.filter(noisyValue, this.context.time.time);
|
|
272
|
-
* ```
|
|
273
|
-
*
|
|
274
|
-
* @example Without timestamps (using frequency estimate)
|
|
275
|
-
* ```ts
|
|
276
|
-
* // Assuming 60 FPS update rate
|
|
277
|
-
* const filter = new OneEuroFilter(60, 1.0, 0.5);
|
|
278
|
-
*
|
|
279
|
-
* // Call without timestamp - uses the frequency estimate
|
|
280
|
-
* const smoothedValue = filter.filter(noisyValue);
|
|
281
|
-
* ```
|
|
282
|
-
*
|
|
283
|
-
* @example Smoothing 3D positions
|
|
284
|
-
* ```ts
|
|
285
|
-
* const posFilter = new OneEuroFilterXYZ(90, 0.5, 0.0);
|
|
286
|
-
*
|
|
287
|
-
* posFilter.filter(trackedPosition, smoothedPosition, this.context.time.time);
|
|
288
|
-
* ```
|
|
289
|
-
*
|
|
290
|
-
* @see {@link OneEuroFilterXYZ} for filtering 3D vectors
|
|
257
|
+
* OneEuroFilter is a simple low-pass filter for noisy signals. It uses a one-euro filter to smooth the signal.
|
|
291
258
|
*/
|
|
292
259
|
export class OneEuroFilter {
|
|
293
260
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const defaultNetworkingBackendUrlProvider = "https://urls.needle.tools/default-networking-backend/index";
|
|
2
|
-
let networkingServerUrl: string | undefined = "wss://networking
|
|
2
|
+
let networkingServerUrl: string | undefined = "wss://networking.needle.tools/socket";
|
|
3
3
|
|
|
4
4
|
import * as flatbuffers from 'flatbuffers';
|
|
5
5
|
import { type Websocket } from 'websocket-ts';
|
|
@@ -164,15 +164,10 @@ export interface IHasGuid {
|
|
|
164
164
|
guid: string;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
// DO NOT CHANGE THE SYMBOL NAME
|
|
168
|
-
export const $componentName = Symbol("component-name");
|
|
169
|
-
|
|
170
167
|
// TODO: we might want to separate the IComponent and IBehaviour where the Behaviour is the one with custom methods and the component only has e.g. the gameobject reference
|
|
171
168
|
export interface IComponent extends IHasGuid {
|
|
172
169
|
get isComponent(): boolean;
|
|
173
170
|
|
|
174
|
-
get [$componentName](): string | undefined;
|
|
175
|
-
|
|
176
171
|
/** the object this component is attached to */
|
|
177
172
|
gameObject: IGameObject;
|
|
178
173
|
// guid: string;
|
|
@@ -17,9 +17,6 @@ export function getIconElement(str: string): HTMLElement {
|
|
|
17
17
|
span.innerText = str;
|
|
18
18
|
span.style.visibility = "hidden";
|
|
19
19
|
span.style.userSelect = "none";
|
|
20
|
-
span.setAttribute("role", "img");
|
|
21
|
-
span.setAttribute("aria-label", str + " icon");
|
|
22
|
-
span.setAttribute("aria-hidden", "true");
|
|
23
20
|
fontReady(fontname).then(res => {
|
|
24
21
|
if (res) span.style.visibility = "";
|
|
25
22
|
else {
|
|
@@ -84,11 +84,8 @@ export class NeedleLogoElement extends HTMLElement {
|
|
|
84
84
|
globalThis.open("https://needle.tools", "_blank");
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
connectedCallback() {
|
|
87
|
+
// set title
|
|
90
88
|
this.wrapper.setAttribute("title", "Made with Needle Engine");
|
|
91
|
-
this.setAttribute("aria-label", "Needle Engine logo. Click to open the Needle Engine website.");
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
private readonly _root: ShadowRoot;
|
|
@@ -13,58 +13,32 @@ const htmlTagName = "needle-button";
|
|
|
13
13
|
const isDev = isDevEnvironment();
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* The button automatically handles session management and displays appropriate UI based on device capabilities.
|
|
19
|
-
* It comes with default styling (glassmorphism design) but can be fully customized with CSS.
|
|
20
|
-
*
|
|
21
|
-
* **Supported button types:**
|
|
22
|
-
* - `ar` - WebXR AR session button
|
|
23
|
-
* - `vr` - WebXR VR session button
|
|
24
|
-
* - `quicklook` - Apple AR Quick Look button (iOS only)
|
|
25
|
-
* - `qrcode` - QR code sharing button
|
|
26
|
-
*
|
|
27
|
-
* @example Basic AR/VR buttons
|
|
16
|
+
* A <needle-button> can be used to simply add VR, AR or Quicklook buttons to your website without having to write any code.
|
|
17
|
+
* @example
|
|
28
18
|
* ```html
|
|
29
|
-
* <needle-engine src="scene.glb"></needle-engine>
|
|
30
19
|
* <needle-button ar></needle-button>
|
|
31
20
|
* <needle-button vr></needle-button>
|
|
32
21
|
* <needle-button quicklook></needle-button>
|
|
33
22
|
* ```
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
23
|
+
*
|
|
24
|
+
* @example custom label
|
|
36
25
|
* ```html
|
|
37
|
-
* <needle-button ar>Start AR
|
|
38
|
-
* <needle-button vr>
|
|
26
|
+
* <needle-button ar>Start AR</needle-button>
|
|
27
|
+
* <needle-button vr>Start VR</needle-button>
|
|
39
28
|
* <needle-button quicklook>View in AR</needle-button>
|
|
40
29
|
* ```
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
30
|
+
*
|
|
31
|
+
* @example custom styling
|
|
43
32
|
* ```html
|
|
33
|
+
* <!-- You can either style the element directly or use a CSS stylesheet -->
|
|
44
34
|
* <style>
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* padding: 1rem 2rem;
|
|
50
|
-
* }
|
|
51
|
-
* needle-button:hover {
|
|
52
|
-
* background-color: #ff5252;
|
|
53
|
-
* }
|
|
35
|
+
* needle-button {
|
|
36
|
+
* background-color: red;
|
|
37
|
+
* color: white;
|
|
38
|
+
* }
|
|
54
39
|
* </style>
|
|
55
40
|
* <needle-button ar>Start AR</needle-button>
|
|
56
41
|
* ```
|
|
57
|
-
*
|
|
58
|
-
* @example Unstyled button (for complete custom styling)
|
|
59
|
-
* ```html
|
|
60
|
-
* <needle-button ar unstyled>
|
|
61
|
-
* <span class="my-icon">🥽</span>
|
|
62
|
-
* Launch AR
|
|
63
|
-
* </needle-button>
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @see {@link NeedleEngineWebComponent} for the main <needle-engine> element
|
|
67
|
-
* @see {@link NeedleMenu} for the built-in menu component that can display similar buttons
|
|
68
42
|
*/
|
|
69
43
|
export class NeedleButtonElement extends HTMLElement {
|
|
70
44
|
|
|
@@ -99,22 +73,18 @@ export class NeedleButtonElement extends HTMLElement {
|
|
|
99
73
|
if (this.getAttribute("ar") != null) {
|
|
100
74
|
this.#webxrfactory ??= new WebXRButtonFactory()
|
|
101
75
|
this.#button = this.#webxrfactory.createARButton();
|
|
102
|
-
this.setAttribute("aria-label", "Enter augmented reality mode");
|
|
103
76
|
}
|
|
104
77
|
else if (this.getAttribute("vr") != null) {
|
|
105
78
|
this.#webxrfactory ??= new WebXRButtonFactory()
|
|
106
79
|
this.#button = this.#webxrfactory.createVRButton();
|
|
107
|
-
this.setAttribute("aria-label", "Enter virtual reality mode");
|
|
108
80
|
}
|
|
109
81
|
else if (this.getAttribute("quicklook") != null) {
|
|
110
82
|
this.#webxrfactory ??= new WebXRButtonFactory()
|
|
111
83
|
this.#button = this.#webxrfactory.createQuicklookButton();
|
|
112
|
-
this.setAttribute("aria-label", "View in AR with Apple Quick Look");
|
|
113
84
|
}
|
|
114
85
|
else if (this.getAttribute("qrcode") != null) {
|
|
115
86
|
this.#buttonfactory ??= new ButtonsFactory();
|
|
116
87
|
this.#button = this.#buttonfactory.createQRCode({ anchorElement: this });
|
|
117
|
-
this.setAttribute("aria-label", "Share application with QR code");
|
|
118
88
|
}
|
|
119
89
|
else {
|
|
120
90
|
if (isDev) {
|
|
@@ -123,7 +93,6 @@ export class NeedleButtonElement extends HTMLElement {
|
|
|
123
93
|
else {
|
|
124
94
|
console.debug("No button type specified for <needle-button>. Use either ar, vr or quicklook attribute.")
|
|
125
95
|
}
|
|
126
|
-
this.setAttribute("aria-label", "Needle Button with no specified type");
|
|
127
96
|
return;
|
|
128
97
|
}
|
|
129
98
|
|
|
@@ -87,25 +87,17 @@ const observedAttributes = [
|
|
|
87
87
|
|
|
88
88
|
// https://developers.google.com/web/fundamentals/web-components/customelements
|
|
89
89
|
|
|
90
|
-
/**
|
|
91
|
-
* The `<needle-engine>` web component. See {@link NeedleEngineAttributes} attributes for supported attributes
|
|
92
|
-
* The web component creates and manages a Needle Engine context, which is responsible for rendering a 3D scene using threejs.
|
|
93
|
-
* The context is created when the `src` attribute is set, and disposed when the element is removed from the DOM. You can prevent cleanup by setting the `keep-alive` attribute to `true`.
|
|
90
|
+
/**
|
|
91
|
+
* The `<needle-engine>` web component. See {@link NeedleEngineAttributes} attributes for supported attributes
|
|
92
|
+
* The web component creates and manages a Needle Engine context, which is responsible for rendering a 3D scene using threejs.
|
|
93
|
+
* The context is created when the `src` attribute is set, and disposed when the element is removed from the DOM. You can prevent cleanup by setting the `keep-alive` attribute to `true`.
|
|
94
94
|
* The context is accessible from the `<needle-engine>` element: `document.querySelector("needle-engine").context`.
|
|
95
95
|
* See {@link https://engine.needle.tools/docs/reference/needle-engine-attributes}
|
|
96
96
|
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```html
|
|
97
|
+
* @example
|
|
99
98
|
* <needle-engine src="https://example.com/scene.glb"></needle-engine>
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* @example With camera controls disabled
|
|
103
|
-
* ```html
|
|
99
|
+
* @example
|
|
104
100
|
* <needle-engine src="https://example.com/scene.glb" camera-controls="false"></needle-engine>
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* @see {@link NeedleButtonElement} for adding AR/VR/Quicklook buttons via <needle-button>
|
|
108
|
-
* @see {@link NeedleMenu} for the built-in menu configuration component
|
|
109
101
|
*/
|
|
110
102
|
export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngineComponent {
|
|
111
103
|
|
|
@@ -184,9 +176,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
|
|
|
184
176
|
|
|
185
177
|
ensureFonts();
|
|
186
178
|
|
|
187
|
-
this.attachShadow({ mode: 'open'
|
|
188
|
-
this.setAttribute("role", "application");
|
|
189
|
-
this.setAttribute("aria-label", "Needle Engine 3D scene");
|
|
179
|
+
this.attachShadow({ mode: 'open' });
|
|
190
180
|
const template = document.createElement('template');
|
|
191
181
|
// #region CSS
|
|
192
182
|
template.innerHTML = `<style>
|
|
@@ -292,7 +282,6 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
|
|
|
292
282
|
if (this.getAttribute("tabindex") === null || this.getAttribute("tabindex") === undefined)
|
|
293
283
|
this.setAttribute("tabindex", "0");
|
|
294
284
|
|
|
295
|
-
|
|
296
285
|
this.addEventListener("xr-session-started", this.onXRSessionStarted);
|
|
297
286
|
this.onSetupDesktop();
|
|
298
287
|
|
|
@@ -10,7 +10,7 @@ import * as main from "../engine/engine_mainloop_utils.js";
|
|
|
10
10
|
import { syncDestroy, syncInstantiate, SyncInstantiateOptions } from "../engine/engine_networking_instantiate.js";
|
|
11
11
|
import { Context, FrameEvent } from "../engine/engine_setup.js";
|
|
12
12
|
import * as threeutils from "../engine/engine_three_utils.js";
|
|
13
|
-
import {
|
|
13
|
+
import type { Collision, ComponentInit, Constructor, ConstructorConcrete, GuidsMap, ICollider, IComponent, IGameObject, SourceIdentifier } from "../engine/engine_types.js";
|
|
14
14
|
import { TypeStore } from "../engine/engine_typestore.js";
|
|
15
15
|
import type { INeedleXRSessionEventReceiver, NeedleXRControllerEventArgs, NeedleXREventArgs } from "../engine/engine_xr.js";
|
|
16
16
|
import { type IPointerEventHandler, PointerEventData } from "./ui/PointerEvents.js";
|
|
@@ -542,6 +542,8 @@ export abstract class GameObject extends Object3D implements Object3D, IGameObje
|
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
+
// DO NOT CHANGE THE SYMBOL NAME
|
|
546
|
+
const $componentName = Symbol("component-name");
|
|
545
547
|
|
|
546
548
|
/**
|
|
547
549
|
* Needle Engine component's are the main building blocks of the Needle Engine.
|
|
@@ -193,7 +193,7 @@ export class DragControls extends Behaviour implements IPointerEventHandler {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
|
|
197
197
|
private _rigidbody: Rigidbody | null = null;
|
|
198
198
|
|
|
199
199
|
// future:
|
|
@@ -235,22 +235,12 @@ export class DragControls extends Behaviour implements IPointerEventHandler {
|
|
|
235
235
|
/** @internal */
|
|
236
236
|
onEnable(): void {
|
|
237
237
|
DragControls._instances.push(this);
|
|
238
|
-
this.context.accessibility.updateElement(this, {
|
|
239
|
-
role: "button",
|
|
240
|
-
label: "Drag " + (this.gameObject.name || "object"),
|
|
241
|
-
hidden: false,
|
|
242
|
-
});
|
|
243
238
|
}
|
|
244
239
|
/** @internal */
|
|
245
240
|
onDisable(): void {
|
|
246
|
-
this.context.accessibility.updateElement(this, { hidden: true });
|
|
247
241
|
DragControls._instances = DragControls._instances.filter(i => i !== this);
|
|
248
242
|
}
|
|
249
243
|
|
|
250
|
-
onDestroy(): void {
|
|
251
|
-
this.context.accessibility.removeElement(this);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
244
|
/**
|
|
255
245
|
* Checks if editing is allowed for the current networking connection.
|
|
256
246
|
* @param _obj Optional object to check edit permissions for
|
|
@@ -278,8 +268,6 @@ export class DragControls extends Behaviour implements IPointerEventHandler {
|
|
|
278
268
|
if (!dc || dc !== this) return;
|
|
279
269
|
DragControls.lastHovered = evt.object;
|
|
280
270
|
this.context.domElement.style.cursor = 'pointer';
|
|
281
|
-
|
|
282
|
-
this.context.accessibility.hover(this, `Draggable ${evt.object?.name}`);
|
|
283
271
|
}
|
|
284
272
|
|
|
285
273
|
/**
|
|
@@ -351,14 +339,6 @@ export class DragControls extends Behaviour implements IPointerEventHandler {
|
|
|
351
339
|
}
|
|
352
340
|
|
|
353
341
|
args.use();
|
|
354
|
-
|
|
355
|
-
this.context.accessibility.updateElement(this, {
|
|
356
|
-
role: "button",
|
|
357
|
-
label: "Dragging " + (this.gameObject.name || "object"),
|
|
358
|
-
hidden: false,
|
|
359
|
-
busy: true,
|
|
360
|
-
});
|
|
361
|
-
this.context.accessibility.focus(this);
|
|
362
342
|
}
|
|
363
343
|
}
|
|
364
344
|
|
|
@@ -395,11 +375,6 @@ export class DragControls extends Behaviour implements IPointerEventHandler {
|
|
|
395
375
|
}
|
|
396
376
|
args.use();
|
|
397
377
|
}
|
|
398
|
-
|
|
399
|
-
this.context.accessibility.unfocus(this);
|
|
400
|
-
this.context.accessibility.updateElement(this, {
|
|
401
|
-
busy: false,
|
|
402
|
-
});
|
|
403
378
|
}
|
|
404
379
|
|
|
405
380
|
/**
|
|
@@ -804,12 +779,12 @@ class DragPointerHandler implements IDragHandler {
|
|
|
804
779
|
* Used for determining if enough motion has occurred to start a drag.
|
|
805
780
|
*/
|
|
806
781
|
getTotalMovement(): Vector3 { return this._totalMovement; }
|
|
807
|
-
|
|
782
|
+
|
|
808
783
|
/**
|
|
809
784
|
* Returns the object that follows the pointer during dragging operations.
|
|
810
785
|
*/
|
|
811
786
|
get followObject(): GameObject { return this._followObject; }
|
|
812
|
-
|
|
787
|
+
|
|
813
788
|
/**
|
|
814
789
|
* Returns the point where the pointer initially hit the object in local space.
|
|
815
790
|
*/
|
|
@@ -1402,7 +1377,7 @@ class LegacyDragVisualsHelper {
|
|
|
1402
1377
|
|
|
1403
1378
|
/** Controls whether visual helpers like lines and markers are displayed */
|
|
1404
1379
|
showGizmo: boolean = true;
|
|
1405
|
-
|
|
1380
|
+
|
|
1406
1381
|
/** When true, drag plane alignment changes based on view angle */
|
|
1407
1382
|
useViewAngle: boolean = true;
|
|
1408
1383
|
|
|
@@ -9,8 +9,8 @@ import type { Voip } from './Voip.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* [NeedleMenu](https://engine.needle.tools/docs/api/NeedleMenu) provides configuration for the built-in UI menu.
|
|
11
11
|
* The menu renders as HTML overlay in browser mode and automatically
|
|
12
|
-
* switches to a 3D spatial menu in VR/AR.
|
|
13
|
-
*
|
|
12
|
+
* switches to a 3D spatial menu in VR/AR.
|
|
13
|
+
*
|
|
14
14
|
* 
|
|
15
15
|
*
|
|
16
16
|
* **Features:**
|
|
@@ -18,7 +18,7 @@ import type { Voip } from './Voip.js';
|
|
|
18
18
|
* - Audio mute/unmute button
|
|
19
19
|
* - QR code sharing (desktop only)
|
|
20
20
|
* - Spatial menu in XR (appears when looking up)
|
|
21
|
-
* - Custom positioning (top/bottom)
|
|
21
|
+
* - Custom positioning (top/bottom)
|
|
22
22
|
*
|
|
23
23
|
* **Programmatic access:**
|
|
24
24
|
* Access the menu API via `this.context.menu` to add custom buttons,
|
|
@@ -36,8 +36,6 @@ import type { Voip } from './Voip.js';
|
|
|
36
36
|
* @category User Interface
|
|
37
37
|
* @group Components
|
|
38
38
|
* @see {@link Context.menu} for programmatic menu control
|
|
39
|
-
* @see {@link NeedleButtonElement} for standalone <needle-button> web component
|
|
40
|
-
* @see {@link NeedleEngineWebComponent} for the main <needle-engine> element
|
|
41
39
|
* @see {@link Voip} adds a microphone button to the menu
|
|
42
40
|
* @see {@link ScreenCapture} adds a screen sharing button
|
|
43
41
|
**/
|
|
@@ -7,34 +7,10 @@ import { Behaviour } from "./Component.js";
|
|
|
7
7
|
const debug = getParam("debugnet");
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Provides
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* it queries this provider for the websocket URL to use instead of the default Needle networking backend.
|
|
15
|
-
*
|
|
16
|
-
* **URL resolution order:**
|
|
17
|
-
* 1. If `urlParameterName` is set and the corresponding URL parameter exists in the browser URL, that value is used
|
|
18
|
-
* 2. If running on a local network and `localhost` is set, the `localhost` URL is used
|
|
19
|
-
* 3. Otherwise, the `url` field is used
|
|
20
|
-
*
|
|
21
|
-
* Without this component, the default backend URL `wss://networking-2.needle.tools/socket` is used.
|
|
22
|
-
*
|
|
23
|
-
* **Note:** This component only configures the websocket URL. To actually join a networked room,
|
|
24
|
-
* use a `SyncedRoom` component or call `this.context.connection.joinRoom("room-name")` directly.
|
|
25
|
-
*
|
|
26
|
-
* @example Overriding the URL via browser parameter
|
|
27
|
-
* ```ts
|
|
28
|
-
* // With urlParameterName="server", visiting:
|
|
29
|
-
* // https://myapp.com/?server=wss://my-server.com/socket
|
|
30
|
-
* // will connect to that server instead
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @see {@link NetworkConnection} for the main networking API (`this.context.connection`)
|
|
34
|
-
* @see {@link SyncedRoom} for automatic room joining
|
|
35
|
-
* @see {@link OwnershipModel} for networked object ownership
|
|
36
|
-
* @see {@link RoomEvents} for room lifecycle events
|
|
37
|
-
* @link https://engine.needle.tools/docs/how-to-guides/networking/
|
|
10
|
+
* Provides configuration to the built-in networking system.
|
|
11
|
+
* This component supplies websocket URLs for establishing connections.
|
|
12
|
+
* It implements the {@link INetworkingWebsocketUrlProvider} interface.
|
|
13
|
+
*
|
|
38
14
|
* @summary Networking configuration
|
|
39
15
|
* @category Networking
|
|
40
16
|
* @group Components
|
|
@@ -44,7 +20,6 @@ export class Networking extends Behaviour implements INetworkingWebsocketUrlProv
|
|
|
44
20
|
/**
|
|
45
21
|
* The websocket URL to connect to for networking functionality.
|
|
46
22
|
* Can be a complete URL or a relative path that will be resolved against the current origin.
|
|
47
|
-
* @default null
|
|
48
23
|
*/
|
|
49
24
|
@serializable()
|
|
50
25
|
url: string | null = null;
|
|
@@ -5,11 +5,10 @@ import { MaterialPropertyBlock } from "../engine/engine_materialpropertyblock.js
|
|
|
5
5
|
import { serializable } from "../engine/engine_serialization.js";
|
|
6
6
|
import { Context } from "../engine/engine_setup.js";
|
|
7
7
|
import type { IRenderer } from "../engine/engine_types.js";
|
|
8
|
-
import { getParam
|
|
8
|
+
import { getParam } from "../engine/engine_utils.js";
|
|
9
9
|
import { BoxHelperComponent } from "./BoxHelperComponent.js";
|
|
10
10
|
import { Behaviour } from "./Component.js";
|
|
11
11
|
import { EventList } from "./EventList.js";
|
|
12
|
-
import { loadPMREM } from "../engine/engine_pmrem.js";
|
|
13
12
|
|
|
14
13
|
export const debug = getParam("debugreflectionprobe");
|
|
15
14
|
const disable = getParam("noreflectionprobe");
|
|
@@ -91,28 +90,10 @@ export class ReflectionProbe extends Behaviour {
|
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
private _texture!: Texture;
|
|
94
|
-
private _textureUrlInFlight?: string;
|
|
95
93
|
|
|
96
|
-
@serializable(
|
|
94
|
+
@serializable(Texture)
|
|
97
95
|
set texture(tex: Texture) {
|
|
98
96
|
if (this._texture === tex) return;
|
|
99
|
-
|
|
100
|
-
if (typeof tex === "string") {
|
|
101
|
-
if(debug) console.debug(`[ReflectionProbe] Loading reflection probe texture from URL: ${tex}`);
|
|
102
|
-
this._textureUrlInFlight = tex;
|
|
103
|
-
const textureUrl = resolveUrl(this.sourceId, tex);
|
|
104
|
-
loadPMREM(textureUrl, this.context.renderer).then(loaded => {
|
|
105
|
-
if (this._textureUrlInFlight === tex && loaded) {
|
|
106
|
-
this._textureUrlInFlight = undefined;
|
|
107
|
-
if (debug) console.debug(`[ReflectionProbe] Successfully loaded reflection probe texture: ${tex}`);
|
|
108
|
-
this.texture = loaded;
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
this._textureUrlInFlight = undefined;
|
|
115
|
-
|
|
116
97
|
this._texture = tex;
|
|
117
98
|
|
|
118
99
|
if (debug) console.debug("[ReflectionProbe] Set reflection probe texture " + (tex?.name || "(removed)"));
|