vim-web 0.5.0-dev.5 → 0.5.0-dev.7
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 +4 -4
- 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/vim.d.ts +4 -5
- package/dist/types/utils/validation.d.ts +4 -4
- package/dist/vim-web.iife.js +235 -245
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +235 -245
- 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,39 +58377,40 @@ 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
|
}
|
|
58408
58385
|
/**
|
|
58409
58386
|
* Creates or retrieves cached color instances for multiple hex values.
|
|
58410
|
-
* @param
|
|
58387
|
+
* @param colors - Array of RGBA32 color values
|
|
58411
58388
|
* @returns Promise resolving to an array of ColorHandles in the same order as input, or undefined if creation fails
|
|
58412
58389
|
* @remarks Duplicate hex values will be mapped to the same color instance for efficiency
|
|
58413
58390
|
*/
|
|
58414
|
-
async getColors(
|
|
58415
|
-
const result = new Array(
|
|
58391
|
+
async getColors(colors) {
|
|
58392
|
+
const result = new Array(colors.length);
|
|
58416
58393
|
const hexToIndices = /* @__PURE__ */ new Map();
|
|
58417
58394
|
const toCreate = [];
|
|
58418
|
-
for (let i2 = 0; i2 <
|
|
58419
|
-
const color =
|
|
58420
|
-
|
|
58421
|
-
|
|
58422
|
-
|
|
58423
|
-
|
|
58395
|
+
for (let i2 = 0; i2 < colors.length; i2++) {
|
|
58396
|
+
const color = colors[i2];
|
|
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
|
-
const
|
|
58430
|
-
if (!
|
|
58431
|
-
for (let i2 = 0; i2 <
|
|
58407
|
+
const remoteColors = await this._createColors(toCreate);
|
|
58408
|
+
if (!remoteColors) return void 0;
|
|
58409
|
+
for (let i2 = 0; i2 < remoteColors.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
|
-
result[index2] =
|
|
58413
|
+
result[index2] = remoteColors[i2];
|
|
58436
58414
|
}
|
|
58437
58415
|
}
|
|
58438
58416
|
return result;
|
|
@@ -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;
|
|
@@ -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);
|
|
@@ -60900,6 +60893,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60900
60893
|
// default state
|
|
60901
60894
|
);
|
|
60902
60895
|
}
|
|
60896
|
+
//TODO: Rename this to getElementFromNode, prefer using element instead
|
|
60903
60897
|
getElement(elementIndex) {
|
|
60904
60898
|
if (this._objects.has(elementIndex)) {
|
|
60905
60899
|
return this._objects.get(elementIndex);
|
|
@@ -60912,7 +60906,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60912
60906
|
throw new Error("Method not implemented.");
|
|
60913
60907
|
}
|
|
60914
60908
|
getElementFromIndex(element) {
|
|
60915
|
-
|
|
60909
|
+
return this.getElement(element);
|
|
60916
60910
|
}
|
|
60917
60911
|
getObjectsInBox(box) {
|
|
60918
60912
|
throw new Error("Method not implemented.");
|
|
@@ -61033,12 +61027,12 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61033
61027
|
}
|
|
61034
61028
|
return await this._rpc.RPCGetAABBForVim(this._handle);
|
|
61035
61029
|
}
|
|
61036
|
-
getColor(
|
|
61037
|
-
return this.
|
|
61030
|
+
getColor(elementIndex) {
|
|
61031
|
+
return this._elementColors.get(elementIndex);
|
|
61038
61032
|
}
|
|
61039
|
-
async setColor(
|
|
61040
|
-
const colors = new Array(
|
|
61041
|
-
this.applyColor(
|
|
61033
|
+
async setColor(elementIndex, color) {
|
|
61034
|
+
const colors = new Array(elementIndex.length).fill(color);
|
|
61035
|
+
this.applyColor(elementIndex, colors);
|
|
61042
61036
|
}
|
|
61043
61037
|
async setColors(nodes, color) {
|
|
61044
61038
|
if (color.length !== nodes.length) {
|
|
@@ -61051,9 +61045,9 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61051
61045
|
const c = color[i2];
|
|
61052
61046
|
const n = nodes[i2];
|
|
61053
61047
|
if (c === void 0) {
|
|
61054
|
-
this.
|
|
61048
|
+
this._elementColors.delete(n);
|
|
61055
61049
|
} else {
|
|
61056
|
-
this.
|
|
61050
|
+
this._elementColors.set(n, c);
|
|
61057
61051
|
}
|
|
61058
61052
|
this._updatedColors.add(n);
|
|
61059
61053
|
}
|
|
@@ -61061,9 +61055,9 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61061
61055
|
}
|
|
61062
61056
|
clearColor(elements) {
|
|
61063
61057
|
if (elements === "all") {
|
|
61064
|
-
this.
|
|
61058
|
+
this._elementColors.clear();
|
|
61065
61059
|
} else {
|
|
61066
|
-
elements.forEach((n) => this.
|
|
61060
|
+
elements.forEach((n) => this._elementColors.delete(n));
|
|
61067
61061
|
}
|
|
61068
61062
|
if (!this.connected) return;
|
|
61069
61063
|
if (elements === "all") {
|
|
@@ -61075,7 +61069,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61075
61069
|
}
|
|
61076
61070
|
reapplyColors() {
|
|
61077
61071
|
this._updatedColors.clear();
|
|
61078
|
-
this.
|
|
61072
|
+
this._elementColors.forEach((c, n) => this._updatedColors.add(n));
|
|
61079
61073
|
this.scheduleColorUpdate();
|
|
61080
61074
|
}
|
|
61081
61075
|
scheduleColorUpdate() {
|
|
@@ -61092,7 +61086,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61092
61086
|
}
|
|
61093
61087
|
async updateRemoteColors() {
|
|
61094
61088
|
const nodes = Array.from(this._updatedColors);
|
|
61095
|
-
const colors = nodes.map((n) => this.
|
|
61089
|
+
const colors = nodes.map((n) => this._elementColors.get(n));
|
|
61096
61090
|
const remoteColors = await this._colors.getColors(colors);
|
|
61097
61091
|
const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
|
|
61098
61092
|
this._rpc.RPCSetMaterialOverridesForElements(this._handle, nodes, colorIds);
|
|
@@ -61420,9 +61414,6 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61420
61414
|
INVALID_HANDLE,
|
|
61421
61415
|
InputMode,
|
|
61422
61416
|
MaterialHandles,
|
|
61423
|
-
RGB,
|
|
61424
|
-
RGBA,
|
|
61425
|
-
RGBA32,
|
|
61426
61417
|
Segment,
|
|
61427
61418
|
Viewer: Viewer$2,
|
|
61428
61419
|
VimLoadingStatus,
|
|
@@ -76294,6 +76285,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
76294
76285
|
obj.state = VisibilityState.HIGHLIGHTED;
|
|
76295
76286
|
});
|
|
76296
76287
|
},
|
|
76288
|
+
// TODO: Change this api to use elements
|
|
76297
76289
|
isolate: (instances) => {
|
|
76298
76290
|
hide("all");
|
|
76299
76291
|
viewer.selection.getAll().forEach((obj) => {
|
|
@@ -76327,11 +76319,9 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
76327
76319
|
}
|
|
76328
76320
|
}
|
|
76329
76321
|
},
|
|
76330
|
-
getGhostOpacity: () => viewer.renderer.
|
|
76322
|
+
getGhostOpacity: () => viewer.renderer.ghostOpacity,
|
|
76331
76323
|
setGhostOpacity: (opacity) => {
|
|
76332
|
-
|
|
76333
|
-
c.a = opacity;
|
|
76334
|
-
viewer.renderer.ghostColor = c;
|
|
76324
|
+
viewer.renderer.ghostOpacity = opacity;
|
|
76335
76325
|
},
|
|
76336
76326
|
getShowRooms: () => true,
|
|
76337
76327
|
setShowRooms: (show) => {
|