@@ -72,8 +72,9 @@
|
|
72
72
|
userId!: string;
|
73
73
|
}
|
74
74
|
|
75
|
-
/** The Needle Engine networking server supports the concept of ownership that can be requested.
|
76
|
-
*
|
75
|
+
/** The Needle Engine networking server supports the concept of ownership that can be requested.
|
76
|
+
* The `{@link OwnershipModel}` enum contains possible outgoing (Request) and incoming (Response) events for communicating ownership.
|
77
|
+
* We recommend using the `OwnershipModel` class instead of dealing with those events directly. */
|
77
78
|
export enum OwnershipEvent {
|
78
79
|
RequestHasOwner = 'request-has-owner',
|
79
80
|
ResponseHasOwner = "response-has-owner",
|
@@ -103,7 +104,8 @@
|
|
103
104
|
|
104
105
|
declare type WebsocketSendType = IModel | object | boolean | null | string | number;
|
105
106
|
|
106
|
-
/** Class for abstracting the concept of ownership regarding a networked object or component.
|
107
|
+
/** Class for abstracting the concept of ownership regarding a networked object or component.
|
108
|
+
* A component that is owned by another user can not be modified through networking (the server will reject changes) */
|
107
109
|
export class OwnershipModel {
|
108
110
|
|
109
111
|
public guid: string;
|
@@ -585,11 +585,16 @@
|
|
585
585
|
|
586
586
|
this.setVisibility(true);
|
587
587
|
|
588
|
-
if (
|
588
|
+
// Check if the renderer is using instancing (or any child object is supposed to use instancing)
|
589
|
+
const isUsingInstancing = this._isInstancingEnabled ||
|
590
|
+
(this.enableInstancing == true || (Array.isArray(this.enableInstancing) && this.enableInstancing.some(x => x)));
|
591
|
+
|
592
|
+
if (isUsingInstancing) {
|
589
593
|
if (this.__internalDidAwakeAndStart) this.setInstancingEnabled(true);
|
590
594
|
}
|
595
|
+
// if no insancing is used we can apply the stencil settings
|
596
|
+
// but instancing and stencil at the same time is not supported
|
591
597
|
else if (this.enabled) {
|
592
|
-
// this.gameObject.visible = true;
|
593
598
|
this.applyStencil();
|
594
599
|
}
|
595
600
|
|
@@ -25,9 +25,21 @@
|
|
25
25
|
|
26
26
|
const couldNotLoadScenePromise = Promise.resolve(false);
|
27
27
|
|
28
|
+
/**
|
29
|
+
* {@link SceneSwitcher} event argument data
|
30
|
+
*/
|
28
31
|
export type LoadSceneEvent = {
|
32
|
+
/**
|
33
|
+
* The {@link SceneSwitcher} that is loading the scene
|
34
|
+
*/
|
29
35
|
switcher: SceneSwitcher;
|
36
|
+
/**
|
37
|
+
* The scene that is being loaded
|
38
|
+
*/
|
30
39
|
scene: AssetReference;
|
40
|
+
/**
|
41
|
+
* The index of the scene that is being loaded
|
42
|
+
*/
|
31
43
|
index: number;
|
32
44
|
}
|
33
45
|
|
@@ -40,14 +52,31 @@
|
|
40
52
|
}
|
41
53
|
|
42
54
|
|
43
|
-
/**
|
44
|
-
* Available scenes are defined in the `scenes` array.
|
55
|
+
/** The SceneSwitcher can be used to dynamically load and unload extra content
|
56
|
+
* Available scenes are defined in the `scenes` array.
|
57
|
+
* Loaded scenes will be added to the SceneSwitcher's GameObject as a child and removed when another scene is loaded by the same SceneSwitcher.
|
58
|
+
* Live Examples
|
59
|
+
* - [Multi Scenes Sample](https://engine.needle.tools/samples/multi-scenes-dynamic-loading) (source code available)
|
60
|
+
* - [Needle Website](https://needle.tools)
|
61
|
+
* - [Songs Of Cultures](https://app.songsofcultures.com)
|
45
62
|
*
|
46
63
|
* ### Events
|
47
64
|
* - `loadscene-start`: Called when a scene starts loading
|
48
65
|
* - `loadscene-finished`: Called when a scene finished loading
|
49
66
|
* - `progress`: Called when a scene is loading and the progress changes
|
50
|
-
*
|
67
|
+
* @example
|
68
|
+
* ```ts
|
69
|
+
* sceneSwitcher.addEventListener("loadscene-start", (e) => {
|
70
|
+
* console.log("Loading scene", e.detail.scene.uri);
|
71
|
+
* });
|
72
|
+
* sceneSwitcher.addEventListener("loadscene-finished", (e) => {
|
73
|
+
* console.log("Finished loading scene", e.detail.scene.uri);
|
74
|
+
* });
|
75
|
+
* sceneSwitcher.addEventListener("progress", (e) => {
|
76
|
+
* console.log("Loading progress", e.loaded, e.total);
|
77
|
+
* });
|
78
|
+
* ```
|
79
|
+
*
|
51
80
|
*/
|
52
81
|
export class SceneSwitcher extends Behaviour {
|