vim-web 0.5.0-dev.2 → 0.5.0-dev.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.
@@ -50892,16 +50892,16 @@ void main() {
50892
50892
  //= ===========================================================================
50893
50893
  // HANDLE VALIDATIONS
50894
50894
  //= ===========================================================================
50895
- static isComponentHandle(handle) {
50896
- if (!this.isPositiveInteger(handle)) return false;
50897
- if (handle === INVALID_HANDLE) {
50898
- console.warn(`Invalid handle ${handle}. Aborting operation.`);
50895
+ static isIndex(index2) {
50896
+ if (!this.isPositiveInteger(index2)) return false;
50897
+ if (index2 === INVALID_HANDLE) {
50898
+ console.warn(`Invalid index ${index2}. Aborting operation.`);
50899
50899
  return false;
50900
50900
  }
50901
50901
  return true;
50902
50902
  }
50903
- static areComponentHandles(handles) {
50904
- return handles.every((h) => this.isComponentHandle(h));
50903
+ static areIndices(indices) {
50904
+ return indices.every((h) => this.isIndex(h));
50905
50905
  }
50906
50906
  static isMaterialHandle(handle) {
50907
50907
  if (!materialHandles.includes(handle)) {
@@ -57545,7 +57545,7 @@ void main() {
57545
57545
  * @returns Promise that resolves when the framing animation is complete
57546
57546
  */
57547
57547
  async frameAll(blendTime = this._defaultBlendTime) {
57548
- const segment = await this._rpc.RPCFrameAll(blendTime);
57548
+ const segment = await this._rpc.RPCFrameScene(blendTime);
57549
57549
  this._savedPosition = this._savedPosition ?? segment;
57550
57550
  return segment;
57551
57551
  }
@@ -57562,16 +57562,16 @@ void main() {
57562
57562
  /**
57563
57563
  * Frames specific nodes of a Vim model in the camera view
57564
57564
  * @param vim - The Vim model containing the nodes to frame
57565
- * @param nodes - Array of node indices to frame, or 'all' to frame the entire model
57565
+ * @param elements - Array of element indices to frame, or 'all' to frame the entire model
57566
57566
  * @param blendTime - Duration of the camera animation in seconds (defaults to 0.5)
57567
57567
  * @returns Promise that resolves when the framing animation is complete
57568
57568
  */
57569
- async frameVim(vim, nodes, blendTime = this._defaultBlendTime) {
57569
+ async frameVim(vim, elements, blendTime = this._defaultBlendTime) {
57570
57570
  let segment;
57571
- if (nodes === "all") {
57571
+ if (elements === "all") {
57572
57572
  segment = await this._rpc.RPCFrameVim(vim.handle, blendTime);
57573
57573
  } else {
57574
- segment = await this._rpc.RPCFrameElements(vim.handle, nodes, blendTime);
57574
+ segment = await this._rpc.RPCFrameElements(vim.handle, elements, blendTime);
57575
57575
  }
57576
57576
  this._savedPosition = this._savedPosition ?? segment;
57577
57577
  return segment;
@@ -57654,9 +57654,9 @@ void main() {
57654
57654
  // -------------------- HitCheckResult -------------------
57655
57655
  writeHitCheckResult(data2) {
57656
57656
  this.ensureCapacity(4 + 4 + 4 + 4 * 3 + 4 * 3);
57657
- this.writeUInt(data2.vimHandle);
57658
- this.writeUInt(data2.nodeIndex);
57659
- this.writeUInt(data2.elementIndex);
57657
+ this.writeUInt(data2.vimIndex);
57658
+ this.writeUInt(data2.vimElementIndex);
57659
+ this.writeUInt(data2.sceneElementIndex);
57660
57660
  this.writeVector3(data2.worldPosition);
57661
57661
  this.writeVector3(data2.worldNormal);
57662
57662
  }
@@ -57804,15 +57804,15 @@ void main() {
57804
57804
  return textDecoder.decode(stringData);
57805
57805
  }
57806
57806
  readHitCheckResult() {
57807
- const vimHandle = this.readUInt();
57808
- const nodeIndex = this.readUInt();
57809
- const mElementIndex = this.readUInt();
57807
+ const vimIndex = this.readUInt();
57808
+ const vimElementIndex = this.readUInt();
57809
+ const sceneElementIndex = this.readUInt();
57810
57810
  const worldPosition = this.readVector3();
57811
57811
  const worldNormal = this.readVector3();
57812
57812
  return {
57813
- vimHandle,
57814
- nodeIndex,
57815
- elementIndex: mElementIndex,
57813
+ vimIndex,
57814
+ vimElementIndex,
57815
+ sceneElementIndex,
57816
57816
  worldPosition,
57817
57817
  worldNormal
57818
57818
  };
@@ -57944,10 +57944,9 @@ void main() {
57944
57944
  get url() {
57945
57945
  return this._socket.url;
57946
57946
  }
57947
- RPCClearMaterialOverrides(componentHandle) {
57947
+ RPCClearMaterialOverrides() {
57948
57948
  const marshal = new Marshal();
57949
57949
  marshal.writeString("RPCClearMaterialOverrides");
57950
- marshal.writeUInt(componentHandle);
57951
57950
  this._socket.sendRPC(marshal);
57952
57951
  }
57953
57952
  async RPCCreateMaterialInstances(materialHandle, smoothness, colors) {
@@ -57970,10 +57969,10 @@ void main() {
57970
57969
  const ret = returnMarshal.readUInt();
57971
57970
  return ret;
57972
57971
  }
57973
- RPCDestroyMaterialInstances(materialInstanceHandle) {
57972
+ RPCDestroyMaterialInstances(materialInstanceHandles) {
57974
57973
  const marshal = new Marshal();
57975
57974
  marshal.writeString("RPCDestroyMaterialInstances");
57976
- marshal.writeArrayOfUInt(materialInstanceHandle);
57975
+ marshal.writeArrayOfUInt(materialInstanceHandles);
57977
57976
  this._socket.sendRPC(marshal);
57978
57977
  }
57979
57978
  RPCDestroyText(componentHandle) {
@@ -57997,53 +57996,53 @@ void main() {
57997
57996
  const ret = returnMarshal.readSegment();
57998
57997
  return ret;
57999
57998
  }
58000
- async RPCFrameAll(blendTime) {
57999
+ async RPCFrameElements(vimIndex, elementIndices, blendTime) {
58001
58000
  const marshal = new Marshal();
58002
- marshal.writeString("RPCFrameAll");
58001
+ marshal.writeString("RPCFrameElements");
58002
+ marshal.writeUInt(vimIndex);
58003
+ marshal.writeArrayOfUInt(elementIndices);
58003
58004
  marshal.writeFloat(blendTime);
58004
58005
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58005
58006
  const ret = returnMarshal.readSegment();
58006
58007
  return ret;
58007
58008
  }
58008
- async RPCFrameElements(componentHandle, elementIndices, blendTime) {
58009
+ async RPCFrameScene(blendTime) {
58009
58010
  const marshal = new Marshal();
58010
- marshal.writeString("RPCFrameElements");
58011
- marshal.writeUInt(componentHandle);
58012
- marshal.writeArrayOfUInt(elementIndices);
58011
+ marshal.writeString("RPCFrameScene");
58013
58012
  marshal.writeFloat(blendTime);
58014
58013
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58015
58014
  const ret = returnMarshal.readSegment();
58016
58015
  return ret;
58017
58016
  }
58018
- async RPCFrameVim(componentHandle, blendTime) {
58017
+ async RPCFrameVim(vimIndex, blendTime) {
58019
58018
  const marshal = new Marshal();
58020
58019
  marshal.writeString("RPCFrameVim");
58021
- marshal.writeUInt(componentHandle);
58020
+ marshal.writeUInt(vimIndex);
58022
58021
  marshal.writeFloat(blendTime);
58023
58022
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58024
58023
  const ret = returnMarshal.readSegment();
58025
58024
  return ret;
58026
58025
  }
58027
- async RPCGetAABBForAll() {
58026
+ async RPCGetAABBForElements(vimIndex, elementIndices) {
58028
58027
  const marshal = new Marshal();
58029
- marshal.writeString("RPCGetAABBForAll");
58028
+ marshal.writeString("RPCGetAABBForElements");
58029
+ marshal.writeUInt(vimIndex);
58030
+ marshal.writeArrayOfUInt(elementIndices);
58030
58031
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58031
58032
  const ret = returnMarshal.readBox3();
58032
58033
  return ret;
58033
58034
  }
58034
- async RPCGetAABBForElements(componentHandle, elementIndices) {
58035
+ async RPCGetAABBForScene() {
58035
58036
  const marshal = new Marshal();
58036
- marshal.writeString("RPCGetAABBForElements");
58037
- marshal.writeUInt(componentHandle);
58038
- marshal.writeArrayOfUInt(elementIndices);
58037
+ marshal.writeString("RPCGetAABBForScene");
58039
58038
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58040
58039
  const ret = returnMarshal.readBox3();
58041
58040
  return ret;
58042
58041
  }
58043
- async RPCGetAABBForVim(componentHandle) {
58042
+ async RPCGetAABBForVim(vimIndex) {
58044
58043
  const marshal = new Marshal();
58045
58044
  marshal.writeString("RPCGetAABBForVim");
58046
- marshal.writeUInt(componentHandle);
58045
+ marshal.writeUInt(vimIndex);
58047
58046
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58048
58047
  const ret = returnMarshal.readBox3();
58049
58048
  return ret;
@@ -58062,18 +58061,25 @@ void main() {
58062
58061
  const ret = returnMarshal.readSegment();
58063
58062
  return ret;
58064
58063
  }
58065
- async RPCGetElementCount(componentHandle) {
58064
+ async RPCGetElementCountForScene() {
58066
58065
  const marshal = new Marshal();
58067
- marshal.writeString("RPCGetElementCount");
58068
- marshal.writeUInt(componentHandle);
58066
+ marshal.writeString("RPCGetElementCountForScene");
58067
+ const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58068
+ const ret = returnMarshal.readUInt();
58069
+ return ret;
58070
+ }
58071
+ async RPCGetElementCountForVim(vimIndex) {
58072
+ const marshal = new Marshal();
58073
+ marshal.writeString("RPCGetElementCountForVim");
58074
+ marshal.writeUInt(vimIndex);
58069
58075
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58070
58076
  const ret = returnMarshal.readUInt();
58071
58077
  return ret;
58072
58078
  }
58073
- async RPCGetElementIds(componentHandle) {
58079
+ async RPCGetElementIds(vimIndex) {
58074
58080
  const marshal = new Marshal();
58075
58081
  marshal.writeString("RPCGetElementIds");
58076
- marshal.writeUInt(componentHandle);
58082
+ marshal.writeUInt(vimIndex);
58077
58083
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58078
58084
  const ret = returnMarshal.readArrayOfUInt64();
58079
58085
  return ret;
@@ -58085,10 +58091,10 @@ void main() {
58085
58091
  const ret = returnMarshal.readString();
58086
58092
  return ret;
58087
58093
  }
58088
- async RPCGetRoomElements(componentHandle) {
58094
+ async RPCGetRoomElements(vimIndex) {
58089
58095
  const marshal = new Marshal();
58090
58096
  marshal.writeString("RPCGetRoomElements");
58091
- marshal.writeUInt(componentHandle);
58097
+ marshal.writeUInt(vimIndex);
58092
58098
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58093
58099
  const ret = returnMarshal.readArrayOfUInt();
58094
58100
  return ret;
@@ -58100,10 +58106,10 @@ void main() {
58100
58106
  const ret = returnMarshal.readSectionBoxState();
58101
58107
  return ret;
58102
58108
  }
58103
- async RPCGetVimLoadingState(componentHandle) {
58109
+ async RPCGetVimLoadingState(vimIndex) {
58104
58110
  const marshal = new Marshal();
58105
58111
  marshal.writeString("RPCGetVimLoadingState");
58106
- marshal.writeUInt(componentHandle);
58112
+ marshal.writeUInt(vimIndex);
58107
58113
  const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
58108
58114
  const ret = returnMarshal.readVimStatus();
58109
58115
  return ret;
@@ -58237,10 +58243,10 @@ void main() {
58237
58243
  marshal.writeRGBA(backgroundColor);
58238
58244
  this._socket.sendRPC(marshal);
58239
58245
  }
58240
- RPCSetMaterialOverrides(componentHandle, elementIndices, materialInstanceHandles) {
58246
+ RPCSetMaterialOverridesForElements(vimIndex, elementIndices, materialInstanceHandles) {
58241
58247
  const marshal = new Marshal();
58242
- marshal.writeString("RPCSetMaterialOverrides");
58243
- marshal.writeUInt(componentHandle);
58248
+ marshal.writeString("RPCSetMaterialOverridesForElements");
58249
+ marshal.writeUInt(vimIndex);
58244
58250
  marshal.writeArrayOfUInt(elementIndices);
58245
58251
  marshal.writeArrayOfUInt(materialInstanceHandles);
58246
58252
  this._socket.sendRPC(marshal);
@@ -58251,25 +58257,31 @@ void main() {
58251
58257
  marshal.writeSectionBoxState(state);
58252
58258
  this._socket.sendRPC(marshal);
58253
58259
  }
58254
- RPCSetStateVim(componentHandle, state) {
58260
+ RPCSetStateElements(vimIndex, elementIndices, state) {
58255
58261
  const marshal = new Marshal();
58256
- marshal.writeString("RPCSetStateVim");
58257
- marshal.writeUInt(componentHandle);
58262
+ marshal.writeString("RPCSetStateElements");
58263
+ marshal.writeUInt(vimIndex);
58264
+ marshal.writeArrayOfUInt(elementIndices);
58258
58265
  marshal.writeUInt(state);
58259
58266
  this._socket.sendRPC(marshal);
58260
58267
  }
58261
- RPCSetStateElements(componentHandle, elementIndices, state) {
58268
+ RPCSetStateScene(state) {
58262
58269
  const marshal = new Marshal();
58263
- marshal.writeString("RPCSetStateElements");
58264
- marshal.writeUInt(componentHandle);
58265
- marshal.writeArrayOfUInt(elementIndices);
58270
+ marshal.writeString("RPCSetStateScene");
58271
+ marshal.writeUInt(state);
58272
+ this._socket.sendRPC(marshal);
58273
+ }
58274
+ RPCSetStateVim(vimIndex, state) {
58275
+ const marshal = new Marshal();
58276
+ marshal.writeString("RPCSetStateVim");
58277
+ marshal.writeUInt(vimIndex);
58266
58278
  marshal.writeUInt(state);
58267
58279
  this._socket.sendRPC(marshal);
58268
58280
  }
58269
- RPCSetStatesElements(componentHandle, elementIndices, states) {
58281
+ RPCSetStatesElements(vimIndex, elementIndices, states) {
58270
58282
  const marshal = new Marshal();
58271
58283
  marshal.writeString("RPCSetStatesElements");
58272
- marshal.writeUInt(componentHandle);
58284
+ marshal.writeUInt(vimIndex);
58273
58285
  marshal.writeArrayOfUInt(elementIndices);
58274
58286
  marshal.writeArrayOfUInt(states);
58275
58287
  this._socket.sendRPC(marshal);
@@ -58297,12 +58309,6 @@ void main() {
58297
58309
  marshal.writeString("RPCUnloadAll");
58298
58310
  this._socket.sendRPC(marshal);
58299
58311
  }
58300
- RPCUnloadVim(componentHandle) {
58301
- const marshal = new Marshal();
58302
- marshal.writeString("RPCUnloadVim");
58303
- marshal.writeUInt(componentHandle);
58304
- this._socket.sendRPC(marshal);
58305
- }
58306
58312
  }
58307
58313
  class RemoteColor {
58308
58314
  /**
@@ -59053,9 +59059,9 @@ void main() {
59053
59059
  if (!Validation.isRelativeVector2(position)) return void 0;
59054
59060
  const test2 = await this._rpc.RPCPerformHitTest(position);
59055
59061
  if (!test2) return void 0;
59056
- const vim = this._vims.getFromHandle(test2.vimHandle);
59062
+ const vim = this._vims.getFromHandle(test2.vimIndex);
59057
59063
  if (!vim) return void 0;
59058
- const object = vim.getElement(test2.elementIndex);
59064
+ const object = vim.getElement(test2.vimElementIndex);
59059
59065
  if (!object) return void 0;
59060
59066
  return new UltraRaycastResult(
59061
59067
  object,
@@ -59084,7 +59090,7 @@ void main() {
59084
59090
  hdrScale: 1.37,
59085
59091
  hdrBackgroundScale: 1,
59086
59092
  hdrBackgroundSaturation: 1,
59087
- backGroundBlur: 1,
59093
+ backgroundBlur: 1,
59088
59094
  backgroundColor: new RGBA(0.9, 0.9, 0.9, 1)
59089
59095
  };
59090
59096
  var VimLoadingStatus = /* @__PURE__ */ ((VimLoadingStatus2) => {
@@ -59097,15 +59103,26 @@ void main() {
59097
59103
  return VimLoadingStatus2;
59098
59104
  })(VimLoadingStatus || {});
59099
59105
  class RpcSafeClient {
59106
+ /**
59107
+ * Creates a new RpcSafeClient instance.
59108
+ * @param rpc - The underlying RpcClient used for communication
59109
+ * @param batchSize - Maximum size of batched data for operations (default: 10000)
59110
+ */
59100
59111
  constructor(rpc, batchSize = defaultBatchSize) {
59101
59112
  __publicField(this, "rpc");
59102
59113
  __publicField(this, "batchSize");
59103
59114
  this.rpc = rpc;
59104
59115
  this.batchSize = batchSize;
59105
59116
  }
59117
+ /**
59118
+ * The URL used by the underlying RPC connection.
59119
+ */
59106
59120
  get url() {
59107
59121
  return this.rpc.url;
59108
59122
  }
59123
+ /**
59124
+ * Indicates whether the RPC client is currently connected.
59125
+ */
59109
59126
  get connected() {
59110
59127
  return this.rpc.connected;
59111
59128
  }
@@ -59115,9 +59132,10 @@ void main() {
59115
59132
  * and scene-wide settings.
59116
59133
  ******************************************************************************/
59117
59134
  /**
59118
- * Initializes and starts the scene with specified settings.
59135
+ * Initializes and starts the scene with the given settings.
59119
59136
  * @param settings - Optional partial scene settings to override defaults
59120
- * @remarks If no settings are provided, default values will be used
59137
+ * @returns Promise resolving to true if the scene started successfully, false otherwise
59138
+ * @remarks Missing values will be filled from {@link defaultSceneSettings}
59121
59139
  */
59122
59140
  async RPCStartScene(settings2) {
59123
59141
  const s = { ...defaultSceneSettings, ...settings2 ?? {} };
@@ -59127,15 +59145,15 @@ void main() {
59127
59145
  Validation.min0(s.hdrScale),
59128
59146
  Validation.clamp01(s.hdrBackgroundScale),
59129
59147
  Validation.clamp01(s.hdrBackgroundSaturation),
59130
- Validation.clamp01(s.backGroundBlur),
59148
+ Validation.clamp01(s.backgroundBlur),
59131
59149
  Validation.clampRGBA01(s.backgroundColor)
59132
59150
  ),
59133
59151
  false
59134
59152
  );
59135
59153
  }
59136
59154
  /**
59137
- * Sets the lighting settings for the scene.
59138
- * @param settings - The lighting settings to apply
59155
+ * Updates the scene’s lighting configuration.
59156
+ * @param settings - The complete lighting and background settings to apply
59139
59157
  */
59140
59158
  RPCSetLighting(settings2) {
59141
59159
  const s = settings2;
@@ -59144,43 +59162,80 @@ void main() {
59144
59162
  Validation.min0(s.hdrScale),
59145
59163
  Validation.clamp01(s.hdrBackgroundScale),
59146
59164
  Validation.clamp01(s.hdrBackgroundSaturation),
59147
- Validation.clamp01(s.backGroundBlur),
59165
+ Validation.clamp01(s.backgroundBlur),
59148
59166
  Validation.clampRGBA01(s.backgroundColor)
59149
59167
  );
59150
59168
  }
59169
+ /**
59170
+ * Retrieves the total number of elements across the entire scene.
59171
+ * @returns Promise resolving to the total number of elements (0 on failure).
59172
+ */
59173
+ RPCGetElementCountForScene() {
59174
+ return this.safeCall(
59175
+ () => this.rpc.RPCGetElementCountForScene(),
59176
+ 0
59177
+ );
59178
+ }
59179
+ /**
59180
+ * Retrieves the number of elements within a specific loaded vim.
59181
+ * @param vimIndex - Index of the loaded vim to query
59182
+ * @returns Promise resolving to the element count (0 on failure)
59183
+ */
59184
+ RPCGetElementCountForVim(vimIndex) {
59185
+ return this.safeCall(
59186
+ () => this.rpc.RPCGetElementCountForVim(vimIndex),
59187
+ 0
59188
+ );
59189
+ }
59151
59190
  /*******************************************************************************
59152
- * NODE VISIBILITY METHODS
59153
- * Methods for controlling node visibility, including show/hide, ghosting,
59191
+ * ELEMENTS VISIBILITY METHODS
59192
+ * Methods for controlling element visibility, including show/hide, ghosting,
59154
59193
  * and highlighting functionality.
59155
59194
  ******************************************************************************/
59156
59195
  /**
59157
- * Highlights specified nodes in a component.
59158
- * Large node arrays are automatically processed in batches.
59159
- * @param componentHandle - The component containing the nodes
59160
- * @param nodes - Array of node indices to highlight
59161
- * @throws {Error} If the component handle is invalid or nodes array is invalid
59162
- */
59163
- RPCSetStateElements(componentHandle, elements, state) {
59164
- if (elements.length === 0) return;
59165
- if (!Validation.isComponentHandle(componentHandle)) return;
59166
- if (!Validation.areComponentHandles(elements)) return;
59167
- const batches = batchArray(elements, this.batchSize);
59196
+ * Sets a single visibility state for given elements within a loaded vim.
59197
+ * The operation is automatically split into batches if the array is large.
59198
+ *
59199
+ * @param vimIndex - The index of the loaded vim containing the elements
59200
+ * @param vimElementIndices - Array of vim-based element indices to apply the state to
59201
+ * @param state - The visibility state to apply (e.g., VISIBLE, HIDDEN)
59202
+ */
59203
+ RPCSetStateElements(vimIndex, vimElementIndices, state) {
59204
+ if (vimElementIndices.length === 0) return;
59205
+ if (!Validation.isIndex(vimIndex)) return;
59206
+ if (!Validation.areIndices(vimElementIndices)) return;
59207
+ const batches = batchArray(vimElementIndices, this.batchSize);
59168
59208
  for (const batch of batches) {
59169
- this.rpc.RPCSetStateElements(componentHandle, batch, state);
59209
+ this.rpc.RPCSetStateElements(vimIndex, batch, state);
59170
59210
  }
59171
59211
  }
59172
- RPCSetStatesElements(componentHandle, elements, states) {
59173
- if (!Validation.isComponentHandle(componentHandle)) return;
59174
- if (!Validation.areComponentHandles(elements)) return;
59175
- if (!Validation.areSameLength(elements, states)) return;
59176
- const batches = batchArrays(elements, states, this.batchSize);
59212
+ /**
59213
+ * Sets individual visibility states for multiple elements in a vim.
59214
+ * Each element receives a corresponding visibility state from the input array.
59215
+ * The operation is automatically split into batches if the array is large.
59216
+ *
59217
+ * @param vimIndex - The index of the loaded vim
59218
+ * @param vimElementIndices - Array of vim-based element indices
59219
+ * @param states - Array of visibility states to apply, one per element
59220
+ */
59221
+ RPCSetStatesElements(vimIndex, vimElementIndices, states) {
59222
+ if (!Validation.isIndex(vimIndex)) return;
59223
+ if (!Validation.areIndices(vimElementIndices)) return;
59224
+ if (!Validation.areSameLength(vimElementIndices, states)) return;
59225
+ const batches = batchArrays(vimElementIndices, states, this.batchSize);
59177
59226
  for (const [batchedElements, batchedStates] of batches) {
59178
- this.rpc.RPCSetStatesElements(componentHandle, batchedElements, batchedStates);
59227
+ this.rpc.RPCSetStatesElements(vimIndex, batchedElements, batchedStates);
59179
59228
  }
59180
59229
  }
59181
- RPCSetStateVim(componentHandle, state) {
59182
- if (!Validation.isComponentHandle(componentHandle)) return;
59183
- this.rpc.RPCSetStateVim(componentHandle, state);
59230
+ /**
59231
+ * Applies a single visibility state to all elements of a loaded vim.
59232
+ *
59233
+ * @param vimIndex - The index of the loaded vim
59234
+ * @param state - The visibility state to apply (e.g., VISIBLE, HIDDEN)
59235
+ */
59236
+ RPCSetStateVim(vimIndex, state) {
59237
+ if (!Validation.isIndex(vimIndex)) return;
59238
+ this.rpc.RPCSetStateVim(vimIndex, state);
59184
59239
  }
59185
59240
  /*******************************************************************************
59186
59241
  * TEXT AND UI METHODS
@@ -59192,7 +59247,6 @@ void main() {
59192
59247
  * @param color - The color of the text
59193
59248
  * @param text - The content to display
59194
59249
  * @returns Promise resolving to the handle of the created text component
59195
- * @throws {Error} If the text is empty
59196
59250
  */
59197
59251
  async RPCCreateText(position, color, text) {
59198
59252
  if (!Validation.isNonEmptyString(text)) return INVALID_HANDLE;
@@ -59205,19 +59259,26 @@ void main() {
59205
59259
  /**
59206
59260
  * Destroys a text component, removing it from the scene.
59207
59261
  * @param componentHandle - The handle of the text component to destroy
59208
- * @throws {Error} If the component handle is invalid
59209
59262
  */
59210
59263
  RPCDestroyText(componentHandle) {
59211
- if (!Validation.isComponentHandle(componentHandle)) return;
59264
+ if (!Validation.isIndex(componentHandle)) return;
59212
59265
  this.rpc.RPCDestroyText(componentHandle);
59213
59266
  }
59214
59267
  /*******************************************************************************
59215
59268
  * SECTION BOX METHODS
59216
59269
  * Methods for controlling section box visibility and position.
59217
59270
  ******************************************************************************/
59271
+ /**
59272
+ * Enables or disables the section box.
59273
+ * @param enable - True to enable the section box, false to disable it
59274
+ */
59218
59275
  RPCEnableSectionBox(enable) {
59219
59276
  this.rpc.RPCEnableSectionBox(enable);
59220
59277
  }
59278
+ /**
59279
+ * Sets the parameters of the section box.
59280
+ * @param state - The new section box state, including visibility and bounding box
59281
+ */
59221
59282
  RPCSetSectionBox(state) {
59222
59283
  this.rpc.RPCSetSectionBox(
59223
59284
  {
@@ -59226,6 +59287,10 @@ void main() {
59226
59287
  }
59227
59288
  );
59228
59289
  }
59290
+ /**
59291
+ * Retrieves the current section box state.
59292
+ * @returns Promise resolving to the section box state or undefined on failure
59293
+ */
59229
59294
  async RPCGetSectionBox() {
59230
59295
  return await this.safeCall(
59231
59296
  () => this.rpc.RPCGetSectionBox(),
@@ -59282,52 +59347,52 @@ void main() {
59282
59347
  }
59283
59348
  /**
59284
59349
  * Retrieves the axis-aligned bounding box (AABB) that encompasses the entire scene.
59285
- * This includes all loaded geometry across all VIM components.
59350
+ * This includes all loaded geometry across all loaded vims.
59286
59351
  *
59287
59352
  * @returns Promise resolving to the global AABB of the scene, or undefined on failure
59288
59353
  */
59289
- RPCGetAABBForAll() {
59354
+ RPCGetAABBForScene() {
59290
59355
  return this.safeCall(
59291
- () => this.rpc.RPCGetAABBForAll(),
59356
+ () => this.rpc.RPCGetAABBForScene(),
59292
59357
  void 0
59293
59358
  );
59294
59359
  }
59295
59360
  /**
59296
- * Retrieves the axis-aligned bounding box (AABB) for a specific VIM component.
59297
- * This bounding box represents the spatial bounds of all geometry within the given component.
59361
+ * Retrieves the axis-aligned bounding box (AABB) for a specific loaded vim.
59362
+ * This bounding box represents the spatial bounds of all geometry within the given loaded vim.
59298
59363
  *
59299
- * @param componentHandle - The handle of the VIM component to query
59300
- * @returns Promise resolving to the component’s bounding box, or undefined on failure
59364
+ * @param vimIndex - The index of the loaded vim to query
59365
+ * @returns Promise resolving to the vim bounding box, or undefined on failure
59301
59366
  */
59302
- async RPCGetAABBForVim(componentHandle) {
59367
+ async RPCGetAABBForVim(vimIndex) {
59368
+ if (!Validation.isIndex(vimIndex)) return void 0;
59303
59369
  return await this.safeCall(
59304
- () => this.rpc.RPCGetAABBForVim(componentHandle),
59370
+ () => this.rpc.RPCGetAABBForVim(vimIndex),
59305
59371
  void 0
59306
59372
  );
59307
59373
  }
59308
59374
  /**
59309
- * Calculates the bounding box for specified nodes in a component.
59310
- * Large node arrays are automatically processed in batches for better performance.
59311
- * @param componentHandle - The component containing the nodes
59312
- * @param elements - Array of node indices to calculate bounds for
59313
- * @returns Promise resolving to the combined bounding box
59314
- * @throws {Error} If the component handle is invalid or nodes array is invalid
59375
+ * Calculates the bounding box for specified elements of a loaded vim.
59376
+ * Large element arrays are automatically processed in batches.
59377
+ * @param vimIndex - The index of the loaded vim
59378
+ * @param vimElementIndices - Array of vim-based element indices to calculate bounds for
59379
+ * @returns Promise resolving to the combined bounding box or undefined on failure
59315
59380
  */
59316
- async RPCGetAABBForElements(componentHandle, elements) {
59317
- if (!Validation.isComponentHandle(componentHandle)) return;
59318
- if (!Validation.areComponentHandles(elements)) return;
59381
+ async RPCGetAABBForElements(vimIndex, vimElementIndices) {
59382
+ if (!Validation.isIndex(vimIndex)) return;
59383
+ if (!Validation.areIndices(vimElementIndices)) return;
59319
59384
  return await this.safeCall(
59320
- () => this.RPCGetAABBForElementsBatched(componentHandle, elements),
59385
+ () => this.RPCGetAABBForElementsBatched(vimIndex, vimElementIndices),
59321
59386
  void 0
59322
59387
  );
59323
59388
  }
59324
- async RPCGetAABBForElementsBatched(componentHandle, elements) {
59325
- if (elements.length === 0) {
59389
+ async RPCGetAABBForElementsBatched(vimIndex, vimElementIndices) {
59390
+ if (vimElementIndices.length === 0) {
59326
59391
  return new Box3();
59327
59392
  }
59328
- const batches = batchArray(elements, this.batchSize);
59393
+ const batches = batchArray(vimElementIndices, this.batchSize);
59329
59394
  const promises = batches.map(async (batch) => {
59330
- const aabb = await this.rpc.RPCGetAABBForElements(componentHandle, batch);
59395
+ const aabb = await this.rpc.RPCGetAABBForElements(vimIndex, batch);
59331
59396
  const v1 = new Vector3(aabb.min.x, aabb.min.y, aabb.min.z);
59332
59397
  const v2 = new Vector3(aabb.max.x, aabb.max.y, aabb.max.z);
59333
59398
  return new Box3(v1, v2);
@@ -59338,53 +59403,51 @@ void main() {
59338
59403
  return box;
59339
59404
  }
59340
59405
  /**
59341
- * Frames the camera to show all components in the scene.
59406
+ * Frames the camera to show all elements in the scene.
59342
59407
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59343
59408
  * @returns Promise resolving to camera segment representing the final position
59344
59409
  */
59345
- async RPCFrameAll(blendTime) {
59410
+ async RPCFrameScene(blendTime) {
59346
59411
  blendTime = Validation.clamp01(blendTime);
59347
59412
  return await this.safeCall(
59348
- () => this.rpc.RPCFrameAll(blendTime),
59413
+ () => this.rpc.RPCFrameScene(blendTime),
59349
59414
  void 0
59350
59415
  );
59351
59416
  }
59352
59417
  /**
59353
- * Frames a specific VIM component in the scene.
59354
- * @param componentHandle - The handle of the VIM component to frame
59418
+ * Frames a specific vim in the scene.
59419
+ * @param vimIndex - The index of the loaded vim to frame
59355
59420
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59356
59421
  * @returns Promise resolving to camera segment representing the final position
59357
- * @throws {Error} If the component handle is invalid
59358
59422
  */
59359
- async RPCFrameVim(componentHandle, blendTime) {
59360
- if (!Validation.isComponentHandle(componentHandle)) return;
59423
+ async RPCFrameVim(vimIndex, blendTime) {
59424
+ if (!Validation.isIndex(vimIndex)) return;
59361
59425
  blendTime = Validation.clamp01(blendTime);
59362
59426
  return await this.safeCall(
59363
- () => this.rpc.RPCFrameVim(componentHandle, blendTime),
59427
+ () => this.rpc.RPCFrameVim(vimIndex, blendTime),
59364
59428
  void 0
59365
59429
  );
59366
59430
  }
59367
59431
  /**
59368
- * Frames specific instances within a component. For large numbers of instances,
59369
- * automatically switches to bounding box framing for better performance.
59370
- * @param componentHandle - The component containing the instances
59371
- * @param elements - Array of node indices to frame
59432
+ * Frames specific elements of a loaded vim.
59433
+ * Automatically batches large arrays of elements.
59434
+ * @param vimIndex - The index of the loaded vim
59435
+ * @param vimElementIndices - Array of vim-based element indices to frame
59372
59436
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59373
59437
  * @returns Promise resolving to camera segment representing the final position
59374
- * @throws {Error} If the component handle is invalid or nodes array is empty
59375
59438
  */
59376
- async RPCFrameElements(componentHandle, elements, blendTime) {
59377
- if (!Validation.isComponentHandle(componentHandle)) return;
59378
- if (!Validation.areComponentHandles(elements)) return;
59439
+ async RPCFrameElements(vimIndex, vimElementIndices, blendTime) {
59440
+ if (!Validation.isIndex(vimIndex)) return;
59441
+ if (!Validation.areIndices(vimElementIndices)) return;
59379
59442
  blendTime = Validation.clamp01(blendTime);
59380
- if (elements.length < this.batchSize) {
59443
+ if (vimElementIndices.length < this.batchSize) {
59381
59444
  return await this.safeCall(
59382
- () => this.rpc.RPCFrameElements(componentHandle, elements, blendTime),
59445
+ () => this.rpc.RPCFrameElements(vimIndex, vimElementIndices, blendTime),
59383
59446
  void 0
59384
59447
  );
59385
59448
  } else {
59386
59449
  const box = await this.safeCall(
59387
- () => this.RPCGetAABBForElementsBatched(componentHandle, elements),
59450
+ () => this.RPCGetAABBForElementsBatched(vimIndex, vimElementIndices),
59388
59451
  void 0
59389
59452
  );
59390
59453
  if (!box) return void 0;
@@ -59398,7 +59461,6 @@ void main() {
59398
59461
  * Frames the camera to show a specific bounding box.
59399
59462
  * @param box - The bounding box to frame
59400
59463
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
59401
- * @throws {Error} If the box is invalid (min values must be less than max values)
59402
59464
  */
59403
59465
  async RPCFrameAABB(box, blendTime) {
59404
59466
  if (!Validation.isValidBox(box)) return;
@@ -59415,12 +59477,15 @@ void main() {
59415
59477
  /**
59416
59478
  * Sets the camera movement speed.
59417
59479
  * @param speed - The desired movement speed (must be positive)
59418
- * @throws {Error} If speed is not positive
59419
59480
  */
59420
59481
  RPCSetCameraSpeed(speed) {
59421
59482
  speed = Validation.min0(speed);
59422
59483
  this.rpc.RPCSetCameraSpeed(speed);
59423
59484
  }
59485
+ /**
59486
+ * Sets the camera control mode.
59487
+ * @param mode - The desired input mode (e.g., {@link InputMode.Orbit} or {@link InputMode.Free})
59488
+ */
59424
59489
  RPCSetCameraMode(mode) {
59425
59490
  this.rpc.RPCSetCameraMode(
59426
59491
  mode === "orbit"
@@ -59429,9 +59494,8 @@ void main() {
59429
59494
  }
59430
59495
  /**
59431
59496
  * Sets the viewer's aspect ratio.
59432
- * @param width - The width component of the aspect ratio
59433
- * @param height - The height component of the aspect ratio
59434
- * @throws {Error} If width or height are not positive integers
59497
+ * @param width - The width of the desired aspect ratio
59498
+ * @param height - The height of the desired aspect ratio
59435
59499
  */
59436
59500
  RPCSetCameraAspectRatio(width, height) {
59437
59501
  if (!Validation.isPositiveInteger(width)) return;
@@ -59440,13 +59504,12 @@ void main() {
59440
59504
  }
59441
59505
  /*******************************************************************************
59442
59506
  * VIM FILE MANAGEMENT METHODS
59443
- * Methods for loading, unloading, and managing VIM files and components.
59507
+ * Methods for loading, unloading, and managing VIM files.
59444
59508
  ******************************************************************************/
59445
59509
  /**
59446
59510
  * Loads a VIM file from the local filesystem.
59447
59511
  * @param source - The path to the VIM file (supports file:// protocol)
59448
- * @returns Promise resolving to the handle of the loaded VIM component
59449
- * @throws {Error} If the filename is invalid or empty
59512
+ * @returns Promise resolving to the index of the loaded vim
59450
59513
  */
59451
59514
  async RPCLoadVim(source) {
59452
59515
  if (!Validation.isNonEmptyString(source.url)) return INVALID_HANDLE;
@@ -59458,9 +59521,8 @@ void main() {
59458
59521
  }
59459
59522
  /**
59460
59523
  * Loads a VIM file from a remote URL.
59461
- * @param url - The URL of the VIM file to load
59462
- * @returns Promise resolving to the handle of the loaded VIM component
59463
- * @throws {Error} If the URL is invalid
59524
+ * @param source - The URL or file path of the VIM file to load
59525
+ * @returns Promise resolving to the index of the loaded vim
59464
59526
  */
59465
59527
  async RPCLoadVimURL(source) {
59466
59528
  if (!Validation.isURL(source.url)) return INVALID_HANDLE;
@@ -59470,17 +59532,16 @@ void main() {
59470
59532
  );
59471
59533
  }
59472
59534
  /**
59473
- * Retrieves the current loading state and progress of a VIM component.
59474
- * @param componentHandle - The handle of the VIM component
59535
+ * Retrieves the current loading state and progress of a vim.
59536
+ * @param vimIndex - The index of the vim being loaded
59475
59537
  * @returns Promise resolving to the current loading state and progress
59476
- * @throws {Error} If the component handle is invalid
59477
59538
  */
59478
- async RPCGetVimLoadingState(componentHandle) {
59479
- if (!Validation.isComponentHandle(componentHandle)) {
59539
+ async RPCGetVimLoadingState(vimIndex) {
59540
+ if (!Validation.isIndex(vimIndex)) {
59480
59541
  return { status: 0, progress: 0 };
59481
59542
  }
59482
59543
  const result = await this.safeCall(
59483
- () => this.rpc.RPCGetVimLoadingState(componentHandle),
59544
+ () => this.rpc.RPCGetVimLoadingState(vimIndex),
59484
59545
  { status: 0, progress: 0 }
59485
59546
  );
59486
59547
  if (!(result.status in VimLoadingStatus)) {
@@ -59489,16 +59550,7 @@ void main() {
59489
59550
  return result;
59490
59551
  }
59491
59552
  /**
59492
- * Unloads a VIM component and frees associated resources.
59493
- * @param componentHandle - The handle of the component to unload
59494
- * @throws {Error} If the component handle is invalid
59495
- */
59496
- RPCUnloadVim(componentHandle) {
59497
- if (!Validation.isComponentHandle(componentHandle)) return;
59498
- this.rpc.RPCUnloadVim(componentHandle);
59499
- }
59500
- /**
59501
- * Clears the entire scene, removing all components and resetting to initial state.
59553
+ * Clears the entire scene, unloading all vims and resetting to initial state.
59502
59554
  */
59503
59555
  RPCUnloadAll() {
59504
59556
  this.rpc.RPCUnloadAll();
@@ -59514,7 +59566,7 @@ void main() {
59514
59566
  /**
59515
59567
  * Performs hit testing at a specified screen position.
59516
59568
  * @param pos - Normalized screen coordinates (0-1, 0-1)
59517
- * @returns Promise resolving to hit test result if something was hit, undefined otherwise
59569
+ * @returns Promise resolving to hit test result if a valid hit was detected, undefined otherwise
59518
59570
  */
59519
59571
  async RPCPerformHitTest(pos) {
59520
59572
  if (!Validation.isRelativeVector2(pos)) return;
@@ -59522,7 +59574,7 @@ void main() {
59522
59574
  () => this.rpc.RPCPerformHitTest(pos),
59523
59575
  void 0
59524
59576
  );
59525
- if (!result || result.nodeIndex < 0) {
59577
+ if (!result || result.vimIndex === INVALID_HANDLE) {
59526
59578
  return void 0;
59527
59579
  }
59528
59580
  return result;
@@ -59532,7 +59584,6 @@ void main() {
59532
59584
  * @param position - The normalized screen coordinates (0-1, 0-1)
59533
59585
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
59534
59586
  * @param down - True if button is pressed down, false if released
59535
- * @throws {Error} If mouseButton is not a valid positive integer
59536
59587
  */
59537
59588
  RPCMouseButtonEvent(position, mouseButton, down) {
59538
59589
  if (!Validation.isPositiveInteger(mouseButton)) return;
@@ -59543,7 +59594,6 @@ void main() {
59543
59594
  * Sends a mouse double-click event to the viewer.
59544
59595
  * @param position - The normalized screen coordinates (0-1, 0-1)
59545
59596
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
59546
- * @throws {Error} If mouseButton is not a valid positive integer
59547
59597
  */
59548
59598
  RPCMouseDoubleClickEvent(position, mouseButton) {
59549
59599
  if (!Validation.isPositiveInteger(mouseButton)) return;
@@ -59570,7 +59620,6 @@ void main() {
59570
59620
  * Sends a mouse selection event to the viewer.
59571
59621
  * @param position - The normalized screen coordinates (0-1, 0-1)
59572
59622
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
59573
- * @throws {Error} If mouseButton is not a valid positive integer
59574
59623
  */
59575
59624
  RPCMouseSelectEvent(position, mouseButton) {
59576
59625
  if (!Validation.isPositiveInteger(mouseButton)) return;
@@ -59597,7 +59646,6 @@ void main() {
59597
59646
  * @param smoothness - The smoothness value to apply (clamped between 0 and 1)
59598
59647
  * @param colors - Array of colors for each material instance
59599
59648
  * @returns Array of handles for the created material instances
59600
- * @throws {Error} If the material handle is invalid or smoothness is out of range
59601
59649
  */
59602
59650
  async RPCCreateMaterialInstances(materialHandle, smoothness, colors) {
59603
59651
  if (!Validation.isMaterialHandle(materialHandle)) return;
@@ -59620,46 +59668,41 @@ void main() {
59620
59668
  }
59621
59669
  /**
59622
59670
  * Destroys multiple material instances, freeing associated resources.
59623
- * @param materialInstanceHandle - Array of handles for material instances to destroy
59624
- * @throws {Error} If any handle in the array is invalid
59671
+ * @param materialInstanceHandles - Array of handles for material instances to destroy
59625
59672
  */
59626
- RPCDestroyMaterialInstances(materialInstanceHandle) {
59627
- if (!Validation.areComponentHandles(materialInstanceHandle)) return;
59628
- this.rpc.RPCDestroyMaterialInstances(materialInstanceHandle);
59673
+ RPCDestroyMaterialInstances(materialInstanceHandles) {
59674
+ if (!Validation.areIndices(materialInstanceHandles)) return;
59675
+ this.rpc.RPCDestroyMaterialInstances(materialInstanceHandles);
59629
59676
  }
59630
59677
  /**
59631
- * Sets material overrides for specific nodes in a component.
59632
- * Large arrays are automatically processed in batches for better performance.
59633
- * @param componentHandle - The component containing the nodes
59634
- * @param nodes - Array of node indices to override
59635
- * @param materialInstanceHandles - Array of material instance handles to apply (must match nodes length)
59636
- * @throws {Error} If arrays have different lengths or any handle is invalid
59678
+ * Sets material overrides for specific elements in a loaded vim.
59679
+ * Large arrays are automatically processed in batches.
59680
+ * @param vimIndex - The index of the loaded vim
59681
+ * @param vimElementIndices - Array of vim-based element indices to override
59682
+ * @param materialInstanceHandles - Array of material instance handles to apply (must match element length)
59637
59683
  */
59638
- RPCSetMaterialOverrides(componentHandle, nodes, materialInstanceHandles) {
59639
- if (!Validation.areSameLength(nodes, materialInstanceHandles)) return;
59640
- if (!Validation.isComponentHandle(componentHandle)) return;
59641
- if (!Validation.areComponentHandles(nodes)) return;
59684
+ RPCSetMaterialOverridesForElements(vimIndex, vimElementIndices, materialInstanceHandles) {
59685
+ if (!Validation.areSameLength(vimElementIndices, materialInstanceHandles)) return;
59686
+ if (!Validation.isIndex(vimIndex)) return;
59687
+ if (!Validation.areIndices(vimElementIndices)) return;
59642
59688
  if (!Validation.areIntegers(materialInstanceHandles)) return;
59643
59689
  this.setMaterialOverridesBatched(
59644
- componentHandle,
59645
- nodes,
59690
+ vimIndex,
59691
+ vimElementIndices,
59646
59692
  materialInstanceHandles
59647
59693
  );
59648
59694
  }
59649
- setMaterialOverridesBatched(componentHandle, nodes, materialInstanceHandles) {
59650
- const batches = batchArrays(nodes, materialInstanceHandles, this.batchSize);
59651
- for (const [batchedNodes, batchedMaterials] of batches) {
59652
- this.rpc.RPCSetMaterialOverrides(componentHandle, batchedNodes, batchedMaterials);
59695
+ setMaterialOverridesBatched(vimIndex, vimElementIndices, materialInstanceHandles) {
59696
+ const batches = batchArrays(vimElementIndices, materialInstanceHandles, this.batchSize);
59697
+ for (const [batchedElements, batchedMaterials] of batches) {
59698
+ this.rpc.RPCSetMaterialOverridesForElements(vimIndex, batchedElements, batchedMaterials);
59653
59699
  }
59654
59700
  }
59655
59701
  /**
59656
- * Clears all material overrides for the specified component, restoring default materials.
59657
- * @param componentHandle - The unique identifier of the component
59658
- * @throws {Error} If the component handle is invalid or INVALID_HANDLE
59702
+ * Clears all material overrides for the entire scene.
59659
59703
  */
59660
- RPCClearMaterialOverrides(componentHandle) {
59661
- if (!Validation.isComponentHandle(componentHandle)) return;
59662
- this.rpc.RPCClearMaterialOverrides(componentHandle);
59704
+ RPCClearMaterialOverrides() {
59705
+ this.rpc.RPCClearMaterialOverrides();
59663
59706
  }
59664
59707
  /*******************************************************************************
59665
59708
  * DEBUG AND UTILITY METHODS
@@ -59809,7 +59852,7 @@ void main() {
59809
59852
  * @returns Current background blur
59810
59853
  */
59811
59854
  get backgroundBlur() {
59812
- return this._settings.backGroundBlur;
59855
+ return this._settings.backgroundBlur;
59813
59856
  }
59814
59857
  /**
59815
59858
  * Gets the background color
@@ -59880,8 +59923,8 @@ void main() {
59880
59923
  */
59881
59924
  set backgroundBlur(value) {
59882
59925
  value = Validation.clamp01(value);
59883
- if (this._settings.backGroundBlur === value) return;
59884
- this._settings.backGroundBlur = value;
59926
+ if (this._settings.backgroundBlur === value) return;
59927
+ this._settings.backgroundBlur = value;
59885
59928
  this._updateLighting = true;
59886
59929
  this.requestSettingsUpdate();
59887
59930
  }
@@ -59897,7 +59940,7 @@ void main() {
59897
59940
  this.requestSettingsUpdate();
59898
59941
  }
59899
59942
  getBoundingBox() {
59900
- return this._rpc.RPCGetAABBForAll();
59943
+ return this._rpc.RPCGetAABBForScene();
59901
59944
  }
59902
59945
  /**
59903
59946
  * Requests an update to be performed on the next animation frame.
@@ -60036,7 +60079,7 @@ void main() {
60036
60079
  VisibilityState2[VisibilityState2["GHOSTED_HIGHLIGHTED"] = 18] = "GHOSTED_HIGHLIGHTED";
60037
60080
  return VisibilityState2;
60038
60081
  })(VisibilityState$1 || {});
60039
- class StateSynchronizer {
60082
+ class VisibilitySynchronizer {
60040
60083
  /**
60041
60084
  * Creates a new StateSynchronizer instance.
60042
60085
  *
@@ -60054,7 +60097,7 @@ void main() {
60054
60097
  __publicField(this, "_onUpdate");
60055
60098
  __publicField(this, "_isConnected");
60056
60099
  __publicField(this, "_animationFrame");
60057
- this._tracker = new StateTracker(defaultState);
60100
+ this._tracker = new VisibilityTracker(defaultState);
60058
60101
  this._rpc = rpc;
60059
60102
  this._onUpdate = onUpdate;
60060
60103
  this._getHandle = getHandle;
@@ -60103,7 +60146,7 @@ void main() {
60103
60146
  * @param elementIndex - The element index to update
60104
60147
  * @param state - The new state to apply
60105
60148
  */
60106
- setElementState(elementIndex, state) {
60149
+ setStateForElement(elementIndex, state) {
60107
60150
  this._tracker.setState(elementIndex, state);
60108
60151
  this.scheduleUpdate();
60109
60152
  }
@@ -60167,7 +60210,7 @@ void main() {
60167
60210
  this._onUpdate();
60168
60211
  }
60169
60212
  }
60170
- class StateTracker {
60213
+ class VisibilityTracker {
60171
60214
  /**
60172
60215
  * Creates a new StateTracker instance.
60173
60216
  *
@@ -60804,7 +60847,7 @@ Averrage Date/Second ${avgDataRatePS} kb
60804
60847
  return this.vim.visibility.getElementState(this.element);
60805
60848
  }
60806
60849
  set state(state) {
60807
- this.vim.visibility.setElementState(this.element, state);
60850
+ this.vim.visibility.setStateForElement(this.element, state);
60808
60851
  }
60809
60852
  /**
60810
60853
  * Gets or sets the color override of the element.
@@ -60834,19 +60877,21 @@ Averrage Date/Second ${avgDataRatePS} kb
60834
60877
  __publicField(this, "_renderer");
60835
60878
  __publicField(this, "_logger");
60836
60879
  // The StateSynchronizer wraps a StateTracker and handles RPC synchronization.
60880
+ // Should be private
60837
60881
  __publicField(this, "visibility");
60838
60882
  // Color tracking remains unchanged.
60839
60883
  __publicField(this, "_nodeColors", /* @__PURE__ */ new Map());
60840
60884
  __publicField(this, "_updatedColors", /* @__PURE__ */ new Set());
60841
60885
  // Delayed update flag.
60842
60886
  __publicField(this, "_updateScheduled", false);
60887
+ __publicField(this, "_elementCount", 0);
60843
60888
  __publicField(this, "_objects", /* @__PURE__ */ new Map());
60844
60889
  this._rpc = rpc;
60845
60890
  this.source = source;
60846
60891
  this._colors = color;
60847
60892
  this._renderer = renderer;
60848
60893
  this._logger = logger;
60849
- this.visibility = new StateSynchronizer(
60894
+ this.visibility = new VisibilitySynchronizer(
60850
60895
  this._rpc,
60851
60896
  () => this._handle,
60852
60897
  () => this.connected,
@@ -60873,7 +60918,10 @@ Averrage Date/Second ${avgDataRatePS} kb
60873
60918
  throw new Error("Method not implemented.");
60874
60919
  }
60875
60920
  getAllElements() {
60876
- throw new Error("Method not implemented.");
60921
+ for (var i2 = 0; i2 < this._elementCount; i2++) {
60922
+ this.getElement(i2);
60923
+ }
60924
+ return Array.from(this._objects.values());
60877
60925
  }
60878
60926
  get handle() {
60879
60927
  return this._handle;
@@ -60904,7 +60952,6 @@ Averrage Date/Second ${avgDataRatePS} kb
60904
60952
  (_a3 = this._request) == null ? void 0 : _a3.error("cancelled", "The request was cancelled");
60905
60953
  this._request = void 0;
60906
60954
  if (this.connected) {
60907
- this._rpc.RPCUnloadVim(this._handle);
60908
60955
  this._handle = -1;
60909
60956
  }
60910
60957
  }
@@ -60926,12 +60973,12 @@ Averrage Date/Second ${avgDataRatePS} kb
60926
60973
  case VimLoadingStatus.FailedToDownload:
60927
60974
  case VimLoadingStatus.FailedToLoad:
60928
60975
  case VimLoadingStatus.Unknown:
60929
- this._rpc.RPCUnloadVim(handle);
60930
60976
  const details = await this._rpc.RPCGetLastError();
60931
60977
  const error = this.getErrorType(state.status);
60932
60978
  return result.error(error, details);
60933
60979
  case VimLoadingStatus.Done:
60934
60980
  this._handle = handle;
60981
+ this._elementCount = await this._rpc.RPCGetElementCountForVim(handle);
60935
60982
  return result.success(this);
60936
60983
  }
60937
60984
  } catch (e) {
@@ -61012,18 +61059,18 @@ Averrage Date/Second ${avgDataRatePS} kb
61012
61059
  }
61013
61060
  this.scheduleColorUpdate();
61014
61061
  }
61015
- clearColor(nodes) {
61016
- if (nodes === "all") {
61062
+ clearColor(elements) {
61063
+ if (elements === "all") {
61017
61064
  this._nodeColors.clear();
61018
61065
  } else {
61019
- nodes.forEach((n) => this._nodeColors.delete(n));
61066
+ elements.forEach((n) => this._nodeColors.delete(n));
61020
61067
  }
61021
61068
  if (!this.connected) return;
61022
- if (nodes === "all") {
61023
- this._rpc.RPCClearMaterialOverrides(this._handle);
61069
+ if (elements === "all") {
61070
+ this._rpc.RPCClearMaterialOverrides();
61024
61071
  } else {
61025
- const ids = new Array(nodes.length).fill(MaterialHandles.Invalid);
61026
- this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids);
61072
+ const ids = new Array(elements.length).fill(MaterialHandles.Invalid);
61073
+ this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, ids);
61027
61074
  }
61028
61075
  }
61029
61076
  reapplyColors() {
@@ -61048,7 +61095,7 @@ Averrage Date/Second ${avgDataRatePS} kb
61048
61095
  const colors = nodes.map((n) => this._nodeColors.get(n));
61049
61096
  const remoteColors = await this._colors.getColors(colors);
61050
61097
  const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
61051
- this._rpc.RPCSetMaterialOverrides(this._handle, nodes, colorIds);
61098
+ this._rpc.RPCSetMaterialOverridesForElements(this._handle, nodes, colorIds);
61052
61099
  this._updatedColors.clear();
61053
61100
  }
61054
61101
  }
@@ -61349,6 +61396,9 @@ Averrage Date/Second ${avgDataRatePS} kb
61349
61396
  this._vims.getAll().forEach((vim) => vim.disconnect());
61350
61397
  this._vims.clear();
61351
61398
  }
61399
+ getElement3Ds() {
61400
+ return this.rpc.RPCGetElementCountForScene();
61401
+ }
61352
61402
  /**
61353
61403
  * Disposes all resources used by the viewer and disconnects from the server.
61354
61404
  */