@needle-tools/engine 2.28.0-pre → 2.29.0-pre
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 +10 -0
- package/dist/needle-engine.d.ts +188 -131
- package/dist/needle-engine.js +345 -345
- package/dist/needle-engine.js.map +4 -4
- package/dist/needle-engine.min.js +19 -19
- package/dist/needle-engine.min.js.map +4 -4
- package/lib/engine/engine_input.d.ts +13 -1
- package/lib/engine/engine_input.js +47 -16
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_physics.d.ts +1 -0
- package/lib/engine/engine_physics.js +2 -1
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_playerview.d.ts +26 -0
- package/lib/engine/engine_playerview.js +65 -0
- package/lib/engine/engine_playerview.js.map +1 -0
- package/lib/engine/engine_serialization_core.js +5 -0
- package/lib/engine/engine_serialization_core.js.map +1 -1
- package/lib/engine/engine_setup.d.ts +3 -0
- package/lib/engine/engine_setup.js +17 -0
- package/lib/engine/engine_setup.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_lighting_settings.js +6 -2
- package/lib/engine/extensions/NEEDLE_lighting_settings.js.map +1 -1
- package/lib/engine-components/Component.d.ts +1 -1
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/Light.js +1 -0
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/OrbitControls.js +1 -2
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/ParticleSystem.d.ts +0 -1
- package/lib/engine-components/ParticleSystem.js +24 -27
- package/lib/engine-components/ParticleSystem.js.map +1 -1
- package/lib/engine-components/PlayerColor.js +1 -2
- package/lib/engine-components/PlayerColor.js.map +1 -1
- package/lib/engine-components/SpectatorCamera.d.ts +24 -17
- package/lib/engine-components/SpectatorCamera.js +410 -181
- package/lib/engine-components/SpectatorCamera.js.map +1 -1
- package/lib/engine-components/SyncedCamera.d.ts +8 -4
- package/lib/engine-components/SyncedCamera.js +15 -18
- package/lib/engine-components/SyncedCamera.js.map +1 -1
- package/lib/engine-components/WebXR.js +1 -0
- package/lib/engine-components/WebXR.js.map +1 -1
- package/lib/engine-components/WebXRAvatar.d.ts +3 -0
- package/lib/engine-components/WebXRAvatar.js +16 -0
- package/lib/engine-components/WebXRAvatar.js.map +1 -1
- package/lib/engine-components/WebXRController.js +1 -1
- package/lib/engine-components/WebXRController.js.map +1 -1
- package/lib/engine-components/WebXRSync.js +3 -3
- package/lib/engine-components/WebXRSync.js.map +1 -1
- package/lib/engine-components/XRFlag.d.ts +2 -1
- package/lib/engine-components/XRFlag.js +1 -0
- package/lib/engine-components/XRFlag.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_components.js +16 -0
- package/src/engine/engine_input.ts +62 -20
- package/src/engine/engine_physics.ts +2 -1
- package/src/engine/engine_playerview.ts +80 -0
- package/src/engine/engine_serialization_core.ts +8 -0
- package/src/engine/engine_setup.ts +18 -0
- package/src/engine/extensions/NEEDLE_lighting_settings.ts +4 -2
- package/src/engine-components/Component.ts +1 -1
- package/src/engine-components/Light.ts +3 -0
- package/src/engine-components/OrbitControls.ts +1 -2
- package/src/engine-components/ParticleSystem.ts +25 -26
- package/src/engine-components/PlayerColor.ts +1 -1
- package/src/engine-components/SpectatorCamera.ts +466 -194
- package/src/engine-components/SyncedCamera.ts +23 -22
- package/src/engine-components/WebXR.ts +1 -0
- package/src/engine-components/WebXRAvatar.ts +22 -2
- package/src/engine-components/WebXRController.ts +1 -1
- package/src/engine-components/WebXRSync.ts +3 -3
- package/src/engine-components/XRFlag.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [2.29.0-pre] - 2022-10-10
|
|
8
|
+
- Add: Context.removeCamera method
|
|
9
|
+
- Add: SpectatorCam allows to follow other users across devices by clicking on respective avatar (e.g. clicking SyncedCam avatar or WebXR avatar, ESC or long press to stop spectating)
|
|
10
|
+
- Add: ``Input`` events for pointerdown, pointerup, pointermove and keydown, keyup, keypress. Subscribe via ``this.context.input.addEventListener(InputEvents.pointerdown, evt => {...})``
|
|
11
|
+
- Change: Default WebXR rig matches Unity forward
|
|
12
|
+
- Fix: WebXRController raycast line being rendered as huge line before first world hit
|
|
13
|
+
- Fix: SpectatorCam works again
|
|
14
|
+
- Fix: ``serializable()`` does now not write undefined values if serialize data is undefined
|
|
15
|
+
- Fix: exit VR lighting
|
|
16
|
+
|
|
7
17
|
## [2.28.0-pre] - 2022-10-06
|
|
8
18
|
- Add: ``resolutionScaleFactor`` to context
|
|
9
19
|
- Fix ``IsLocalNetwork`` regex
|
package/dist/needle-engine.d.ts
CHANGED
|
@@ -424,7 +424,7 @@ declare module "engine-components/Component" {
|
|
|
424
424
|
static findObjectsOfType<T>(typeName: Constructor<T>, context?: Context | THREE.Object3D): Array<T>;
|
|
425
425
|
static getComponentInChildren<T>(go: GameObject | THREE.Object3D, typeName: Constructor<T> | null): T | null;
|
|
426
426
|
static getComponentsInChildren<T>(go: GameObject | THREE.Object3D, typeName: Constructor<T> | null, arr?: T[] | null): Array<T>;
|
|
427
|
-
static getComponentInParent<T>(go: GameObject | THREE.Object3D
|
|
427
|
+
static getComponentInParent<T>(go: GameObject | THREE.Object3D | Array<Object3D>, typeName: Constructor<T>): T | null;
|
|
428
428
|
static getComponentsInParent<T>(go: GameObject | THREE.Object3D, typeName: Constructor<T>, arr?: Array<T> | null): Array<T>;
|
|
429
429
|
static getAllComponents(go: GameObject | THREE.Object3D): Behaviour[];
|
|
430
430
|
static iterateComponents(go: GameObject | THREE.Object3D): Generator<any, void, unknown>;
|
|
@@ -517,6 +517,112 @@ declare module "engine-components/Component" {
|
|
|
517
517
|
}
|
|
518
518
|
export { Behaviour, Component, GameObject };
|
|
519
519
|
}
|
|
520
|
+
declare module "engine/extensions/extension_resolver" {
|
|
521
|
+
import { GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
522
|
+
export interface IExtensionReferenceResolver {
|
|
523
|
+
resolve(parser: GLTFParser, path: string): Promise<void> | null;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
declare module "engine/engine_default_parameters" {
|
|
527
|
+
export const showGizmos: string | boolean;
|
|
528
|
+
export const debugExtension: string | boolean;
|
|
529
|
+
}
|
|
530
|
+
declare module "engine/extensions/extension_utils" {
|
|
531
|
+
import { GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
532
|
+
export function resolveReferences(parser: GLTFParser, obj: any): Promise<void | void[]>;
|
|
533
|
+
}
|
|
534
|
+
declare module "engine/engine_typestore" {
|
|
535
|
+
class _TypeStore {
|
|
536
|
+
private _types;
|
|
537
|
+
add(key: any, type: any): void;
|
|
538
|
+
get(key: any): any;
|
|
539
|
+
}
|
|
540
|
+
export const TypeStore: _TypeStore;
|
|
541
|
+
}
|
|
542
|
+
declare module "engine/extensions/NEEDLE_persistent_assets" {
|
|
543
|
+
import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
544
|
+
import { IExtensionReferenceResolver } from "engine/extensions/extension_resolver";
|
|
545
|
+
export const EXTENSION_NAME = "NEEDLE_persistent_assets";
|
|
546
|
+
export function isPersistentAsset(asset: any): boolean;
|
|
547
|
+
export class NEEDLE_persistent_assets implements GLTFLoaderPlugin, IExtensionReferenceResolver {
|
|
548
|
+
get name(): string;
|
|
549
|
+
private parser;
|
|
550
|
+
constructor(parser: GLTFParser);
|
|
551
|
+
afterRoot(_result: GLTF): Promise<void>;
|
|
552
|
+
resolve(parser: GLTFParser, path: string): Promise<void> | null | any;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
declare module "engine/engine_serialization_core" {
|
|
556
|
+
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
|
|
557
|
+
import { Object3D } from "three";
|
|
558
|
+
import { Context } from "engine/engine_setup";
|
|
559
|
+
import { SourceIdentifier } from "engine/engine_gltf";
|
|
560
|
+
export type Constructor<T> = {
|
|
561
|
+
new (...args: any[]): T;
|
|
562
|
+
};
|
|
563
|
+
export type NodeToObjectMap = {
|
|
564
|
+
[nodeId: string]: Object3D;
|
|
565
|
+
};
|
|
566
|
+
export type ObjectToNodeMap = {
|
|
567
|
+
[uuid: string]: number;
|
|
568
|
+
};
|
|
569
|
+
class SerializationHelper {
|
|
570
|
+
register(type: string, ser: ITypeSerializer): void;
|
|
571
|
+
typeMap: {
|
|
572
|
+
[type: string]: ITypeSerializer;
|
|
573
|
+
};
|
|
574
|
+
getSerializer(type: string): ITypeSerializer | undefined;
|
|
575
|
+
getSerializerForConstructor(type: any, level?: number): ITypeSerializer | undefined;
|
|
576
|
+
}
|
|
577
|
+
export const helper: SerializationHelper;
|
|
578
|
+
export interface ITypeSerializer {
|
|
579
|
+
onSerialize(data: any, context: SerializationContext): any;
|
|
580
|
+
onDeserialize(data: any, context: SerializationContext): any;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* implement and call super(<type string or array>) with the type names this serializer can handle
|
|
584
|
+
* for example:
|
|
585
|
+
* class ColorSerializer extends TypeSerializer {
|
|
586
|
+
* constructor() {
|
|
587
|
+
* super("Color")
|
|
588
|
+
* }
|
|
589
|
+
* }
|
|
590
|
+
*/
|
|
591
|
+
export abstract class TypeSerializer implements ITypeSerializer {
|
|
592
|
+
constructor(type: Constructor<any> | Constructor<any>[]);
|
|
593
|
+
abstract onSerialize(data: any, context: SerializationContext): any | void;
|
|
594
|
+
abstract onDeserialize(data: any, context: SerializationContext): any | void;
|
|
595
|
+
}
|
|
596
|
+
export interface ITypeInformation {
|
|
597
|
+
type?: Constructor<any>;
|
|
598
|
+
}
|
|
599
|
+
export class SerializationContext {
|
|
600
|
+
root: THREE.Object3D;
|
|
601
|
+
gltf?: GLTF;
|
|
602
|
+
gltfId?: SourceIdentifier;
|
|
603
|
+
object: THREE.Object3D;
|
|
604
|
+
target?: object;
|
|
605
|
+
nodeId?: number;
|
|
606
|
+
nodeToObject?: NodeToObjectMap;
|
|
607
|
+
objectToNode?: ObjectToNodeMap;
|
|
608
|
+
context?: Context;
|
|
609
|
+
path?: string;
|
|
610
|
+
constructor(root: THREE.Object3D);
|
|
611
|
+
}
|
|
612
|
+
export interface ISerializable {
|
|
613
|
+
$serializedTypes?: {
|
|
614
|
+
[key: string]: Constructor<any> | ITypeInformation | null;
|
|
615
|
+
};
|
|
616
|
+
onBeforeDeserialize?(data: any, context: SerializationContext): void | undefined | boolean;
|
|
617
|
+
onBeforeDeserializeMember?(key: string, data: any, context: SerializationContext): void | undefined | boolean;
|
|
618
|
+
onAfterDeserializeMember?(key: string, data: any, context: SerializationContext): void;
|
|
619
|
+
onAfterDeserialize?(data: any, context: SerializationContext): void;
|
|
620
|
+
}
|
|
621
|
+
export function serializeObject(obj: ISerializable, context: SerializationContext): object | null;
|
|
622
|
+
export function deserializeObject(obj: ISerializable, serializedData: object, context: SerializationContext): boolean;
|
|
623
|
+
/** Object.assign behaviour but check if property is writeable (e.g. getter only properties are skipped) */
|
|
624
|
+
export function assign(target: any, source: any): void;
|
|
625
|
+
}
|
|
520
626
|
declare module "engine/engine_input" {
|
|
521
627
|
import * as THREE from 'three';
|
|
522
628
|
import { Context } from "engine/engine_setup";
|
|
@@ -528,8 +634,19 @@ declare module "engine/engine_input" {
|
|
|
528
634
|
pointerType: string;
|
|
529
635
|
source?: Event;
|
|
530
636
|
};
|
|
637
|
+
export class KeyEventArgs {
|
|
638
|
+
key: string;
|
|
639
|
+
keyType: string;
|
|
640
|
+
source?: Event;
|
|
641
|
+
constructor(evt: KeyboardEvent);
|
|
642
|
+
}
|
|
531
643
|
export enum InputEvents {
|
|
532
|
-
PointerDown = "
|
|
644
|
+
PointerDown = "pointerdown",
|
|
645
|
+
PointerUp = "pointerup",
|
|
646
|
+
PointerMove = "pointermove",
|
|
647
|
+
KeyDown = "keydown",
|
|
648
|
+
KeyUp = "keyup",
|
|
649
|
+
KeyPressed = "keypress"
|
|
533
650
|
}
|
|
534
651
|
export class Input extends EventTarget {
|
|
535
652
|
_doubleClickTimeThreshold: number;
|
|
@@ -609,6 +726,7 @@ declare module "engine/engine_input" {
|
|
|
609
726
|
private getPointerIndex;
|
|
610
727
|
private setPointerState;
|
|
611
728
|
private setPointerStateT;
|
|
729
|
+
private onDispatchEvent;
|
|
612
730
|
}
|
|
613
731
|
export enum KeyCode {
|
|
614
732
|
BACKSPACE = 8,
|
|
@@ -952,6 +1070,7 @@ declare module "engine/engine_physics" {
|
|
|
952
1070
|
}
|
|
953
1071
|
export class RaycastOptions {
|
|
954
1072
|
ray: THREE.Ray | undefined;
|
|
1073
|
+
cam: THREE.Camera | undefined | null;
|
|
955
1074
|
screenPoint: THREE.Vector2 | undefined;
|
|
956
1075
|
raycaster: THREE.Raycaster | undefined;
|
|
957
1076
|
results: Array<THREE.Intersection> | undefined;
|
|
@@ -1250,112 +1369,6 @@ declare module "engine/extensions/NEEDLE_animator_controller_model" {
|
|
|
1250
1369
|
Trigger = 9
|
|
1251
1370
|
}
|
|
1252
1371
|
}
|
|
1253
|
-
declare module "engine/engine_typestore" {
|
|
1254
|
-
class _TypeStore {
|
|
1255
|
-
private _types;
|
|
1256
|
-
add(key: any, type: any): void;
|
|
1257
|
-
get(key: any): any;
|
|
1258
|
-
}
|
|
1259
|
-
export const TypeStore: _TypeStore;
|
|
1260
|
-
}
|
|
1261
|
-
declare module "engine/extensions/extension_resolver" {
|
|
1262
|
-
import { GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
1263
|
-
export interface IExtensionReferenceResolver {
|
|
1264
|
-
resolve(parser: GLTFParser, path: string): Promise<void> | null;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
declare module "engine/engine_default_parameters" {
|
|
1268
|
-
export const showGizmos: string | boolean;
|
|
1269
|
-
export const debugExtension: string | boolean;
|
|
1270
|
-
}
|
|
1271
|
-
declare module "engine/extensions/extension_utils" {
|
|
1272
|
-
import { GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
1273
|
-
export function resolveReferences(parser: GLTFParser, obj: any): Promise<void | void[]>;
|
|
1274
|
-
}
|
|
1275
|
-
declare module "engine/extensions/NEEDLE_persistent_assets" {
|
|
1276
|
-
import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
1277
|
-
import { IExtensionReferenceResolver } from "engine/extensions/extension_resolver";
|
|
1278
|
-
export const EXTENSION_NAME = "NEEDLE_persistent_assets";
|
|
1279
|
-
export function isPersistentAsset(asset: any): boolean;
|
|
1280
|
-
export class NEEDLE_persistent_assets implements GLTFLoaderPlugin, IExtensionReferenceResolver {
|
|
1281
|
-
get name(): string;
|
|
1282
|
-
private parser;
|
|
1283
|
-
constructor(parser: GLTFParser);
|
|
1284
|
-
afterRoot(_result: GLTF): Promise<void>;
|
|
1285
|
-
resolve(parser: GLTFParser, path: string): Promise<void> | null | any;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
declare module "engine/engine_serialization_core" {
|
|
1289
|
-
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
|
|
1290
|
-
import { Object3D } from "three";
|
|
1291
|
-
import { Context } from "engine/engine_setup";
|
|
1292
|
-
import { SourceIdentifier } from "engine/engine_gltf";
|
|
1293
|
-
export type Constructor<T> = {
|
|
1294
|
-
new (...args: any[]): T;
|
|
1295
|
-
};
|
|
1296
|
-
export type NodeToObjectMap = {
|
|
1297
|
-
[nodeId: string]: Object3D;
|
|
1298
|
-
};
|
|
1299
|
-
export type ObjectToNodeMap = {
|
|
1300
|
-
[uuid: string]: number;
|
|
1301
|
-
};
|
|
1302
|
-
class SerializationHelper {
|
|
1303
|
-
register(type: string, ser: ITypeSerializer): void;
|
|
1304
|
-
typeMap: {
|
|
1305
|
-
[type: string]: ITypeSerializer;
|
|
1306
|
-
};
|
|
1307
|
-
getSerializer(type: string): ITypeSerializer | undefined;
|
|
1308
|
-
getSerializerForConstructor(type: any, level?: number): ITypeSerializer | undefined;
|
|
1309
|
-
}
|
|
1310
|
-
export const helper: SerializationHelper;
|
|
1311
|
-
export interface ITypeSerializer {
|
|
1312
|
-
onSerialize(data: any, context: SerializationContext): any;
|
|
1313
|
-
onDeserialize(data: any, context: SerializationContext): any;
|
|
1314
|
-
}
|
|
1315
|
-
/**
|
|
1316
|
-
* implement and call super(<type string or array>) with the type names this serializer can handle
|
|
1317
|
-
* for example:
|
|
1318
|
-
* class ColorSerializer extends TypeSerializer {
|
|
1319
|
-
* constructor() {
|
|
1320
|
-
* super("Color")
|
|
1321
|
-
* }
|
|
1322
|
-
* }
|
|
1323
|
-
*/
|
|
1324
|
-
export abstract class TypeSerializer implements ITypeSerializer {
|
|
1325
|
-
constructor(type: Constructor<any> | Constructor<any>[]);
|
|
1326
|
-
abstract onSerialize(data: any, context: SerializationContext): any | void;
|
|
1327
|
-
abstract onDeserialize(data: any, context: SerializationContext): any | void;
|
|
1328
|
-
}
|
|
1329
|
-
export interface ITypeInformation {
|
|
1330
|
-
type?: Constructor<any>;
|
|
1331
|
-
}
|
|
1332
|
-
export class SerializationContext {
|
|
1333
|
-
root: THREE.Object3D;
|
|
1334
|
-
gltf?: GLTF;
|
|
1335
|
-
gltfId?: SourceIdentifier;
|
|
1336
|
-
object: THREE.Object3D;
|
|
1337
|
-
target?: object;
|
|
1338
|
-
nodeId?: number;
|
|
1339
|
-
nodeToObject?: NodeToObjectMap;
|
|
1340
|
-
objectToNode?: ObjectToNodeMap;
|
|
1341
|
-
context?: Context;
|
|
1342
|
-
path?: string;
|
|
1343
|
-
constructor(root: THREE.Object3D);
|
|
1344
|
-
}
|
|
1345
|
-
export interface ISerializable {
|
|
1346
|
-
$serializedTypes?: {
|
|
1347
|
-
[key: string]: Constructor<any> | ITypeInformation | null;
|
|
1348
|
-
};
|
|
1349
|
-
onBeforeDeserialize?(data: any, context: SerializationContext): void | undefined | boolean;
|
|
1350
|
-
onBeforeDeserializeMember?(key: string, data: any, context: SerializationContext): void | undefined | boolean;
|
|
1351
|
-
onAfterDeserializeMember?(key: string, data: any, context: SerializationContext): void;
|
|
1352
|
-
onAfterDeserialize?(data: any, context: SerializationContext): void;
|
|
1353
|
-
}
|
|
1354
|
-
export function serializeObject(obj: ISerializable, context: SerializationContext): object | null;
|
|
1355
|
-
export function deserializeObject(obj: ISerializable, serializedData: object, context: SerializationContext): boolean;
|
|
1356
|
-
/** Object.assign behaviour but check if property is writeable (e.g. getter only properties are skipped) */
|
|
1357
|
-
export function assign(target: any, source: any): void;
|
|
1358
|
-
}
|
|
1359
1372
|
declare module "engine-components/AnimatorController" {
|
|
1360
1373
|
import { Animator } from "engine-components/Animator";
|
|
1361
1374
|
import { AnimatorControllerModel, State } from "engine/extensions/NEEDLE_animator_controller_model";
|
|
@@ -1823,7 +1836,8 @@ declare module "engine-components/XRFlag" {
|
|
|
1823
1836
|
AR = 2,
|
|
1824
1837
|
VR = 4,
|
|
1825
1838
|
FirstPerson = 8,
|
|
1826
|
-
ThirdPerson = 16
|
|
1839
|
+
ThirdPerson = 16,
|
|
1840
|
+
All = 4294967295
|
|
1827
1841
|
}
|
|
1828
1842
|
export class XRState {
|
|
1829
1843
|
static Global: XRState;
|
|
@@ -2077,6 +2091,34 @@ declare module "engine-components/WebXRSync" {
|
|
|
2077
2091
|
private getAvatarId;
|
|
2078
2092
|
}
|
|
2079
2093
|
}
|
|
2094
|
+
declare module "engine/engine_playerview" {
|
|
2095
|
+
import { Object3D } from "three";
|
|
2096
|
+
import { Context } from "engine/engine_setup";
|
|
2097
|
+
export enum ViewDevice {
|
|
2098
|
+
Browser = "browser",
|
|
2099
|
+
Headset = "headset",
|
|
2100
|
+
Handheld = "handheld"
|
|
2101
|
+
}
|
|
2102
|
+
export class PlayerView {
|
|
2103
|
+
readonly userId: string;
|
|
2104
|
+
readonly context: Context;
|
|
2105
|
+
viewDevice: ViewDevice;
|
|
2106
|
+
get currentObject(): Object3D | undefined | null;
|
|
2107
|
+
set currentObject(obj: Object3D | undefined | null);
|
|
2108
|
+
get isConnected(): boolean;
|
|
2109
|
+
removed: boolean;
|
|
2110
|
+
private _object;
|
|
2111
|
+
constructor(userId: string, context: Context);
|
|
2112
|
+
}
|
|
2113
|
+
export class PlayerViewManager {
|
|
2114
|
+
private readonly context;
|
|
2115
|
+
private readonly playerViews;
|
|
2116
|
+
constructor(context: Context);
|
|
2117
|
+
setPlayerView(id: string, obj: Object3D | undefined | null, device: ViewDevice): void;
|
|
2118
|
+
getPlayerView(id: string | null | undefined): PlayerView | undefined;
|
|
2119
|
+
removePlayerView(id: string, device: ViewDevice): void;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2080
2122
|
declare module "engine-components/WebXRAvatar" {
|
|
2081
2123
|
import { Behaviour } from "engine-components/Component";
|
|
2082
2124
|
import { WebXR } from "engine-components/WebXR";
|
|
@@ -2091,6 +2133,7 @@ declare module "engine-components/WebXRAvatar" {
|
|
|
2091
2133
|
gameObject: Object3D;
|
|
2092
2134
|
};
|
|
2093
2135
|
export class AvatarMarker extends Behaviour {
|
|
2136
|
+
static getAvatar(index: number): AvatarMarker | null;
|
|
2094
2137
|
static instances: AvatarMarker[];
|
|
2095
2138
|
static onAvatarMarkerCreated(cb: (args: AvatarMarkerEventArgs) => void): Function;
|
|
2096
2139
|
static onAvatarMarkerDestroyed(cb: (args: AvatarMarkerEventArgs) => void): Function;
|
|
@@ -2107,6 +2150,8 @@ declare module "engine-components/WebXRAvatar" {
|
|
|
2107
2150
|
private static loader;
|
|
2108
2151
|
private _isVisible;
|
|
2109
2152
|
setVisible(visible: boolean): void;
|
|
2153
|
+
get isWebXRAvatar(): boolean;
|
|
2154
|
+
/** the user id */
|
|
2110
2155
|
guid: string;
|
|
2111
2156
|
private root;
|
|
2112
2157
|
head: THREE.Object3D | null;
|
|
@@ -2995,6 +3040,7 @@ declare module "engine/engine_setup" {
|
|
|
2995
3040
|
import { Addressables } from "engine/engine_addressables";
|
|
2996
3041
|
import { Application } from "engine/engine_application";
|
|
2997
3042
|
import { ILightDataRegistry } from "engine/engine_lightdata";
|
|
3043
|
+
import { PlayerViewManager } from "engine/engine_playerview";
|
|
2998
3044
|
export const build_scene_functions: {
|
|
2999
3045
|
[name: string]: (context: Context) => Promise<void>;
|
|
3000
3046
|
};
|
|
@@ -3083,6 +3129,7 @@ declare module "engine/engine_setup" {
|
|
|
3083
3129
|
rendererData: RendererData;
|
|
3084
3130
|
addressables: Addressables;
|
|
3085
3131
|
lightmaps: ILightDataRegistry;
|
|
3132
|
+
players: PlayerViewManager;
|
|
3086
3133
|
private _sizeChanged;
|
|
3087
3134
|
private _isCreated;
|
|
3088
3135
|
private _stats;
|
|
@@ -3096,6 +3143,7 @@ declare module "engine/engine_setup" {
|
|
|
3096
3143
|
stopAllCoroutinesFrom(script: Component): void;
|
|
3097
3144
|
private _cameraStack;
|
|
3098
3145
|
setCurrentCamera(cam: Camera): void;
|
|
3146
|
+
removeCamera(cam?: Camera | null): void;
|
|
3099
3147
|
private _onBeforeRenderListeners;
|
|
3100
3148
|
/** use this to subscribe to onBeforeRender events on threejs objects */
|
|
3101
3149
|
addBeforeRenderListener(target: THREE.Object3D, callback: OnBeforeRenderCallback): void;
|
|
@@ -3663,7 +3711,6 @@ declare module "engine-components/ParticleSystem" {
|
|
|
3663
3711
|
private tempQuat;
|
|
3664
3712
|
awake(): void;
|
|
3665
3713
|
onEnable(): void;
|
|
3666
|
-
update(): void;
|
|
3667
3714
|
emit(deltaTime: number): void;
|
|
3668
3715
|
private initializeParticle;
|
|
3669
3716
|
private updateOverLifetime;
|
|
@@ -3864,36 +3911,43 @@ declare module "engine-components/SpatialTrigger" {
|
|
|
3864
3911
|
declare module "engine-components/SpectatorCamera" {
|
|
3865
3912
|
import { Behaviour } from "engine-components/Component";
|
|
3866
3913
|
import { Camera } from "engine-components/Camera";
|
|
3914
|
+
import { PlayerView } from "engine/engine_playerview";
|
|
3915
|
+
export enum SpectatorMode {
|
|
3916
|
+
FirstPerson = 0,
|
|
3917
|
+
ThirdPerson = 1
|
|
3918
|
+
}
|
|
3867
3919
|
export class SpectatorCamera extends Behaviour {
|
|
3868
3920
|
cam: Camera | null;
|
|
3869
|
-
private
|
|
3870
|
-
get
|
|
3871
|
-
set
|
|
3872
|
-
|
|
3873
|
-
|
|
3921
|
+
private _mode;
|
|
3922
|
+
get mode(): SpectatorMode;
|
|
3923
|
+
set mode(val: SpectatorMode);
|
|
3924
|
+
/** if this user is currently spectating someone else */
|
|
3925
|
+
get isSpectating(): boolean;
|
|
3926
|
+
isSpectatingUser(userId: string): boolean;
|
|
3927
|
+
isFollowedBy(userId: string): boolean;
|
|
3928
|
+
/** list of other users that are following me */
|
|
3929
|
+
get followers(): string[];
|
|
3930
|
+
stopSpectating(): void;
|
|
3931
|
+
/** player view to follow */
|
|
3932
|
+
set target(target: PlayerView | undefined);
|
|
3933
|
+
get target(): PlayerView | undefined;
|
|
3934
|
+
requestAllFollowMe(): void;
|
|
3935
|
+
private get isSpectatingSelf();
|
|
3874
3936
|
private orbit;
|
|
3875
|
-
private
|
|
3876
|
-
private spectatorUIDomElement;
|
|
3937
|
+
private _handler?;
|
|
3877
3938
|
private eventSub_WebXRRequestStartEvent;
|
|
3878
3939
|
private eventSub_WebXRStartEvent;
|
|
3879
3940
|
private eventSub_WebXREndEvent;
|
|
3941
|
+
private _debug?;
|
|
3942
|
+
private _networking;
|
|
3880
3943
|
awake(): void;
|
|
3881
3944
|
onDestroy(): void;
|
|
3882
|
-
private toggleView;
|
|
3883
|
-
private updateUI;
|
|
3884
3945
|
private isSupportedPlatform;
|
|
3885
3946
|
private onXRSessionRequestStart;
|
|
3886
3947
|
private onXRSessionStart;
|
|
3887
3948
|
private onXRSessionEnded;
|
|
3888
|
-
private
|
|
3889
|
-
private _firstPersonIsSetup;
|
|
3890
|
-
private _orbitStartPos;
|
|
3891
|
-
private _orbitStartRot;
|
|
3892
|
-
private _orbitStartPos2;
|
|
3893
|
-
private _orbitStartRot2;
|
|
3949
|
+
private followSelf;
|
|
3894
3950
|
onAfterRender(): void;
|
|
3895
|
-
private setupFollowMode;
|
|
3896
|
-
private updateFollowSettings;
|
|
3897
3951
|
private setAvatarFlagsBeforeRender;
|
|
3898
3952
|
private resetAvatarFlags;
|
|
3899
3953
|
}
|
|
@@ -3976,11 +4030,15 @@ declare module "engine-schemes/synced-camera-model" {
|
|
|
3976
4030
|
}
|
|
3977
4031
|
declare module "engine-components/SyncedCamera" {
|
|
3978
4032
|
import { Behaviour } from "engine-components/Component";
|
|
3979
|
-
import { Camera } from "engine-components/Camera";
|
|
3980
4033
|
import { AssetReference } from "engine/engine_addressables";
|
|
4034
|
+
type UserCamInfo = {
|
|
4035
|
+
obj: THREE.Object3D;
|
|
4036
|
+
lastUpdate: number;
|
|
4037
|
+
userId: string;
|
|
4038
|
+
};
|
|
3981
4039
|
export class SyncedCamera extends Behaviour {
|
|
3982
|
-
|
|
3983
|
-
|
|
4040
|
+
static instances: UserCamInfo[];
|
|
4041
|
+
getCameraObject(userId: string): THREE.Object3D | null;
|
|
3984
4042
|
cameraPrefab: THREE.Object3D | null | AssetReference;
|
|
3985
4043
|
private _lastWorldPosition;
|
|
3986
4044
|
private _lastWorldQuaternion;
|
|
@@ -3992,7 +4050,6 @@ declare module "engine-components/SyncedCamera" {
|
|
|
3992
4050
|
private _camTimeoutInSeconds;
|
|
3993
4051
|
private _receiveCallback;
|
|
3994
4052
|
awake(): Promise<void>;
|
|
3995
|
-
start(): void;
|
|
3996
4053
|
onEnable(): void;
|
|
3997
4054
|
onDisable(): void;
|
|
3998
4055
|
update(): void;
|