@gnsx/three 0.185.14 → 0.185.16

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.
@@ -2065,9 +2065,79 @@ function warnOnce( ...params ) {
2065
2065
 
2066
2066
  }
2067
2067
 
2068
+ // WITH_GENESYS
2069
+ /**
2070
+ * Shared MessageChannel used by {@link yieldToTask}. One pair of ports is
2071
+ * owned for the lifetime of this module so compileAsync does not allocate a
2072
+ * channel per yield.
2073
+ *
2074
+ * @private
2075
+ * @type {MessageChannel|null}
2076
+ */
2077
+ let _taskYieldChannel = null;
2078
+
2079
+ /**
2080
+ * Resolvers waiting for the next MessageChannel task. Sequential
2081
+ * `await yieldToMain()` callers queue at most one entry; the array still
2082
+ * preserves ordering if several yields overlap.
2083
+ *
2084
+ * @private
2085
+ * @type {Array<Function>}
2086
+ */
2087
+ const _taskYieldResolvers = [];
2088
+
2089
+ /**
2090
+ * Yields to a new event-loop task without waiting for a display frame.
2091
+ *
2092
+ * @private
2093
+ * @return {Promise<void>}
2094
+ */
2095
+ function yieldToTask() {
2096
+
2097
+ return new Promise( resolve => {
2098
+
2099
+ if ( typeof MessageChannel === 'function' ) {
2100
+
2101
+ if ( _taskYieldChannel === null ) {
2102
+
2103
+ _taskYieldChannel = new MessageChannel();
2104
+ _taskYieldChannel.port1.onmessage = function () {
2105
+
2106
+ const next = _taskYieldResolvers.shift();
2107
+ if ( next !== undefined ) next();
2108
+
2109
+ };
2110
+
2111
+ }
2112
+
2113
+ _taskYieldResolvers.push( resolve );
2114
+ _taskYieldChannel.port2.postMessage( null );
2115
+ return;
2116
+
2117
+ }
2118
+
2119
+ if ( typeof setTimeout === 'function' ) {
2120
+
2121
+ setTimeout( resolve, 0 );
2122
+ return;
2123
+
2124
+ }
2125
+
2126
+ resolve();
2127
+
2128
+ } );
2129
+
2130
+ }
2131
+ // !WITH_GENESYS
2132
+
2068
2133
  /**
2069
2134
  * Yields execution to the main thread to allow rendering and other tasks.
2070
- * Uses scheduler.yield() when available (Chrome 115+), falls back to requestAnimationFrame.
2135
+ * Uses scheduler.yield() when available (Chrome 115+).
2136
+ * WITH_GENESYS
2137
+ * Falls back to a MessageChannel (or setTimeout) task continuation so browsers
2138
+ * without the Scheduler API do not wait one animation frame per yield.
2139
+ * !WITH_GENESYS
2140
+ * Falls back to requestAnimationFrame.
2071
2141
  *
2072
2142
  * @return {Promise<void>}
2073
2143
  */
@@ -2079,11 +2149,14 @@ function yieldToMain() {
2079
2149
 
2080
2150
  }
2081
2151
 
2082
- return new Promise( resolve => {
2083
-
2084
- requestAnimationFrame( resolve );
2085
-
2086
- } );
2152
+ // WITH_GENESYS
2153
+ return yieldToTask();
2154
+ // !WITH_GENESYS
2155
+ // return new Promise( resolve => {
2156
+ //
2157
+ // requestAnimationFrame( resolve );
2158
+ //
2159
+ // } );
2087
2160
 
2088
2161
  }
2089
2162
 
@@ -11743,6 +11816,488 @@ class Layers {
11743
11816
 
11744
11817
  }
11745
11818
 
