vim-web 0.5.0-dev.3 → 0.5.0-dev.5
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/types/core-viewers/ultra/rpcClient.d.ts +16 -17
- package/dist/types/core-viewers/ultra/rpcSafeClient.d.ts +188 -86
- package/dist/types/core-viewers/ultra/sectionBox.d.ts +1 -1
- package/dist/types/core-viewers/ultra/vim.d.ts +2 -2
- package/dist/types/core-viewers/ultra/visibility.d.ts +2 -2
- package/dist/types/utils/validation.d.ts +2 -2
- package/dist/vim-web.iife.js +224 -205
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +224 -205
- package/dist/vim-web.js.map +1 -1
- package/package.json +2 -2
package/dist/vim-web.iife.js
CHANGED
|
@@ -50892,16 +50892,16 @@ void main() {
|
|
|
50892
50892
|
//= ===========================================================================
|
|
50893
50893
|
// HANDLE VALIDATIONS
|
|
50894
50894
|
//= ===========================================================================
|
|
50895
|
-
static
|
|
50896
|
-
if (!this.isPositiveInteger(
|
|
50897
|
-
if (
|
|
50898
|
-
console.warn(`Invalid
|
|
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
|
|
50904
|
-
return
|
|
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.
|
|
57548
|
+
const segment = await this._rpc.RPCFrameScene(blendTime);
|
|
57549
57549
|
this._savedPosition = this._savedPosition ?? segment;
|
|
57550
57550
|
return segment;
|
|
57551
57551
|
}
|
|
@@ -57969,10 +57969,10 @@ void main() {
|
|
|
57969
57969
|
const ret = returnMarshal.readUInt();
|
|
57970
57970
|
return ret;
|
|
57971
57971
|
}
|
|
57972
|
-
RPCDestroyMaterialInstances(
|
|
57972
|
+
RPCDestroyMaterialInstances(materialInstanceHandles) {
|
|
57973
57973
|
const marshal = new Marshal();
|
|
57974
57974
|
marshal.writeString("RPCDestroyMaterialInstances");
|
|
57975
|
-
marshal.writeArrayOfUInt(
|
|
57975
|
+
marshal.writeArrayOfUInt(materialInstanceHandles);
|
|
57976
57976
|
this._socket.sendRPC(marshal);
|
|
57977
57977
|
}
|
|
57978
57978
|
RPCDestroyText(componentHandle) {
|
|
@@ -57996,53 +57996,53 @@ void main() {
|
|
|
57996
57996
|
const ret = returnMarshal.readSegment();
|
|
57997
57997
|
return ret;
|
|
57998
57998
|
}
|
|
57999
|
-
async
|
|
57999
|
+
async RPCFrameElements(vimIndex, elementIndices, blendTime) {
|
|
58000
58000
|
const marshal = new Marshal();
|
|
58001
|
-
marshal.writeString("
|
|
58001
|
+
marshal.writeString("RPCFrameElements");
|
|
58002
|
+
marshal.writeUInt(vimIndex);
|
|
58003
|
+
marshal.writeArrayOfUInt(elementIndices);
|
|
58002
58004
|
marshal.writeFloat(blendTime);
|
|
58003
58005
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58004
58006
|
const ret = returnMarshal.readSegment();
|
|
58005
58007
|
return ret;
|
|
58006
58008
|
}
|
|
58007
|
-
async
|
|
58009
|
+
async RPCFrameScene(blendTime) {
|
|
58008
58010
|
const marshal = new Marshal();
|
|
58009
|
-
marshal.writeString("
|
|
58010
|
-
marshal.writeUInt(componentHandle);
|
|
58011
|
-
marshal.writeArrayOfUInt(elementIndices);
|
|
58011
|
+
marshal.writeString("RPCFrameScene");
|
|
58012
58012
|
marshal.writeFloat(blendTime);
|
|
58013
58013
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58014
58014
|
const ret = returnMarshal.readSegment();
|
|
58015
58015
|
return ret;
|
|
58016
58016
|
}
|
|
58017
|
-
async RPCFrameVim(
|
|
58017
|
+
async RPCFrameVim(vimIndex, blendTime) {
|
|
58018
58018
|
const marshal = new Marshal();
|
|
58019
58019
|
marshal.writeString("RPCFrameVim");
|
|
58020
|
-
marshal.writeUInt(
|
|
58020
|
+
marshal.writeUInt(vimIndex);
|
|
58021
58021
|
marshal.writeFloat(blendTime);
|
|
58022
58022
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58023
58023
|
const ret = returnMarshal.readSegment();
|
|
58024
58024
|
return ret;
|
|
58025
58025
|
}
|
|
58026
|
-
async
|
|
58026
|
+
async RPCGetAABBForElements(vimIndex, elementIndices) {
|
|
58027
58027
|
const marshal = new Marshal();
|
|
58028
|
-
marshal.writeString("
|
|
58028
|
+
marshal.writeString("RPCGetAABBForElements");
|
|
58029
|
+
marshal.writeUInt(vimIndex);
|
|
58030
|
+
marshal.writeArrayOfUInt(elementIndices);
|
|
58029
58031
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58030
58032
|
const ret = returnMarshal.readBox3();
|
|
58031
58033
|
return ret;
|
|
58032
58034
|
}
|
|
58033
|
-
async
|
|
58035
|
+
async RPCGetAABBForScene() {
|
|
58034
58036
|
const marshal = new Marshal();
|
|
58035
|
-
marshal.writeString("
|
|
58036
|
-
marshal.writeUInt(componentHandle);
|
|
58037
|
-
marshal.writeArrayOfUInt(elementIndices);
|
|
58037
|
+
marshal.writeString("RPCGetAABBForScene");
|
|
58038
58038
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58039
58039
|
const ret = returnMarshal.readBox3();
|
|
58040
58040
|
return ret;
|
|
58041
58041
|
}
|
|
58042
|
-
async RPCGetAABBForVim(
|
|
58042
|
+
async RPCGetAABBForVim(vimIndex) {
|
|
58043
58043
|
const marshal = new Marshal();
|
|
58044
58044
|
marshal.writeString("RPCGetAABBForVim");
|
|
58045
|
-
marshal.writeUInt(
|
|
58045
|
+
marshal.writeUInt(vimIndex);
|
|
58046
58046
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58047
58047
|
const ret = returnMarshal.readBox3();
|
|
58048
58048
|
return ret;
|
|
@@ -58061,25 +58061,25 @@ void main() {
|
|
|
58061
58061
|
const ret = returnMarshal.readSegment();
|
|
58062
58062
|
return ret;
|
|
58063
58063
|
}
|
|
58064
|
-
async
|
|
58064
|
+
async RPCGetElementCountForScene() {
|
|
58065
58065
|
const marshal = new Marshal();
|
|
58066
|
-
marshal.writeString("
|
|
58066
|
+
marshal.writeString("RPCGetElementCountForScene");
|
|
58067
58067
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58068
58068
|
const ret = returnMarshal.readUInt();
|
|
58069
58069
|
return ret;
|
|
58070
58070
|
}
|
|
58071
|
-
async
|
|
58071
|
+
async RPCGetElementCountForVim(vimIndex) {
|
|
58072
58072
|
const marshal = new Marshal();
|
|
58073
|
-
marshal.writeString("
|
|
58073
|
+
marshal.writeString("RPCGetElementCountForVim");
|
|
58074
58074
|
marshal.writeUInt(vimIndex);
|
|
58075
58075
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58076
58076
|
const ret = returnMarshal.readUInt();
|
|
58077
58077
|
return ret;
|
|
58078
58078
|
}
|
|
58079
|
-
async RPCGetElementIds(
|
|
58079
|
+
async RPCGetElementIds(vimIndex) {
|
|
58080
58080
|
const marshal = new Marshal();
|
|
58081
58081
|
marshal.writeString("RPCGetElementIds");
|
|
58082
|
-
marshal.writeUInt(
|
|
58082
|
+
marshal.writeUInt(vimIndex);
|
|
58083
58083
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58084
58084
|
const ret = returnMarshal.readArrayOfUInt64();
|
|
58085
58085
|
return ret;
|
|
@@ -58091,10 +58091,10 @@ void main() {
|
|
|
58091
58091
|
const ret = returnMarshal.readString();
|
|
58092
58092
|
return ret;
|
|
58093
58093
|
}
|
|
58094
|
-
async RPCGetRoomElements(
|
|
58094
|
+
async RPCGetRoomElements(vimIndex) {
|
|
58095
58095
|
const marshal = new Marshal();
|
|
58096
58096
|
marshal.writeString("RPCGetRoomElements");
|
|
58097
|
-
marshal.writeUInt(
|
|
58097
|
+
marshal.writeUInt(vimIndex);
|
|
58098
58098
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58099
58099
|
const ret = returnMarshal.readArrayOfUInt();
|
|
58100
58100
|
return ret;
|
|
@@ -58106,10 +58106,10 @@ void main() {
|
|
|
58106
58106
|
const ret = returnMarshal.readSectionBoxState();
|
|
58107
58107
|
return ret;
|
|
58108
58108
|
}
|
|
58109
|
-
async RPCGetVimLoadingState(
|
|
58109
|
+
async RPCGetVimLoadingState(vimIndex) {
|
|
58110
58110
|
const marshal = new Marshal();
|
|
58111
58111
|
marshal.writeString("RPCGetVimLoadingState");
|
|
58112
|
-
marshal.writeUInt(
|
|
58112
|
+
marshal.writeUInt(vimIndex);
|
|
58113
58113
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58114
58114
|
const ret = returnMarshal.readVimStatus();
|
|
58115
58115
|
return ret;
|
|
@@ -58243,10 +58243,10 @@ void main() {
|
|
|
58243
58243
|
marshal.writeRGBA(backgroundColor);
|
|
58244
58244
|
this._socket.sendRPC(marshal);
|
|
58245
58245
|
}
|
|
58246
|
-
|
|
58246
|
+
RPCSetMaterialOverridesForElements(vimIndex, elementIndices, materialInstanceHandles) {
|
|
58247
58247
|
const marshal = new Marshal();
|
|
58248
|
-
marshal.writeString("
|
|
58249
|
-
marshal.writeUInt(
|
|
58248
|
+
marshal.writeString("RPCSetMaterialOverridesForElements");
|
|
58249
|
+
marshal.writeUInt(vimIndex);
|
|
58250
58250
|
marshal.writeArrayOfUInt(elementIndices);
|
|
58251
58251
|
marshal.writeArrayOfUInt(materialInstanceHandles);
|
|
58252
58252
|
this._socket.sendRPC(marshal);
|
|
@@ -58257,10 +58257,10 @@ void main() {
|
|
|
58257
58257
|
marshal.writeSectionBoxState(state);
|
|
58258
58258
|
this._socket.sendRPC(marshal);
|
|
58259
58259
|
}
|
|
58260
|
-
RPCSetStateElements(
|
|
58260
|
+
RPCSetStateElements(vimIndex, elementIndices, state) {
|
|
58261
58261
|
const marshal = new Marshal();
|
|
58262
58262
|
marshal.writeString("RPCSetStateElements");
|
|
58263
|
-
marshal.writeUInt(
|
|
58263
|
+
marshal.writeUInt(vimIndex);
|
|
58264
58264
|
marshal.writeArrayOfUInt(elementIndices);
|
|
58265
58265
|
marshal.writeUInt(state);
|
|
58266
58266
|
this._socket.sendRPC(marshal);
|
|
@@ -58271,17 +58271,17 @@ void main() {
|
|
|
58271
58271
|
marshal.writeUInt(state);
|
|
58272
58272
|
this._socket.sendRPC(marshal);
|
|
58273
58273
|
}
|
|
58274
|
-
RPCSetStateVim(
|
|
58274
|
+
RPCSetStateVim(vimIndex, state) {
|
|
58275
58275
|
const marshal = new Marshal();
|
|
58276
58276
|
marshal.writeString("RPCSetStateVim");
|
|
58277
|
-
marshal.writeUInt(
|
|
58277
|
+
marshal.writeUInt(vimIndex);
|
|
58278
58278
|
marshal.writeUInt(state);
|
|
58279
58279
|
this._socket.sendRPC(marshal);
|
|
58280
58280
|
}
|
|
58281
|
-
RPCSetStatesElements(
|
|
58281
|
+
RPCSetStatesElements(vimIndex, elementIndices, states) {
|
|
58282
58282
|
const marshal = new Marshal();
|
|
58283
58283
|
marshal.writeString("RPCSetStatesElements");
|
|
58284
|
-
marshal.writeUInt(
|
|
58284
|
+
marshal.writeUInt(vimIndex);
|
|
58285
58285
|
marshal.writeArrayOfUInt(elementIndices);
|
|
58286
58286
|
marshal.writeArrayOfUInt(states);
|
|
58287
58287
|
this._socket.sendRPC(marshal);
|
|
@@ -58309,12 +58309,6 @@ void main() {
|
|
|
58309
58309
|
marshal.writeString("RPCUnloadAll");
|
|
58310
58310
|
this._socket.sendRPC(marshal);
|
|
58311
58311
|
}
|
|
58312
|
-
RPCUnloadVim(componentHandle) {
|
|
58313
|
-
const marshal = new Marshal();
|
|
58314
|
-
marshal.writeString("RPCUnloadVim");
|
|
58315
|
-
marshal.writeUInt(componentHandle);
|
|
58316
|
-
this._socket.sendRPC(marshal);
|
|
58317
|
-
}
|
|
58318
58312
|
}
|
|
58319
58313
|
class RemoteColor {
|
|
58320
58314
|
/**
|
|
@@ -59096,7 +59090,7 @@ void main() {
|
|
|
59096
59090
|
hdrScale: 1.37,
|
|
59097
59091
|
hdrBackgroundScale: 1,
|
|
59098
59092
|
hdrBackgroundSaturation: 1,
|
|
59099
|
-
|
|
59093
|
+
backgroundBlur: 1,
|
|
59100
59094
|
backgroundColor: new RGBA(0.9, 0.9, 0.9, 1)
|
|
59101
59095
|
};
|
|
59102
59096
|
var VimLoadingStatus = /* @__PURE__ */ ((VimLoadingStatus2) => {
|
|
@@ -59109,15 +59103,26 @@ void main() {
|
|
|
59109
59103
|
return VimLoadingStatus2;
|
|
59110
59104
|
})(VimLoadingStatus || {});
|
|
59111
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
|
+
*/
|
|
59112
59111
|
constructor(rpc, batchSize = defaultBatchSize) {
|
|
59113
59112
|
__publicField(this, "rpc");
|
|
59114
59113
|
__publicField(this, "batchSize");
|
|
59115
59114
|
this.rpc = rpc;
|
|
59116
59115
|
this.batchSize = batchSize;
|
|
59117
59116
|
}
|
|
59117
|
+
/**
|
|
59118
|
+
* The URL used by the underlying RPC connection.
|
|
59119
|
+
*/
|
|
59118
59120
|
get url() {
|
|
59119
59121
|
return this.rpc.url;
|
|
59120
59122
|
}
|
|
59123
|
+
/**
|
|
59124
|
+
* Indicates whether the RPC client is currently connected.
|
|
59125
|
+
*/
|
|
59121
59126
|
get connected() {
|
|
59122
59127
|
return this.rpc.connected;
|
|
59123
59128
|
}
|
|
@@ -59127,9 +59132,10 @@ void main() {
|
|
|
59127
59132
|
* and scene-wide settings.
|
|
59128
59133
|
******************************************************************************/
|
|
59129
59134
|
/**
|
|
59130
|
-
* Initializes and starts the scene with
|
|
59135
|
+
* Initializes and starts the scene with the given settings.
|
|
59131
59136
|
* @param settings - Optional partial scene settings to override defaults
|
|
59132
|
-
* @
|
|
59137
|
+
* @returns Promise resolving to true if the scene started successfully, false otherwise
|
|
59138
|
+
* @remarks Missing values will be filled from {@link defaultSceneSettings}
|
|
59133
59139
|
*/
|
|
59134
59140
|
async RPCStartScene(settings2) {
|
|
59135
59141
|
const s = { ...defaultSceneSettings, ...settings2 ?? {} };
|
|
@@ -59139,15 +59145,15 @@ void main() {
|
|
|
59139
59145
|
Validation.min0(s.hdrScale),
|
|
59140
59146
|
Validation.clamp01(s.hdrBackgroundScale),
|
|
59141
59147
|
Validation.clamp01(s.hdrBackgroundSaturation),
|
|
59142
|
-
Validation.clamp01(s.
|
|
59148
|
+
Validation.clamp01(s.backgroundBlur),
|
|
59143
59149
|
Validation.clampRGBA01(s.backgroundColor)
|
|
59144
59150
|
),
|
|
59145
59151
|
false
|
|
59146
59152
|
);
|
|
59147
59153
|
}
|
|
59148
59154
|
/**
|
|
59149
|
-
*
|
|
59150
|
-
* @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
|
|
59151
59157
|
*/
|
|
59152
59158
|
RPCSetLighting(settings2) {
|
|
59153
59159
|
const s = settings2;
|
|
@@ -59156,55 +59162,80 @@ void main() {
|
|
|
59156
59162
|
Validation.min0(s.hdrScale),
|
|
59157
59163
|
Validation.clamp01(s.hdrBackgroundScale),
|
|
59158
59164
|
Validation.clamp01(s.hdrBackgroundSaturation),
|
|
59159
|
-
Validation.clamp01(s.
|
|
59165
|
+
Validation.clamp01(s.backgroundBlur),
|
|
59160
59166
|
Validation.clampRGBA01(s.backgroundColor)
|
|
59161
59167
|
);
|
|
59162
59168
|
}
|
|
59163
|
-
|
|
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() {
|
|
59164
59174
|
return this.safeCall(
|
|
59165
|
-
() => this.rpc.
|
|
59175
|
+
() => this.rpc.RPCGetElementCountForScene(),
|
|
59166
59176
|
0
|
|
59167
59177
|
);
|
|
59168
59178
|
}
|
|
59169
|
-
|
|
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) {
|
|
59170
59185
|
return this.safeCall(
|
|
59171
|
-
() => this.rpc.
|
|
59186
|
+
() => this.rpc.RPCGetElementCountForVim(vimIndex),
|
|
59172
59187
|
0
|
|
59173
59188
|
);
|
|
59174
59189
|
}
|
|
59175
59190
|
/*******************************************************************************
|
|
59176
|
-
*
|
|
59177
|
-
* Methods for controlling
|
|
59191
|
+
* ELEMENTS VISIBILITY METHODS
|
|
59192
|
+
* Methods for controlling element visibility, including show/hide, ghosting,
|
|
59178
59193
|
* and highlighting functionality.
|
|
59179
59194
|
******************************************************************************/
|
|
59180
59195
|
/**
|
|
59181
|
-
*
|
|
59182
|
-
*
|
|
59183
|
-
*
|
|
59184
|
-
* @param
|
|
59185
|
-
* @
|
|
59186
|
-
|
|
59187
|
-
|
|
59188
|
-
|
|
59189
|
-
if (
|
|
59190
|
-
if (!Validation.
|
|
59191
|
-
|
|
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);
|
|
59192
59208
|
for (const batch of batches) {
|
|
59193
|
-
this.rpc.RPCSetStateElements(
|
|
59209
|
+
this.rpc.RPCSetStateElements(vimIndex, batch, state);
|
|
59194
59210
|
}
|
|
59195
59211
|
}
|
|
59196
|
-
|
|
59197
|
-
|
|
59198
|
-
|
|
59199
|
-
|
|
59200
|
-
|
|
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);
|
|
59201
59226
|
for (const [batchedElements, batchedStates] of batches) {
|
|
59202
|
-
this.rpc.RPCSetStatesElements(
|
|
59227
|
+
this.rpc.RPCSetStatesElements(vimIndex, batchedElements, batchedStates);
|
|
59203
59228
|
}
|
|
59204
59229
|
}
|
|
59205
|
-
|
|
59206
|
-
|
|
59207
|
-
|
|
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);
|
|
59208
59239
|
}
|
|
59209
59240
|
/*******************************************************************************
|
|
59210
59241
|
* TEXT AND UI METHODS
|
|
@@ -59216,7 +59247,6 @@ void main() {
|
|
|
59216
59247
|
* @param color - The color of the text
|
|
59217
59248
|
* @param text - The content to display
|
|
59218
59249
|
* @returns Promise resolving to the handle of the created text component
|
|
59219
|
-
* @throws {Error} If the text is empty
|
|
59220
59250
|
*/
|
|
59221
59251
|
async RPCCreateText(position, color, text) {
|
|
59222
59252
|
if (!Validation.isNonEmptyString(text)) return INVALID_HANDLE;
|
|
@@ -59229,19 +59259,26 @@ void main() {
|
|
|
59229
59259
|
/**
|
|
59230
59260
|
* Destroys a text component, removing it from the scene.
|
|
59231
59261
|
* @param componentHandle - The handle of the text component to destroy
|
|
59232
|
-
* @throws {Error} If the component handle is invalid
|
|
59233
59262
|
*/
|
|
59234
59263
|
RPCDestroyText(componentHandle) {
|
|
59235
|
-
if (!Validation.
|
|
59264
|
+
if (!Validation.isIndex(componentHandle)) return;
|
|
59236
59265
|
this.rpc.RPCDestroyText(componentHandle);
|
|
59237
59266
|
}
|
|
59238
59267
|
/*******************************************************************************
|
|
59239
59268
|
* SECTION BOX METHODS
|
|
59240
59269
|
* Methods for controlling section box visibility and position.
|
|
59241
59270
|
******************************************************************************/
|
|
59271
|
+
/**
|
|
59272
|
+
* Enables or disables the section box.
|
|
59273
|
+
* @param enable - True to enable the section box, false to disable it
|
|
59274
|
+
*/
|
|
59242
59275
|
RPCEnableSectionBox(enable) {
|
|
59243
59276
|
this.rpc.RPCEnableSectionBox(enable);
|
|
59244
59277
|
}
|
|
59278
|
+
/**
|
|
59279
|
+
* Sets the parameters of the section box.
|
|
59280
|
+
* @param state - The new section box state, including visibility and bounding box
|
|
59281
|
+
*/
|
|
59245
59282
|
RPCSetSectionBox(state) {
|
|
59246
59283
|
this.rpc.RPCSetSectionBox(
|
|
59247
59284
|
{
|
|
@@ -59250,6 +59287,10 @@ void main() {
|
|
|
59250
59287
|
}
|
|
59251
59288
|
);
|
|
59252
59289
|
}
|
|
59290
|
+
/**
|
|
59291
|
+
* Retrieves the current section box state.
|
|
59292
|
+
* @returns Promise resolving to the section box state or undefined on failure
|
|
59293
|
+
*/
|
|
59253
59294
|
async RPCGetSectionBox() {
|
|
59254
59295
|
return await this.safeCall(
|
|
59255
59296
|
() => this.rpc.RPCGetSectionBox(),
|
|
@@ -59306,52 +59347,52 @@ void main() {
|
|
|
59306
59347
|
}
|
|
59307
59348
|
/**
|
|
59308
59349
|
* Retrieves the axis-aligned bounding box (AABB) that encompasses the entire scene.
|
|
59309
|
-
* This includes all loaded geometry across all
|
|
59350
|
+
* This includes all loaded geometry across all loaded vims.
|
|
59310
59351
|
*
|
|
59311
59352
|
* @returns Promise resolving to the global AABB of the scene, or undefined on failure
|
|
59312
59353
|
*/
|
|
59313
|
-
|
|
59354
|
+
RPCGetAABBForScene() {
|
|
59314
59355
|
return this.safeCall(
|
|
59315
|
-
() => this.rpc.
|
|
59356
|
+
() => this.rpc.RPCGetAABBForScene(),
|
|
59316
59357
|
void 0
|
|
59317
59358
|
);
|
|
59318
59359
|
}
|
|
59319
59360
|
/**
|
|
59320
|
-
* Retrieves the axis-aligned bounding box (AABB) for a specific
|
|
59321
|
-
* This bounding box represents the spatial bounds of all geometry within the given
|
|
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.
|
|
59322
59363
|
*
|
|
59323
|
-
* @param
|
|
59324
|
-
* @returns Promise resolving to the
|
|
59364
|
+
* @param vimIndex - The index of the loaded vim to query
|
|
59365
|
+
* @returns Promise resolving to the vim bounding box, or undefined on failure
|
|
59325
59366
|
*/
|
|
59326
|
-
async RPCGetAABBForVim(
|
|
59367
|
+
async RPCGetAABBForVim(vimIndex) {
|
|
59368
|
+
if (!Validation.isIndex(vimIndex)) return void 0;
|
|
59327
59369
|
return await this.safeCall(
|
|
59328
|
-
() => this.rpc.RPCGetAABBForVim(
|
|
59370
|
+
() => this.rpc.RPCGetAABBForVim(vimIndex),
|
|
59329
59371
|
void 0
|
|
59330
59372
|
);
|
|
59331
59373
|
}
|
|
59332
59374
|
/**
|
|
59333
|
-
* Calculates the bounding box for specified
|
|
59334
|
-
* Large
|
|
59335
|
-
* @param
|
|
59336
|
-
* @param
|
|
59337
|
-
* @returns Promise resolving to the combined bounding box
|
|
59338
|
-
* @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
|
|
59339
59380
|
*/
|
|
59340
|
-
async RPCGetAABBForElements(
|
|
59341
|
-
if (!Validation.
|
|
59342
|
-
if (!Validation.
|
|
59381
|
+
async RPCGetAABBForElements(vimIndex, vimElementIndices) {
|
|
59382
|
+
if (!Validation.isIndex(vimIndex)) return;
|
|
59383
|
+
if (!Validation.areIndices(vimElementIndices)) return;
|
|
59343
59384
|
return await this.safeCall(
|
|
59344
|
-
() => this.RPCGetAABBForElementsBatched(
|
|
59385
|
+
() => this.RPCGetAABBForElementsBatched(vimIndex, vimElementIndices),
|
|
59345
59386
|
void 0
|
|
59346
59387
|
);
|
|
59347
59388
|
}
|
|
59348
|
-
async RPCGetAABBForElementsBatched(
|
|
59349
|
-
if (
|
|
59389
|
+
async RPCGetAABBForElementsBatched(vimIndex, vimElementIndices) {
|
|
59390
|
+
if (vimElementIndices.length === 0) {
|
|
59350
59391
|
return new Box3();
|
|
59351
59392
|
}
|
|
59352
|
-
const batches = batchArray(
|
|
59393
|
+
const batches = batchArray(vimElementIndices, this.batchSize);
|
|
59353
59394
|
const promises = batches.map(async (batch) => {
|
|
59354
|
-
const aabb = await this.rpc.RPCGetAABBForElements(
|
|
59395
|
+
const aabb = await this.rpc.RPCGetAABBForElements(vimIndex, batch);
|
|
59355
59396
|
const v1 = new Vector3(aabb.min.x, aabb.min.y, aabb.min.z);
|
|
59356
59397
|
const v2 = new Vector3(aabb.max.x, aabb.max.y, aabb.max.z);
|
|
59357
59398
|
return new Box3(v1, v2);
|
|
@@ -59362,53 +59403,51 @@ void main() {
|
|
|
59362
59403
|
return box;
|
|
59363
59404
|
}
|
|
59364
59405
|
/**
|
|
59365
|
-
* Frames the camera to show all
|
|
59406
|
+
* Frames the camera to show all elements in the scene.
|
|
59366
59407
|
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
59367
59408
|
* @returns Promise resolving to camera segment representing the final position
|
|
59368
59409
|
*/
|
|
59369
|
-
async
|
|
59410
|
+
async RPCFrameScene(blendTime) {
|
|
59370
59411
|
blendTime = Validation.clamp01(blendTime);
|
|
59371
59412
|
return await this.safeCall(
|
|
59372
|
-
() => this.rpc.
|
|
59413
|
+
() => this.rpc.RPCFrameScene(blendTime),
|
|
59373
59414
|
void 0
|
|
59374
59415
|
);
|
|
59375
59416
|
}
|
|
59376
59417
|
/**
|
|
59377
|
-
* Frames a specific
|
|
59378
|
-
* @param
|
|
59418
|
+
* Frames a specific vim in the scene.
|
|
59419
|
+
* @param vimIndex - The index of the loaded vim to frame
|
|
59379
59420
|
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
59380
59421
|
* @returns Promise resolving to camera segment representing the final position
|
|
59381
|
-
* @throws {Error} If the component handle is invalid
|
|
59382
59422
|
*/
|
|
59383
|
-
async RPCFrameVim(
|
|
59384
|
-
if (!Validation.
|
|
59423
|
+
async RPCFrameVim(vimIndex, blendTime) {
|
|
59424
|
+
if (!Validation.isIndex(vimIndex)) return;
|
|
59385
59425
|
blendTime = Validation.clamp01(blendTime);
|
|
59386
59426
|
return await this.safeCall(
|
|
59387
|
-
() => this.rpc.RPCFrameVim(
|
|
59427
|
+
() => this.rpc.RPCFrameVim(vimIndex, blendTime),
|
|
59388
59428
|
void 0
|
|
59389
59429
|
);
|
|
59390
59430
|
}
|
|
59391
59431
|
/**
|
|
59392
|
-
* Frames specific
|
|
59393
|
-
*
|
|
59394
|
-
* @param
|
|
59395
|
-
* @param
|
|
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
|
|
59396
59436
|
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
59397
59437
|
* @returns Promise resolving to camera segment representing the final position
|
|
59398
|
-
* @throws {Error} If the component handle is invalid or nodes array is empty
|
|
59399
59438
|
*/
|
|
59400
|
-
async RPCFrameElements(
|
|
59401
|
-
if (!Validation.
|
|
59402
|
-
if (!Validation.
|
|
59439
|
+
async RPCFrameElements(vimIndex, vimElementIndices, blendTime) {
|
|
59440
|
+
if (!Validation.isIndex(vimIndex)) return;
|
|
59441
|
+
if (!Validation.areIndices(vimElementIndices)) return;
|
|
59403
59442
|
blendTime = Validation.clamp01(blendTime);
|
|
59404
|
-
if (
|
|
59443
|
+
if (vimElementIndices.length < this.batchSize) {
|
|
59405
59444
|
return await this.safeCall(
|
|
59406
|
-
() => this.rpc.RPCFrameElements(
|
|
59445
|
+
() => this.rpc.RPCFrameElements(vimIndex, vimElementIndices, blendTime),
|
|
59407
59446
|
void 0
|
|
59408
59447
|
);
|
|
59409
59448
|
} else {
|
|
59410
59449
|
const box = await this.safeCall(
|
|
59411
|
-
() => this.RPCGetAABBForElementsBatched(
|
|
59450
|
+
() => this.RPCGetAABBForElementsBatched(vimIndex, vimElementIndices),
|
|
59412
59451
|
void 0
|
|
59413
59452
|
);
|
|
59414
59453
|
if (!box) return void 0;
|
|
@@ -59422,7 +59461,6 @@ void main() {
|
|
|
59422
59461
|
* Frames the camera to show a specific bounding box.
|
|
59423
59462
|
* @param box - The bounding box to frame
|
|
59424
59463
|
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
59425
|
-
* @throws {Error} If the box is invalid (min values must be less than max values)
|
|
59426
59464
|
*/
|
|
59427
59465
|
async RPCFrameAABB(box, blendTime) {
|
|
59428
59466
|
if (!Validation.isValidBox(box)) return;
|
|
@@ -59439,12 +59477,15 @@ void main() {
|
|
|
59439
59477
|
/**
|
|
59440
59478
|
* Sets the camera movement speed.
|
|
59441
59479
|
* @param speed - The desired movement speed (must be positive)
|
|
59442
|
-
* @throws {Error} If speed is not positive
|
|
59443
59480
|
*/
|
|
59444
59481
|
RPCSetCameraSpeed(speed) {
|
|
59445
59482
|
speed = Validation.min0(speed);
|
|
59446
59483
|
this.rpc.RPCSetCameraSpeed(speed);
|
|
59447
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
|
+
*/
|
|
59448
59489
|
RPCSetCameraMode(mode) {
|
|
59449
59490
|
this.rpc.RPCSetCameraMode(
|
|
59450
59491
|
mode === "orbit"
|
|
@@ -59453,9 +59494,8 @@ void main() {
|
|
|
59453
59494
|
}
|
|
59454
59495
|
/**
|
|
59455
59496
|
* Sets the viewer's aspect ratio.
|
|
59456
|
-
* @param width - The width
|
|
59457
|
-
* @param height - The height
|
|
59458
|
-
* @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
|
|
59459
59499
|
*/
|
|
59460
59500
|
RPCSetCameraAspectRatio(width, height) {
|
|
59461
59501
|
if (!Validation.isPositiveInteger(width)) return;
|
|
@@ -59464,13 +59504,12 @@ void main() {
|
|
|
59464
59504
|
}
|
|
59465
59505
|
/*******************************************************************************
|
|
59466
59506
|
* VIM FILE MANAGEMENT METHODS
|
|
59467
|
-
* Methods for loading, unloading, and managing VIM files
|
|
59507
|
+
* Methods for loading, unloading, and managing VIM files.
|
|
59468
59508
|
******************************************************************************/
|
|
59469
59509
|
/**
|
|
59470
59510
|
* Loads a VIM file from the local filesystem.
|
|
59471
59511
|
* @param source - The path to the VIM file (supports file:// protocol)
|
|
59472
|
-
* @returns Promise resolving to the
|
|
59473
|
-
* @throws {Error} If the filename is invalid or empty
|
|
59512
|
+
* @returns Promise resolving to the index of the loaded vim
|
|
59474
59513
|
*/
|
|
59475
59514
|
async RPCLoadVim(source) {
|
|
59476
59515
|
if (!Validation.isNonEmptyString(source.url)) return INVALID_HANDLE;
|
|
@@ -59482,9 +59521,8 @@ void main() {
|
|
|
59482
59521
|
}
|
|
59483
59522
|
/**
|
|
59484
59523
|
* Loads a VIM file from a remote URL.
|
|
59485
|
-
* @param
|
|
59486
|
-
* @returns Promise resolving to the
|
|
59487
|
-
* @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
|
|
59488
59526
|
*/
|
|
59489
59527
|
async RPCLoadVimURL(source) {
|
|
59490
59528
|
if (!Validation.isURL(source.url)) return INVALID_HANDLE;
|
|
@@ -59494,17 +59532,16 @@ void main() {
|
|
|
59494
59532
|
);
|
|
59495
59533
|
}
|
|
59496
59534
|
/**
|
|
59497
|
-
* Retrieves the current loading state and progress of a
|
|
59498
|
-
* @param
|
|
59535
|
+
* Retrieves the current loading state and progress of a vim.
|
|
59536
|
+
* @param vimIndex - The index of the vim being loaded
|
|
59499
59537
|
* @returns Promise resolving to the current loading state and progress
|
|
59500
|
-
* @throws {Error} If the component handle is invalid
|
|
59501
59538
|
*/
|
|
59502
|
-
async RPCGetVimLoadingState(
|
|
59503
|
-
if (!Validation.
|
|
59539
|
+
async RPCGetVimLoadingState(vimIndex) {
|
|
59540
|
+
if (!Validation.isIndex(vimIndex)) {
|
|
59504
59541
|
return { status: 0, progress: 0 };
|
|
59505
59542
|
}
|
|
59506
59543
|
const result = await this.safeCall(
|
|
59507
|
-
() => this.rpc.RPCGetVimLoadingState(
|
|
59544
|
+
() => this.rpc.RPCGetVimLoadingState(vimIndex),
|
|
59508
59545
|
{ status: 0, progress: 0 }
|
|
59509
59546
|
);
|
|
59510
59547
|
if (!(result.status in VimLoadingStatus)) {
|
|
@@ -59513,16 +59550,7 @@ void main() {
|
|
|
59513
59550
|
return result;
|
|
59514
59551
|
}
|
|
59515
59552
|
/**
|
|
59516
|
-
*
|
|
59517
|
-
* @param componentHandle - The handle of the component to unload
|
|
59518
|
-
* @throws {Error} If the component handle is invalid
|
|
59519
|
-
*/
|
|
59520
|
-
RPCUnloadVim(componentHandle) {
|
|
59521
|
-
if (!Validation.isComponentHandle(componentHandle)) return;
|
|
59522
|
-
this.rpc.RPCUnloadVim(componentHandle);
|
|
59523
|
-
}
|
|
59524
|
-
/**
|
|
59525
|
-
* 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.
|
|
59526
59554
|
*/
|
|
59527
59555
|
RPCUnloadAll() {
|
|
59528
59556
|
this.rpc.RPCUnloadAll();
|
|
@@ -59538,7 +59566,7 @@ void main() {
|
|
|
59538
59566
|
/**
|
|
59539
59567
|
* Performs hit testing at a specified screen position.
|
|
59540
59568
|
* @param pos - Normalized screen coordinates (0-1, 0-1)
|
|
59541
|
-
* @returns Promise resolving to hit test result if
|
|
59569
|
+
* @returns Promise resolving to hit test result if a valid hit was detected, undefined otherwise
|
|
59542
59570
|
*/
|
|
59543
59571
|
async RPCPerformHitTest(pos) {
|
|
59544
59572
|
if (!Validation.isRelativeVector2(pos)) return;
|
|
@@ -59546,7 +59574,7 @@ void main() {
|
|
|
59546
59574
|
() => this.rpc.RPCPerformHitTest(pos),
|
|
59547
59575
|
void 0
|
|
59548
59576
|
);
|
|
59549
|
-
if (!result || result.
|
|
59577
|
+
if (!result || result.vimIndex === INVALID_HANDLE) {
|
|
59550
59578
|
return void 0;
|
|
59551
59579
|
}
|
|
59552
59580
|
return result;
|
|
@@ -59556,7 +59584,6 @@ void main() {
|
|
|
59556
59584
|
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
59557
59585
|
* @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
|
|
59558
59586
|
* @param down - True if button is pressed down, false if released
|
|
59559
|
-
* @throws {Error} If mouseButton is not a valid positive integer
|
|
59560
59587
|
*/
|
|
59561
59588
|
RPCMouseButtonEvent(position, mouseButton, down) {
|
|
59562
59589
|
if (!Validation.isPositiveInteger(mouseButton)) return;
|
|
@@ -59567,7 +59594,6 @@ void main() {
|
|
|
59567
59594
|
* Sends a mouse double-click event to the viewer.
|
|
59568
59595
|
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
59569
59596
|
* @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
|
|
59570
|
-
* @throws {Error} If mouseButton is not a valid positive integer
|
|
59571
59597
|
*/
|
|
59572
59598
|
RPCMouseDoubleClickEvent(position, mouseButton) {
|
|
59573
59599
|
if (!Validation.isPositiveInteger(mouseButton)) return;
|
|
@@ -59594,7 +59620,6 @@ void main() {
|
|
|
59594
59620
|
* Sends a mouse selection event to the viewer.
|
|
59595
59621
|
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
59596
59622
|
* @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
|
|
59597
|
-
* @throws {Error} If mouseButton is not a valid positive integer
|
|
59598
59623
|
*/
|
|
59599
59624
|
RPCMouseSelectEvent(position, mouseButton) {
|
|
59600
59625
|
if (!Validation.isPositiveInteger(mouseButton)) return;
|
|
@@ -59621,7 +59646,6 @@ void main() {
|
|
|
59621
59646
|
* @param smoothness - The smoothness value to apply (clamped between 0 and 1)
|
|
59622
59647
|
* @param colors - Array of colors for each material instance
|
|
59623
59648
|
* @returns Array of handles for the created material instances
|
|
59624
|
-
* @throws {Error} If the material handle is invalid or smoothness is out of range
|
|
59625
59649
|
*/
|
|
59626
59650
|
async RPCCreateMaterialInstances(materialHandle, smoothness, colors) {
|
|
59627
59651
|
if (!Validation.isMaterialHandle(materialHandle)) return;
|
|
@@ -59644,42 +59668,38 @@ void main() {
|
|
|
59644
59668
|
}
|
|
59645
59669
|
/**
|
|
59646
59670
|
* Destroys multiple material instances, freeing associated resources.
|
|
59647
|
-
* @param
|
|
59648
|
-
* @throws {Error} If any handle in the array is invalid
|
|
59671
|
+
* @param materialInstanceHandles - Array of handles for material instances to destroy
|
|
59649
59672
|
*/
|
|
59650
|
-
RPCDestroyMaterialInstances(
|
|
59651
|
-
if (!Validation.
|
|
59652
|
-
this.rpc.RPCDestroyMaterialInstances(
|
|
59673
|
+
RPCDestroyMaterialInstances(materialInstanceHandles) {
|
|
59674
|
+
if (!Validation.areIndices(materialInstanceHandles)) return;
|
|
59675
|
+
this.rpc.RPCDestroyMaterialInstances(materialInstanceHandles);
|
|
59653
59676
|
}
|
|
59654
59677
|
/**
|
|
59655
|
-
* Sets material overrides for specific
|
|
59656
|
-
* Large arrays are automatically processed in batches
|
|
59657
|
-
* @param
|
|
59658
|
-
* @param
|
|
59659
|
-
* @param materialInstanceHandles - Array of material instance handles to apply (must match
|
|
59660
|
-
* @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)
|
|
59661
59683
|
*/
|
|
59662
|
-
|
|
59663
|
-
if (!Validation.areSameLength(
|
|
59664
|
-
if (!Validation.
|
|
59665
|
-
if (!Validation.
|
|
59684
|
+
RPCSetMaterialOverridesForElements(vimIndex, vimElementIndices, materialInstanceHandles) {
|
|
59685
|
+
if (!Validation.areSameLength(vimElementIndices, materialInstanceHandles)) return;
|
|
59686
|
+
if (!Validation.isIndex(vimIndex)) return;
|
|
59687
|
+
if (!Validation.areIndices(vimElementIndices)) return;
|
|
59666
59688
|
if (!Validation.areIntegers(materialInstanceHandles)) return;
|
|
59667
59689
|
this.setMaterialOverridesBatched(
|
|
59668
|
-
|
|
59669
|
-
|
|
59690
|
+
vimIndex,
|
|
59691
|
+
vimElementIndices,
|
|
59670
59692
|
materialInstanceHandles
|
|
59671
59693
|
);
|
|
59672
59694
|
}
|
|
59673
|
-
setMaterialOverridesBatched(
|
|
59674
|
-
const batches = batchArrays(
|
|
59675
|
-
for (const [
|
|
59676
|
-
this.rpc.
|
|
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);
|
|
59677
59699
|
}
|
|
59678
59700
|
}
|
|
59679
59701
|
/**
|
|
59680
|
-
* Clears all material overrides for the
|
|
59681
|
-
* @param componentHandle - The unique identifier of the component
|
|
59682
|
-
* @throws {Error} If the component handle is invalid or INVALID_HANDLE
|
|
59702
|
+
* Clears all material overrides for the entire scene.
|
|
59683
59703
|
*/
|
|
59684
59704
|
RPCClearMaterialOverrides() {
|
|
59685
59705
|
this.rpc.RPCClearMaterialOverrides();
|
|
@@ -59832,7 +59852,7 @@ void main() {
|
|
|
59832
59852
|
* @returns Current background blur
|
|
59833
59853
|
*/
|
|
59834
59854
|
get backgroundBlur() {
|
|
59835
|
-
return this._settings.
|
|
59855
|
+
return this._settings.backgroundBlur;
|
|
59836
59856
|
}
|
|
59837
59857
|
/**
|
|
59838
59858
|
* Gets the background color
|
|
@@ -59903,8 +59923,8 @@ void main() {
|
|
|
59903
59923
|
*/
|
|
59904
59924
|
set backgroundBlur(value) {
|
|
59905
59925
|
value = Validation.clamp01(value);
|
|
59906
|
-
if (this._settings.
|
|
59907
|
-
this._settings.
|
|
59926
|
+
if (this._settings.backgroundBlur === value) return;
|
|
59927
|
+
this._settings.backgroundBlur = value;
|
|
59908
59928
|
this._updateLighting = true;
|
|
59909
59929
|
this.requestSettingsUpdate();
|
|
59910
59930
|
}
|
|
@@ -59920,7 +59940,7 @@ void main() {
|
|
|
59920
59940
|
this.requestSettingsUpdate();
|
|
59921
59941
|
}
|
|
59922
59942
|
getBoundingBox() {
|
|
59923
|
-
return this._rpc.
|
|
59943
|
+
return this._rpc.RPCGetAABBForScene();
|
|
59924
59944
|
}
|
|
59925
59945
|
/**
|
|
59926
59946
|
* Requests an update to be performed on the next animation frame.
|
|
@@ -60035,7 +60055,7 @@ void main() {
|
|
|
60035
60055
|
* Fits the given box, invalid dimensions will be reversed.
|
|
60036
60056
|
* @param box - The new bounding box.
|
|
60037
60057
|
*/
|
|
60038
|
-
|
|
60058
|
+
setBox(box) {
|
|
60039
60059
|
box = safeBox(box);
|
|
60040
60060
|
this._box = box;
|
|
60041
60061
|
this.scheduleUpdate();
|
|
@@ -60059,7 +60079,7 @@ void main() {
|
|
|
60059
60079
|
VisibilityState2[VisibilityState2["GHOSTED_HIGHLIGHTED"] = 18] = "GHOSTED_HIGHLIGHTED";
|
|
60060
60080
|
return VisibilityState2;
|
|
60061
60081
|
})(VisibilityState$1 || {});
|
|
60062
|
-
class
|
|
60082
|
+
class VisibilitySynchronizer {
|
|
60063
60083
|
/**
|
|
60064
60084
|
* Creates a new StateSynchronizer instance.
|
|
60065
60085
|
*
|
|
@@ -60077,7 +60097,7 @@ void main() {
|
|
|
60077
60097
|
__publicField(this, "_onUpdate");
|
|
60078
60098
|
__publicField(this, "_isConnected");
|
|
60079
60099
|
__publicField(this, "_animationFrame");
|
|
60080
|
-
this._tracker = new
|
|
60100
|
+
this._tracker = new VisibilityTracker(defaultState);
|
|
60081
60101
|
this._rpc = rpc;
|
|
60082
60102
|
this._onUpdate = onUpdate;
|
|
60083
60103
|
this._getHandle = getHandle;
|
|
@@ -60126,7 +60146,7 @@ void main() {
|
|
|
60126
60146
|
* @param elementIndex - The element index to update
|
|
60127
60147
|
* @param state - The new state to apply
|
|
60128
60148
|
*/
|
|
60129
|
-
|
|
60149
|
+
setStateForElement(elementIndex, state) {
|
|
60130
60150
|
this._tracker.setState(elementIndex, state);
|
|
60131
60151
|
this.scheduleUpdate();
|
|
60132
60152
|
}
|
|
@@ -60190,7 +60210,7 @@ void main() {
|
|
|
60190
60210
|
this._onUpdate();
|
|
60191
60211
|
}
|
|
60192
60212
|
}
|
|
60193
|
-
class
|
|
60213
|
+
class VisibilityTracker {
|
|
60194
60214
|
/**
|
|
60195
60215
|
* Creates a new StateTracker instance.
|
|
60196
60216
|
*
|
|
@@ -60827,7 +60847,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60827
60847
|
return this.vim.visibility.getElementState(this.element);
|
|
60828
60848
|
}
|
|
60829
60849
|
set state(state) {
|
|
60830
|
-
this.vim.visibility.
|
|
60850
|
+
this.vim.visibility.setStateForElement(this.element, state);
|
|
60831
60851
|
}
|
|
60832
60852
|
/**
|
|
60833
60853
|
* Gets or sets the color override of the element.
|
|
@@ -60857,6 +60877,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60857
60877
|
__publicField(this, "_renderer");
|
|
60858
60878
|
__publicField(this, "_logger");
|
|
60859
60879
|
// The StateSynchronizer wraps a StateTracker and handles RPC synchronization.
|
|
60880
|
+
// Should be private
|
|
60860
60881
|
__publicField(this, "visibility");
|
|
60861
60882
|
// Color tracking remains unchanged.
|
|
60862
60883
|
__publicField(this, "_nodeColors", /* @__PURE__ */ new Map());
|
|
@@ -60870,7 +60891,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60870
60891
|
this._colors = color;
|
|
60871
60892
|
this._renderer = renderer;
|
|
60872
60893
|
this._logger = logger;
|
|
60873
|
-
this.visibility = new
|
|
60894
|
+
this.visibility = new VisibilitySynchronizer(
|
|
60874
60895
|
this._rpc,
|
|
60875
60896
|
() => this._handle,
|
|
60876
60897
|
() => this.connected,
|
|
@@ -60931,7 +60952,6 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60931
60952
|
(_a3 = this._request) == null ? void 0 : _a3.error("cancelled", "The request was cancelled");
|
|
60932
60953
|
this._request = void 0;
|
|
60933
60954
|
if (this.connected) {
|
|
60934
|
-
this._rpc.RPCUnloadVim(this._handle);
|
|
60935
60955
|
this._handle = -1;
|
|
60936
60956
|
}
|
|
60937
60957
|
}
|
|
@@ -60953,13 +60973,12 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60953
60973
|
case VimLoadingStatus.FailedToDownload:
|
|
60954
60974
|
case VimLoadingStatus.FailedToLoad:
|
|
60955
60975
|
case VimLoadingStatus.Unknown:
|
|
60956
|
-
this._rpc.RPCUnloadVim(handle);
|
|
60957
60976
|
const details = await this._rpc.RPCGetLastError();
|
|
60958
60977
|
const error = this.getErrorType(state.status);
|
|
60959
60978
|
return result.error(error, details);
|
|
60960
60979
|
case VimLoadingStatus.Done:
|
|
60961
60980
|
this._handle = handle;
|
|
60962
|
-
this._elementCount = await this._rpc.
|
|
60981
|
+
this._elementCount = await this._rpc.RPCGetElementCountForVim(handle);
|
|
60963
60982
|
return result.success(this);
|
|
60964
60983
|
}
|
|
60965
60984
|
} catch (e) {
|
|
@@ -61051,7 +61070,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61051
61070
|
this._rpc.RPCClearMaterialOverrides();
|
|
61052
61071
|
} else {
|
|
61053
61072
|
const ids = new Array(elements.length).fill(MaterialHandles.Invalid);
|
|
61054
|
-
this._rpc.
|
|
61073
|
+
this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, ids);
|
|
61055
61074
|
}
|
|
61056
61075
|
}
|
|
61057
61076
|
reapplyColors() {
|
|
@@ -61076,7 +61095,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61076
61095
|
const colors = nodes.map((n) => this._nodeColors.get(n));
|
|
61077
61096
|
const remoteColors = await this._colors.getColors(colors);
|
|
61078
61097
|
const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
|
|
61079
|
-
this._rpc.
|
|
61098
|
+
this._rpc.RPCSetMaterialOverridesForElements(this._handle, nodes, colorIds);
|
|
61080
61099
|
this._updatedColors.clear();
|
|
61081
61100
|
}
|
|
61082
61101
|
}
|
|
@@ -61378,7 +61397,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61378
61397
|
this._vims.clear();
|
|
61379
61398
|
}
|
|
61380
61399
|
getElement3Ds() {
|
|
61381
|
-
return this.rpc.
|
|
61400
|
+
return this.rpc.RPCGetElementCountForScene();
|
|
61382
61401
|
}
|
|
61383
61402
|
/**
|
|
61384
61403
|
* Disposes all resources used by the viewer and disconnects from the server.
|
|
@@ -76194,7 +76213,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
76194
76213
|
viewer.sectionBox.interactive = b;
|
|
76195
76214
|
},
|
|
76196
76215
|
getBox: () => viewer.sectionBox.getBox(),
|
|
76197
|
-
setBox: (box) => viewer.sectionBox.
|
|
76216
|
+
setBox: (box) => viewer.sectionBox.setBox(box),
|
|
76198
76217
|
onSelectionChanged: viewer.selection.onSelectionChanged,
|
|
76199
76218
|
getSelectionBox: () => viewer.selection.getBoundingBox(),
|
|
76200
76219
|
getSceneBox: () => viewer.renderer.getBoundingBox()
|