vim-web 0.5.0-dev.7 → 0.5.0-dev.9
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/colorManager.d.ts +2 -2
- package/dist/types/core-viewers/ultra/rpcClient.d.ts +5 -3
- package/dist/types/core-viewers/ultra/rpcSafeClient.d.ts +12 -1
- package/dist/types/core-viewers/ultra/vim.d.ts +1 -1
- package/dist/vim-web.iife.js +74 -38
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +74 -38
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,11 +24,11 @@ export declare class ColorManager {
|
|
|
24
24
|
getColor(color: THREE.Color): Promise<RemoteColor | undefined>;
|
|
25
25
|
/**
|
|
26
26
|
* Creates or retrieves cached color instances for multiple hex values.
|
|
27
|
-
* @param colors - Array of
|
|
27
|
+
* @param colors - Array of color values or undefined for no color
|
|
28
28
|
* @returns Promise resolving to an array of ColorHandles in the same order as input, or undefined if creation fails
|
|
29
29
|
* @remarks Duplicate hex values will be mapped to the same color instance for efficiency
|
|
30
30
|
*/
|
|
31
|
-
getColors(colors: THREE.Color[]): Promise<RemoteColor[]>;
|
|
31
|
+
getColors(colors: (THREE.Color | undefined)[]): Promise<RemoteColor[]>;
|
|
32
32
|
/**
|
|
33
33
|
* Retrieves a color instance by its unique identifier.
|
|
34
34
|
* @param id - The unique identifier of the color
|
|
@@ -32,7 +32,9 @@ export declare class RpcClient {
|
|
|
32
32
|
get url(): string;
|
|
33
33
|
constructor(_socket: SocketClient);
|
|
34
34
|
readonly API_VERSION = "6.0.0";
|
|
35
|
-
|
|
35
|
+
RPCClearMaterialOverridesForElements(vimIndex: number, elementIndices: number[]): void;
|
|
36
|
+
RPCClearMaterialOverridesForScene(): void;
|
|
37
|
+
RPCClearMaterialOverridesForVim(vimIndex: number): void;
|
|
36
38
|
RPCCreateMaterialInstances(materialHandle: number, smoothness: number, colors: RpcTypes.RGBA32[]): Promise<number>;
|
|
37
39
|
RPCCreateText(position: RpcTypes.Vector3, color: RpcTypes.RGBA32, text: string): Promise<number>;
|
|
38
40
|
RPCDestroyMaterialInstances(materialInstanceHandles: number[]): void;
|
|
@@ -46,7 +48,7 @@ export declare class RpcClient {
|
|
|
46
48
|
RPCGetAABBForScene(): Promise<RpcTypes.Box3>;
|
|
47
49
|
RPCGetAABBForVim(vimIndex: number): Promise<RpcTypes.Box3>;
|
|
48
50
|
RPCGetAPIVersion(): Promise<string>;
|
|
49
|
-
|
|
51
|
+
RPCGetCameraPose(): Promise<RpcTypes.Segment>;
|
|
50
52
|
RPCGetElementCountForScene(): Promise<number>;
|
|
51
53
|
RPCGetElementCountForVim(vimIndex: number): Promise<number>;
|
|
52
54
|
RPCGetElementIds(vimIndex: number): Promise<bigint[]>;
|
|
@@ -66,10 +68,10 @@ export declare class RpcClient {
|
|
|
66
68
|
RPCPerformHitTest(pos: RpcTypes.Vector2): Promise<RpcTypes.HitCheckResult>;
|
|
67
69
|
RPCSetCameraAspectRatio(width: number, height: number): void;
|
|
68
70
|
RPCSetCameraMode(orbit: boolean): void;
|
|
71
|
+
RPCSetCameraPose(state: RpcTypes.Segment, blendTime: number): void;
|
|
69
72
|
RPCSetCameraPosition(position: RpcTypes.Vector3, blendTime: number): void;
|
|
70
73
|
RPCSetCameraSpeed(speed: number): void;
|
|
71
74
|
RPCSetCameraTarget(target: RpcTypes.Vector3, blendTime: number): void;
|
|
72
|
-
RPCSetCameraView(state: RpcTypes.Segment, blendTime: number): void;
|
|
73
75
|
RPCSetGhostColor(ghostColor: RpcTypes.RGBA): void;
|
|
74
76
|
RPCSetLighting(toneMappingWhitePoint: number, hdrScale: number, hdrBackgroundScale: number, hdrBackgroundSaturation: number, backgroundBlur: number, backgroundColor: RpcTypes.RGBA): void;
|
|
75
77
|
RPCSetMaterialOverridesForElements(vimIndex: number, elementIndices: number[], materialInstanceHandles: number[]): void;
|
|
@@ -426,7 +426,18 @@ export declare class RpcSafeClient {
|
|
|
426
426
|
/**
|
|
427
427
|
* Clears all material overrides for the entire scene.
|
|
428
428
|
*/
|
|
429
|
-
|
|
429
|
+
RPCClearMaterialOverridesForScene(): void;
|
|
430
|
+
/**
|
|
431
|
+
* Clears all material overrides for a specific loaded vim.
|
|
432
|
+
* @param vimIndex - The index of the loaded vim
|
|
433
|
+
*/
|
|
434
|
+
RPCClearMaterialOverridesForVim(vimIndex: number): void;
|
|
435
|
+
/**
|
|
436
|
+
* Clears all material overrides for specific elements in a loaded vim.
|
|
437
|
+
* @param vimIndex - The index of the loaded vim
|
|
438
|
+
* @param vimElementIndices - Array of vim-based element indices to clear overrides for
|
|
439
|
+
*/
|
|
440
|
+
RPCClearMaterialOverridesForElements(vimIndex: number, vimElementIndices: number[]): void;
|
|
430
441
|
/*******************************************************************************
|
|
431
442
|
* DEBUG AND UTILITY METHODS
|
|
432
443
|
* Utility methods for debugging, error handling, and misc functionality.
|
|
@@ -38,7 +38,7 @@ export declare class Vim implements IVim<Element3D> {
|
|
|
38
38
|
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
39
39
|
getColor(elementIndex: number): THREE.Color | undefined;
|
|
40
40
|
setColor(elementIndex: number[], color: THREE.Color | undefined): Promise<void>;
|
|
41
|
-
setColors(
|
|
41
|
+
setColors(elements: number[], color: (THREE.Color | undefined)[]): Promise<void>;
|
|
42
42
|
private applyColor;
|
|
43
43
|
clearColor(elements: number[] | 'all'): void;
|
|
44
44
|
reapplyColors(): void;
|
package/dist/vim-web.iife.js
CHANGED
|
@@ -57943,9 +57943,22 @@ void main() {
|
|
|
57943
57943
|
get url() {
|
|
57944
57944
|
return this._socket.url;
|
|
57945
57945
|
}
|
|
57946
|
-
|
|
57946
|
+
RPCClearMaterialOverridesForElements(vimIndex, elementIndices) {
|
|
57947
57947
|
const marshal = new Marshal();
|
|
57948
|
-
marshal.writeString("
|
|
57948
|
+
marshal.writeString("RPCClearMaterialOverridesForElements");
|
|
57949
|
+
marshal.writeUInt(vimIndex);
|
|
57950
|
+
marshal.writeArrayOfUInt(elementIndices);
|
|
57951
|
+
this._socket.sendRPC(marshal);
|
|
57952
|
+
}
|
|
57953
|
+
RPCClearMaterialOverridesForScene() {
|
|
57954
|
+
const marshal = new Marshal();
|
|
57955
|
+
marshal.writeString("RPCClearMaterialOverridesForScene");
|
|
57956
|
+
this._socket.sendRPC(marshal);
|
|
57957
|
+
}
|
|
57958
|
+
RPCClearMaterialOverridesForVim(vimIndex) {
|
|
57959
|
+
const marshal = new Marshal();
|
|
57960
|
+
marshal.writeString("RPCClearMaterialOverridesForVim");
|
|
57961
|
+
marshal.writeUInt(vimIndex);
|
|
57949
57962
|
this._socket.sendRPC(marshal);
|
|
57950
57963
|
}
|
|
57951
57964
|
async RPCCreateMaterialInstances(materialHandle, smoothness, colors) {
|
|
@@ -58053,9 +58066,9 @@ void main() {
|
|
|
58053
58066
|
const ret = returnMarshal.readString();
|
|
58054
58067
|
return ret;
|
|
58055
58068
|
}
|
|
58056
|
-
async
|
|
58069
|
+
async RPCGetCameraPose() {
|
|
58057
58070
|
const marshal = new Marshal();
|
|
58058
|
-
marshal.writeString("
|
|
58071
|
+
marshal.writeString("RPCGetCameraPose");
|
|
58059
58072
|
const returnMarshal = await this._socket.sendRPCWithReturn(marshal);
|
|
58060
58073
|
const ret = returnMarshal.readSegment();
|
|
58061
58074
|
return ret;
|
|
@@ -58198,6 +58211,13 @@ void main() {
|
|
|
58198
58211
|
marshal.writeBoolean(orbit2);
|
|
58199
58212
|
this._socket.sendRPC(marshal);
|
|
58200
58213
|
}
|
|
58214
|
+
RPCSetCameraPose(state, blendTime) {
|
|
58215
|
+
const marshal = new Marshal();
|
|
58216
|
+
marshal.writeString("RPCSetCameraPose");
|
|
58217
|
+
marshal.writeSegment(state);
|
|
58218
|
+
marshal.writeFloat(blendTime);
|
|
58219
|
+
this._socket.sendRPC(marshal);
|
|
58220
|
+
}
|
|
58201
58221
|
RPCSetCameraPosition(position, blendTime) {
|
|
58202
58222
|
const marshal = new Marshal();
|
|
58203
58223
|
marshal.writeString("RPCSetCameraPosition");
|
|
@@ -58218,13 +58238,6 @@ void main() {
|
|
|
58218
58238
|
marshal.writeFloat(blendTime);
|
|
58219
58239
|
this._socket.sendRPC(marshal);
|
|
58220
58240
|
}
|
|
58221
|
-
RPCSetCameraView(state, blendTime) {
|
|
58222
|
-
const marshal = new Marshal();
|
|
58223
|
-
marshal.writeString("RPCSetCameraView");
|
|
58224
|
-
marshal.writeSegment(state);
|
|
58225
|
-
marshal.writeFloat(blendTime);
|
|
58226
|
-
this._socket.sendRPC(marshal);
|
|
58227
|
-
}
|
|
58228
58241
|
RPCSetGhostColor(ghostColor) {
|
|
58229
58242
|
const marshal = new Marshal();
|
|
58230
58243
|
marshal.writeString("RPCSetGhostColor");
|
|
@@ -58384,7 +58397,7 @@ void main() {
|
|
|
58384
58397
|
}
|
|
58385
58398
|
/**
|
|
58386
58399
|
* Creates or retrieves cached color instances for multiple hex values.
|
|
58387
|
-
* @param colors - Array of
|
|
58400
|
+
* @param colors - Array of color values or undefined for no color
|
|
58388
58401
|
* @returns Promise resolving to an array of ColorHandles in the same order as input, or undefined if creation fails
|
|
58389
58402
|
* @remarks Duplicate hex values will be mapped to the same color instance for efficiency
|
|
58390
58403
|
*/
|
|
@@ -58394,15 +58407,23 @@ void main() {
|
|
|
58394
58407
|
const toCreate = [];
|
|
58395
58408
|
for (let i2 = 0; i2 < colors.length; i2++) {
|
|
58396
58409
|
const color = colors[i2];
|
|
58397
|
-
|
|
58398
|
-
|
|
58399
|
-
|
|
58400
|
-
}
|
|
58410
|
+
if (color === void 0) {
|
|
58411
|
+
result[i2] = void 0;
|
|
58412
|
+
continue;
|
|
58413
|
+
}
|
|
58414
|
+
const hex = (color == null ? void 0 : color.getHex()) ?? -1;
|
|
58415
|
+
const remoteColor = this._hexToColor.get(hex);
|
|
58416
|
+
if (remoteColor) {
|
|
58417
|
+
result[i2] = remoteColor;
|
|
58418
|
+
continue;
|
|
58419
|
+
}
|
|
58420
|
+
const indices = hexToIndices.get(hex);
|
|
58421
|
+
if (indices) {
|
|
58401
58422
|
hexToIndices.get(hex).push(i2);
|
|
58402
|
-
|
|
58403
|
-
toCreate.push(color);
|
|
58404
|
-
hexToIndices.set(hex, [i2]);
|
|
58423
|
+
continue;
|
|
58405
58424
|
}
|
|
58425
|
+
toCreate.push(color);
|
|
58426
|
+
hexToIndices.set(hex, [i2]);
|
|
58406
58427
|
}
|
|
58407
58428
|
const remoteColors = await this._createColors(toCreate);
|
|
58408
58429
|
if (!remoteColors) return void 0;
|
|
@@ -59286,7 +59307,7 @@ void main() {
|
|
|
59286
59307
|
*/
|
|
59287
59308
|
async RPCGetCameraView() {
|
|
59288
59309
|
return await this.safeCall(
|
|
59289
|
-
() => this.rpc.
|
|
59310
|
+
() => this.rpc.RPCGetCameraPose(),
|
|
59290
59311
|
void 0
|
|
59291
59312
|
);
|
|
59292
59313
|
}
|
|
@@ -59298,7 +59319,7 @@ void main() {
|
|
|
59298
59319
|
RPCSetCameraView(segment, blendTime) {
|
|
59299
59320
|
if (!Validation.isValidSegment(segment)) return;
|
|
59300
59321
|
blendTime = Validation.clamp01(blendTime);
|
|
59301
|
-
this.rpc.
|
|
59322
|
+
this.rpc.RPCSetCameraPose(segment, blendTime);
|
|
59302
59323
|
}
|
|
59303
59324
|
/**
|
|
59304
59325
|
* Sets the camera's position without changing its target.
|
|
@@ -59680,8 +59701,23 @@ void main() {
|
|
|
59680
59701
|
/**
|
|
59681
59702
|
* Clears all material overrides for the entire scene.
|
|
59682
59703
|
*/
|
|
59683
|
-
|
|
59684
|
-
this.rpc.
|
|
59704
|
+
RPCClearMaterialOverridesForScene() {
|
|
59705
|
+
this.rpc.RPCClearMaterialOverridesForScene();
|
|
59706
|
+
}
|
|
59707
|
+
/**
|
|
59708
|
+
* Clears all material overrides for a specific loaded vim.
|
|
59709
|
+
* @param vimIndex - The index of the loaded vim
|
|
59710
|
+
*/
|
|
59711
|
+
RPCClearMaterialOverridesForVim(vimIndex) {
|
|
59712
|
+
this.rpc.RPCClearMaterialOverridesForVim(vimIndex);
|
|
59713
|
+
}
|
|
59714
|
+
/**
|
|
59715
|
+
* Clears all material overrides for specific elements in a loaded vim.
|
|
59716
|
+
* @param vimIndex - The index of the loaded vim
|
|
59717
|
+
* @param vimElementIndices - Array of vim-based element indices to clear overrides for
|
|
59718
|
+
*/
|
|
59719
|
+
RPCClearMaterialOverridesForElements(vimIndex, vimElementIndices) {
|
|
59720
|
+
this.rpc.RPCClearMaterialOverridesForElements(vimIndex, vimElementIndices);
|
|
59685
59721
|
}
|
|
59686
59722
|
/*******************************************************************************
|
|
59687
59723
|
* DEBUG AND UTILITY METHODS
|
|
@@ -61034,25 +61070,26 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61034
61070
|
const colors = new Array(elementIndex.length).fill(color);
|
|
61035
61071
|
this.applyColor(elementIndex, colors);
|
|
61036
61072
|
}
|
|
61037
|
-
async setColors(
|
|
61038
|
-
if (color.length !==
|
|
61039
|
-
throw new Error("Color and
|
|
61073
|
+
async setColors(elements, color) {
|
|
61074
|
+
if (color.length !== elements.length) {
|
|
61075
|
+
throw new Error("Color and elements length must be equal");
|
|
61040
61076
|
}
|
|
61041
|
-
this.applyColor(
|
|
61077
|
+
this.applyColor(elements, color);
|
|
61042
61078
|
}
|
|
61043
|
-
applyColor(
|
|
61079
|
+
applyColor(elements, color) {
|
|
61044
61080
|
for (let i2 = 0; i2 < color.length; i2++) {
|
|
61045
61081
|
const c = color[i2];
|
|
61046
|
-
const
|
|
61082
|
+
const element = elements[i2];
|
|
61047
61083
|
if (c === void 0) {
|
|
61048
|
-
this._elementColors.delete(
|
|
61084
|
+
this._elementColors.delete(element);
|
|
61049
61085
|
} else {
|
|
61050
|
-
this._elementColors.set(
|
|
61086
|
+
this._elementColors.set(element, c);
|
|
61051
61087
|
}
|
|
61052
|
-
this._updatedColors.add(
|
|
61088
|
+
this._updatedColors.add(element);
|
|
61053
61089
|
}
|
|
61054
61090
|
this.scheduleColorUpdate();
|
|
61055
61091
|
}
|
|
61092
|
+
//TODO: Remove and rely on element.color
|
|
61056
61093
|
clearColor(elements) {
|
|
61057
61094
|
if (elements === "all") {
|
|
61058
61095
|
this._elementColors.clear();
|
|
@@ -61061,10 +61098,9 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61061
61098
|
}
|
|
61062
61099
|
if (!this.connected) return;
|
|
61063
61100
|
if (elements === "all") {
|
|
61064
|
-
this._rpc.
|
|
61101
|
+
this._rpc.RPCClearMaterialOverridesForVim(this._handle);
|
|
61065
61102
|
} else {
|
|
61066
|
-
|
|
61067
|
-
this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, ids);
|
|
61103
|
+
this._rpc.RPCClearMaterialOverridesForElements(this._handle, elements);
|
|
61068
61104
|
}
|
|
61069
61105
|
}
|
|
61070
61106
|
reapplyColors() {
|
|
@@ -61085,11 +61121,11 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61085
61121
|
this._renderer.notifySceneUpdated();
|
|
61086
61122
|
}
|
|
61087
61123
|
async updateRemoteColors() {
|
|
61088
|
-
const
|
|
61089
|
-
const colors =
|
|
61124
|
+
const elements = Array.from(this._updatedColors);
|
|
61125
|
+
const colors = elements.map((n) => this._elementColors.get(n));
|
|
61090
61126
|
const remoteColors = await this._colors.getColors(colors);
|
|
61091
61127
|
const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
|
|
61092
|
-
this._rpc.RPCSetMaterialOverridesForElements(this._handle,
|
|
61128
|
+
this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, colorIds);
|
|
61093
61129
|
this._updatedColors.clear();
|
|
61094
61130
|
}
|
|
61095
61131
|
}
|