11819
+ // WITH_GENESYS
11820
+ /**
11821
+ * Shared deterministic PRNG helpers (FNV-1a seed hash + xorshift32).
11822
+ * Used by sibling-local nodeId allocation and other deterministic streams.
11823
+ */
11824
+
11825
+ /**
11826
+ * Lightweight FNV-1a hash for converting strings into a deterministic 32-bit seed.
11827
+ * @param {string} input
11828
+ * @return {number}
11829
+ */
11830
+ function hashStringToUint32( input ) {
11831
+
11832
+ let hash = 0x811c9dc5;
11833
+
11834
+ for ( let i = 0; i < input.length; i ++ ) {
11835
+
11836
+ hash ^= input.charCodeAt( i );
11837
+ hash = Math.imul( hash, 0x01000193 );
11838
+
11839
+ }
11840
+
11841
+ return ( hash >>> 0 ) || 0x9e3779b9;
11842
+
11843
+ }
11844
+
11845
+ /**
11846
+ * Xorshift32 step; deterministic and fast for ID generation. Never returns 0.
11847
+ * @param {number} state
11848
+ * @return {number}
11849
+ */
11850
+ function xorshift32( state ) {
11851
+
11852
+ let next = state | 0;
11853
+ next ^= next << 13;
11854
+ next ^= next >>> 17;
11855
+ next ^= next << 5;
11856
+ return ( next >>> 0 ) || 0x9e3779b9;
11857
+
11858
+ }
11859
+
11860
+ /**
11861
+ * Random non-zero uint32 seed for non-deterministic streams.
11862
+ * @return {number}
11863
+ */
11864
+ function randomSeedUint32() {
11865
+
11866
+ return ( ( Math.random() * 0x100000000 ) >>> 0 ) || 0x9e3779b9;
11867
+
11868
+ }
11869
+
11870
+ /**
11871
+ * Deterministic xorshift32 stream. Internal state is never 0.
11872
+ */
11873
+ class XorShift32 {
11874
+
11875
+ /**
11876
+ * @param {number|string} [seed]
11877
+ */
11878
+ constructor( seed = randomSeedUint32() ) {
11879
+
11880
+ this._state = typeof seed === 'string'
11881
+ ? hashStringToUint32( seed )
11882
+ : ( ( seed >>> 0 ) || 0x9e3779b9 );
11883
+
11884
+ }
11885
+
11886
+ /**
11887
+ * Advance and return the next non-zero uint32.
11888
+ * @return {number}
11889
+ */
11890
+ nextUint32() {
11891
+
11892
+ this._state = xorshift32( this._state );
11893
+ return this._state;
11894
+
11895
+ }
11896
+
11897
+ /**
11898
+ * Advance and return the low 16 bits (0 is allowed).
11899
+ * @return {number}
11900
+ */
11901
+ nextUint16() {
11902
+
11903
+ return this.nextUint32() & 0xffff;
11904
+
11905
+ }
11906
+
11907
+ /**
11908
+ * @return {number}
11909
+ */
11910
+ getState() {
11911
+
11912
+ return this._state >>> 0;
11913
+
11914
+ }
11915
+
11916
+ /**
11917
+ * @param {number} state
11918
+ */
11919
+ setState( state ) {
11920
+
11921
+ this._state = ( state >>> 0 ) || 0x9e3779b9;
11922
+
11923
+ }
11924
+
11925
+ /**
11926
+ * @return {XorShift32}
11927
+ */
11928
+ clone() {
11929
+
11930
+ return new XorShift32( this._state );
11931
+
11932
+ }
11933
+
11934
+ }
11935
+ // !WITH_GENESYS
11936
+
11937
+ // WITH_GENESYS
11938
+ /**
11939
+ * Sibling-local 16-bit node identities.
11940
+ *
11941
+ * `null` / `undefined` mean unset. `0` is a valid NodeId.
11942
+ */
11943
+
11944
+
11945
+ /**
11946
+ * True when `id` is a finite integer in the uint16 range (including 0).
11947
+ * @param {unknown} id
11948
+ * @return {boolean}
11949
+ */
11950
+ function isValidNodeId( id ) {
11951
+
11952
+ return typeof id === 'number' && Number.isInteger( id ) && id >= 0 && id <= 0xffff;
11953
+
11954
+ }
11955
+
11956
+ /**
11957
+ * Canonical display form: 4 lowercase hex characters.
11958
+ * @param {number} id
11959
+ * @return {string}
11960
+ */
11961
+ function nodeIdToString( id ) {
11962
+
11963
+ return ( id & 0xffff ).toString( 16 ).padStart( 4, '0' );
11964
+
11965
+ }
11966
+
11967
+ /**
11968
+ * Parses a hex node-id segment (1–4 hex digits).
11969
+ * @param {string} value
11970
+ * @return {?number}
11971
+ */
11972
+ function nodeIdFromString( value ) {
11973
+
11974
+ const trimmed = value.trim();
11975
+ if ( ! /^[0-9a-fA-F]{1,4}$/.test( trimmed ) ) {
11976
+
11977
+ return null;
11978
+
11979
+ }
11980
+
11981
+ return Number.parseInt( trimmed, 16 ) & 0xffff;
11982
+
11983
+ }
11984
+
11985
+ const defaultNodeIdRng = new XorShift32();
11986
+
11987
+ /**
11988
+ * Seeds the process-wide NodeId RNG for deterministic construction.
11989
+ * Pass `undefined` / omit to restore a non-deterministic stream.
11990
+ * @param {string} [seed]
11991
+ */
11992
+ function configureNodeIdSeed( seed ) {
11993
+
11994
+ if ( seed == null ) {
11995
+
11996
+ defaultNodeIdRng.setState( randomSeedUint32() );
11997
+ return;
11998
+
11999
+ }
12000
+
12001
+ defaultNodeIdRng.setState( hashStringToUint32( seed ) );
12002
+
12003
+ }
12004
+
12005
+ /**
12006
+ * Generates a random NodeId from the process-wide default RNG.
12007
+ * @param {XorShift32} [rng]
12008
+ * @return {number}
12009
+ */
12010
+ function generateNodeId( rng = defaultNodeIdRng ) {
12011
+
12012
+ return rng.nextUint16();
12013
+
12014
+ }
12015
+
12016
+ /**
12017
+ * Allocates a NodeId not present in `existing`.
12018
+ * @param {Iterable<number>|ReadonlySet<number>} existing
12019
+ * @param {XorShift32} [rng]
12020
+ * @return {number}
12021
+ */
12022
+ function allocateNodeId( existing, rng = defaultNodeIdRng ) {
12023
+
12024
+ const taken = existing instanceof Set ? existing : new Set( existing );
12025
+ if ( taken.size >= 0x10000 ) {
12026
+
12027
+ throw new Error( '[nodeId] Cannot allocate NodeId: all 65536 sibling ids are in use' );
12028
+
12029
+ }
12030
+
12031
+ let id = rng.nextUint16();
12032
+ while ( taken.has( id ) ) {
12033
+
12034
+ id = rng.nextUint16();
12035
+
12036
+ }
12037
+
12038
+ return id;
12039
+
12040
+ }
12041
+
12042
+ /**
12043
+ * Deterministic NodeId from a stable key (first-try candidate for remints).
12044
+ * @param {string} key
12045
+ * @return {number}
12046
+ */
12047
+ function nodeIdFromKey( key ) {
12048
+
12049
+ return new XorShift32( key ).nextUint16();
12050
+
12051
+ }
12052
+
12053
+ /**
12054
+ * Collects nodeId values from a sibling set.
12055
+ * @param {Iterable<{nodeId?: ?number}>} nodes
12056
+ * @param {Object} [except]
12057
+ * @return {Set<number>}
12058
+ */
12059
+ function collectSiblingNodeIds( nodes, except ) {
12060
+
12061
+ const taken = new Set();
12062
+ for ( const node of nodes ) {
12063
+
12064
+ if ( node !== except && isValidNodeId( node.nodeId ) ) {
12065
+
12066
+ taken.add( node.nodeId );
12067
+
12068
+ }
12069
+
12070
+ }
12071
+
12072
+ return taken;
12073
+
12074
+ }
12075
+
12076
+ /**
12077
+ * Ensures `object.nodeId` is unique among `parent.children`.
12078
+ * @param {import('./Object3D.js').Object3D} object
12079
+ * @param {import('./Object3D.js').Object3D} parent
12080
+ */
12081
+ function ensureUniqueNodeIdAmongParentChildren( object, parent ) {
12082
+
12083
+ const taken = collectSiblingNodeIds( parent.children, object );
12084
+ if ( ! isValidNodeId( object.nodeId ) || taken.has( object.nodeId ) ) {
12085
+
12086
+ object.nodeId = allocateNodeId( taken );
12087
+
12088
+ }
12089
+
12090
+ }
12091
+ // !WITH_GENESYS
12092
+
12093
+ // WITH_GENESYS
12094
+ /**
12095
+ * Path of sibling-local nodeIds identifying a node in the scene tree.
12096
+ * String form: `"a1b2/c3d4"` (4-hex segments separated by `/`).
12097
+ */
12098
+
12099
+
12100
+ class NodePath {
12101
+
12102
+ /**
12103
+ * @param {readonly number[]} [ids]
12104
+ */
12105
+ constructor( ids = [] ) {
12106
+
12107
+ const normalized = [];
12108
+ for ( const id of ids ) {
12109
+
12110
+ if ( ! isValidNodeId( id ) ) {
12111
+
12112
+ throw new Error( `[NodePath] Invalid NodeId segment: ${ String( id ) }` );
12113
+
12114
+ }
12115
+
12116
+ normalized.push( id & 0xffff );
12117
+
12118
+ }
12119
+
12120
+ this.ids = normalized;
12121
+
12122
+ }
12123
+
12124
+ /**
12125
+ * @param {...number} ids
12126
+ * @return {NodePath}
12127
+ */
12128
+ static fromIds( ...ids ) {
12129
+
12130
+ return new NodePath( ids );
12131
+
12132
+ }
12133
+
12134
+ /**
12135
+ * Parses `"a1b2/c3d4"`. Empty / whitespace-only string yields {@link NodePath.empty}.
12136
+ * @param {string} path
12137
+ * @return {NodePath}
12138
+ */
12139
+ static fromString( path ) {
12140
+
12141
+ const trimmed = path.trim();
12142
+ if ( trimmed.length === 0 ) {
12143
+
12144
+ return NodePath.empty;
12145
+
12146
+ }
12147
+
12148
+ const parts = trimmed.split( '/' );
12149
+ const ids = [];
12150
+ for ( const part of parts ) {
12151
+
12152
+ if ( part.length === 0 ) {
12153
+
12154
+ throw new Error( `[NodePath] Empty segment in path "${ path }"` );
12155
+
12156
+ }
12157
+
12158
+ const id = nodeIdFromString( part );
12159
+ if ( id === null ) {
12160
+
12161
+ throw new Error( `[NodePath] Invalid segment "${ part }" in path "${ path }"` );
12162
+
12163
+ }
12164
+
12165
+ ids.push( id );
12166
+
12167
+ }
12168
+
12169
+ return new NodePath( ids );
12170
+
12171
+ }
12172
+
12173
+ /**
12174
+ * @param {NodePath|string} path
12175
+ * @return {NodePath}
12176
+ */
12177
+ static coerce( path ) {
12178
+
12179
+ return typeof path === 'string' ? NodePath.fromString( path ) : path;
12180
+
12181
+ }
12182
+
12183
+ /** @return {number} */
12184
+ get length() {
12185
+
12186
+ return this.ids.length;
12187
+
12188
+ }
12189
+
12190
+ /** @return {boolean} */
12191
+ get isEmpty() {
12192
+
12193
+ return this.ids.length === 0;
12194
+
12195
+ }
12196
+
12197
+ /** @return {string} */
12198
+ toString() {
12199
+
12200
+ return this.ids.map( nodeIdToString ).join( '/' );
12201
+
12202
+ }
12203
+
12204
+ /**
12205
+ * @param {NodePath} other
12206
+ * @return {boolean}
12207
+ */
12208
+ equals( other ) {
12209
+
12210
+ if ( this.ids.length !== other.ids.length ) {
12211
+
12212
+ return false;
12213
+
12214
+ }
12215
+
12216
+ for ( let i = 0; i < this.ids.length; i ++ ) {
12217
+
12218
+ if ( this.ids[ i ] !== other.ids[ i ] ) {
12219
+
12220
+ return false;
12221
+
12222
+ }
12223
+
12224
+ }
12225
+
12226
+ return true;
12227
+
12228
+ }
12229
+
12230
+ /**
12231
+ * @param {NodePath} prefix
12232
+ * @return {boolean}
12233
+ */
12234
+ startsWith( prefix ) {
12235
+
12236
+ if ( prefix.ids.length > this.ids.length ) {
12237
+
12238
+ return false;
12239
+
12240
+ }
12241
+
12242
+ for ( let i = 0; i < prefix.ids.length; i ++ ) {
12243
+
12244
+ if ( this.ids[ i ] !== prefix.ids[ i ] ) {
12245
+
12246
+ return false;
12247
+
12248
+ }
12249
+
12250
+ }
12251
+
12252
+ return true;
12253
+
12254
+ }
12255
+
12256
+ /**
12257
+ * @param {number} start
12258
+ * @param {number} [end]
12259
+ * @return {NodePath}
12260
+ */
12261
+ slice( start, end ) {
12262
+
12263
+ return new NodePath( this.ids.slice( start, end ) );
12264
+
12265
+ }
12266
+
12267
+ /**
12268
+ * @param {NodePath} relative
12269
+ * @return {NodePath}
12270
+ */
12271
+ concat( relative ) {
12272
+
12273
+ return new NodePath( [ ...this.ids, ...relative.ids ] );
12274
+
12275
+ }
12276
+
12277
+ /**
12278
+ * If this path starts with `ancestor`, returns the remainder; otherwise `null`.
12279
+ * @param {NodePath} ancestor
12280
+ * @return {?NodePath}
12281
+ */
12282
+ relativeFrom( ancestor ) {
12283
+
12284
+ if ( ! this.startsWith( ancestor ) ) {
12285
+
12286
+ return null;
12287
+
12288
+ }
12289
+
12290
+ return this.slice( ancestor.length );
12291
+
12292
+ }
12293
+
12294
+ }
12295
+
12296
+ NodePath.empty = new NodePath( [] );
12297
+ // !WITH_GENESYS
12298
+
12299
+ // !WITH_GENESYS
12300
+
11746
12301
  let _object3DId = 0;
