@zephyr3d/scene 0.9.3 → 0.9.4
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/dist/animation/spring/spring_particle.js +4 -4
- package/dist/animation/spring/spring_particle.js.map +1 -1
- package/dist/app/engine.js +119 -71
- package/dist/app/engine.js.map +1 -1
- package/dist/asset/assetmanager.js +296 -244
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/loaders/gltf/gltf_loader.js +1 -0
- package/dist/asset/loaders/gltf/gltf_loader.js.map +1 -1
- package/dist/asset/model.js +57 -57
- package/dist/asset/model.js.map +1 -1
- package/dist/index.d.ts +684 -33
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/material/material.js +1 -1
- package/dist/material/material.js.map +1 -1
- package/dist/material/msdf_text.js +180 -0
- package/dist/material/msdf_text.js.map +1 -0
- package/dist/material/msdf_text_sprite.js +64 -0
- package/dist/material/msdf_text_sprite.js.map +1 -0
- package/dist/material/pbrblueprint.js +123 -108
- package/dist/material/pbrblueprint.js.map +1 -1
- package/dist/material/shader/helper.js +277 -277
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/sprite_sdf.js +106 -0
- package/dist/material/sprite_sdf.js.map +1 -0
- package/dist/posteffect/ssr.js +1 -0
- package/dist/posteffect/ssr.js.map +1 -1
- package/dist/render/abuffer_oit.js +1 -0
- package/dist/render/abuffer_oit.js.map +1 -1
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/cull_visitor.js +28 -0
- package/dist/render/cull_visitor.js.map +1 -1
- package/dist/render/drawable.js.map +1 -1
- package/dist/render/drawable_mixin.js +1 -0
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/fbm_wavegenerator.js +1 -0
- package/dist/render/fbm_wavegenerator.js.map +1 -1
- package/dist/render/gerstner_wavegenerator.js +1 -0
- package/dist/render/gerstner_wavegenerator.js.map +1 -1
- package/dist/render/globalbindgroup_allocator.js +1 -0
- package/dist/render/globalbindgroup_allocator.js.map +1 -1
- package/dist/render/render_queue.js +1 -0
- package/dist/render/render_queue.js.map +1 -1
- package/dist/scene/basesprite.js +1 -5
- package/dist/scene/basesprite.js.map +1 -1
- package/dist/scene/batchgroup.js +29 -17
- package/dist/scene/batchgroup.js.map +1 -1
- package/dist/scene/environment.js +1 -0
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/mesh.js +86 -87
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/meshdrawable.js +96 -0
- package/dist/scene/meshdrawable.js.map +1 -0
- package/dist/scene/msdftext.js +341 -0
- package/dist/scene/msdftext.js.map +1 -0
- package/dist/scene/msdftextsprite.js +349 -0
- package/dist/scene/msdftextsprite.js.map +1 -0
- package/dist/scene/particlesys.js +1 -0
- package/dist/scene/particlesys.js.map +1 -1
- package/dist/scene/scene.js +1 -0
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/scene_node.js +234 -228
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/sdftextsprite.js +322 -0
- package/dist/scene/sdftextsprite.js.map +1 -0
- package/dist/scene/terrain-cm/grass.js +1 -0
- package/dist/scene/terrain-cm/grass.js.map +1 -1
- package/dist/scene/terrain-cm/grassmaterial.js +1 -0
- package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
- package/dist/scene/terrain-cm/terrain-cm.js +1 -0
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
- package/dist/scene/textsprite.js +120 -0
- package/dist/scene/textsprite.js.map +1 -0
- package/dist/scene/water.js +1 -0
- package/dist/scene/water.js.map +1 -1
- package/dist/shadow/shader.js +1 -0
- package/dist/shadow/shader.js.map +1 -1
- package/dist/text/font/font_asset.js +884 -0
- package/dist/text/font/font_asset.js.map +1 -0
- package/dist/text/font/sfnt_reader.js +43 -0
- package/dist/text/font/sfnt_reader.js.map +1 -0
- package/dist/text/msdf/generator.js +417 -0
- package/dist/text/msdf/generator.js.map +1 -0
- package/dist/text/msdf/shape.js +143 -0
- package/dist/text/msdf/shape.js.map +1 -0
- package/dist/text/runtime/msdf_glyph_atlas.js +146 -0
- package/dist/text/runtime/msdf_glyph_atlas.js.map +1 -0
- package/dist/text/runtime/msdf_text_atlas_manager.js +47 -0
- package/dist/text/runtime/msdf_text_atlas_manager.js.map +1 -0
- package/dist/text/runtime/text_layout.js +96 -0
- package/dist/text/runtime/text_layout.js.map +1 -0
- package/dist/utility/blueprint/material/inputs.js +1275 -1091
- package/dist/utility/blueprint/material/inputs.js.map +1 -1
- package/dist/utility/blueprint/material/ir.js +16 -1
- package/dist/utility/blueprint/material/ir.js.map +1 -1
- package/dist/utility/blueprint/material/pbr.js +32 -0
- package/dist/utility/blueprint/material/pbr.js.map +1 -1
- package/dist/utility/serialization/manager.js +321 -277
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +2 -0
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/batch.js +2 -0
- package/dist/utility/serialization/scene/batch.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +2 -0
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/utility/serialization/scene/light.js +2 -0
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +1 -0
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +2 -0
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +2 -0
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/scene/particle.js +2 -0
- package/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/utility/serialization/scene/primitive.js +1 -0
- package/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/utility/serialization/scene/sprite.js +2 -0
- package/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/dist/utility/serialization/scene/terrain.js +2 -0
- package/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/utility/serialization/scene/text.js +516 -0
- package/dist/utility/serialization/scene/text.js.map +1 -0
- package/dist/utility/serialization/scene/water.js +2 -0
- package/dist/utility/serialization/scene/water.js.map +1 -1
- package/dist/utility/serialization/types.js.map +1 -1
- package/dist/values.js +48 -48
- package/dist/values.js.map +1 -1
- package/package.json +3 -3
package/dist/scene/scene_node.js
CHANGED
|
@@ -3,33 +3,33 @@ import { AnimationSet } from '../animation/animationset.js';
|
|
|
3
3
|
import { getEngine } from '../app/api.js';
|
|
4
4
|
import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttachments } from './script_attachment.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* The base class of all scene graph objects.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Responsibilities:
|
|
11
|
-
* - Defines hierarchical transform (position, rotation, scale) with lazily computed matrices.
|
|
12
|
-
* - Integrates with the scene graph (parent/children, attachment notifications).
|
|
13
|
-
* - Provides traversal utilities (`iterate`, `iterateBottomToTop`, `traverse`).
|
|
14
|
-
* - Manages visibility state and CPU/GPU picking flags.
|
|
15
|
-
* - Computes and caches local/world bounding volumes, notifies scene for spatial updates.
|
|
16
|
-
* - Supports cloning and shared model instancing.
|
|
17
|
-
* - Emits events on visibility, transform, bounding volume, attachment, and disposal.
|
|
18
|
-
*
|
|
19
|
-
* Performance:
|
|
20
|
-
* - `localMatrix`, `worldMatrix`, and `invWorldMatrix` are cached until invalidated.
|
|
21
|
-
* - Transform mutations and `invalidateBoundingVolume` update caches and spatial structures.
|
|
22
|
-
*
|
|
23
|
-
* Events:
|
|
24
|
-
* - `nodeattached`, `noderemoved`, `visiblechanged`, `transformchanged`, `bvchanged`, `dispose`.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
6
|
+
/**
|
|
7
|
+
* The base class of all scene graph objects.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Responsibilities:
|
|
11
|
+
* - Defines hierarchical transform (position, rotation, scale) with lazily computed matrices.
|
|
12
|
+
* - Integrates with the scene graph (parent/children, attachment notifications).
|
|
13
|
+
* - Provides traversal utilities (`iterate`, `iterateBottomToTop`, `traverse`).
|
|
14
|
+
* - Manages visibility state and CPU/GPU picking flags.
|
|
15
|
+
* - Computes and caches local/world bounding volumes, notifies scene for spatial updates.
|
|
16
|
+
* - Supports cloning and shared model instancing.
|
|
17
|
+
* - Emits events on visibility, transform, bounding volume, attachment, and disposal.
|
|
18
|
+
*
|
|
19
|
+
* Performance:
|
|
20
|
+
* - `localMatrix`, `worldMatrix`, and `invWorldMatrix` are cached until invalidated.
|
|
21
|
+
* - Transform mutations and `invalidateBoundingVolume` update caches and spatial structures.
|
|
22
|
+
*
|
|
23
|
+
* Events:
|
|
24
|
+
* - `nodeattached`, `noderemoved`, `visiblechanged`, `transformchanged`, `bvchanged`, `dispose`.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
27
|
*/ class SceneNode extends makeObservable(Disposable)() {
|
|
28
28
|
static _runTimeId = 1;
|
|
29
|
-
/*
|
|
30
|
-
static readonly PICK_INHERITED = -1;
|
|
31
|
-
static readonly PICK_DISABLED = 0;
|
|
32
|
-
static readonly PICK_ENABLED = 1;
|
|
29
|
+
/*
|
|
30
|
+
static readonly PICK_INHERITED = -1;
|
|
31
|
+
static readonly PICK_DISABLED = 0;
|
|
32
|
+
static readonly PICK_ENABLED = 1;
|
|
33
33
|
*/ /** Bounding-box draw mode inherited from nearest graph ancestor. */ static BBOXDRAW_INHERITED = -1;
|
|
34
34
|
/** Disable bounding-box visualization. */ static BBOXDRAW_DISABLED = 0;
|
|
35
35
|
/** Draw local-space bounding box. */ static BBOXDRAW_LOCAL = 1;
|
|
@@ -70,14 +70,14 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
70
70
|
/** @internal Arbitrary metadata payload for this node. */ _metaData;
|
|
71
71
|
/** @internal If greater than zero, suppress transform-change callbacks (during bulk updates). */ _disableCallback;
|
|
72
72
|
/** @internal User-attached script entries (engine-defined). */ _scripts;
|
|
73
|
-
/**
|
|
74
|
-
* Construct a scene node.
|
|
75
|
-
*
|
|
76
|
-
* @remarks
|
|
77
|
-
* If a `scene` is provided and this is not the root node, the node is reparented
|
|
78
|
-
* under the scene's root immediately.
|
|
79
|
-
*
|
|
80
|
-
* @param scene - Scene that will own this node.
|
|
73
|
+
/**
|
|
74
|
+
* Construct a scene node.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* If a `scene` is provided and this is not the root node, the node is reparented
|
|
78
|
+
* under the scene's root immediately.
|
|
79
|
+
*
|
|
80
|
+
* @param scene - Scene that will own this node.
|
|
81
81
|
*/ constructor(scene){
|
|
82
82
|
super();
|
|
83
83
|
this._runtimeId = SceneNode._runTimeId++;
|
|
@@ -118,11 +118,11 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
118
118
|
this._parent = null;
|
|
119
119
|
this.reparent(scene?.rootNode ?? null);
|
|
120
120
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Whether the node should be inserted into the scene's spatial structure.
|
|
123
|
-
*
|
|
124
|
-
* @remarks
|
|
125
|
-
* Toggling this hints the scene to (re)place the node in octree/acceleration structures.
|
|
121
|
+
/**
|
|
122
|
+
* Whether the node should be inserted into the scene's spatial structure.
|
|
123
|
+
*
|
|
124
|
+
* @remarks
|
|
125
|
+
* Toggling this hints the scene to (re)place the node in octree/acceleration structures.
|
|
126
126
|
*/ get placeToOctree() {
|
|
127
127
|
return this._placeToOctree;
|
|
128
128
|
}
|
|
@@ -134,88 +134,88 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
/**
|
|
138
|
-
* Node's runtime unique identifier
|
|
137
|
+
/**
|
|
138
|
+
* Node's runtime unique identifier
|
|
139
139
|
*/ get runtimeId() {
|
|
140
140
|
return this._runtimeId;
|
|
141
141
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Node's persistent identifier.
|
|
144
|
-
*
|
|
145
|
-
* @remarks
|
|
146
|
-
* Changing this affects serialization and registry lookup; ensure uniqueness.
|
|
142
|
+
/**
|
|
143
|
+
* Node's persistent identifier.
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
* Changing this affects serialization and registry lookup; ensure uniqueness.
|
|
147
147
|
*/ get persistentId() {
|
|
148
148
|
return this._id;
|
|
149
149
|
}
|
|
150
150
|
set persistentId(id) {
|
|
151
151
|
this._id = id;
|
|
152
152
|
}
|
|
153
|
-
/**
|
|
154
|
-
* If not empty, this node was loaded from a prefab
|
|
155
|
-
*
|
|
156
|
-
* @remarks
|
|
157
|
-
* Internal used for serialization
|
|
153
|
+
/**
|
|
154
|
+
* If not empty, this node was loaded from a prefab
|
|
155
|
+
*
|
|
156
|
+
* @remarks
|
|
157
|
+
* Internal used for serialization
|
|
158
158
|
*/ get prefabId() {
|
|
159
159
|
return this._prefabId;
|
|
160
160
|
}
|
|
161
161
|
set prefabId(id) {
|
|
162
162
|
this._prefabId = id;
|
|
163
163
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Get prefab node this node belongs to, or null if this node does not belongs to any prefab
|
|
166
|
-
* @returns prefab node this node belongs to
|
|
164
|
+
/**
|
|
165
|
+
* Get prefab node this node belongs to, or null if this node does not belongs to any prefab
|
|
166
|
+
* @returns prefab node this node belongs to
|
|
167
167
|
*/ getPrefabNode() {
|
|
168
168
|
return this._prefabId ? this : this.parent?.getPrefabNode() ?? null;
|
|
169
169
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Translation type if this is a joint node of any skeleton
|
|
172
|
-
*
|
|
173
|
-
* @remarks
|
|
174
|
-
* Internal used for serialization
|
|
170
|
+
/**
|
|
171
|
+
* Translation type if this is a joint node of any skeleton
|
|
172
|
+
*
|
|
173
|
+
* @remarks
|
|
174
|
+
* Internal used for serialization
|
|
175
175
|
*/ get jointTypeT() {
|
|
176
176
|
return this._jointTypeT;
|
|
177
177
|
}
|
|
178
178
|
set jointTypeT(val) {
|
|
179
179
|
this._jointTypeT = val;
|
|
180
180
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Scale type if this is a joint node of any skeleton
|
|
183
|
-
*
|
|
184
|
-
* @remarks
|
|
185
|
-
* Internal used for serialization
|
|
181
|
+
/**
|
|
182
|
+
* Scale type if this is a joint node of any skeleton
|
|
183
|
+
*
|
|
184
|
+
* @remarks
|
|
185
|
+
* Internal used for serialization
|
|
186
186
|
*/ get jointTypeS() {
|
|
187
187
|
return this._jointTypeS;
|
|
188
188
|
}
|
|
189
189
|
set jointTypeS(val) {
|
|
190
190
|
this._jointTypeS = val;
|
|
191
191
|
}
|
|
192
|
-
/**
|
|
193
|
-
* Rotation type if this is a joint node of any skeleton
|
|
194
|
-
*
|
|
195
|
-
* @remarks
|
|
196
|
-
* Internal used for serialization
|
|
192
|
+
/**
|
|
193
|
+
* Rotation type if this is a joint node of any skeleton
|
|
194
|
+
*
|
|
195
|
+
* @remarks
|
|
196
|
+
* Internal used for serialization
|
|
197
197
|
*/ get jointTypeR() {
|
|
198
198
|
return this._jointTypeR;
|
|
199
199
|
}
|
|
200
200
|
set jointTypeR(val) {
|
|
201
201
|
this._jointTypeR = val;
|
|
202
202
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Arbitrary metadata associated with this node.
|
|
205
|
-
*
|
|
206
|
-
* @remarks
|
|
207
|
-
* Stored and transported with the node; format is application-defined.
|
|
203
|
+
/**
|
|
204
|
+
* Arbitrary metadata associated with this node.
|
|
205
|
+
*
|
|
206
|
+
* @remarks
|
|
207
|
+
* Stored and transported with the node; format is application-defined.
|
|
208
208
|
*/ get metaData() {
|
|
209
209
|
return this._metaData;
|
|
210
210
|
}
|
|
211
211
|
set metaData(val) {
|
|
212
212
|
this._metaData = val;
|
|
213
213
|
}
|
|
214
|
-
/**
|
|
215
|
-
* Attached script filename or identifier (engine-specific).
|
|
216
|
-
*
|
|
217
|
-
* @remarks
|
|
218
|
-
* Integrates with the engine’s scripting system if available.
|
|
214
|
+
/**
|
|
215
|
+
* Attached script filename or identifier (engine-specific).
|
|
216
|
+
*
|
|
217
|
+
* @remarks
|
|
218
|
+
* Integrates with the engine’s scripting system if available.
|
|
219
219
|
*/ get script() {
|
|
220
220
|
return this._scripts[0]?.script ?? '';
|
|
221
221
|
}
|
|
@@ -229,8 +229,8 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
229
229
|
this._scripts.unshift(new ScriptAttachment(script));
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
/**
|
|
233
|
-
* Script component configuration payload used by editor/runtime script components.
|
|
232
|
+
/**
|
|
233
|
+
* Script component configuration payload used by editor/runtime script components.
|
|
234
234
|
*/ get scriptConfig() {
|
|
235
235
|
return this._scripts[0]?.config ?? null;
|
|
236
236
|
}
|
|
@@ -245,16 +245,16 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
245
245
|
this._scripts.splice(0, 1);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
/**
|
|
249
|
-
* All script attachments on this node.
|
|
248
|
+
/**
|
|
249
|
+
* All script attachments on this node.
|
|
250
250
|
*/ get scripts() {
|
|
251
251
|
return this._scripts;
|
|
252
252
|
}
|
|
253
253
|
set scripts(value) {
|
|
254
254
|
this._scripts = normalizeScriptAttachments(value);
|
|
255
255
|
}
|
|
256
|
-
/**
|
|
257
|
-
* Script configs for all script attachments.
|
|
256
|
+
/**
|
|
257
|
+
* Script configs for all script attachments.
|
|
258
258
|
*/ get scriptConfigs() {
|
|
259
259
|
return this._scripts.map((item)=>item.config);
|
|
260
260
|
}
|
|
@@ -270,8 +270,8 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
270
270
|
}
|
|
271
271
|
this._scripts = this._scripts.filter((item)=>item.script || item.config != null);
|
|
272
272
|
}
|
|
273
|
-
/**
|
|
274
|
-
* Display name of the node (for UI/debugging).
|
|
273
|
+
/**
|
|
274
|
+
* Display name of the node (for UI/debugging).
|
|
275
275
|
*/ get name() {
|
|
276
276
|
return this._name;
|
|
277
277
|
}
|
|
@@ -281,8 +281,8 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
281
281
|
/** The owning scene. */ get scene() {
|
|
282
282
|
return this._scene;
|
|
283
283
|
}
|
|
284
|
-
/**
|
|
285
|
-
* Whether this node is currently attached under the scene's root.
|
|
284
|
+
/**
|
|
285
|
+
* Whether this node is currently attached under the scene's root.
|
|
286
286
|
*/ get attached() {
|
|
287
287
|
if (!this._scene) {
|
|
288
288
|
return false;
|
|
@@ -293,20 +293,20 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
293
293
|
}
|
|
294
294
|
return node === this._scene.rootNode;
|
|
295
295
|
}
|
|
296
|
-
/**
|
|
297
|
-
* If true, the node is logically sealed; some operations (like cloning as child)
|
|
298
|
-
* may be restricted by engine policies.
|
|
296
|
+
/**
|
|
297
|
+
* If true, the node is logically sealed; some operations (like cloning as child)
|
|
298
|
+
* may be restricted by engine policies.
|
|
299
299
|
*/ get sealed() {
|
|
300
300
|
return this._sealed;
|
|
301
301
|
}
|
|
302
302
|
set sealed(val) {
|
|
303
303
|
this._sealed = val;
|
|
304
304
|
}
|
|
305
|
-
/**
|
|
306
|
-
* Lazily created animation set for this node.
|
|
307
|
-
*
|
|
308
|
-
* @remarks
|
|
309
|
-
* Accessing this schedules the node for update in the scene.
|
|
305
|
+
/**
|
|
306
|
+
* Lazily created animation set for this node.
|
|
307
|
+
*
|
|
308
|
+
* @remarks
|
|
309
|
+
* Accessing this schedules the node for update in the scene.
|
|
310
310
|
*/ get animationSet() {
|
|
311
311
|
if (!this._animationSet.get()) {
|
|
312
312
|
this._animationSet.set(new AnimationSet(this));
|
|
@@ -314,24 +314,24 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
314
314
|
}
|
|
315
315
|
return this._animationSet.get();
|
|
316
316
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Shared model reference for instancing/streaming systems.
|
|
317
|
+
/**
|
|
318
|
+
* Shared model reference for instancing/streaming systems.
|
|
319
319
|
*/ get sharedModel() {
|
|
320
320
|
return this._sharedModel.get();
|
|
321
321
|
}
|
|
322
322
|
set sharedModel(model) {
|
|
323
323
|
this._sharedModel.set(model);
|
|
324
324
|
}
|
|
325
|
-
/**
|
|
326
|
-
* Clone this node.
|
|
327
|
-
*
|
|
328
|
-
* @remarks
|
|
329
|
-
* If a shared model exists, it may create an instanced node. The clone is
|
|
330
|
-
* attached under the same parent; children are cloned based on `method` and `recursive`.
|
|
331
|
-
*
|
|
332
|
-
* @param method - Clone method ('deep' or 'instance').
|
|
333
|
-
* @param recursive - Whether children are cloned recursively.
|
|
334
|
-
* @returns New node instance
|
|
325
|
+
/**
|
|
326
|
+
* Clone this node.
|
|
327
|
+
*
|
|
328
|
+
* @remarks
|
|
329
|
+
* If a shared model exists, it may create an instanced node. The clone is
|
|
330
|
+
* attached under the same parent; children are cloned based on `method` and `recursive`.
|
|
331
|
+
*
|
|
332
|
+
* @param method - Clone method ('deep' or 'instance').
|
|
333
|
+
* @param recursive - Whether children are cloned recursively.
|
|
334
|
+
* @returns New node instance
|
|
335
335
|
*/ async clone() {
|
|
336
336
|
this.iterate((node)=>{
|
|
337
337
|
if (node.isClipmapTerrain()) {
|
|
@@ -357,53 +357,53 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
357
357
|
}
|
|
358
358
|
return other;
|
|
359
359
|
}
|
|
360
|
-
/**
|
|
361
|
-
* Whether the given node is a direct child of this node.
|
|
362
|
-
* @param child - The node to be checked
|
|
363
|
-
* @returns true if the given node is a direct child of this node, false otherwise
|
|
360
|
+
/**
|
|
361
|
+
* Whether the given node is a direct child of this node.
|
|
362
|
+
* @param child - The node to be checked
|
|
363
|
+
* @returns true if the given node is a direct child of this node, false otherwise
|
|
364
364
|
*/ hasChild(child) {
|
|
365
365
|
return child && child.parent === this;
|
|
366
366
|
}
|
|
367
|
-
/**
|
|
368
|
-
* Remove all children from this node.
|
|
367
|
+
/**
|
|
368
|
+
* Remove all children from this node.
|
|
369
369
|
*/ removeChildren() {
|
|
370
370
|
while(this._children.length){
|
|
371
371
|
this._children[0].get().remove();
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Whether this node is an ancestor (direct or indirect) of the given node.
|
|
374
|
+
/**
|
|
375
|
+
* Whether this node is an ancestor (direct or indirect) of the given node.
|
|
376
376
|
*/ isParentOf(child) {
|
|
377
377
|
while(child && child !== this){
|
|
378
378
|
child = child.parent;
|
|
379
379
|
}
|
|
380
380
|
return child === this;
|
|
381
381
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Detach this node from its parent.
|
|
384
|
-
*
|
|
385
|
-
* @returns this
|
|
382
|
+
/**
|
|
383
|
+
* Detach this node from its parent.
|
|
384
|
+
*
|
|
385
|
+
* @returns this
|
|
386
386
|
*/ remove() {
|
|
387
387
|
this.parent = null;
|
|
388
388
|
return this;
|
|
389
389
|
}
|
|
390
|
-
/**
|
|
391
|
-
* Depth-first traversal of this node's subtree (pre-order).
|
|
392
|
-
*
|
|
393
|
-
* @param v - Visitor invoked on each node.
|
|
390
|
+
/**
|
|
391
|
+
* Depth-first traversal of this node's subtree (pre-order).
|
|
392
|
+
*
|
|
393
|
+
* @param v - Visitor invoked on each node.
|
|
394
394
|
*/ traverse(v) {
|
|
395
395
|
v.visit(this);
|
|
396
396
|
for (const child of this._children){
|
|
397
397
|
child.get().traverse(v);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
/**
|
|
401
|
-
* Iterate self and descendants in pre-order.
|
|
402
|
-
*
|
|
403
|
-
* Warning: Do not remove children during this iteration. To allow removal, use `iterateBottomToTop`.
|
|
404
|
-
*
|
|
405
|
-
* @param callback - Called for each node; if returns true, iteration stops.
|
|
406
|
-
* @returns If returns true, the iteration will immediately stop.
|
|
400
|
+
/**
|
|
401
|
+
* Iterate self and descendants in pre-order.
|
|
402
|
+
*
|
|
403
|
+
* Warning: Do not remove children during this iteration. To allow removal, use `iterateBottomToTop`.
|
|
404
|
+
*
|
|
405
|
+
* @param callback - Called for each node; if returns true, iteration stops.
|
|
406
|
+
* @returns If returns true, the iteration will immediately stop.
|
|
407
407
|
*/ iterate(callback) {
|
|
408
408
|
if (callback(this)) {
|
|
409
409
|
return true;
|
|
@@ -415,13 +415,13 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
415
415
|
}
|
|
416
416
|
return false;
|
|
417
417
|
}
|
|
418
|
-
/**
|
|
419
|
-
* Iterate self and descendants in reverse post-order (bottom-to-top).
|
|
420
|
-
*
|
|
421
|
-
* Child nodes can be safely removed during this iteration.
|
|
422
|
-
*
|
|
423
|
-
* @param callback - Called for each node; if returns true, iteration stops.
|
|
424
|
-
* @returns If returns true, the iteration will immediately stop.
|
|
418
|
+
/**
|
|
419
|
+
* Iterate self and descendants in reverse post-order (bottom-to-top).
|
|
420
|
+
*
|
|
421
|
+
* Child nodes can be safely removed during this iteration.
|
|
422
|
+
*
|
|
423
|
+
* @param callback - Called for each node; if returns true, iteration stops.
|
|
424
|
+
* @returns If returns true, the iteration will immediately stop.
|
|
425
425
|
*/ iterateBottomToTop(callback) {
|
|
426
426
|
for(let i = this._children.length - 1; i >= 0; i--){
|
|
427
427
|
const child = this._children[i];
|
|
@@ -446,6 +446,12 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
446
446
|
/** Type guard: true if this node is a sprite */ isSprite() {
|
|
447
447
|
return false;
|
|
448
448
|
}
|
|
449
|
+
/** Type guard: true if this node is a MSDF text sprite */ isMSDFTextSprite() {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
/** Type guard: true if this node is a MSDF text sprite */ isMSDFText() {
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
449
455
|
/** Type guard: true if this node is a water node. */ isWater() {
|
|
450
456
|
return false;
|
|
451
457
|
}
|
|
@@ -464,15 +470,15 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
464
470
|
/** true if this is a punctual light node, false otherwise */ isPunctualLight() {
|
|
465
471
|
return false;
|
|
466
472
|
}
|
|
467
|
-
/**
|
|
468
|
-
* Computes the bounding volume of the node
|
|
469
|
-
* @returns The output bounding volume
|
|
473
|
+
/**
|
|
474
|
+
* Computes the bounding volume of the node
|
|
475
|
+
* @returns The output bounding volume
|
|
470
476
|
*/ computeBoundingVolume() {
|
|
471
477
|
return null;
|
|
472
478
|
}
|
|
473
|
-
/**
|
|
474
|
-
* Gets the bounding volume of the node
|
|
475
|
-
* @returns The bounding volume of the node
|
|
479
|
+
/**
|
|
480
|
+
* Gets the bounding volume of the node
|
|
481
|
+
* @returns The bounding volume of the node
|
|
476
482
|
*/ getBoundingVolume() {
|
|
477
483
|
if (this._bvDirty) {
|
|
478
484
|
this._bv = this.computeBoundingVolume();
|
|
@@ -480,9 +486,9 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
480
486
|
}
|
|
481
487
|
return this._bv;
|
|
482
488
|
}
|
|
483
|
-
/**
|
|
484
|
-
* Sets the bounding volume of the node
|
|
485
|
-
* @param bv - The bounding volume to set
|
|
489
|
+
/**
|
|
490
|
+
* Sets the bounding volume of the node
|
|
491
|
+
* @param bv - The bounding volume to set
|
|
486
492
|
*/ setBoundingVolume(bv) {
|
|
487
493
|
if (bv !== this._bv) {
|
|
488
494
|
this._bv = bv;
|
|
@@ -490,23 +496,23 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
490
496
|
this.invalidateWorldBoundingVolume(false);
|
|
491
497
|
}
|
|
492
498
|
}
|
|
493
|
-
/**
|
|
494
|
-
* Gets the world space bounding volume of the node
|
|
495
|
-
* @returns The world space bounding volume of the node
|
|
499
|
+
/**
|
|
500
|
+
* Gets the world space bounding volume of the node
|
|
501
|
+
* @returns The world space bounding volume of the node
|
|
496
502
|
*/ getWorldBoundingVolume() {
|
|
497
503
|
if (!this._bvWorld) {
|
|
498
504
|
this._bvWorld = this.computeWorldBoundingVolume(this.getBoundingVolume());
|
|
499
505
|
}
|
|
500
506
|
return this._bvWorld;
|
|
501
507
|
}
|
|
502
|
-
/**
|
|
503
|
-
* Computes the world space bounding volume of the node
|
|
504
|
-
* @returns The output bounding volume
|
|
508
|
+
/**
|
|
509
|
+
* Computes the world space bounding volume of the node
|
|
510
|
+
* @returns The output bounding volume
|
|
505
511
|
*/ computeWorldBoundingVolume(localBV) {
|
|
506
512
|
return localBV?.transform(this.worldMatrix) ?? null;
|
|
507
513
|
}
|
|
508
|
-
/**
|
|
509
|
-
* Force the bounding volume to be recalculated
|
|
514
|
+
/**
|
|
515
|
+
* Force the bounding volume to be recalculated
|
|
510
516
|
*/ invalidateBoundingVolume() {
|
|
511
517
|
this._bvDirty = true;
|
|
512
518
|
this.invalidateWorldBoundingVolume(false);
|
|
@@ -571,12 +577,12 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
571
577
|
set gpuPickable(val) {
|
|
572
578
|
this._gpuPickable = !!val;
|
|
573
579
|
}
|
|
574
|
-
/**
|
|
575
|
-
* Finds a scene node by its persistent ID.
|
|
576
|
-
*
|
|
577
|
-
* @typeParam T - Expected node type.
|
|
578
|
-
* @param id - Persistent identifier to match against `SceneNode.persistentId`.
|
|
579
|
-
* @returns The first matching node, or `null` if not found.
|
|
580
|
+
/**
|
|
581
|
+
* Finds a scene node by its persistent ID.
|
|
582
|
+
*
|
|
583
|
+
* @typeParam T - Expected node type.
|
|
584
|
+
* @param id - Persistent identifier to match against `SceneNode.persistentId`.
|
|
585
|
+
* @returns The first matching node, or `null` if not found.
|
|
580
586
|
*/ findNodeById(id) {
|
|
581
587
|
let node = null;
|
|
582
588
|
this.iterate((child)=>{
|
|
@@ -587,10 +593,10 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
587
593
|
});
|
|
588
594
|
return node;
|
|
589
595
|
}
|
|
590
|
-
/**
|
|
591
|
-
* Finds a skeleton object by its persistent ID.
|
|
592
|
-
* @param id - Persistent identifier to match against `Skeleton.persistentId`.
|
|
593
|
-
* @returns The first matchign node, or `null` if not found.
|
|
596
|
+
/**
|
|
597
|
+
* Finds a skeleton object by its persistent ID.
|
|
598
|
+
* @param id - Persistent identifier to match against `Skeleton.persistentId`.
|
|
599
|
+
* @returns The first matchign node, or `null` if not found.
|
|
594
600
|
*/ findSkeletonById(id) {
|
|
595
601
|
const prefabNode = this.getPrefabNode() ?? this;
|
|
596
602
|
let sk = null;
|
|
@@ -601,18 +607,18 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
601
607
|
// avoid ts2339 compilation error (maybe a typescript bug?)
|
|
602
608
|
return sk?.get() ?? null;
|
|
603
609
|
}
|
|
604
|
-
/**
|
|
605
|
-
* Finds a scene node by name.
|
|
606
|
-
*
|
|
607
|
-
* If multiple nodes share the same name, returns the first match encountered
|
|
608
|
-
* during traversal.
|
|
609
|
-
*
|
|
610
|
-
* @typeParam T - Expected node type.
|
|
611
|
-
* @param name - Node name to match.
|
|
612
|
-
* @returns The first matching node, or `null` if not found.
|
|
613
|
-
*
|
|
614
|
-
* @remarks
|
|
615
|
-
* Names are not guaranteed unique. Prefer IDs for stable references.
|
|
610
|
+
/**
|
|
611
|
+
* Finds a scene node by name.
|
|
612
|
+
*
|
|
613
|
+
* If multiple nodes share the same name, returns the first match encountered
|
|
614
|
+
* during traversal.
|
|
615
|
+
*
|
|
616
|
+
* @typeParam T - Expected node type.
|
|
617
|
+
* @param name - Node name to match.
|
|
618
|
+
* @returns The first matching node, or `null` if not found.
|
|
619
|
+
*
|
|
620
|
+
* @remarks
|
|
621
|
+
* Names are not guaranteed unique. Prefer IDs for stable references.
|
|
616
622
|
*/ findNodeByName(name) {
|
|
617
623
|
let node = null;
|
|
618
624
|
this.iterate((child)=>{
|
|
@@ -704,11 +710,11 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
704
710
|
}
|
|
705
711
|
}
|
|
706
712
|
}
|
|
707
|
-
/**
|
|
708
|
-
* Get called when this node is attached to scene
|
|
713
|
+
/**
|
|
714
|
+
* Get called when this node is attached to scene
|
|
709
715
|
*/ _onAttached() {}
|
|
710
|
-
/**
|
|
711
|
-
* Get called when this node is detached from scene
|
|
716
|
+
/**
|
|
717
|
+
* Get called when this node is detached from scene
|
|
712
718
|
*/ _onDetached() {}
|
|
713
719
|
/** @internal */ _attached() {
|
|
714
720
|
this.iterate((child)=>{
|
|
@@ -741,24 +747,24 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
741
747
|
/** Children of this xform */ get children() {
|
|
742
748
|
return this._children.map((child)=>child.get());
|
|
743
749
|
}
|
|
744
|
-
/**
|
|
745
|
-
* Position of the xform relative to it's parent
|
|
750
|
+
/**
|
|
751
|
+
* Position of the xform relative to it's parent
|
|
746
752
|
*/ get position() {
|
|
747
753
|
return this._position;
|
|
748
754
|
}
|
|
749
755
|
set position(val) {
|
|
750
756
|
this._position.setXYZ(val[0], val[1], val[2]);
|
|
751
757
|
}
|
|
752
|
-
/**
|
|
753
|
-
* Scaling of the xform
|
|
758
|
+
/**
|
|
759
|
+
* Scaling of the xform
|
|
754
760
|
*/ get scale() {
|
|
755
761
|
return this._scaling;
|
|
756
762
|
}
|
|
757
763
|
set scale(val) {
|
|
758
764
|
this._scaling.setXYZ(val[0], val[1], val[2]);
|
|
759
765
|
}
|
|
760
|
-
/**
|
|
761
|
-
* Rotation of the xform
|
|
766
|
+
/**
|
|
767
|
+
* Rotation of the xform
|
|
762
768
|
*/ get rotation() {
|
|
763
769
|
return this._rotation;
|
|
764
770
|
}
|
|
@@ -793,32 +799,32 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
793
799
|
thisToOther(other, v, result) {
|
|
794
800
|
return other.worldToThis(this.thisToWorld(v, result), result);
|
|
795
801
|
}
|
|
796
|
-
/**
|
|
797
|
-
* Gets the position of the xform in world space
|
|
798
|
-
* @returns position of the xform in world space
|
|
802
|
+
/**
|
|
803
|
+
* Gets the position of the xform in world space
|
|
804
|
+
* @returns position of the xform in world space
|
|
799
805
|
*/ getWorldPosition(outPos) {
|
|
800
806
|
return outPos?.setXYZ(this.worldMatrix.m03, this.worldMatrix.m13, this.worldMatrix.m23) ?? new Vector3(this.worldMatrix.m03, this.worldMatrix.m13, this.worldMatrix.m23);
|
|
801
807
|
}
|
|
802
|
-
/**
|
|
803
|
-
* Moves the xform by an offset vector
|
|
804
|
-
* @param delta - The offset vector
|
|
805
|
-
* @returns self
|
|
808
|
+
/**
|
|
809
|
+
* Moves the xform by an offset vector
|
|
810
|
+
* @param delta - The offset vector
|
|
811
|
+
* @returns self
|
|
806
812
|
*/ moveBy(delta) {
|
|
807
813
|
this._position.addBy(delta);
|
|
808
814
|
return this;
|
|
809
815
|
}
|
|
810
|
-
/**
|
|
811
|
-
* Scales the xform by a given scale factor
|
|
812
|
-
* @param factor - The scale factor
|
|
813
|
-
* @returns self
|
|
816
|
+
/**
|
|
817
|
+
* Scales the xform by a given scale factor
|
|
818
|
+
* @param factor - The scale factor
|
|
819
|
+
* @returns self
|
|
814
820
|
*/ scaleBy(factor) {
|
|
815
821
|
this._scaling.mulBy(factor);
|
|
816
822
|
return this;
|
|
817
823
|
}
|
|
818
|
-
/**
|
|
819
|
-
* Sets the local transform matrix of the xform
|
|
820
|
-
* @param matrix - The transform matrix to set
|
|
821
|
-
* @returns self
|
|
824
|
+
/**
|
|
825
|
+
* Sets the local transform matrix of the xform
|
|
826
|
+
* @param matrix - The transform matrix to set
|
|
827
|
+
* @returns self
|
|
822
828
|
*/ setLocalTransform(matrix) {
|
|
823
829
|
this._disableCallback++;
|
|
824
830
|
matrix.decompose(this._scaling, this._rotation, this._position);
|
|
@@ -848,15 +854,15 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
848
854
|
this.syncTransform();
|
|
849
855
|
return this._invWorldMatrix;
|
|
850
856
|
}
|
|
851
|
-
/**
|
|
852
|
-
* Calculate local transform matrix
|
|
853
|
-
* @param outMatrix - Matrix object that holds the result of calculation
|
|
857
|
+
/**
|
|
858
|
+
* Calculate local transform matrix
|
|
859
|
+
* @param outMatrix - Matrix object that holds the result of calculation
|
|
854
860
|
*/ calculateLocalTransform(outMatrix) {
|
|
855
861
|
outMatrix.compose(this._scaling, this._rotation, this._position);
|
|
856
862
|
}
|
|
857
|
-
/**
|
|
858
|
-
* Calculate world transform matrix
|
|
859
|
-
* @param outMatrix - Matrix object that holds the result of calculation
|
|
863
|
+
/**
|
|
864
|
+
* Calculate world transform matrix
|
|
865
|
+
* @param outMatrix - Matrix object that holds the result of calculation
|
|
860
866
|
*/ calculateWorldTransform(outMatrix) {
|
|
861
867
|
if (this._parent) {
|
|
862
868
|
Matrix4x4.multiplyAffine(this._parent.worldMatrix, this.localMatrix, outMatrix);
|
|
@@ -864,21 +870,21 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
864
870
|
outMatrix.set(this.localMatrix);
|
|
865
871
|
}
|
|
866
872
|
}
|
|
867
|
-
/**
|
|
868
|
-
* Sets the local tranformation matrix by a look-at matrix
|
|
869
|
-
* @param eye - The eye position used to make the look-at matrix
|
|
870
|
-
* @param target - The target position used to make the look-at matrix
|
|
871
|
-
* @param up - The up vector used to make the look-at matrix
|
|
872
|
-
* @returns self
|
|
873
|
+
/**
|
|
874
|
+
* Sets the local tranformation matrix by a look-at matrix
|
|
875
|
+
* @param eye - The eye position used to make the look-at matrix
|
|
876
|
+
* @param target - The target position used to make the look-at matrix
|
|
877
|
+
* @param up - The up vector used to make the look-at matrix
|
|
878
|
+
* @returns self
|
|
873
879
|
*/ lookAt(eye, target, up) {
|
|
874
880
|
this.setLocalTransform(Matrix4x4.lookAt(eye, target, up));
|
|
875
881
|
return this;
|
|
876
882
|
}
|
|
877
|
-
/**
|
|
878
|
-
* Update node state once per-frame
|
|
879
|
-
* @param frameId - Current frame id
|
|
880
|
-
* @param elapsedInSeconds - Elapsed time from game start in seconds
|
|
881
|
-
* @param deltaInSeconds - Elapsed time since previous frame in seconds
|
|
883
|
+
/**
|
|
884
|
+
* Update node state once per-frame
|
|
885
|
+
* @param frameId - Current frame id
|
|
886
|
+
* @param elapsedInSeconds - Elapsed time from game start in seconds
|
|
887
|
+
* @param deltaInSeconds - Elapsed time since previous frame in seconds
|
|
882
888
|
*/ update(frameId, elapsedInSeconds, deltaInSeconds) {
|
|
883
889
|
if (!this.attached) {
|
|
884
890
|
return;
|
|
@@ -893,16 +899,16 @@ import { ScriptAttachment, normalizeScriptAttachmentConfig, normalizeScriptAttac
|
|
|
893
899
|
}
|
|
894
900
|
}
|
|
895
901
|
}
|
|
896
|
-
/**
|
|
897
|
-
* Update node state once per-camera
|
|
898
|
-
* @param _camera - Updates according to which camera
|
|
899
|
-
* @param _elapsedInSeconds - Elapsed time from game start in seconds
|
|
900
|
-
* @param _deltaInSeconds - Elapsed time since previous frame in seconds
|
|
902
|
+
/**
|
|
903
|
+
* Update node state once per-camera
|
|
904
|
+
* @param _camera - Updates according to which camera
|
|
905
|
+
* @param _elapsedInSeconds - Elapsed time from game start in seconds
|
|
906
|
+
* @param _deltaInSeconds - Elapsed time since previous frame in seconds
|
|
901
907
|
*/ updatePerCamera(_camera, _elapsedInSeconds, _deltaInSeconds) {}
|
|
902
|
-
/**
|
|
903
|
-
* Removes this node from it's parent and add this node to another parent node if required
|
|
904
|
-
* @param p - The new parent node that this node should be added to or null
|
|
905
|
-
* @returns self
|
|
908
|
+
/**
|
|
909
|
+
* Removes this node from it's parent and add this node to another parent node if required
|
|
910
|
+
* @param p - The new parent node that this node should be added to or null
|
|
911
|
+
* @returns self
|
|
906
912
|
*/ reparent(p) {
|
|
907
913
|
this.parent = p ?? null;
|
|
908
914
|
return this;
|