vim-web 0.6.0-dev.8 → 1.0.0-alpha.0
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/vim-web.d.ts +13 -103
- package/dist/vim-web.iife.js +109 -276
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +109 -276
- package/dist/vim-web.js.map +1 -1
- package/package.json +2 -1
package/dist/vim-web.iife.js
CHANGED
|
@@ -47544,25 +47544,6 @@ void main() {
|
|
|
47544
47544
|
};
|
|
47545
47545
|
__publicField(_CameraMovementSnap, "_ZERO", new Vector3());
|
|
47546
47546
|
let CameraMovementSnap = _CameraMovementSnap;
|
|
47547
|
-
function createOpaque() {
|
|
47548
|
-
return new StandardMaterial(createBasicOpaque());
|
|
47549
|
-
}
|
|
47550
|
-
function createTransparent() {
|
|
47551
|
-
return new StandardMaterial(createBasicTransparent());
|
|
47552
|
-
}
|
|
47553
|
-
function createBasicOpaque() {
|
|
47554
|
-
return new MeshLambertMaterial({
|
|
47555
|
-
color: 13421772,
|
|
47556
|
-
flatShading: true,
|
|
47557
|
-
side: DoubleSide
|
|
47558
|
-
});
|
|
47559
|
-
}
|
|
47560
|
-
function createBasicTransparent() {
|
|
47561
|
-
const mat = createBasicOpaque();
|
|
47562
|
-
mat.transparent = true;
|
|
47563
|
-
mat.opacity = 0.25;
|
|
47564
|
-
return mat;
|
|
47565
|
-
}
|
|
47566
47547
|
class StandardMaterial {
|
|
47567
47548
|
constructor(material) {
|
|
47568
47549
|
__publicField(this, "three");
|
|
@@ -53777,7 +53758,7 @@ void main() {
|
|
|
53777
53758
|
}
|
|
53778
53759
|
};
|
|
53779
53760
|
class Gizmos {
|
|
53780
|
-
constructor(renderer, viewport, viewer, camera2) {
|
|
53761
|
+
constructor(renderer, viewport, viewer, camera2, settings2) {
|
|
53781
53762
|
__publicField(this, "_viewport");
|
|
53782
53763
|
__publicField(this, "_measure");
|
|
53783
53764
|
/**
|
|
@@ -53804,9 +53785,9 @@ void main() {
|
|
|
53804
53785
|
renderer,
|
|
53805
53786
|
camera2,
|
|
53806
53787
|
viewer.inputs,
|
|
53807
|
-
|
|
53788
|
+
settings2
|
|
53808
53789
|
);
|
|
53809
|
-
this.axes = new GizmoAxes(camera2, viewport,
|
|
53790
|
+
this.axes = new GizmoAxes(camera2, viewport, settings2.axes);
|
|
53810
53791
|
this.markers = new GizmoMarkers(renderer, viewer.selection);
|
|
53811
53792
|
(_a3 = viewport.canvas.parentElement) == null ? void 0 : _a3.prepend(this.axes.canvas);
|
|
53812
53793
|
}
|
|
@@ -54059,8 +54040,8 @@ void main() {
|
|
|
54059
54040
|
clipping: true,
|
|
54060
54041
|
// Use GLSL ES 3.0 for WebGL 2
|
|
54061
54042
|
glslVersion: GLSL3,
|
|
54062
|
-
//
|
|
54063
|
-
|
|
54043
|
+
// Writes 1.0 to color for selected, 0.0 for background (after clear).
|
|
54044
|
+
// Outline shader does edge detection on this binary mask.
|
|
54064
54045
|
vertexShader: (
|
|
54065
54046
|
/* glsl */
|
|
54066
54047
|
`
|
|
@@ -54209,33 +54190,13 @@ void main() {
|
|
|
54209
54190
|
});
|
|
54210
54191
|
}
|
|
54211
54192
|
class OutlineMaterial {
|
|
54212
|
-
constructor(
|
|
54193
|
+
constructor(onUpdate) {
|
|
54213
54194
|
__publicField(this, "three");
|
|
54214
|
-
__publicField(this, "_camera");
|
|
54215
54195
|
__publicField(this, "_resolution");
|
|
54216
|
-
__publicField(this, "_precision", 1);
|
|
54217
54196
|
__publicField(this, "_onUpdate");
|
|
54218
54197
|
this.three = createOutlineMaterial();
|
|
54219
54198
|
this._onUpdate = onUpdate;
|
|
54220
|
-
this.
|
|
54221
|
-
this._resolution = (options == null ? void 0 : options.resolution) ?? new Vector2(1, 1);
|
|
54222
|
-
this.resolution = this._resolution;
|
|
54223
|
-
if (options == null ? void 0 : options.sceneBuffer) {
|
|
54224
|
-
this.sceneBuffer = options.sceneBuffer;
|
|
54225
|
-
}
|
|
54226
|
-
this.camera = options == null ? void 0 : options.camera;
|
|
54227
|
-
}
|
|
54228
|
-
/**
|
|
54229
|
-
* Precision of the outline. This is used to scale the resolution of the outline.
|
|
54230
|
-
*/
|
|
54231
|
-
get precision() {
|
|
54232
|
-
return this._precision;
|
|
54233
|
-
}
|
|
54234
|
-
set precision(value) {
|
|
54235
|
-
var _a3;
|
|
54236
|
-
this._precision = value;
|
|
54237
|
-
this.resolution = this._resolution;
|
|
54238
|
-
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54199
|
+
this._resolution = new Vector2(1, 1);
|
|
54239
54200
|
}
|
|
54240
54201
|
/**
|
|
54241
54202
|
* Resolution of the outline. This should match the resolution of screen.
|
|
@@ -54246,50 +54207,24 @@ void main() {
|
|
|
54246
54207
|
set resolution(value) {
|
|
54247
54208
|
var _a3;
|
|
54248
54209
|
this.three.uniforms.screenSize.value.set(
|
|
54249
|
-
value.x
|
|
54250
|
-
value.y
|
|
54251
|
-
1 /
|
|
54252
|
-
1 /
|
|
54210
|
+
value.x,
|
|
54211
|
+
value.y,
|
|
54212
|
+
1 / value.x,
|
|
54213
|
+
1 / value.y
|
|
54253
54214
|
);
|
|
54254
54215
|
this._resolution = value;
|
|
54255
54216
|
this.three.uniformsNeedUpdate = true;
|
|
54256
54217
|
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54257
54218
|
}
|
|
54258
54219
|
/**
|
|
54259
|
-
*
|
|
54220
|
+
* Thickness of the outline in pixels (of the outline render target).
|
|
54260
54221
|
*/
|
|
54261
|
-
get
|
|
54262
|
-
return this.
|
|
54222
|
+
get thickness() {
|
|
54223
|
+
return this.three.uniforms.thickness.value;
|
|
54263
54224
|
}
|
|
54264
|
-
set
|
|
54225
|
+
set thickness(value) {
|
|
54265
54226
|
var _a3;
|
|
54266
|
-
this.
|
|
54267
|
-
this.three.uniforms.cameraNear.value = (value == null ? void 0 : value.near) ?? 1;
|
|
54268
|
-
this.three.uniforms.cameraFar.value = (value == null ? void 0 : value.far) ?? 1e3;
|
|
54269
|
-
this.three.uniformsNeedUpdate = true;
|
|
54270
|
-
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54271
|
-
}
|
|
54272
|
-
/**
|
|
54273
|
-
* Intensity of the outline. Controls the strength of the edge detection.
|
|
54274
|
-
*/
|
|
54275
|
-
get intensity() {
|
|
54276
|
-
return this.three.uniforms.intensity.value;
|
|
54277
|
-
}
|
|
54278
|
-
set intensity(value) {
|
|
54279
|
-
var _a3;
|
|
54280
|
-
this.three.uniforms.intensity.value = value;
|
|
54281
|
-
this.three.uniformsNeedUpdate = true;
|
|
54282
|
-
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54283
|
-
}
|
|
54284
|
-
/**
|
|
54285
|
-
* Color of the outline.
|
|
54286
|
-
*/
|
|
54287
|
-
get color() {
|
|
54288
|
-
return this.three.uniforms.outlineColor.value;
|
|
54289
|
-
}
|
|
54290
|
-
set color(value) {
|
|
54291
|
-
var _a3;
|
|
54292
|
-
this.three.uniforms.outlineColor.value.set(value);
|
|
54227
|
+
this.three.uniforms.thickness.value = Math.max(1, Math.round(value));
|
|
54293
54228
|
this.three.uniformsNeedUpdate = true;
|
|
54294
54229
|
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54295
54230
|
}
|
|
@@ -54305,18 +54240,6 @@ void main() {
|
|
|
54305
54240
|
this.three.uniformsNeedUpdate = true;
|
|
54306
54241
|
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54307
54242
|
}
|
|
54308
|
-
/**
|
|
54309
|
-
* Depth buffer used to render the outline.
|
|
54310
|
-
*/
|
|
54311
|
-
get depthBuffer() {
|
|
54312
|
-
return this.three.uniforms.depthBuffer.value;
|
|
54313
|
-
}
|
|
54314
|
-
set depthBuffer(value) {
|
|
54315
|
-
var _a3;
|
|
54316
|
-
this.three.uniforms.depthBuffer.value = value;
|
|
54317
|
-
this.three.uniformsNeedUpdate = true;
|
|
54318
|
-
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54319
|
-
}
|
|
54320
54243
|
/**
|
|
54321
54244
|
* Dispose of the outline material.
|
|
54322
54245
|
*/
|
|
@@ -54330,18 +54253,9 @@ void main() {
|
|
|
54330
54253
|
glslVersion: GLSL3,
|
|
54331
54254
|
depthWrite: false,
|
|
54332
54255
|
uniforms: {
|
|
54333
|
-
// Input buffers
|
|
54334
54256
|
sceneBuffer: { value: null },
|
|
54335
|
-
|
|
54336
|
-
|
|
54337
|
-
cameraNear: { value: 1 },
|
|
54338
|
-
cameraFar: { value: 1e3 },
|
|
54339
|
-
screenSize: {
|
|
54340
|
-
value: new Vector4(1, 1, 1, 1)
|
|
54341
|
-
},
|
|
54342
|
-
// Options
|
|
54343
|
-
outlineColor: { value: new Color(16777215) },
|
|
54344
|
-
intensity: { value: 2 }
|
|
54257
|
+
screenSize: { value: new Vector4(1, 1, 1, 1) },
|
|
54258
|
+
thickness: { value: 2 }
|
|
54345
54259
|
},
|
|
54346
54260
|
vertexShader: `
|
|
54347
54261
|
out vec2 vUv;
|
|
@@ -54351,52 +54265,55 @@ void main() {
|
|
|
54351
54265
|
}
|
|
54352
54266
|
`,
|
|
54353
54267
|
fragmentShader: `
|
|
54354
|
-
|
|
54355
|
-
|
|
54356
|
-
uniform sampler2D depthBuffer;
|
|
54357
|
-
uniform float cameraNear;
|
|
54358
|
-
uniform float cameraFar;
|
|
54268
|
+
uniform sampler2D sceneBuffer;
|
|
54359
54269
|
uniform vec4 screenSize;
|
|
54360
|
-
uniform
|
|
54361
|
-
uniform float intensity;
|
|
54270
|
+
uniform float thickness;
|
|
54362
54271
|
|
|
54363
54272
|
in vec2 vUv;
|
|
54364
54273
|
out vec4 fragColor;
|
|
54365
54274
|
|
|
54366
|
-
//
|
|
54367
|
-
|
|
54275
|
+
// Read binary selection mask (1.0 = selected, 0.0 = background).
|
|
54276
|
+
// Clamped to texture bounds to avoid false outlines at screen edges.
|
|
54277
|
+
float getMask(int x, int y) {
|
|
54368
54278
|
ivec2 pixelCoord = ivec2(vUv * screenSize.xy) + ivec2(x, y);
|
|
54369
|
-
|
|
54370
|
-
|
|
54371
|
-
return viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);
|
|
54279
|
+
pixelCoord = clamp(pixelCoord, ivec2(0), ivec2(screenSize.xy) - 1);
|
|
54280
|
+
return texelFetch(sceneBuffer, pixelCoord, 0).x;
|
|
54372
54281
|
}
|
|
54373
|
-
|
|
54374
|
-
|
|
54375
|
-
|
|
54282
|
+
|
|
54283
|
+
// Check the full grid ring at Chebyshev distance d.
|
|
54284
|
+
// Called with literal constants so the compiler inlines and unrolls.
|
|
54285
|
+
bool checkRing(int d) {
|
|
54286
|
+
// Top and bottom rows (full width)
|
|
54287
|
+
for (int x = -d; x <= d; x++) {
|
|
54288
|
+
if (getMask(x, -d) < 0.5) return true;
|
|
54289
|
+
if (getMask(x, d) < 0.5) return true;
|
|
54290
|
+
}
|
|
54291
|
+
// Left and right columns (excluding corners)
|
|
54292
|
+
for (int y = -d + 1; y < d; y++) {
|
|
54293
|
+
if (getMask(-d, y) < 0.5) return true;
|
|
54294
|
+
if (getMask( d, y) < 0.5) return true;
|
|
54295
|
+
}
|
|
54296
|
+
return false;
|
|
54376
54297
|
}
|
|
54377
|
-
|
|
54378
|
-
void main() {
|
|
54379
|
-
float depth = getPixelDepth(0, 0);
|
|
54380
54298
|
|
|
54381
|
-
|
|
54382
|
-
|
|
54383
|
-
|
|
54299
|
+
void main() {
|
|
54300
|
+
// Skip non-selected pixels
|
|
54301
|
+
if (getMask(0, 0) < 0.5) {
|
|
54302
|
+
fragColor = vec4(0.0);
|
|
54384
54303
|
return;
|
|
54385
54304
|
}
|
|
54386
54305
|
|
|
54387
|
-
//
|
|
54388
|
-
//
|
|
54389
|
-
//
|
|
54390
|
-
|
|
54391
|
-
|
|
54392
|
-
|
|
54393
|
-
|
|
54394
|
-
|
|
54395
|
-
|
|
54306
|
+
// Full grid search ring by ring (3x3, 5x5, 7x7 ... up to 11x11).
|
|
54307
|
+
// Each ring checks all pixels at that Chebyshev distance.
|
|
54308
|
+
// Early-exit between rings once an edge is found.
|
|
54309
|
+
bool edge = checkRing(1);
|
|
54310
|
+
|
|
54311
|
+
if (!edge && thickness >= 2.0) edge = checkRing(2);
|
|
54312
|
+
if (!edge && thickness >= 3.0) edge = checkRing(3);
|
|
54313
|
+
if (!edge && thickness >= 4.0) edge = checkRing(4);
|
|
54314
|
+
if (!edge && thickness >= 5.0) edge = checkRing(5);
|
|
54396
54315
|
|
|
54397
|
-
|
|
54398
|
-
// Merge pass will use this to blend outline color with scene
|
|
54399
|
-
fragColor = vec4(outline, 0.0, 0.0, 0.0);
|
|
54316
|
+
fragColor = vec4(edge ? 1.0 : 0.0, 0.0, 0.0, 0.0);
|
|
54400
54317
|
}
|
|
54401
54318
|
`
|
|
54402
54319
|
});
|
|
@@ -54417,6 +54334,15 @@ void main() {
|
|
|
54417
54334
|
this.three.uniformsNeedUpdate = true;
|
|
54418
54335
|
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54419
54336
|
}
|
|
54337
|
+
get opacity() {
|
|
54338
|
+
return this.three.uniforms.opacity.value;
|
|
54339
|
+
}
|
|
54340
|
+
set opacity(value) {
|
|
54341
|
+
var _a3;
|
|
54342
|
+
this.three.uniforms.opacity.value = Math.max(0, Math.min(1, value));
|
|
54343
|
+
this.three.uniformsNeedUpdate = true;
|
|
54344
|
+
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54345
|
+
}
|
|
54420
54346
|
get sourceA() {
|
|
54421
54347
|
return this.three.uniforms.sourceA.value;
|
|
54422
54348
|
}
|
|
@@ -54442,7 +54368,8 @@ void main() {
|
|
|
54442
54368
|
uniforms: {
|
|
54443
54369
|
sourceA: { value: null },
|
|
54444
54370
|
sourceB: { value: null },
|
|
54445
|
-
color: { value: new Color(16777215) }
|
|
54371
|
+
color: { value: new Color(16777215) },
|
|
54372
|
+
opacity: { value: 1 }
|
|
54446
54373
|
},
|
|
54447
54374
|
vertexShader: (
|
|
54448
54375
|
/* glsl */
|
|
@@ -54458,25 +54385,26 @@ void main() {
|
|
|
54458
54385
|
/* glsl */
|
|
54459
54386
|
`
|
|
54460
54387
|
uniform vec3 color;
|
|
54388
|
+
uniform float opacity;
|
|
54461
54389
|
uniform sampler2D sourceA;
|
|
54462
54390
|
uniform sampler2D sourceB;
|
|
54463
54391
|
in vec2 vUv;
|
|
54464
54392
|
out vec4 fragColor;
|
|
54465
54393
|
|
|
54466
54394
|
void main() {
|
|
54467
|
-
// Fetch outline
|
|
54395
|
+
// Fetch outline mask first (cheaper to check)
|
|
54468
54396
|
// Use texture() for proper handling of different resolutions
|
|
54469
|
-
|
|
54397
|
+
float edge = texture(sourceB, vUv).x;
|
|
54470
54398
|
|
|
54471
54399
|
// Early-out: if no outline, just copy scene directly
|
|
54472
|
-
if (
|
|
54400
|
+
if (edge < 0.01) {
|
|
54473
54401
|
fragColor = texture(sourceA, vUv);
|
|
54474
54402
|
return;
|
|
54475
54403
|
}
|
|
54476
54404
|
|
|
54477
|
-
// Fetch scene and blend with outline color
|
|
54405
|
+
// Fetch scene and blend with outline color using opacity
|
|
54478
54406
|
vec4 A = texture(sourceA, vUv);
|
|
54479
|
-
fragColor = vec4(mix(A.xyz, color,
|
|
54407
|
+
fragColor = vec4(mix(A.xyz, color, edge * opacity), 1.0);
|
|
54480
54408
|
}
|
|
54481
54409
|
`
|
|
54482
54410
|
)
|
|
@@ -54624,9 +54552,7 @@ void main() {
|
|
|
54624
54552
|
mesh.visible = true;
|
|
54625
54553
|
}
|
|
54626
54554
|
const _Materials = class _Materials {
|
|
54627
|
-
constructor(
|
|
54628
|
-
__publicField(this, "_opaque");
|
|
54629
|
-
__publicField(this, "_transparent");
|
|
54555
|
+
constructor(modelOpaque, modelTransparent, ghost2, mask, outline, merge) {
|
|
54630
54556
|
__publicField(this, "_modelOpaque");
|
|
54631
54557
|
__publicField(this, "_modelTransparent");
|
|
54632
54558
|
__publicField(this, "_ghost");
|
|
@@ -54635,20 +54561,15 @@ void main() {
|
|
|
54635
54561
|
__publicField(this, "_outline");
|
|
54636
54562
|
__publicField(this, "_merge");
|
|
54637
54563
|
__publicField(this, "_clippingPlanes");
|
|
54638
|
-
__publicField(this, "_sectionStrokeWidth", 0.01);
|
|
54639
|
-
__publicField(this, "_sectionStrokeFalloff", 0.75);
|
|
54640
|
-
__publicField(this, "_sectionStrokeColor", new Color(16185078));
|
|
54641
54564
|
__publicField(this, "_onUpdate", new distExports$2.SignalDispatcher());
|
|
54642
54565
|
// Shared color palette texture for all scene materials
|
|
54643
54566
|
__publicField(this, "_colorPaletteTexture");
|
|
54644
|
-
this._opaque = opaque ?? createOpaque();
|
|
54645
|
-
this._transparent = transparent ?? createTransparent();
|
|
54646
54567
|
const onUpdate = () => this._onUpdate.dispatch();
|
|
54647
54568
|
this._modelOpaque = modelOpaque ?? createModelOpaque(onUpdate);
|
|
54648
54569
|
this._modelTransparent = modelTransparent ?? createModelTransparent(onUpdate);
|
|
54649
54570
|
this._ghost = ghost2 ?? new GhostMaterial(void 0, onUpdate);
|
|
54650
54571
|
this._mask = mask ?? createMaskMaterial();
|
|
54651
|
-
this._outline = outline ?? new OutlineMaterial(
|
|
54572
|
+
this._outline = outline ?? new OutlineMaterial(onUpdate);
|
|
54652
54573
|
this._merge = merge ?? new MergeMaterial(onUpdate);
|
|
54653
54574
|
}
|
|
54654
54575
|
static createInstance(instance) {
|
|
@@ -54694,34 +54615,29 @@ void main() {
|
|
|
54694
54615
|
* Updates material settings based on the provided configuration.
|
|
54695
54616
|
*/
|
|
54696
54617
|
applySettings(settings2) {
|
|
54697
|
-
this.modelColor = settings2.standard.color;
|
|
54698
54618
|
this._ghost.opacity = settings2.ghost.opacity;
|
|
54699
54619
|
this._ghost.color = settings2.ghost.color;
|
|
54700
|
-
this.
|
|
54701
|
-
this.sectionStrokeFalloff = settings2.section.strokeFalloff;
|
|
54702
|
-
this.sectionStrokeColor = settings2.section.strokeColor;
|
|
54703
|
-
this.outlineIntensity = settings2.outline.intensity;
|
|
54620
|
+
this.outlineOpacity = settings2.outline.opacity;
|
|
54704
54621
|
this.outlineColor = settings2.outline.color;
|
|
54622
|
+
this.outlineThickness = settings2.outline.thickness;
|
|
54705
54623
|
}
|
|
54706
54624
|
/** @internal Signal dispatched whenever a material is modified. */
|
|
54707
54625
|
get onUpdate() {
|
|
54708
54626
|
return this._onUpdate.asEvent();
|
|
54709
54627
|
}
|
|
54710
|
-
/**
|
|
54711
|
-
get
|
|
54712
|
-
return this.
|
|
54628
|
+
/** Opacity of the selection outline (0 = invisible, 1 = fully opaque). */
|
|
54629
|
+
get outlineOpacity() {
|
|
54630
|
+
return this._merge.opacity;
|
|
54713
54631
|
}
|
|
54714
|
-
set
|
|
54715
|
-
this.
|
|
54716
|
-
this._transparent.color = color;
|
|
54717
|
-
this._onUpdate.dispatch();
|
|
54632
|
+
set outlineOpacity(value) {
|
|
54633
|
+
this._merge.opacity = value;
|
|
54718
54634
|
}
|
|
54719
|
-
/**
|
|
54720
|
-
get
|
|
54721
|
-
return this._outline.
|
|
54635
|
+
/** Thickness of the selection outline in pixels (of the outline render target). */
|
|
54636
|
+
get outlineThickness() {
|
|
54637
|
+
return this._outline.thickness;
|
|
54722
54638
|
}
|
|
54723
|
-
set
|
|
54724
|
-
this._outline.
|
|
54639
|
+
set outlineThickness(value) {
|
|
54640
|
+
this._outline.thickness = value;
|
|
54725
54641
|
}
|
|
54726
54642
|
/** Color of the selection outline post-process effect. */
|
|
54727
54643
|
get outlineColor() {
|
|
@@ -54738,45 +54654,10 @@ void main() {
|
|
|
54738
54654
|
this._clippingPlanes = value;
|
|
54739
54655
|
this._modelOpaque.clippingPlanes = value ?? null;
|
|
54740
54656
|
this._modelTransparent.clippingPlanes = value ?? null;
|
|
54741
|
-
this._opaque.clippingPlanes = value ?? null;
|
|
54742
|
-
this._transparent.clippingPlanes = value ?? null;
|
|
54743
54657
|
this._ghost.clippingPlanes = value ?? null;
|
|
54744
54658
|
this._mask.clippingPlanes = value ?? null;
|
|
54745
54659
|
this._onUpdate.dispatch();
|
|
54746
54660
|
}
|
|
54747
|
-
/** Width of the stroke rendered where the section box intersects the model. */
|
|
54748
|
-
get sectionStrokeWidth() {
|
|
54749
|
-
return this._sectionStrokeWidth;
|
|
54750
|
-
}
|
|
54751
|
-
set sectionStrokeWidth(value) {
|
|
54752
|
-
if (this._sectionStrokeWidth === value) return;
|
|
54753
|
-
this._sectionStrokeWidth = value;
|
|
54754
|
-
this._opaque.sectionStrokeWidth = value;
|
|
54755
|
-
this._transparent.sectionStrokeWidth = value;
|
|
54756
|
-
this._onUpdate.dispatch();
|
|
54757
|
-
}
|
|
54758
|
-
/** Gradient falloff of the section box intersection stroke. */
|
|
54759
|
-
get sectionStrokeFalloff() {
|
|
54760
|
-
return this._sectionStrokeFalloff;
|
|
54761
|
-
}
|
|
54762
|
-
set sectionStrokeFalloff(value) {
|
|
54763
|
-
if (this._sectionStrokeFalloff === value) return;
|
|
54764
|
-
this._sectionStrokeFalloff = value;
|
|
54765
|
-
this._opaque.sectionStrokeFalloff = value;
|
|
54766
|
-
this._transparent.sectionStrokeFalloff = value;
|
|
54767
|
-
this._onUpdate.dispatch();
|
|
54768
|
-
}
|
|
54769
|
-
/** Color of the section box intersection stroke. */
|
|
54770
|
-
get sectionStrokeColor() {
|
|
54771
|
-
return this._sectionStrokeColor;
|
|
54772
|
-
}
|
|
54773
|
-
set sectionStrokeColor(value) {
|
|
54774
|
-
if (this._sectionStrokeColor === value) return;
|
|
54775
|
-
this._sectionStrokeColor = value;
|
|
54776
|
-
this._opaque.sectionStrokeColor = value;
|
|
54777
|
-
this._transparent.sectionStrokeColor = value;
|
|
54778
|
-
this._onUpdate.dispatch();
|
|
54779
|
-
}
|
|
54780
54661
|
/**
|
|
54781
54662
|
* Creates the fixed quantized color palette texture if it doesn't exist.
|
|
54782
54663
|
* The palette is deterministic (25³ = 15,625 quantized colors in 128×128 texture)
|
|
@@ -54786,6 +54667,8 @@ void main() {
|
|
|
54786
54667
|
if (this._colorPaletteTexture) return;
|
|
54787
54668
|
const textureData = buildPaletteTexture();
|
|
54788
54669
|
this._colorPaletteTexture = new DataTexture(
|
|
54670
|
+
// Cast: TS 5.7 narrows Uint8Array.buffer to ArrayBufferLike (includes SharedArrayBuffer),
|
|
54671
|
+
// but Three.js expects BufferSource (ArrayBuffer only). Safe — Uint8Array always backs ArrayBuffer.
|
|
54789
54672
|
textureData,
|
|
54790
54673
|
128,
|
|
54791
54674
|
128,
|
|
@@ -54795,8 +54678,6 @@ void main() {
|
|
|
54795
54678
|
this._colorPaletteTexture.needsUpdate = true;
|
|
54796
54679
|
this._colorPaletteTexture.minFilter = NearestFilter;
|
|
54797
54680
|
this._colorPaletteTexture.magFilter = NearestFilter;
|
|
54798
|
-
this._opaque.setColorPaletteTexture(this._colorPaletteTexture);
|
|
54799
|
-
this._transparent.setColorPaletteTexture(this._colorPaletteTexture);
|
|
54800
54681
|
this._modelOpaque.setColorPaletteTexture(this._colorPaletteTexture);
|
|
54801
54682
|
this._modelTransparent.setColorPaletteTexture(this._colorPaletteTexture);
|
|
54802
54683
|
this._onUpdate.dispatch();
|
|
@@ -54807,8 +54688,6 @@ void main() {
|
|
|
54807
54688
|
this._colorPaletteTexture.dispose();
|
|
54808
54689
|
this._colorPaletteTexture = void 0;
|
|
54809
54690
|
}
|
|
54810
|
-
this._opaque.dispose();
|
|
54811
|
-
this._transparent.dispose();
|
|
54812
54691
|
this._modelOpaque.dispose();
|
|
54813
54692
|
this._modelTransparent.dispose();
|
|
54814
54693
|
this._ghost.dispose();
|
|
@@ -55540,52 +55419,17 @@ void main() {
|
|
|
55540
55419
|
opacityAlways: 0.1
|
|
55541
55420
|
}
|
|
55542
55421
|
},
|
|
55543
|
-
background: { color: new Color(
|
|
55544
|
-
skybox: {
|
|
55545
|
-
enable: true,
|
|
55546
|
-
skyColor: new Color(16777215),
|
|
55547
|
-
// white
|
|
55548
|
-
groundColor: new Color(16185078),
|
|
55549
|
-
// less white
|
|
55550
|
-
sharpness: 2
|
|
55551
|
-
},
|
|
55552
|
-
skylight: {
|
|
55553
|
-
skyColor: new Color(16777215),
|
|
55554
|
-
groundColor: new Color(16777215),
|
|
55555
|
-
intensity: 0.8
|
|
55556
|
-
},
|
|
55557
|
-
sunlights: [
|
|
55558
|
-
{
|
|
55559
|
-
followCamera: true,
|
|
55560
|
-
position: new Vector3(1e3, 1e3, 1e3),
|
|
55561
|
-
color: new Color(16777215),
|
|
55562
|
-
intensity: 0.8
|
|
55563
|
-
},
|
|
55564
|
-
{
|
|
55565
|
-
followCamera: true,
|
|
55566
|
-
position: new Vector3(-1e3, -1e3, -1e3),
|
|
55567
|
-
color: new Color(16777215),
|
|
55568
|
-
intensity: 0.2
|
|
55569
|
-
}
|
|
55570
|
-
],
|
|
55422
|
+
background: { color: new Color(16777215) },
|
|
55571
55423
|
materials: {
|
|
55572
|
-
useFastMaterials: false,
|
|
55573
|
-
standard: {
|
|
55574
|
-
color: new Color(13421772)
|
|
55575
|
-
},
|
|
55576
55424
|
ghost: {
|
|
55577
55425
|
color: new Color(921102),
|
|
55578
55426
|
opacity: 7 / 255
|
|
55579
55427
|
},
|
|
55580
|
-
section: {
|
|
55581
|
-
strokeWidth: 0.01,
|
|
55582
|
-
strokeFalloff: 0.75,
|
|
55583
|
-
strokeColor: new Color(16185078)
|
|
55584
|
-
},
|
|
55585
55428
|
outline: {
|
|
55586
|
-
|
|
55429
|
+
opacity: 0.85,
|
|
55587
55430
|
color: new Color(65535),
|
|
55588
|
-
scale: 0.75
|
|
55431
|
+
scale: 0.75,
|
|
55432
|
+
thickness: 2
|
|
55589
55433
|
}
|
|
55590
55434
|
},
|
|
55591
55435
|
axes: getDefaultAxesSettings(),
|
|
@@ -55756,11 +55600,11 @@ void main() {
|
|
|
55756
55600
|
this._unregisterResize = () => window.removeEventListener("resize", onResize);
|
|
55757
55601
|
}
|
|
55758
55602
|
};
|
|
55759
|
-
function createInputHandler(viewer) {
|
|
55603
|
+
function createInputHandler(viewer, controls) {
|
|
55760
55604
|
return new InputHandler(
|
|
55761
55605
|
viewer.viewport.canvas,
|
|
55762
55606
|
createAdapter$2(viewer),
|
|
55763
|
-
|
|
55607
|
+
controls
|
|
55764
55608
|
);
|
|
55765
55609
|
}
|
|
55766
55610
|
function createAdapter$2(viewer) {
|
|
@@ -56272,24 +56116,17 @@ void main() {
|
|
|
56272
56116
|
}
|
|
56273
56117
|
}
|
|
56274
56118
|
class OutlinePass extends Pass {
|
|
56275
|
-
constructor(
|
|
56119
|
+
constructor(material) {
|
|
56276
56120
|
super();
|
|
56277
56121
|
__publicField(this, "_fsQuad");
|
|
56278
56122
|
__publicField(this, "material");
|
|
56279
|
-
this.material = material
|
|
56280
|
-
this.material.camera = camera2;
|
|
56123
|
+
this.material = material;
|
|
56281
56124
|
this._fsQuad = new FullScreenQuad(this.material.three);
|
|
56282
56125
|
this.needsSwap = true;
|
|
56283
56126
|
}
|
|
56284
56127
|
setSize(width, height) {
|
|
56285
56128
|
this.material.resolution = new Vector2(width, height);
|
|
56286
56129
|
}
|
|
56287
|
-
get camera() {
|
|
56288
|
-
return this.material.camera;
|
|
56289
|
-
}
|
|
56290
|
-
set camera(value) {
|
|
56291
|
-
this.material.camera = value;
|
|
56292
|
-
}
|
|
56293
56130
|
dispose() {
|
|
56294
56131
|
this._fsQuad.dispose();
|
|
56295
56132
|
this.material.dispose();
|
|
@@ -56297,7 +56134,6 @@ void main() {
|
|
|
56297
56134
|
render(renderer, writeBuffer, readBuffer) {
|
|
56298
56135
|
const depthBufferValue = writeBuffer.depthBuffer;
|
|
56299
56136
|
writeBuffer.depthBuffer = false;
|
|
56300
|
-
this.material.depthBuffer = readBuffer.depthTexture;
|
|
56301
56137
|
this.material.sceneBuffer = readBuffer.texture;
|
|
56302
56138
|
if (this.renderToScreen) {
|
|
56303
56139
|
renderer.setRenderTarget(null);
|
|
@@ -56474,8 +56310,7 @@ void main() {
|
|
|
56474
56310
|
outlineHeight,
|
|
56475
56311
|
{
|
|
56476
56312
|
format: RedFormat,
|
|
56477
|
-
type: UnsignedByteType
|
|
56478
|
-
depthTexture: new DepthTexture(outlineWidth, outlineHeight)
|
|
56313
|
+
type: UnsignedByteType
|
|
56479
56314
|
}
|
|
56480
56315
|
);
|
|
56481
56316
|
this._outlineTarget.texture.name = "selectionTarget";
|
|
@@ -56485,9 +56320,10 @@ void main() {
|
|
|
56485
56320
|
this._camera,
|
|
56486
56321
|
this._materials.system.mask
|
|
56487
56322
|
);
|
|
56323
|
+
this._selectionRenderPass.clearColor = new Color(0);
|
|
56324
|
+
this._selectionRenderPass.clearAlpha = 0;
|
|
56488
56325
|
this._composer.addPass(this._selectionRenderPass);
|
|
56489
56326
|
this._outlinePass = new OutlinePass(
|
|
56490
|
-
this._camera,
|
|
56491
56327
|
this._materials.system.outline
|
|
56492
56328
|
);
|
|
56493
56329
|
this._composer.addPass(this._outlinePass);
|
|
@@ -56540,7 +56376,6 @@ void main() {
|
|
|
56540
56376
|
set camera(value) {
|
|
56541
56377
|
this._renderPass.camera = value;
|
|
56542
56378
|
this._selectionRenderPass.camera = value;
|
|
56543
|
-
this._outlinePass.material.camera = value;
|
|
56544
56379
|
this._camera = value;
|
|
56545
56380
|
}
|
|
56546
56381
|
/**
|
|
@@ -56582,7 +56417,10 @@ void main() {
|
|
|
56582
56417
|
delta,
|
|
56583
56418
|
false
|
|
56584
56419
|
);
|
|
56420
|
+
const bg = this._scene.threeScene.background;
|
|
56421
|
+
this._scene.threeScene.background = null;
|
|
56585
56422
|
this._composer.render(delta);
|
|
56423
|
+
this._scene.threeScene.background = bg;
|
|
56586
56424
|
}
|
|
56587
56425
|
/**
|
|
56588
56426
|
* Cleans up all resources used by the composer
|
|
@@ -57581,16 +57419,12 @@ void main() {
|
|
|
57581
57419
|
}
|
|
57582
57420
|
};
|
|
57583
57421
|
class WebglViewer {
|
|
57584
|
-
constructor(
|
|
57422
|
+
constructor(options) {
|
|
57585
57423
|
/**
|
|
57586
57424
|
* The type of the viewer, indicating it is a WebGL viewer.
|
|
57587
57425
|
* Useful for distinguishing between different viewer types in a multi-viewer application.
|
|
57588
57426
|
*/
|
|
57589
57427
|
__publicField(this, "type", "webgl");
|
|
57590
|
-
/**
|
|
57591
|
-
* The settings configuration used by the viewer.
|
|
57592
|
-
*/
|
|
57593
|
-
__publicField(this, "settings");
|
|
57594
57428
|
__publicField(this, "_renderer");
|
|
57595
57429
|
__publicField(this, "_viewport");
|
|
57596
57430
|
/**
|
|
@@ -57610,22 +57444,22 @@ void main() {
|
|
|
57610
57444
|
__publicField(this, "vimCollection", new VimCollection());
|
|
57611
57445
|
__publicField(this, "_onVimLoaded", new distExports$2.SignalDispatcher());
|
|
57612
57446
|
__publicField(this, "_updateId");
|
|
57613
|
-
|
|
57447
|
+
const settings2 = createViewerSettings(options);
|
|
57614
57448
|
this._materials = Materials.getInstance();
|
|
57615
57449
|
const scene = new RenderScene();
|
|
57616
|
-
this._viewport = new Viewport$1(
|
|
57617
|
-
this._camera = new Camera$1(scene, this._viewport,
|
|
57450
|
+
this._viewport = new Viewport$1(settings2);
|
|
57451
|
+
this._camera = new Camera$1(scene, this._viewport, settings2);
|
|
57618
57452
|
this._renderer = new Renderer$1(
|
|
57619
57453
|
scene,
|
|
57620
57454
|
this._viewport,
|
|
57621
57455
|
this._materials,
|
|
57622
57456
|
this._camera,
|
|
57623
|
-
|
|
57457
|
+
settings2
|
|
57624
57458
|
);
|
|
57625
57459
|
this.selection = createSelection$1();
|
|
57626
|
-
this._inputs = createInputHandler(this);
|
|
57627
|
-
this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera);
|
|
57628
|
-
this.materials.applySettings(
|
|
57460
|
+
this._inputs = createInputHandler(this, settings2.camera.controls);
|
|
57461
|
+
this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera, settings2);
|
|
57462
|
+
this.materials.applySettings(settings2.materials);
|
|
57629
57463
|
const size = this._renderer.three.getSize(new Vector2());
|
|
57630
57464
|
const gpuPicker = new GpuPicker(
|
|
57631
57465
|
this._renderer.three,
|
|
@@ -60217,7 +60051,6 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60217
60051
|
*/
|
|
60218
60052
|
async _onOpen(_) {
|
|
60219
60053
|
var _a3;
|
|
60220
|
-
console.log("WebSocket connection opened to ", this.url);
|
|
60221
60054
|
clearTimeout(this._connectionTimeout);
|
|
60222
60055
|
this.updateState({ status: "validating" });
|
|
60223
60056
|
const issues = await this._validateConnection();
|