11747
12302
 
11748
12303
  const _v1$6 = /*@__PURE__*/ new Vector3();
@@ -11831,6 +12386,16 @@ class Object3D extends EventDispatcher {
11831
12386
  */
11832
12387
  this.uuid = generateUUID();
11833
12388
 
12389
+ // WITH_GENESYS
12390
+ /**
12391
+ * Sibling-local 16-bit identity for scene-graph addressing ({@link NodePath}).
12392
+ * `0` is valid. Reminted on parent attach when colliding with a sibling.
12393
+ *
12394
+ * @type {number}
12395
+ */
12396
+ this.nodeId = generateNodeId();
12397
+ // !WITH_GENESYS
12398
+
11834
12399
  /**
11835
12400
  * The name of the 3D object.
11836
12401
  *
@@ -12513,6 +13078,9 @@ class Object3D extends EventDispatcher {
12513
13078
  if ( object && object.isObject3D ) {
12514
13079
 
12515
13080
  object.removeFromParent();
13081
+ // WITH_GENESYS
13082
+ ensureUniqueNodeIdAmongParentChildren( object, this );
13083
+ // !WITH_GENESYS
12516
13084
  object.parent = this;
12517
13085
  this.children.push( object );
12518
13086
 
@@ -12638,6 +13206,9 @@ class Object3D extends EventDispatcher {
12638
13206
  object.applyMatrix4( _m1$1 );
12639
13207
 
12640
13208
  object.removeFromParent();
13209
+ // WITH_GENESYS
13210
+ ensureUniqueNodeIdAmongParentChildren( object, this );
13211
+ // !WITH_GENESYS
12641
13212
  object.parent = this;
12642
13213
  this.children.push( object );
12643
13214
 
@@ -12653,6 +13224,166 @@ class Object3D extends EventDispatcher {
12653
13224
 
12654
13225
  }
12655
13226
 
13227
+ // WITH_GENESYS
13228
+ /**
13229
+ * Assigns a {@link nodeId} when unset or outside the uint16 range.
13230
+ * @return {number}
13231
+ */
13232
+ ensureNodeId() {
13233
+
13234
+ if ( ! isValidNodeId( this.nodeId ) ) {
13235
+
13236
+ this.nodeId = generateNodeId();
13237
+
13238
+ }
13239
+
13240
+ return this.nodeId;
13241
+
13242
+ }
13243
+
13244
+ /**
13245
+ * Replaces {@link nodeId} with a newly generated value (e.g. prefab instance roots).
13246
+ * @param {Iterable<number>} [existingSiblingIds]
13247
+ * @return {number}
13248
+ */
13249
+ remintNodeId( existingSiblingIds ) {
13250
+
13251
+ this.nodeId = existingSiblingIds !== undefined
13252
+ ? allocateNodeId( existingSiblingIds )
13253
+ : generateNodeId();
13254
+ return this.nodeId;
13255
+
13256
+ }
13257
+
13258
+ /**
13259
+ * Direct child with the given {@link nodeId}, or `null`.
13260
+ * @param {number} id
13261
+ * @return {?Object3D}
13262
+ */
13263
+ findChildByNodeId( id ) {
13264
+
13265
+ for ( let i = 0; i < this.children.length; i ++ ) {
13266
+
13267
+ const child = this.children[ i ];
13268
+ if ( child.nodeId === id ) {
13269
+
13270
+ return child;
13271
+
13272
+ }
13273
+
13274
+ }
13275
+
13276
+ return null;
13277
+
13278
+ }
13279
+
13280
+ /**
13281
+ * Resolves a path relative to this node. An empty path returns `this`.
13282
+ * @param {NodePath|string} path
13283
+ * @return {?Object3D}
13284
+ */
13285
+ resolvePath( path ) {
13286
+
13287
+ const nodePath = NodePath.coerce( path );
13288
+ if ( nodePath.isEmpty ) {
13289
+
13290
+ return this;
13291
+
13292
+ }
13293
+
13294
+ let current = this;
13295
+ for ( let i = 0; i < nodePath.ids.length; i ++ ) {
13296
+
13297
+ const next = current.findChildByNodeId( nodePath.ids[ i ] );
13298
+ if ( ! next ) {
13299
+
13300
+ return null;
13301
+
13302
+ }
13303
+
13304
+ current = next;
13305
+
13306
+ }
13307
+
13308
+ return current;
13309
+
13310
+ }
13311
+
13312
+ /**
13313
+ * Builds a {@link NodePath} for this node.
13314
+ * - Without `root`: absolute path from the topmost non-Scene ancestor down to this node.
13315
+ * - With `root`: path relative to `root` (empty when `this === root`); `null` when not under `root`.
13316
+ * @param {Object3D} [root]
13317
+ * @return {?NodePath}
13318
+ */
13319
+ getNodePath( root ) {
13320
+
13321
+ if ( root !== undefined ) {
13322
+
13323
+ if ( this === root ) {
13324
+
13325
+ return NodePath.empty;
13326
+
13327
+ }
13328
+
13329
+ const absolute = this.getNodePath();
13330
+ const rootAbsolute = root.getNodePath();
13331
+ if ( ! absolute || ! rootAbsolute ) {
13332
+
13333
+ return null;
13334
+
13335
+ }
13336
+
13337
+ return absolute.relativeFrom( rootAbsolute );
13338
+
13339
+ }
13340
+
13341
+ const ids = [];
13342
+ let current = this;
13343
+ while ( current ) {
13344
+
13345
+ ids.push( current.ensureNodeId() );
13346
+ const parent = current.parent;
13347
+ // Scene / World containers are not part of authored NodePaths.
13348
+ if ( parent === null || parent.isScene === true ) {
13349
+
13350
+ break;
13351
+
13352
+ }
13353
+
13354
+ current = parent;
13355
+
13356
+ }
13357
+
13358
+ ids.reverse();
13359
+ return new NodePath( ids );
13360
+
13361
+ }
13362
+
13363
+ /**
13364
+ * Ensures every Object3D in this subtree has a valid {@link nodeId}, unique among its siblings.
13365
+ */
13366
+ ensureNodeIdsInSubtree() {
13367
+
13368
+ this.ensureNodeId();
13369
+ const taken = new Set();
13370
+ for ( let i = 0; i < this.children.length; i ++ ) {
13371
+
13372
+ const child = this.children[ i ];
13373
+ if ( ! isValidNodeId( child.nodeId ) || taken.has( child.nodeId ) ) {
13374
+
13375
+ child.nodeId = allocateNodeId( taken );
13376
+
13377
+ }
13378
+
13379
+ taken.add( child.nodeId );
13380
+ child.ensureNodeIdsInSubtree();
13381
+
13382
+ }
13383
+
13384
+ }
13385
+ // !WITH_GENESYS
13386
+
12656
13387
  /**
12657
13388
  * Searches through the 3D object and its children, starting with the 3D object
12658
13389
  * itself, and returns the first with a matching ID.
@@ -13055,6 +13786,10 @@ class Object3D extends EventDispatcher {
13055
13786
  object.uuid = this.uuid;
13056
13787
  object.type = this.type;
13057
13788
 
13789
+ // WITH_GENESYS
13790
+ object.nodeId = this.nodeId;
13791
+ // !WITH_GENESYS
13792
+
13058
13793
  if ( this.name !== '' ) object.name = this.name;
13059
13794
  if ( this.castShadow === true ) object.castShadow = true;
13060
13795
  if ( this.receiveShadow === true ) object.receiveShadow = true;
@@ -13365,6 +14100,8 @@ class Object3D extends EventDispatcher {
13365
14100
  this.visible = source.visible;
13366
14101
  // WITH_GENESYS
13367
14102
  this.selfHidden = source.selfHidden;
14103
+ // Keep nodeId; reminted on attach if it collides with a sibling.
14104
+ this.nodeId = source.nodeId;
13368
14105
  // !WITH_GENESYS
13369
14106
 
13370
14107
  this.castShadow = source.castShadow;
@@ -49601,6 +50338,10 @@ class ObjectLoader extends Loader {
49601
50338
 
49602
50339
  object.uuid = data.uuid;
49603
50340
 
50341
+ // WITH_GENESYS
50342
+ if ( data.nodeId !== undefined ) object.nodeId = data.nodeId;
50343
+ // !WITH_GENESYS
50344
+
49604
50345
  if ( data.name !== undefined ) object.name = data.name;
49605
50346
 
49606
50347
  if ( data.matrix !== undefined ) {
@@ -61731,4 +62472,4 @@ if ( typeof window !== 'undefined' ) {
61731
62472
 
61732
62473
  }
61733
62474
 
61734
- export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, ProfilerService, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, cloneUniforms, createCanvasElement, createElementNS, error, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, isTypedArray, log, mergeUniforms, probeAsync, profile, profileClass, setConsoleFunction, warn, warnOnce, yieldToMain };
62475
+ export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NodePath, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, ProfilerService, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, XorShift32, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, allocateNodeId, cloneUniforms, collectSiblingNodeIds, configureNodeIdSeed, createCanvasElement, createElementNS, ensureUniqueNodeIdAmongParentChildren, error, generateNodeId, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, hashStringToUint32, isTypedArray, isValidNodeId, log, mergeUniforms, nodeIdFromKey, nodeIdFromString, nodeIdToString, probeAsync, profile, profileClass, randomSeedUint32, setConsoleFunction, warn, warnOnce, xorshift32, yieldToMain };