vim-web 0.5.0-dev.4 → 0.5.0-dev.6
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 +3 -3
- package/dist/types/core-viewers/ultra/element3d.d.ts +4 -4
- package/dist/types/core-viewers/ultra/index.d.ts +1 -1
- package/dist/types/core-viewers/ultra/remoteColor.d.ts +3 -23
- package/dist/types/core-viewers/ultra/renderer.d.ts +14 -11
- package/dist/types/core-viewers/ultra/rpcTypes.d.ts +3 -0
- package/dist/types/core-viewers/ultra/rpcUtils.d.ts +8 -0
- package/dist/types/core-viewers/ultra/sectionBox.d.ts +1 -1
- package/dist/types/core-viewers/ultra/vim.d.ts +4 -5
- package/dist/types/utils/validation.d.ts +4 -4
- package/dist/vim-web.iife.js +225 -237
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +225 -237
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
package/dist/vim-web.iife.js
CHANGED
|
@@ -50841,6 +50841,164 @@ void main() {
|
|
|
50841
50841
|
}
|
|
50842
50842
|
return true;
|
|
50843
50843
|
}
|
|
50844
|
+
class Segment {
|
|
50845
|
+
constructor(origin = new Vector3(), target = new Vector3()) {
|
|
50846
|
+
__publicField(this, "origin");
|
|
50847
|
+
__publicField(this, "target");
|
|
50848
|
+
this.origin = origin;
|
|
50849
|
+
this.target = target;
|
|
50850
|
+
}
|
|
50851
|
+
static fromArray(array) {
|
|
50852
|
+
return new Segment(
|
|
50853
|
+
new Vector3(array[0], array[1], array[2]),
|
|
50854
|
+
new Vector3(array[3], array[4], array[5])
|
|
50855
|
+
);
|
|
50856
|
+
}
|
|
50857
|
+
toArray() {
|
|
50858
|
+
return [this.origin.x, this.origin.y, this.origin.z, this.target.x, this.target.y, this.target.z];
|
|
50859
|
+
}
|
|
50860
|
+
isValid() {
|
|
50861
|
+
return !this.origin.equals(this.target);
|
|
50862
|
+
}
|
|
50863
|
+
equals(segment) {
|
|
50864
|
+
return this.origin.equals(segment.origin) && this.target.equals(segment.target);
|
|
50865
|
+
}
|
|
50866
|
+
}
|
|
50867
|
+
class RGBA {
|
|
50868
|
+
constructor(r, g, b, a = 1) {
|
|
50869
|
+
__publicField(this, "r");
|
|
50870
|
+
__publicField(this, "g");
|
|
50871
|
+
__publicField(this, "b");
|
|
50872
|
+
__publicField(this, "a");
|
|
50873
|
+
this.r = r;
|
|
50874
|
+
this.g = g;
|
|
50875
|
+
this.b = b;
|
|
50876
|
+
this.a = a;
|
|
50877
|
+
}
|
|
50878
|
+
static fromThree(color, opacity = 1) {
|
|
50879
|
+
return new RGBA(color.r, color.g, color.b, opacity);
|
|
50880
|
+
}
|
|
50881
|
+
toThree() {
|
|
50882
|
+
return new Color(this.r, this.g, this.b);
|
|
50883
|
+
}
|
|
50884
|
+
clone() {
|
|
50885
|
+
return new RGBA(this.r, this.g, this.b, this.a);
|
|
50886
|
+
}
|
|
50887
|
+
isValid() {
|
|
50888
|
+
return Number.isFinite(this.r) && Number.isFinite(this.g) && Number.isFinite(this.b) && Number.isFinite(this.a);
|
|
50889
|
+
}
|
|
50890
|
+
equals(color) {
|
|
50891
|
+
return this.r === color.r && this.g === color.g && this.b === color.b && this.a === color.a;
|
|
50892
|
+
}
|
|
50893
|
+
static fromString(str) {
|
|
50894
|
+
str = str.trim();
|
|
50895
|
+
if (str.startsWith("(")) {
|
|
50896
|
+
str = str.substring(1);
|
|
50897
|
+
}
|
|
50898
|
+
if (str.endsWith(")")) {
|
|
50899
|
+
str = str.substring(0, str.length - 1);
|
|
50900
|
+
}
|
|
50901
|
+
const parts = str.split(",");
|
|
50902
|
+
if (parts.length < 3 || parts.length > 4) {
|
|
50903
|
+
throw new Error("Invalid color string format. Expected 3 or 4 components.");
|
|
50904
|
+
}
|
|
50905
|
+
const r = parseFloat(parts[0]);
|
|
50906
|
+
const g = parseFloat(parts[1]);
|
|
50907
|
+
const b = parseFloat(parts[2]);
|
|
50908
|
+
const a = parts.length === 4 ? parseFloat(parts[3]) : 1;
|
|
50909
|
+
if ([r, g, b, a].some((n) => isNaN(n))) {
|
|
50910
|
+
throw new Error("Invalid number in color string.");
|
|
50911
|
+
}
|
|
50912
|
+
return new RGBA(r, g, b, a);
|
|
50913
|
+
}
|
|
50914
|
+
}
|
|
50915
|
+
class RGB {
|
|
50916
|
+
constructor(r, g, b) {
|
|
50917
|
+
__publicField(this, "r");
|
|
50918
|
+
__publicField(this, "g");
|
|
50919
|
+
__publicField(this, "b");
|
|
50920
|
+
this.r = r;
|
|
50921
|
+
this.g = g;
|
|
50922
|
+
this.b = b;
|
|
50923
|
+
}
|
|
50924
|
+
}
|
|
50925
|
+
class RGBA32 {
|
|
50926
|
+
constructor(hex) {
|
|
50927
|
+
__publicField(this, "hex");
|
|
50928
|
+
if (!Number.isInteger(hex) || hex < 0 || hex > 4294967295) {
|
|
50929
|
+
throw new Error("Invalid value: must be a 32-bit unsigned integer");
|
|
50930
|
+
}
|
|
50931
|
+
this.hex = hex;
|
|
50932
|
+
}
|
|
50933
|
+
static fromThree(color, opacity = 1) {
|
|
50934
|
+
return this.fromFloats(color.r, color.g, color.b, opacity);
|
|
50935
|
+
}
|
|
50936
|
+
static fromInts(r, g, b, a = 1) {
|
|
50937
|
+
if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255 || a < 0 || a > 255) {
|
|
50938
|
+
throw new Error("Each RGBA component must be in the range 0-255.");
|
|
50939
|
+
}
|
|
50940
|
+
const hex = r * 2 ** 24 + g * 2 ** 16 + b * 2 ** 8 + a;
|
|
50941
|
+
return new RGBA32(hex);
|
|
50942
|
+
}
|
|
50943
|
+
static fromFloats(r, g, b, a = 1) {
|
|
50944
|
+
return this.fromInts(
|
|
50945
|
+
remap(r, 255),
|
|
50946
|
+
remap(g, 255),
|
|
50947
|
+
remap(b, 255),
|
|
50948
|
+
remap(a, 255)
|
|
50949
|
+
);
|
|
50950
|
+
}
|
|
50951
|
+
static fromString(str) {
|
|
50952
|
+
if (str.startsWith("#")) {
|
|
50953
|
+
str = str.slice(1);
|
|
50954
|
+
}
|
|
50955
|
+
if (str.length === 3 || str.length === 4) {
|
|
50956
|
+
str = str.split("").map((c) => c + c).join("");
|
|
50957
|
+
}
|
|
50958
|
+
let r = 0;
|
|
50959
|
+
let g = 0;
|
|
50960
|
+
let b = 0;
|
|
50961
|
+
let a = 255;
|
|
50962
|
+
if (str.length === 6 || str.length === 8) {
|
|
50963
|
+
r = parseInt(str.slice(0, 2), 16);
|
|
50964
|
+
g = parseInt(str.slice(2, 4), 16);
|
|
50965
|
+
b = parseInt(str.slice(4, 6), 16);
|
|
50966
|
+
if (str.length === 8) {
|
|
50967
|
+
a = parseInt(str.slice(6, 8), 16);
|
|
50968
|
+
}
|
|
50969
|
+
} else {
|
|
50970
|
+
throw new Error("Invalid color string format");
|
|
50971
|
+
}
|
|
50972
|
+
if ([r, g, b, a].some((v) => isNaN(v))) {
|
|
50973
|
+
throw new Error("Invalid color string format");
|
|
50974
|
+
}
|
|
50975
|
+
return this.fromInts(r, g, b, a);
|
|
50976
|
+
}
|
|
50977
|
+
/**
|
|
50978
|
+
* The red component of the color in the range [0-255].
|
|
50979
|
+
*/
|
|
50980
|
+
get r() {
|
|
50981
|
+
return this.hex >>> 24;
|
|
50982
|
+
}
|
|
50983
|
+
/**
|
|
50984
|
+
* The green component of the color in the range [0-255].
|
|
50985
|
+
*/
|
|
50986
|
+
get g() {
|
|
50987
|
+
return this.hex >>> 16 & 255;
|
|
50988
|
+
}
|
|
50989
|
+
/**
|
|
50990
|
+
* The blue component of the color in the range [0-255].
|
|
50991
|
+
*/
|
|
50992
|
+
get b() {
|
|
50993
|
+
return this.hex >>> 8 & 255;
|
|
50994
|
+
}
|
|
50995
|
+
/**
|
|
50996
|
+
* The alpha component of the color in the range [0-255].
|
|
50997
|
+
*/
|
|
50998
|
+
get a() {
|
|
50999
|
+
return this.hex & 255;
|
|
51000
|
+
}
|
|
51001
|
+
}
|
|
50844
51002
|
class Validation {
|
|
50845
51003
|
//= ===========================================================================
|
|
50846
51004
|
// BASIC NUMBER VALIDATIONS
|
|
@@ -50950,23 +51108,6 @@ void main() {
|
|
|
50950
51108
|
return true;
|
|
50951
51109
|
}
|
|
50952
51110
|
//= ===========================================================================
|
|
50953
|
-
// COLOR VALIDATIONS
|
|
50954
|
-
//= ===========================================================================
|
|
50955
|
-
static isRelativeRGBA(color) {
|
|
50956
|
-
if (color.r < 0 || color.r > 1 || color.g < 0 || color.g > 1 || color.b < 0 || color.b > 1) {
|
|
50957
|
-
console.warn("Invalid value: must be a relative color (0-1, 0-1, 0-1)");
|
|
50958
|
-
return false;
|
|
50959
|
-
}
|
|
50960
|
-
return true;
|
|
50961
|
-
}
|
|
50962
|
-
static isRelativeRGB(color) {
|
|
50963
|
-
if (color.r < 0 || color.r > 1 || color.g < 0 || color.g > 1 || color.b < 0 || color.b > 1) {
|
|
50964
|
-
console.warn("Invalid value: must be a relative color (0-1, 0-1, 0-1)");
|
|
50965
|
-
return false;
|
|
50966
|
-
}
|
|
50967
|
-
return true;
|
|
50968
|
-
}
|
|
50969
|
-
//= ===========================================================================
|
|
50970
51111
|
// STRING AND URL VALIDATIONS
|
|
50971
51112
|
//= ===========================================================================
|
|
50972
51113
|
static isNonEmptyString(value) {
|
|
@@ -51053,6 +51194,13 @@ void main() {
|
|
|
51053
51194
|
}
|
|
51054
51195
|
return value;
|
|
51055
51196
|
}
|
|
51197
|
+
static clampColor01(value) {
|
|
51198
|
+
return new Color(
|
|
51199
|
+
this.clamp01(value.r),
|
|
51200
|
+
this.clamp01(value.g),
|
|
51201
|
+
this.clamp01(value.b)
|
|
51202
|
+
);
|
|
51203
|
+
}
|
|
51056
51204
|
static clampRGBA01(value) {
|
|
51057
51205
|
return new RGBA(
|
|
51058
51206
|
this.clamp01(value.r),
|
|
@@ -57333,155 +57481,6 @@ void main() {
|
|
|
57333
57481
|
getDefaultVimSettings,
|
|
57334
57482
|
request: requestVim
|
|
57335
57483
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
57336
|
-
class Segment {
|
|
57337
|
-
constructor(origin = new Vector3(), target = new Vector3()) {
|
|
57338
|
-
__publicField(this, "origin");
|
|
57339
|
-
__publicField(this, "target");
|
|
57340
|
-
this.origin = origin;
|
|
57341
|
-
this.target = target;
|
|
57342
|
-
}
|
|
57343
|
-
static fromArray(array) {
|
|
57344
|
-
return new Segment(
|
|
57345
|
-
new Vector3(array[0], array[1], array[2]),
|
|
57346
|
-
new Vector3(array[3], array[4], array[5])
|
|
57347
|
-
);
|
|
57348
|
-
}
|
|
57349
|
-
toArray() {
|
|
57350
|
-
return [this.origin.x, this.origin.y, this.origin.z, this.target.x, this.target.y, this.target.z];
|
|
57351
|
-
}
|
|
57352
|
-
isValid() {
|
|
57353
|
-
return !this.origin.equals(this.target);
|
|
57354
|
-
}
|
|
57355
|
-
equals(segment) {
|
|
57356
|
-
return this.origin.equals(segment.origin) && this.target.equals(segment.target);
|
|
57357
|
-
}
|
|
57358
|
-
}
|
|
57359
|
-
class RGBA {
|
|
57360
|
-
constructor(r, g, b, a = 1) {
|
|
57361
|
-
__publicField(this, "r");
|
|
57362
|
-
__publicField(this, "g");
|
|
57363
|
-
__publicField(this, "b");
|
|
57364
|
-
__publicField(this, "a");
|
|
57365
|
-
this.r = r;
|
|
57366
|
-
this.g = g;
|
|
57367
|
-
this.b = b;
|
|
57368
|
-
this.a = a;
|
|
57369
|
-
}
|
|
57370
|
-
clone() {
|
|
57371
|
-
return new RGBA(this.r, this.g, this.b, this.a);
|
|
57372
|
-
}
|
|
57373
|
-
isValid() {
|
|
57374
|
-
return Number.isFinite(this.r) && Number.isFinite(this.g) && Number.isFinite(this.b) && Number.isFinite(this.a);
|
|
57375
|
-
}
|
|
57376
|
-
equals(color) {
|
|
57377
|
-
return this.r === color.r && this.g === color.g && this.b === color.b && this.a === color.a;
|
|
57378
|
-
}
|
|
57379
|
-
static fromString(str) {
|
|
57380
|
-
str = str.trim();
|
|
57381
|
-
if (str.startsWith("(")) {
|
|
57382
|
-
str = str.substring(1);
|
|
57383
|
-
}
|
|
57384
|
-
if (str.endsWith(")")) {
|
|
57385
|
-
str = str.substring(0, str.length - 1);
|
|
57386
|
-
}
|
|
57387
|
-
const parts = str.split(",");
|
|
57388
|
-
if (parts.length < 3 || parts.length > 4) {
|
|
57389
|
-
throw new Error("Invalid color string format. Expected 3 or 4 components.");
|
|
57390
|
-
}
|
|
57391
|
-
const r = parseFloat(parts[0]);
|
|
57392
|
-
const g = parseFloat(parts[1]);
|
|
57393
|
-
const b = parseFloat(parts[2]);
|
|
57394
|
-
const a = parts.length === 4 ? parseFloat(parts[3]) : 1;
|
|
57395
|
-
if ([r, g, b, a].some((n) => isNaN(n))) {
|
|
57396
|
-
throw new Error("Invalid number in color string.");
|
|
57397
|
-
}
|
|
57398
|
-
return new RGBA(r, g, b, a);
|
|
57399
|
-
}
|
|
57400
|
-
}
|
|
57401
|
-
class RGB {
|
|
57402
|
-
constructor(r, g, b) {
|
|
57403
|
-
__publicField(this, "r");
|
|
57404
|
-
__publicField(this, "g");
|
|
57405
|
-
__publicField(this, "b");
|
|
57406
|
-
this.r = r;
|
|
57407
|
-
this.g = g;
|
|
57408
|
-
this.b = b;
|
|
57409
|
-
}
|
|
57410
|
-
}
|
|
57411
|
-
class RGBA32 {
|
|
57412
|
-
constructor(hex) {
|
|
57413
|
-
__publicField(this, "hex");
|
|
57414
|
-
if (!Number.isInteger(hex) || hex < 0 || hex > 4294967295) {
|
|
57415
|
-
throw new Error("Invalid value: must be a 32-bit unsigned integer");
|
|
57416
|
-
}
|
|
57417
|
-
this.hex = hex;
|
|
57418
|
-
}
|
|
57419
|
-
static fromInts(r, g, b, a = 1) {
|
|
57420
|
-
if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255 || a < 0 || a > 255) {
|
|
57421
|
-
throw new Error("Each RGBA component must be in the range 0-255.");
|
|
57422
|
-
}
|
|
57423
|
-
const hex = r * 2 ** 24 + g * 2 ** 16 + b * 2 ** 8 + a;
|
|
57424
|
-
return new RGBA32(hex);
|
|
57425
|
-
}
|
|
57426
|
-
static fromFloats(r, g, b, a = 1) {
|
|
57427
|
-
return this.fromInts(
|
|
57428
|
-
remap(r, 255),
|
|
57429
|
-
remap(g, 255),
|
|
57430
|
-
remap(b, 255),
|
|
57431
|
-
remap(a, 255)
|
|
57432
|
-
);
|
|
57433
|
-
}
|
|
57434
|
-
static fromString(str) {
|
|
57435
|
-
if (str.startsWith("#")) {
|
|
57436
|
-
str = str.slice(1);
|
|
57437
|
-
}
|
|
57438
|
-
if (str.length === 3 || str.length === 4) {
|
|
57439
|
-
str = str.split("").map((c) => c + c).join("");
|
|
57440
|
-
}
|
|
57441
|
-
let r = 0;
|
|
57442
|
-
let g = 0;
|
|
57443
|
-
let b = 0;
|
|
57444
|
-
let a = 255;
|
|
57445
|
-
if (str.length === 6 || str.length === 8) {
|
|
57446
|
-
r = parseInt(str.slice(0, 2), 16);
|
|
57447
|
-
g = parseInt(str.slice(2, 4), 16);
|
|
57448
|
-
b = parseInt(str.slice(4, 6), 16);
|
|
57449
|
-
if (str.length === 8) {
|
|
57450
|
-
a = parseInt(str.slice(6, 8), 16);
|
|
57451
|
-
}
|
|
57452
|
-
} else {
|
|
57453
|
-
throw new Error("Invalid color string format");
|
|
57454
|
-
}
|
|
57455
|
-
if ([r, g, b, a].some((v) => isNaN(v))) {
|
|
57456
|
-
throw new Error("Invalid color string format");
|
|
57457
|
-
}
|
|
57458
|
-
return this.fromInts(r, g, b, a);
|
|
57459
|
-
}
|
|
57460
|
-
/**
|
|
57461
|
-
* The red component of the color in the range [0-255].
|
|
57462
|
-
*/
|
|
57463
|
-
get r() {
|
|
57464
|
-
return this.hex >>> 24;
|
|
57465
|
-
}
|
|
57466
|
-
/**
|
|
57467
|
-
* The green component of the color in the range [0-255].
|
|
57468
|
-
*/
|
|
57469
|
-
get g() {
|
|
57470
|
-
return this.hex >>> 16 & 255;
|
|
57471
|
-
}
|
|
57472
|
-
/**
|
|
57473
|
-
* The blue component of the color in the range [0-255].
|
|
57474
|
-
*/
|
|
57475
|
-
get b() {
|
|
57476
|
-
return this.hex >>> 8 & 255;
|
|
57477
|
-
}
|
|
57478
|
-
/**
|
|
57479
|
-
* The alpha component of the color in the range [0-255].
|
|
57480
|
-
*/
|
|
57481
|
-
get a() {
|
|
57482
|
-
return this.hex & 255;
|
|
57483
|
-
}
|
|
57484
|
-
}
|
|
57485
57484
|
class Camera {
|
|
57486
57485
|
/**
|
|
57487
57486
|
* Creates a new Camera instance
|
|
@@ -58340,35 +58339,7 @@ void main() {
|
|
|
58340
58339
|
* @returns {number} The color value as a hexadecimal number.
|
|
58341
58340
|
*/
|
|
58342
58341
|
get hex() {
|
|
58343
|
-
return this.color.
|
|
58344
|
-
}
|
|
58345
|
-
/**
|
|
58346
|
-
* Gets the red component of the color.
|
|
58347
|
-
* @returns {number} The red component value in the range [0-255].
|
|
58348
|
-
*/
|
|
58349
|
-
get r() {
|
|
58350
|
-
return this.color.r;
|
|
58351
|
-
}
|
|
58352
|
-
/**
|
|
58353
|
-
* Gets the green component of the color.
|
|
58354
|
-
* @returns {number} The green component value in the range [0-255].
|
|
58355
|
-
*/
|
|
58356
|
-
get g() {
|
|
58357
|
-
return this.color.g;
|
|
58358
|
-
}
|
|
58359
|
-
/**
|
|
58360
|
-
* Gets the blue component of the color.
|
|
58361
|
-
* @returns {number} The blue component value in the range [0-255].
|
|
58362
|
-
*/
|
|
58363
|
-
get b() {
|
|
58364
|
-
return this.color.b;
|
|
58365
|
-
}
|
|
58366
|
-
/**
|
|
58367
|
-
* Gets the alpha (opacity) component of the color.
|
|
58368
|
-
* @returns {number} The alpha component value in the range [0-255].
|
|
58369
|
-
*/
|
|
58370
|
-
get a() {
|
|
58371
|
-
return this.color.a;
|
|
58342
|
+
return this.color.getHex();
|
|
58372
58343
|
}
|
|
58373
58344
|
/**
|
|
58374
58345
|
* Disposes of the color handle and releases associated resources.
|
|
@@ -58381,6 +58352,12 @@ void main() {
|
|
|
58381
58352
|
this._disposed = true;
|
|
58382
58353
|
}
|
|
58383
58354
|
}
|
|
58355
|
+
function RGBAfromThree(color, opacity = 1) {
|
|
58356
|
+
return new RGBA(color.r, color.g, color.b, opacity);
|
|
58357
|
+
}
|
|
58358
|
+
function RGBA32fromThree(color, opacity = 1) {
|
|
58359
|
+
return RGBA32.fromFloats(color.r, color.g, color.b, opacity);
|
|
58360
|
+
}
|
|
58384
58361
|
const MAX_BATCH_SIZE = 3e3;
|
|
58385
58362
|
class ColorManager {
|
|
58386
58363
|
/**
|
|
@@ -58400,8 +58377,8 @@ void main() {
|
|
|
58400
58377
|
* @param hex - The RGBA32 color value
|
|
58401
58378
|
* @returns Promise resolving to a ColorHandle, or undefined if creation fails
|
|
58402
58379
|
*/
|
|
58403
|
-
async getColor(
|
|
58404
|
-
const colors = await this.getColors([
|
|
58380
|
+
async getColor(color) {
|
|
58381
|
+
const colors = await this.getColors([color]);
|
|
58405
58382
|
if (!colors) return void 0;
|
|
58406
58383
|
return colors[0];
|
|
58407
58384
|
}
|
|
@@ -58417,20 +58394,21 @@ void main() {
|
|
|
58417
58394
|
const toCreate = [];
|
|
58418
58395
|
for (let i2 = 0; i2 < c.length; i2++) {
|
|
58419
58396
|
const color = c[i2];
|
|
58420
|
-
|
|
58421
|
-
|
|
58422
|
-
|
|
58423
|
-
|
|
58397
|
+
const hex = color.getHex();
|
|
58398
|
+
if (this._hexToColor.has(hex)) {
|
|
58399
|
+
result[i2] = this._hexToColor.get(hex);
|
|
58400
|
+
} else if (hexToIndices.has(hex)) {
|
|
58401
|
+
hexToIndices.get(hex).push(i2);
|
|
58424
58402
|
} else {
|
|
58425
58403
|
toCreate.push(color);
|
|
58426
|
-
hexToIndices.set(
|
|
58404
|
+
hexToIndices.set(hex, [i2]);
|
|
58427
58405
|
}
|
|
58428
58406
|
}
|
|
58429
58407
|
const colors = await this._createColors(toCreate);
|
|
58430
58408
|
if (!colors) return void 0;
|
|
58431
58409
|
for (let i2 = 0; i2 < colors.length; i2++) {
|
|
58432
58410
|
const color = toCreate[i2];
|
|
58433
|
-
const indices = hexToIndices.get(color.
|
|
58411
|
+
const indices = hexToIndices.get(color.getHex());
|
|
58434
58412
|
for (const index2 of indices) {
|
|
58435
58413
|
result[index2] = colors[i2];
|
|
58436
58414
|
}
|
|
@@ -58475,7 +58453,8 @@ void main() {
|
|
|
58475
58453
|
if (colors.length === 0) {
|
|
58476
58454
|
return result;
|
|
58477
58455
|
}
|
|
58478
|
-
const
|
|
58456
|
+
const rpcColors = colors.map((c) => RGBA32fromThree(c));
|
|
58457
|
+
const instances = await this._rpc.RPCCreateMaterialInstances(MaterialHandles.StandardOpaque, 1, rpcColors);
|
|
58479
58458
|
if (!instances) return void 0;
|
|
58480
58459
|
for (let i2 = 0; i2 < colors.length; i2++) {
|
|
58481
58460
|
const color = this._createColor(colors[i2], instances[i2]);
|
|
@@ -58492,7 +58471,7 @@ void main() {
|
|
|
58492
58471
|
*/
|
|
58493
58472
|
_createColor(color, id2) {
|
|
58494
58473
|
const handle = new RemoteColor(color, id2, this);
|
|
58495
|
-
this._hexToColor.set(color.
|
|
58474
|
+
this._hexToColor.set(color.getHex(), handle);
|
|
58496
58475
|
this._idToColor.set(handle.id, handle);
|
|
58497
58476
|
return handle;
|
|
58498
58477
|
}
|
|
@@ -59759,7 +59738,8 @@ void main() {
|
|
|
59759
59738
|
}
|
|
59760
59739
|
const defaultRenderSettings = {
|
|
59761
59740
|
...defaultSceneSettings,
|
|
59762
|
-
ghostColor: new
|
|
59741
|
+
ghostColor: new Color(14 / 255, 14 / 255, 14 / 255),
|
|
59742
|
+
ghostOpacity: 64 / 255
|
|
59763
59743
|
};
|
|
59764
59744
|
class Renderer {
|
|
59765
59745
|
/**
|
|
@@ -59806,7 +59786,8 @@ void main() {
|
|
|
59806
59786
|
* Sets up initial scene settings, ghost color, and IBL rotation
|
|
59807
59787
|
*/
|
|
59808
59788
|
onConnect() {
|
|
59809
|
-
this.
|
|
59789
|
+
const color = RGBAfromThree(this._settings.ghostColor, this._settings.ghostOpacity);
|
|
59790
|
+
this._rpc.RPCSetGhostColor(color);
|
|
59810
59791
|
}
|
|
59811
59792
|
notifySceneUpdated() {
|
|
59812
59793
|
this._onSceneUpdated.dispatch();
|
|
@@ -59814,11 +59795,14 @@ void main() {
|
|
|
59814
59795
|
// Getters
|
|
59815
59796
|
/**
|
|
59816
59797
|
* Gets the ghost color used for transparent rendering
|
|
59817
|
-
* @returns Current ghost color as
|
|
59798
|
+
* @returns Current ghost color as a THREE.Color
|
|
59818
59799
|
*/
|
|
59819
59800
|
get ghostColor() {
|
|
59820
59801
|
return this._settings.ghostColor;
|
|
59821
59802
|
}
|
|
59803
|
+
get ghostOpacity() {
|
|
59804
|
+
return this._settings.ghostOpacity;
|
|
59805
|
+
}
|
|
59822
59806
|
/**
|
|
59823
59807
|
* Gets the tone mapping white point value
|
|
59824
59808
|
* @returns Current tone mapping white point
|
|
@@ -59859,20 +59843,26 @@ void main() {
|
|
|
59859
59843
|
* @returns Current background color as RGBA
|
|
59860
59844
|
*/
|
|
59861
59845
|
get backgroundColor() {
|
|
59862
|
-
return this._settings.backgroundColor;
|
|
59846
|
+
return this._settings.backgroundColor.toThree();
|
|
59863
59847
|
}
|
|
59864
59848
|
// Setters
|
|
59865
59849
|
/**
|
|
59866
59850
|
* Updates the ghost color used for transparent rendering
|
|
59867
|
-
* @param value - New ghost color as
|
|
59851
|
+
* @param value - New ghost color as THREE.Color
|
|
59868
59852
|
*/
|
|
59869
59853
|
set ghostColor(value) {
|
|
59870
|
-
value = Validation.clampRGBA01(value);
|
|
59871
59854
|
if (this._settings.ghostColor.equals(value)) return;
|
|
59872
59855
|
this._settings.ghostColor = value;
|
|
59873
59856
|
this._updateGhostColor = true;
|
|
59874
59857
|
this.requestSettingsUpdate();
|
|
59875
59858
|
}
|
|
59859
|
+
set ghostOpacity(value) {
|
|
59860
|
+
value = Validation.clamp01(value);
|
|
59861
|
+
if (this._settings.ghostOpacity === value) return;
|
|
59862
|
+
this._settings.ghostOpacity = value;
|
|
59863
|
+
this._updateGhostColor = true;
|
|
59864
|
+
this.requestSettingsUpdate();
|
|
59865
|
+
}
|
|
59876
59866
|
/**
|
|
59877
59867
|
* Sets the tone mapping white point value
|
|
59878
59868
|
* @param value - New tone mapping white point value
|
|
@@ -59930,12 +59920,12 @@ void main() {
|
|
|
59930
59920
|
}
|
|
59931
59921
|
/**
|
|
59932
59922
|
* Sets the background color
|
|
59933
|
-
* @param value - New background color as
|
|
59923
|
+
* @param value - New background color as THREE.Color
|
|
59934
59924
|
*/
|
|
59935
59925
|
set backgroundColor(value) {
|
|
59936
|
-
|
|
59937
|
-
if (this._settings.backgroundColor.equals(
|
|
59938
|
-
this._settings.backgroundColor =
|
|
59926
|
+
const color = RGBAfromThree(value, 1);
|
|
59927
|
+
if (this._settings.backgroundColor.equals(color)) return;
|
|
59928
|
+
this._settings.backgroundColor = color;
|
|
59939
59929
|
this._updateLighting = true;
|
|
59940
59930
|
this.requestSettingsUpdate();
|
|
59941
59931
|
}
|
|
@@ -59955,7 +59945,10 @@ void main() {
|
|
|
59955
59945
|
}
|
|
59956
59946
|
async applySettings() {
|
|
59957
59947
|
if (this._updateLighting) await this._rpc.RPCSetLighting(this._settings);
|
|
59958
|
-
if (this._updateGhostColor)
|
|
59948
|
+
if (this._updateGhostColor) {
|
|
59949
|
+
const color = RGBAfromThree(this._settings.ghostColor, this._settings.ghostOpacity);
|
|
59950
|
+
await this._rpc.RPCSetGhostColor(color);
|
|
59951
|
+
}
|
|
59959
59952
|
this._updateLighting = false;
|
|
59960
59953
|
this._updateGhostColor = false;
|
|
59961
59954
|
this._animationFrame = void 0;
|
|
@@ -60055,7 +60048,7 @@ void main() {
|
|
|
60055
60048
|
* Fits the given box, invalid dimensions will be reversed.
|
|
60056
60049
|
* @param box - The new bounding box.
|
|
60057
60050
|
*/
|
|
60058
|
-
|
|
60051
|
+
setBox(box) {
|
|
60059
60052
|
box = safeBox(box);
|
|
60060
60053
|
this._box = box;
|
|
60061
60054
|
this.scheduleUpdate();
|
|
@@ -60880,7 +60873,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60880
60873
|
// Should be private
|
|
60881
60874
|
__publicField(this, "visibility");
|
|
60882
60875
|
// Color tracking remains unchanged.
|
|
60883
|
-
__publicField(this, "
|
|
60876
|
+
__publicField(this, "_elementColors", /* @__PURE__ */ new Map());
|
|
60884
60877
|
__publicField(this, "_updatedColors", /* @__PURE__ */ new Set());
|
|
60885
60878
|
// Delayed update flag.
|
|
60886
60879
|
__publicField(this, "_updateScheduled", false);
|
|
@@ -61033,12 +61026,12 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61033
61026
|
}
|
|
61034
61027
|
return await this._rpc.RPCGetAABBForVim(this._handle);
|
|
61035
61028
|
}
|
|
61036
|
-
getColor(
|
|
61037
|
-
return this.
|
|
61029
|
+
getColor(elementIndex) {
|
|
61030
|
+
return this._elementColors.get(elementIndex);
|
|
61038
61031
|
}
|
|
61039
|
-
async setColor(
|
|
61040
|
-
const colors = new Array(
|
|
61041
|
-
this.applyColor(
|
|
61032
|
+
async setColor(elementIndex, color) {
|
|
61033
|
+
const colors = new Array(elementIndex.length).fill(color);
|
|
61034
|
+
this.applyColor(elementIndex, colors);
|
|
61042
61035
|
}
|
|
61043
61036
|
async setColors(nodes, color) {
|
|
61044
61037
|
if (color.length !== nodes.length) {
|
|
@@ -61051,9 +61044,9 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61051
61044
|
const c = color[i2];
|
|
61052
61045
|
const n = nodes[i2];
|
|
61053
61046
|
if (c === void 0) {
|
|
61054
|
-
this.
|
|
61047
|
+
this._elementColors.delete(n);
|
|
61055
61048
|
} else {
|
|
61056
|
-
this.
|
|
61049
|
+
this._elementColors.set(n, c);
|
|
61057
61050
|
}
|
|
61058
61051
|
this._updatedColors.add(n);
|
|
61059
61052
|
}
|
|
@@ -61061,9 +61054,9 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61061
61054
|
}
|
|
61062
61055
|
clearColor(elements) {
|
|
61063
61056
|
if (elements === "all") {
|
|
61064
|
-
this.
|
|
61057
|
+
this._elementColors.clear();
|
|
61065
61058
|
} else {
|
|
61066
|
-
elements.forEach((n) => this.
|
|
61059
|
+
elements.forEach((n) => this._elementColors.delete(n));
|
|
61067
61060
|
}
|
|
61068
61061
|
if (!this.connected) return;
|
|
61069
61062
|
if (elements === "all") {
|
|
@@ -61075,7 +61068,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61075
61068
|
}
|
|
61076
61069
|
reapplyColors() {
|
|
61077
61070
|
this._updatedColors.clear();
|
|
61078
|
-
this.
|
|
61071
|
+
this._elementColors.forEach((c, n) => this._updatedColors.add(n));
|
|
61079
61072
|
this.scheduleColorUpdate();
|
|
61080
61073
|
}
|
|
61081
61074
|
scheduleColorUpdate() {
|
|
@@ -61092,7 +61085,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61092
61085
|
}
|
|
61093
61086
|
async updateRemoteColors() {
|
|
61094
61087
|
const nodes = Array.from(this._updatedColors);
|
|
61095
|
-
const colors = nodes.map((n) => this.
|
|
61088
|
+
const colors = nodes.map((n) => this._elementColors.get(n));
|
|
61096
61089
|
const remoteColors = await this._colors.getColors(colors);
|
|
61097
61090
|
const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
|
|
61098
61091
|
this._rpc.RPCSetMaterialOverridesForElements(this._handle, nodes, colorIds);
|
|
@@ -61420,9 +61413,6 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61420
61413
|
INVALID_HANDLE,
|
|
61421
61414
|
InputMode,
|
|
61422
61415
|
MaterialHandles,
|
|
61423
|
-
RGB,
|
|
61424
|
-
RGBA,
|
|
61425
|
-
RGBA32,
|
|
61426
61416
|
Segment,
|
|
61427
61417
|
Viewer: Viewer$2,
|
|
61428
61418
|
VimLoadingStatus,
|
|
@@ -76213,7 +76203,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
76213
76203
|
viewer.sectionBox.interactive = b;
|
|
76214
76204
|
},
|
|
76215
76205
|
getBox: () => viewer.sectionBox.getBox(),
|
|
76216
|
-
setBox: (box) => viewer.sectionBox.
|
|
76206
|
+
setBox: (box) => viewer.sectionBox.setBox(box),
|
|
76217
76207
|
onSelectionChanged: viewer.selection.onSelectionChanged,
|
|
76218
76208
|
getSelectionBox: () => viewer.selection.getBoundingBox(),
|
|
76219
76209
|
getSceneBox: () => viewer.renderer.getBoundingBox()
|
|
@@ -76327,11 +76317,9 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
76327
76317
|
}
|
|
76328
76318
|
}
|
|
76329
76319
|
},
|
|
76330
|
-
getGhostOpacity: () => viewer.renderer.
|
|
76320
|
+
getGhostOpacity: () => viewer.renderer.ghostOpacity,
|
|
76331
76321
|
setGhostOpacity: (opacity) => {
|
|
76332
|
-
|
|
76333
|
-
c.a = opacity;
|
|
76334
|
-
viewer.renderer.ghostColor = c;
|
|
76322
|
+
viewer.renderer.ghostOpacity = opacity;
|
|
76335
76323
|
},
|
|
76336
76324
|
getShowRooms: () => true,
|
|
76337
76325
|
setShowRooms: (show) => {
|