vim-web 0.6.0-dev.9 → 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 +94 -252
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +94 -252
- 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
|
}
|
|
@@ -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
|
-
*
|
|
54260
|
-
*/
|
|
54261
|
-
get camera() {
|
|
54262
|
-
return this._camera;
|
|
54263
|
-
}
|
|
54264
|
-
set camera(value) {
|
|
54265
|
-
var _a3;
|
|
54266
|
-
this._camera = value;
|
|
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.
|
|
54220
|
+
* Thickness of the outline in pixels (of the outline render target).
|
|
54274
54221
|
*/
|
|
54275
|
-
get
|
|
54276
|
-
return this.three.uniforms.
|
|
54222
|
+
get thickness() {
|
|
54223
|
+
return this.three.uniforms.thickness.value;
|
|
54277
54224
|
}
|
|
54278
|
-
set
|
|
54225
|
+
set thickness(value) {
|
|
54279
54226
|
var _a3;
|
|
54280
|
-
this.three.uniforms.
|
|
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;
|
|
@@ -54353,20 +54267,35 @@ void main() {
|
|
|
54353
54267
|
fragmentShader: `
|
|
54354
54268
|
uniform sampler2D sceneBuffer;
|
|
54355
54269
|
uniform vec4 screenSize;
|
|
54356
|
-
uniform float
|
|
54270
|
+
uniform float thickness;
|
|
54357
54271
|
|
|
54358
54272
|
in vec2 vUv;
|
|
54359
54273
|
out vec4 fragColor;
|
|
54360
54274
|
|
|
54361
|
-
// Read binary selection mask
|
|
54362
|
-
//
|
|
54363
|
-
// (which returns 0 and creates false outlines at the screen border).
|
|
54275
|
+
// Read binary selection mask (1.0 = selected, 0.0 = background).
|
|
54276
|
+
// Clamped to texture bounds to avoid false outlines at screen edges.
|
|
54364
54277
|
float getMask(int x, int y) {
|
|
54365
54278
|
ivec2 pixelCoord = ivec2(vUv * screenSize.xy) + ivec2(x, y);
|
|
54366
54279
|
pixelCoord = clamp(pixelCoord, ivec2(0), ivec2(screenSize.xy) - 1);
|
|
54367
54280
|
return texelFetch(sceneBuffer, pixelCoord, 0).x;
|
|
54368
54281
|
}
|
|
54369
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;
|
|
54297
|
+
}
|
|
54298
|
+
|
|
54370
54299
|
void main() {
|
|
54371
54300
|
// Skip non-selected pixels
|
|
54372
54301
|
if (getMask(0, 0) < 0.5) {
|
|
@@ -54374,16 +54303,17 @@ void main() {
|
|
|
54374
54303
|
return;
|
|
54375
54304
|
}
|
|
54376
54305
|
|
|
54377
|
-
//
|
|
54378
|
-
//
|
|
54379
|
-
|
|
54380
|
-
|
|
54381
|
-
|
|
54382
|
-
|
|
54383
|
-
|
|
54384
|
-
|
|
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);
|
|
54385
54315
|
|
|
54386
|
-
fragColor = vec4(
|
|
54316
|
+
fragColor = vec4(edge ? 1.0 : 0.0, 0.0, 0.0, 0.0);
|
|
54387
54317
|
}
|
|
54388
54318
|
`
|
|
54389
54319
|
});
|
|
@@ -54404,6 +54334,15 @@ void main() {
|
|
|
54404
54334
|
this.three.uniformsNeedUpdate = true;
|
|
54405
54335
|
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
54406
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
|
+
}
|
|
54407
54346
|
get sourceA() {
|
|
54408
54347
|
return this.three.uniforms.sourceA.value;
|
|
54409
54348
|
}
|
|
@@ -54429,7 +54368,8 @@ void main() {
|
|
|
54429
54368
|
uniforms: {
|
|
54430
54369
|
sourceA: { value: null },
|
|
54431
54370
|
sourceB: { value: null },
|
|
54432
|
-
color: { value: new Color(16777215) }
|
|
54371
|
+
color: { value: new Color(16777215) },
|
|
54372
|
+
opacity: { value: 1 }
|
|
54433
54373
|
},
|
|
54434
54374
|
vertexShader: (
|
|
54435
54375
|
/* glsl */
|
|
@@ -54445,25 +54385,26 @@ void main() {
|
|
|
54445
54385
|
/* glsl */
|
|
54446
54386
|
`
|
|
54447
54387
|
uniform vec3 color;
|
|
54388
|
+
uniform float opacity;
|
|
54448
54389
|
uniform sampler2D sourceA;
|
|
54449
54390
|
uniform sampler2D sourceB;
|
|
54450
54391
|
in vec2 vUv;
|
|
54451
54392
|
out vec4 fragColor;
|
|
54452
54393
|
|
|
54453
54394
|
void main() {
|
|
54454
|
-
// Fetch outline
|
|
54395
|
+
// Fetch outline mask first (cheaper to check)
|
|
54455
54396
|
// Use texture() for proper handling of different resolutions
|
|
54456
|
-
|
|
54397
|
+
float edge = texture(sourceB, vUv).x;
|
|
54457
54398
|
|
|
54458
54399
|
// Early-out: if no outline, just copy scene directly
|
|
54459
|
-
if (
|
|
54400
|
+
if (edge < 0.01) {
|
|
54460
54401
|
fragColor = texture(sourceA, vUv);
|
|
54461
54402
|
return;
|
|
54462
54403
|
}
|
|
54463
54404
|
|
|
54464
|
-
// Fetch scene and blend with outline color
|
|
54405
|
+
// Fetch scene and blend with outline color using opacity
|
|
54465
54406
|
vec4 A = texture(sourceA, vUv);
|
|
54466
|
-
fragColor = vec4(mix(A.xyz, color,
|
|
54407
|
+
fragColor = vec4(mix(A.xyz, color, edge * opacity), 1.0);
|
|
54467
54408
|
}
|
|
54468
54409
|
`
|
|
54469
54410
|
)
|
|
@@ -54611,9 +54552,7 @@ void main() {
|
|
|
54611
54552
|
mesh.visible = true;
|
|
54612
54553
|
}
|
|
54613
54554
|
const _Materials = class _Materials {
|
|
54614
|
-
constructor(
|
|
54615
|
-
__publicField(this, "_opaque");
|
|
54616
|
-
__publicField(this, "_transparent");
|
|
54555
|
+
constructor(modelOpaque, modelTransparent, ghost2, mask, outline, merge) {
|
|
54617
54556
|
__publicField(this, "_modelOpaque");
|
|
54618
54557
|
__publicField(this, "_modelTransparent");
|
|
54619
54558
|
__publicField(this, "_ghost");
|
|
@@ -54622,20 +54561,15 @@ void main() {
|
|
|
54622
54561
|
__publicField(this, "_outline");
|
|
54623
54562
|
__publicField(this, "_merge");
|
|
54624
54563
|
__publicField(this, "_clippingPlanes");
|
|
54625
|
-
__publicField(this, "_sectionStrokeWidth", 0.01);
|
|
54626
|
-
__publicField(this, "_sectionStrokeFalloff", 0.75);
|
|
54627
|
-
__publicField(this, "_sectionStrokeColor", new Color(16185078));
|
|
54628
54564
|
__publicField(this, "_onUpdate", new distExports$2.SignalDispatcher());
|
|
54629
54565
|
// Shared color palette texture for all scene materials
|
|
54630
54566
|
__publicField(this, "_colorPaletteTexture");
|
|
54631
|
-
this._opaque = opaque ?? createOpaque();
|
|
54632
|
-
this._transparent = transparent ?? createTransparent();
|
|
54633
54567
|
const onUpdate = () => this._onUpdate.dispatch();
|
|
54634
54568
|
this._modelOpaque = modelOpaque ?? createModelOpaque(onUpdate);
|
|
54635
54569
|
this._modelTransparent = modelTransparent ?? createModelTransparent(onUpdate);
|
|
54636
54570
|
this._ghost = ghost2 ?? new GhostMaterial(void 0, onUpdate);
|
|
54637
54571
|
this._mask = mask ?? createMaskMaterial();
|
|
54638
|
-
this._outline = outline ?? new OutlineMaterial(
|
|
54572
|
+
this._outline = outline ?? new OutlineMaterial(onUpdate);
|
|
54639
54573
|
this._merge = merge ?? new MergeMaterial(onUpdate);
|
|
54640
54574
|
}
|
|
54641
54575
|
static createInstance(instance) {
|
|
@@ -54681,34 +54615,29 @@ void main() {
|
|
|
54681
54615
|
* Updates material settings based on the provided configuration.
|
|
54682
54616
|
*/
|
|
54683
54617
|
applySettings(settings2) {
|
|
54684
|
-
this.modelColor = settings2.standard.color;
|
|
54685
54618
|
this._ghost.opacity = settings2.ghost.opacity;
|
|
54686
54619
|
this._ghost.color = settings2.ghost.color;
|
|
54687
|
-
this.
|
|
54688
|
-
this.sectionStrokeFalloff = settings2.section.strokeFalloff;
|
|
54689
|
-
this.sectionStrokeColor = settings2.section.strokeColor;
|
|
54690
|
-
this.outlineIntensity = settings2.outline.intensity;
|
|
54620
|
+
this.outlineOpacity = settings2.outline.opacity;
|
|
54691
54621
|
this.outlineColor = settings2.outline.color;
|
|
54622
|
+
this.outlineThickness = settings2.outline.thickness;
|
|
54692
54623
|
}
|
|
54693
54624
|
/** @internal Signal dispatched whenever a material is modified. */
|
|
54694
54625
|
get onUpdate() {
|
|
54695
54626
|
return this._onUpdate.asEvent();
|
|
54696
54627
|
}
|
|
54697
|
-
/**
|
|
54698
|
-
get
|
|
54699
|
-
return this.
|
|
54628
|
+
/** Opacity of the selection outline (0 = invisible, 1 = fully opaque). */
|
|
54629
|
+
get outlineOpacity() {
|
|
54630
|
+
return this._merge.opacity;
|
|
54700
54631
|
}
|
|
54701
|
-
set
|
|
54702
|
-
this.
|
|
54703
|
-
this._transparent.color = color;
|
|
54704
|
-
this._onUpdate.dispatch();
|
|
54632
|
+
set outlineOpacity(value) {
|
|
54633
|
+
this._merge.opacity = value;
|
|
54705
54634
|
}
|
|
54706
|
-
/**
|
|
54707
|
-
get
|
|
54708
|
-
return this._outline.
|
|
54635
|
+
/** Thickness of the selection outline in pixels (of the outline render target). */
|
|
54636
|
+
get outlineThickness() {
|
|
54637
|
+
return this._outline.thickness;
|
|
54709
54638
|
}
|
|
54710
|
-
set
|
|
54711
|
-
this._outline.
|
|
54639
|
+
set outlineThickness(value) {
|
|
54640
|
+
this._outline.thickness = value;
|
|
54712
54641
|
}
|
|
54713
54642
|
/** Color of the selection outline post-process effect. */
|
|
54714
54643
|
get outlineColor() {
|
|
@@ -54725,45 +54654,10 @@ void main() {
|
|
|
54725
54654
|
this._clippingPlanes = value;
|
|
54726
54655
|
this._modelOpaque.clippingPlanes = value ?? null;
|
|
54727
54656
|
this._modelTransparent.clippingPlanes = value ?? null;
|
|
54728
|
-
this._opaque.clippingPlanes = value ?? null;
|
|
54729
|
-
this._transparent.clippingPlanes = value ?? null;
|
|
54730
54657
|
this._ghost.clippingPlanes = value ?? null;
|
|
54731
54658
|
this._mask.clippingPlanes = value ?? null;
|
|
54732
54659
|
this._onUpdate.dispatch();
|
|
54733
54660
|
}
|
|
54734
|
-
/** Width of the stroke rendered where the section box intersects the model. */
|
|
54735
|
-
get sectionStrokeWidth() {
|
|
54736
|
-
return this._sectionStrokeWidth;
|
|
54737
|
-
}
|
|
54738
|
-
set sectionStrokeWidth(value) {
|
|
54739
|
-
if (this._sectionStrokeWidth === value) return;
|
|
54740
|
-
this._sectionStrokeWidth = value;
|
|
54741
|
-
this._opaque.sectionStrokeWidth = value;
|
|
54742
|
-
this._transparent.sectionStrokeWidth = value;
|
|
54743
|
-
this._onUpdate.dispatch();
|
|
54744
|
-
}
|
|
54745
|
-
/** Gradient falloff of the section box intersection stroke. */
|
|
54746
|
-
get sectionStrokeFalloff() {
|
|
54747
|
-
return this._sectionStrokeFalloff;
|
|
54748
|
-
}
|
|
54749
|
-
set sectionStrokeFalloff(value) {
|
|
54750
|
-
if (this._sectionStrokeFalloff === value) return;
|
|
54751
|
-
this._sectionStrokeFalloff = value;
|
|
54752
|
-
this._opaque.sectionStrokeFalloff = value;
|
|
54753
|
-
this._transparent.sectionStrokeFalloff = value;
|
|
54754
|
-
this._onUpdate.dispatch();
|
|
54755
|
-
}
|
|
54756
|
-
/** Color of the section box intersection stroke. */
|
|
54757
|
-
get sectionStrokeColor() {
|
|
54758
|
-
return this._sectionStrokeColor;
|
|
54759
|
-
}
|
|
54760
|
-
set sectionStrokeColor(value) {
|
|
54761
|
-
if (this._sectionStrokeColor === value) return;
|
|
54762
|
-
this._sectionStrokeColor = value;
|
|
54763
|
-
this._opaque.sectionStrokeColor = value;
|
|
54764
|
-
this._transparent.sectionStrokeColor = value;
|
|
54765
|
-
this._onUpdate.dispatch();
|
|
54766
|
-
}
|
|
54767
54661
|
/**
|
|
54768
54662
|
* Creates the fixed quantized color palette texture if it doesn't exist.
|
|
54769
54663
|
* The palette is deterministic (25³ = 15,625 quantized colors in 128×128 texture)
|
|
@@ -54773,6 +54667,8 @@ void main() {
|
|
|
54773
54667
|
if (this._colorPaletteTexture) return;
|
|
54774
54668
|
const textureData = buildPaletteTexture();
|
|
54775
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.
|
|
54776
54672
|
textureData,
|
|
54777
54673
|
128,
|
|
54778
54674
|
128,
|
|
@@ -54782,8 +54678,6 @@ void main() {
|
|
|
54782
54678
|
this._colorPaletteTexture.needsUpdate = true;
|
|
54783
54679
|
this._colorPaletteTexture.minFilter = NearestFilter;
|
|
54784
54680
|
this._colorPaletteTexture.magFilter = NearestFilter;
|
|
54785
|
-
this._opaque.setColorPaletteTexture(this._colorPaletteTexture);
|
|
54786
|
-
this._transparent.setColorPaletteTexture(this._colorPaletteTexture);
|
|
54787
54681
|
this._modelOpaque.setColorPaletteTexture(this._colorPaletteTexture);
|
|
54788
54682
|
this._modelTransparent.setColorPaletteTexture(this._colorPaletteTexture);
|
|
54789
54683
|
this._onUpdate.dispatch();
|
|
@@ -54794,8 +54688,6 @@ void main() {
|
|
|
54794
54688
|
this._colorPaletteTexture.dispose();
|
|
54795
54689
|
this._colorPaletteTexture = void 0;
|
|
54796
54690
|
}
|
|
54797
|
-
this._opaque.dispose();
|
|
54798
|
-
this._transparent.dispose();
|
|
54799
54691
|
this._modelOpaque.dispose();
|
|
54800
54692
|
this._modelTransparent.dispose();
|
|
54801
54693
|
this._ghost.dispose();
|
|
@@ -55528,51 +55420,16 @@ void main() {
|
|
|
55528
55420
|
}
|
|
55529
55421
|
},
|
|
55530
55422
|
background: { color: new Color(16777215) },
|
|
55531
|
-
skybox: {
|
|
55532
|
-
enable: true,
|
|
55533
|
-
skyColor: new Color(16777215),
|
|
55534
|
-
// white
|
|
55535
|
-
groundColor: new Color(16185078),
|
|
55536
|
-
// less white
|
|
55537
|
-
sharpness: 2
|
|
55538
|
-
},
|
|
55539
|
-
skylight: {
|
|
55540
|
-
skyColor: new Color(16777215),
|
|
55541
|
-
groundColor: new Color(16777215),
|
|
55542
|
-
intensity: 0.8
|
|
55543
|
-
},
|
|
55544
|
-
sunlights: [
|
|
55545
|
-
{
|
|
55546
|
-
followCamera: true,
|
|
55547
|
-
position: new Vector3(1e3, 1e3, 1e3),
|
|
55548
|
-
color: new Color(16777215),
|
|
55549
|
-
intensity: 0.8
|
|
55550
|
-
},
|
|
55551
|
-
{
|
|
55552
|
-
followCamera: true,
|
|
55553
|
-
position: new Vector3(-1e3, -1e3, -1e3),
|
|
55554
|
-
color: new Color(16777215),
|
|
55555
|
-
intensity: 0.2
|
|
55556
|
-
}
|
|
55557
|
-
],
|
|
55558
55423
|
materials: {
|
|
55559
|
-
useFastMaterials: false,
|
|
55560
|
-
standard: {
|
|
55561
|
-
color: new Color(13421772)
|
|
55562
|
-
},
|
|
55563
55424
|
ghost: {
|
|
55564
55425
|
color: new Color(921102),
|
|
55565
55426
|
opacity: 7 / 255
|
|
55566
55427
|
},
|
|
55567
|
-
section: {
|
|
55568
|
-
strokeWidth: 0.01,
|
|
55569
|
-
strokeFalloff: 0.75,
|
|
55570
|
-
strokeColor: new Color(16185078)
|
|
55571
|
-
},
|
|
55572
55428
|
outline: {
|
|
55573
|
-
|
|
55429
|
+
opacity: 0.85,
|
|
55574
55430
|
color: new Color(65535),
|
|
55575
|
-
scale: 0.75
|
|
55431
|
+
scale: 0.75,
|
|
55432
|
+
thickness: 2
|
|
55576
55433
|
}
|
|
55577
55434
|
},
|
|
55578
55435
|
axes: getDefaultAxesSettings(),
|
|
@@ -55743,11 +55600,11 @@ void main() {
|
|
|
55743
55600
|
this._unregisterResize = () => window.removeEventListener("resize", onResize);
|
|
55744
55601
|
}
|
|
55745
55602
|
};
|
|
55746
|
-
function createInputHandler(viewer) {
|
|
55603
|
+
function createInputHandler(viewer, controls) {
|
|
55747
55604
|
return new InputHandler(
|
|
55748
55605
|
viewer.viewport.canvas,
|
|
55749
55606
|
createAdapter$2(viewer),
|
|
55750
|
-
|
|
55607
|
+
controls
|
|
55751
55608
|
);
|
|
55752
55609
|
}
|
|
55753
55610
|
function createAdapter$2(viewer) {
|
|
@@ -56259,24 +56116,17 @@ void main() {
|
|
|
56259
56116
|
}
|
|
56260
56117
|
}
|
|
56261
56118
|
class OutlinePass extends Pass {
|
|
56262
|
-
constructor(
|
|
56119
|
+
constructor(material) {
|
|
56263
56120
|
super();
|
|
56264
56121
|
__publicField(this, "_fsQuad");
|
|
56265
56122
|
__publicField(this, "material");
|
|
56266
|
-
this.material = material
|
|
56267
|
-
this.material.camera = camera2;
|
|
56123
|
+
this.material = material;
|
|
56268
56124
|
this._fsQuad = new FullScreenQuad(this.material.three);
|
|
56269
56125
|
this.needsSwap = true;
|
|
56270
56126
|
}
|
|
56271
56127
|
setSize(width, height) {
|
|
56272
56128
|
this.material.resolution = new Vector2(width, height);
|
|
56273
56129
|
}
|
|
56274
|
-
get camera() {
|
|
56275
|
-
return this.material.camera;
|
|
56276
|
-
}
|
|
56277
|
-
set camera(value) {
|
|
56278
|
-
this.material.camera = value;
|
|
56279
|
-
}
|
|
56280
56130
|
dispose() {
|
|
56281
56131
|
this._fsQuad.dispose();
|
|
56282
56132
|
this.material.dispose();
|
|
@@ -56284,7 +56134,6 @@ void main() {
|
|
|
56284
56134
|
render(renderer, writeBuffer, readBuffer) {
|
|
56285
56135
|
const depthBufferValue = writeBuffer.depthBuffer;
|
|
56286
56136
|
writeBuffer.depthBuffer = false;
|
|
56287
|
-
this.material.depthBuffer = readBuffer.depthTexture;
|
|
56288
56137
|
this.material.sceneBuffer = readBuffer.texture;
|
|
56289
56138
|
if (this.renderToScreen) {
|
|
56290
56139
|
renderer.setRenderTarget(null);
|
|
@@ -56461,8 +56310,7 @@ void main() {
|
|
|
56461
56310
|
outlineHeight,
|
|
56462
56311
|
{
|
|
56463
56312
|
format: RedFormat,
|
|
56464
|
-
type: UnsignedByteType
|
|
56465
|
-
depthTexture: new DepthTexture(outlineWidth, outlineHeight)
|
|
56313
|
+
type: UnsignedByteType
|
|
56466
56314
|
}
|
|
56467
56315
|
);
|
|
56468
56316
|
this._outlineTarget.texture.name = "selectionTarget";
|
|
@@ -56476,7 +56324,6 @@ void main() {
|
|
|
56476
56324
|
this._selectionRenderPass.clearAlpha = 0;
|
|
56477
56325
|
this._composer.addPass(this._selectionRenderPass);
|
|
56478
56326
|
this._outlinePass = new OutlinePass(
|
|
56479
|
-
this._camera,
|
|
56480
56327
|
this._materials.system.outline
|
|
56481
56328
|
);
|
|
56482
56329
|
this._composer.addPass(this._outlinePass);
|
|
@@ -56529,7 +56376,6 @@ void main() {
|
|
|
56529
56376
|
set camera(value) {
|
|
56530
56377
|
this._renderPass.camera = value;
|
|
56531
56378
|
this._selectionRenderPass.camera = value;
|
|
56532
|
-
this._outlinePass.material.camera = value;
|
|
56533
56379
|
this._camera = value;
|
|
56534
56380
|
}
|
|
56535
56381
|
/**
|
|
@@ -57573,16 +57419,12 @@ void main() {
|
|
|
57573
57419
|
}
|
|
57574
57420
|
};
|
|
57575
57421
|
class WebglViewer {
|
|
57576
|
-
constructor(
|
|
57422
|
+
constructor(options) {
|
|
57577
57423
|
/**
|
|
57578
57424
|
* The type of the viewer, indicating it is a WebGL viewer.
|
|
57579
57425
|
* Useful for distinguishing between different viewer types in a multi-viewer application.
|
|
57580
57426
|
*/
|
|
57581
57427
|
__publicField(this, "type", "webgl");
|
|
57582
|
-
/**
|
|
57583
|
-
* The settings configuration used by the viewer.
|
|
57584
|
-
*/
|
|
57585
|
-
__publicField(this, "settings");
|
|
57586
57428
|
__publicField(this, "_renderer");
|
|
57587
57429
|
__publicField(this, "_viewport");
|
|
57588
57430
|
/**
|
|
@@ -57602,22 +57444,22 @@ void main() {
|
|
|
57602
57444
|
__publicField(this, "vimCollection", new VimCollection());
|
|
57603
57445
|
__publicField(this, "_onVimLoaded", new distExports$2.SignalDispatcher());
|
|
57604
57446
|
__publicField(this, "_updateId");
|
|
57605
|
-
|
|
57447
|
+
const settings2 = createViewerSettings(options);
|
|
57606
57448
|
this._materials = Materials.getInstance();
|
|
57607
57449
|
const scene = new RenderScene();
|
|
57608
|
-
this._viewport = new Viewport$1(
|
|
57609
|
-
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);
|
|
57610
57452
|
this._renderer = new Renderer$1(
|
|
57611
57453
|
scene,
|
|
57612
57454
|
this._viewport,
|
|
57613
57455
|
this._materials,
|
|
57614
57456
|
this._camera,
|
|
57615
|
-
|
|
57457
|
+
settings2
|
|
57616
57458
|
);
|
|
57617
57459
|
this.selection = createSelection$1();
|
|
57618
|
-
this._inputs = createInputHandler(this);
|
|
57619
|
-
this._gizmos = new Gizmos(this._renderer, this._viewport, this, this._camera);
|
|
57620
|
-
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);
|
|
57621
57463
|
const size = this._renderer.three.getSize(new Vector2());
|
|
57622
57464
|
const gpuPicker = new GpuPicker(
|
|
57623
57465
|
this._renderer.three,
|