vim-web 1.0.0-alpha.12 → 1.0.0-alpha.13
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 +10 -17
- package/dist/vim-web.iife.js +116 -73
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +116 -73
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
package/dist/vim-web.js
CHANGED
|
@@ -58763,12 +58763,13 @@ let Vim$1 = class Vim {
|
|
|
58763
58763
|
}
|
|
58764
58764
|
/**
|
|
58765
58765
|
* Loads geometry for the given subset, or all geometry if no subset is provided.
|
|
58766
|
-
*
|
|
58766
|
+
* Clears any previously loaded geometry first so meshes are never duplicated.
|
|
58767
58767
|
* @param subset - The subset to load. Omit to load everything.
|
|
58768
58768
|
*/
|
|
58769
58769
|
async load(subset) {
|
|
58770
58770
|
subset ?? (subset = this.subset());
|
|
58771
58771
|
if (subset.getInstanceCount() === 0) return;
|
|
58772
|
+
this.clear();
|
|
58772
58773
|
this._factory.add(subset);
|
|
58773
58774
|
this._onGeometryLoaded.dispatch();
|
|
58774
58775
|
}
|
|
@@ -66178,6 +66179,16 @@ class ModelMaterial {
|
|
|
66178
66179
|
this.three.uniformsNeedUpdate = true;
|
|
66179
66180
|
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
66180
66181
|
}
|
|
66182
|
+
/** Base opacity of the material (0 = invisible, 1 = fully opaque). */
|
|
66183
|
+
get baseOpacity() {
|
|
66184
|
+
return this.three.uniforms.baseOpacity.value;
|
|
66185
|
+
}
|
|
66186
|
+
set baseOpacity(value) {
|
|
66187
|
+
var _a3;
|
|
66188
|
+
this.three.uniforms.baseOpacity.value = value;
|
|
66189
|
+
this.three.uniformsNeedUpdate = true;
|
|
66190
|
+
(_a3 = this._onUpdate) == null ? void 0 : _a3.call(this);
|
|
66191
|
+
}
|
|
66181
66192
|
/** Blend strength for selection tint (0 = off, 1 = solid). */
|
|
66182
66193
|
get selectionTintOpacity() {
|
|
66183
66194
|
return this.three.uniforms.selectionTintOpacity.value;
|
|
@@ -66225,7 +66236,8 @@ function createModelMaterialShader(transparent = false) {
|
|
|
66225
66236
|
uniforms: {
|
|
66226
66237
|
colorPaletteTexture: { value: null },
|
|
66227
66238
|
selectionTintColor: { value: new Color(25855) },
|
|
66228
|
-
selectionTintOpacity: { value: 0 }
|
|
66239
|
+
selectionTintOpacity: { value: 0 },
|
|
66240
|
+
baseOpacity: { value: transparent ? 0.25 : 1 }
|
|
66229
66241
|
},
|
|
66230
66242
|
clipping: true,
|
|
66231
66243
|
transparent,
|
|
@@ -66293,6 +66305,7 @@ function createModelMaterialShader(transparent = false) {
|
|
|
66293
66305
|
|
|
66294
66306
|
uniform vec3 selectionTintColor;
|
|
66295
66307
|
uniform float selectionTintOpacity;
|
|
66308
|
+
uniform float baseOpacity;
|
|
66296
66309
|
|
|
66297
66310
|
out vec4 fragColor;
|
|
66298
66311
|
|
|
@@ -66314,7 +66327,7 @@ function createModelMaterialShader(transparent = false) {
|
|
|
66314
66327
|
finalColor = mix(finalColor, selectionTintColor, selectionTintOpacity);
|
|
66315
66328
|
}
|
|
66316
66329
|
|
|
66317
|
-
fragColor = vec4(finalColor,
|
|
66330
|
+
fragColor = vec4(finalColor, baseOpacity);
|
|
66318
66331
|
}
|
|
66319
66332
|
`
|
|
66320
66333
|
)
|
|
@@ -66572,6 +66585,13 @@ const _Materials = class _Materials {
|
|
|
66572
66585
|
set ghostColor(value) {
|
|
66573
66586
|
this._ghost.color = value;
|
|
66574
66587
|
}
|
|
66588
|
+
/** Opacity of the transparent model material (0 = invisible, 1 = fully opaque). Default: 0.25. */
|
|
66589
|
+
get transparentOpacity() {
|
|
66590
|
+
return this._modelTransparent.baseOpacity;
|
|
66591
|
+
}
|
|
66592
|
+
set transparentOpacity(value) {
|
|
66593
|
+
this._modelTransparent.baseOpacity = value;
|
|
66594
|
+
}
|
|
66575
66595
|
/**
|
|
66576
66596
|
* Updates material settings based on the provided configuration.
|
|
66577
66597
|
*/
|
|
@@ -68959,68 +68979,17 @@ let Renderer$1 = class Renderer {
|
|
|
68959
68979
|
this._composer.outlineScale = value;
|
|
68960
68980
|
}
|
|
68961
68981
|
};
|
|
68962
|
-
function isTransparencyModeValid(value) {
|
|
68963
|
-
if (!value) return false;
|
|
68964
|
-
return ["all", "opaqueOnly", "transparentOnly", "allAsOpaque"].includes(
|
|
68965
|
-
value
|
|
68966
|
-
);
|
|
68967
|
-
}
|
|
68968
|
-
function createGeometryFromMesh(g3d2, mesh, section) {
|
|
68969
|
-
const colorIndices = createColorIndices(g3d2, mesh, section);
|
|
68970
|
-
const positions = g3d2.positions.subarray(
|
|
68971
|
-
g3d2.getMeshVertexStart(mesh) * 3,
|
|
68972
|
-
g3d2.getMeshVertexEnd(mesh) * 3
|
|
68973
|
-
);
|
|
68974
|
-
const start = g3d2.getMeshIndexStart(mesh, section);
|
|
68975
|
-
const end = g3d2.getMeshIndexEnd(mesh, section);
|
|
68976
|
-
const indices = g3d2.indices.subarray(start, end);
|
|
68977
|
-
return createGeometryFromArrays(
|
|
68978
|
-
positions,
|
|
68979
|
-
indices,
|
|
68980
|
-
colorIndices
|
|
68981
|
-
);
|
|
68982
|
-
}
|
|
68983
|
-
function createColorIndices(g3d2, mesh, section) {
|
|
68984
|
-
const vertexCount = g3d2.getMeshVertexCount(mesh);
|
|
68985
|
-
const result = new Uint16Array(vertexCount);
|
|
68986
|
-
const subStart = g3d2.getMeshSubmeshStart(mesh, section);
|
|
68987
|
-
const subEnd = g3d2.getMeshSubmeshEnd(mesh, section);
|
|
68988
|
-
for (let submesh = subStart; submesh < subEnd; submesh++) {
|
|
68989
|
-
const start = g3d2.getSubmeshIndexStart(submesh);
|
|
68990
|
-
const end = g3d2.getSubmeshIndexEnd(submesh);
|
|
68991
|
-
const index2 = g3d2.colorIndices[submesh];
|
|
68992
|
-
for (let i = start; i < end; i++) {
|
|
68993
|
-
const vertexIndex = g3d2.indices[i];
|
|
68994
|
-
result[vertexIndex] = index2;
|
|
68995
|
-
}
|
|
68996
|
-
}
|
|
68997
|
-
return result;
|
|
68998
|
-
}
|
|
68999
|
-
function createGeometryFromArrays(vertices, indices, colorIndices = void 0) {
|
|
69000
|
-
const geometry = new BufferGeometry();
|
|
69001
|
-
geometry.setAttribute("position", new BufferAttribute(vertices, 3));
|
|
69002
|
-
geometry.setIndex(new Uint32BufferAttribute(indices, 1));
|
|
69003
|
-
if (colorIndices) {
|
|
69004
|
-
geometry.setAttribute(
|
|
69005
|
-
"colorIndex",
|
|
69006
|
-
new Uint16BufferAttribute(colorIndices, 1)
|
|
69007
|
-
);
|
|
69008
|
-
}
|
|
69009
|
-
return geometry;
|
|
69010
|
-
}
|
|
69011
68982
|
function getDefaultVimSettings() {
|
|
69012
68983
|
return {
|
|
69013
68984
|
position: new Vector3(),
|
|
69014
68985
|
rotation: new Vector3(),
|
|
69015
68986
|
scale: 1,
|
|
69016
68987
|
matrix: void 0,
|
|
69017
|
-
transparency: "all",
|
|
69018
68988
|
verboseHttp: false
|
|
69019
68989
|
};
|
|
69020
68990
|
}
|
|
69021
68991
|
function createVimSettings(options) {
|
|
69022
68992
|
const merge = options ? deepmerge(getDefaultVimSettings(), options, void 0) : getDefaultVimSettings();
|
|
69023
|
-
merge.transparency = isTransparencyModeValid(merge.transparency) ? merge.transparency : "all";
|
|
69024
68993
|
merge.matrix = merge.matrix ?? new Matrix4().compose(
|
|
69025
68994
|
merge.position,
|
|
69026
68995
|
new Quaternion().setFromEuler(
|
|
@@ -69397,6 +69366,49 @@ class InsertableMeshFactory {
|
|
|
69397
69366
|
return mesh;
|
|
69398
69367
|
}
|
|
69399
69368
|
}
|
|
69369
|
+
function createGeometryFromMesh(g3d2, mesh, section) {
|
|
69370
|
+
const colorIndices = createColorIndices(g3d2, mesh, section);
|
|
69371
|
+
const positions = g3d2.positions.subarray(
|
|
69372
|
+
g3d2.getMeshVertexStart(mesh) * 3,
|
|
69373
|
+
g3d2.getMeshVertexEnd(mesh) * 3
|
|
69374
|
+
);
|
|
69375
|
+
const start = g3d2.getMeshIndexStart(mesh, section);
|
|
69376
|
+
const end = g3d2.getMeshIndexEnd(mesh, section);
|
|
69377
|
+
const indices = g3d2.indices.subarray(start, end);
|
|
69378
|
+
return createGeometryFromArrays(
|
|
69379
|
+
positions,
|
|
69380
|
+
indices,
|
|
69381
|
+
colorIndices
|
|
69382
|
+
);
|
|
69383
|
+
}
|
|
69384
|
+
function createColorIndices(g3d2, mesh, section) {
|
|
69385
|
+
const vertexCount = g3d2.getMeshVertexCount(mesh);
|
|
69386
|
+
const result = new Uint16Array(vertexCount);
|
|
69387
|
+
const subStart = g3d2.getMeshSubmeshStart(mesh, section);
|
|
69388
|
+
const subEnd = g3d2.getMeshSubmeshEnd(mesh, section);
|
|
69389
|
+
for (let submesh = subStart; submesh < subEnd; submesh++) {
|
|
69390
|
+
const start = g3d2.getSubmeshIndexStart(submesh);
|
|
69391
|
+
const end = g3d2.getSubmeshIndexEnd(submesh);
|
|
69392
|
+
const index2 = g3d2.colorIndices[submesh];
|
|
69393
|
+
for (let i = start; i < end; i++) {
|
|
69394
|
+
const vertexIndex = g3d2.indices[i];
|
|
69395
|
+
result[vertexIndex] = index2;
|
|
69396
|
+
}
|
|
69397
|
+
}
|
|
69398
|
+
return result;
|
|
69399
|
+
}
|
|
69400
|
+
function createGeometryFromArrays(vertices, indices, colorIndices = void 0) {
|
|
69401
|
+
const geometry = new BufferGeometry();
|
|
69402
|
+
geometry.setAttribute("position", new BufferAttribute(vertices, 3));
|
|
69403
|
+
geometry.setIndex(new Uint32BufferAttribute(indices, 1));
|
|
69404
|
+
if (colorIndices) {
|
|
69405
|
+
geometry.setAttribute(
|
|
69406
|
+
"colorIndex",
|
|
69407
|
+
new Uint16BufferAttribute(colorIndices, 1)
|
|
69408
|
+
);
|
|
69409
|
+
}
|
|
69410
|
+
return geometry;
|
|
69411
|
+
}
|
|
69400
69412
|
class InstancedMeshFactory {
|
|
69401
69413
|
constructor(mapping, vimIndex = 0) {
|
|
69402
69414
|
__publicField(this, "_mapping");
|
|
@@ -86813,7 +86825,8 @@ function useViewerInput(handler, framing) {
|
|
|
86813
86825
|
const Ids = {
|
|
86814
86826
|
showGhost: "isolationPanel.showGhost",
|
|
86815
86827
|
ghostOpacity: "isolationPanel.ghostOpacity",
|
|
86816
|
-
|
|
86828
|
+
showTransparent: "isolationPanel.showTransparent",
|
|
86829
|
+
transparentOpacity: "isolationPanel.transparentOpacity",
|
|
86817
86830
|
outlineEnabled: "isolationPanel.outlineEnabled",
|
|
86818
86831
|
outlineQuality: "isolationPanel.outlineQuality",
|
|
86819
86832
|
outlineThickness: "isolationPanel.outlineThickness",
|
|
@@ -86832,9 +86845,20 @@ const IsolationPanel$1 = forwardRef(
|
|
|
86832
86845
|
entries: [
|
|
86833
86846
|
{
|
|
86834
86847
|
type: "bool",
|
|
86835
|
-
id: Ids.
|
|
86836
|
-
label: "
|
|
86837
|
-
state: props.state.
|
|
86848
|
+
id: Ids.showTransparent,
|
|
86849
|
+
label: "Show Transparent",
|
|
86850
|
+
state: props.state.showTransparent
|
|
86851
|
+
},
|
|
86852
|
+
{
|
|
86853
|
+
type: "number",
|
|
86854
|
+
id: Ids.transparentOpacity,
|
|
86855
|
+
label: "Transparent Opacity",
|
|
86856
|
+
state: props.state.transparentOpacity,
|
|
86857
|
+
enabled: () => props.state.showTransparent.get(),
|
|
86858
|
+
min: 0,
|
|
86859
|
+
max: 1,
|
|
86860
|
+
step: 0.05,
|
|
86861
|
+
transform: (n) => Math.max(0, Math.min(1, n))
|
|
86838
86862
|
},
|
|
86839
86863
|
{
|
|
86840
86864
|
type: "bool",
|
|
@@ -86915,7 +86939,8 @@ function useSharedIsolation(adapter, initialState) {
|
|
|
86915
86939
|
const showPanel = useStateRef(false);
|
|
86916
86940
|
const showRooms = useStateRef(false);
|
|
86917
86941
|
const showGhost = useStateRef(() => adapter.getShowGhost(), true);
|
|
86918
|
-
const
|
|
86942
|
+
const showTransparent = useStateRef(() => adapter.getShowTransparent(), true);
|
|
86943
|
+
const transparentOpacity = useStateRef(() => adapter.getTransparentOpacity(), true, "vim.transparent.opacity");
|
|
86919
86944
|
const outlineEnabled = useStateRef(() => adapter.getOutlineEnabled(), true, "vim.outline.enabled");
|
|
86920
86945
|
const outlineQuality = useStateRef(() => adapter.getOutlineQuality(), true, "vim.outline.quality");
|
|
86921
86946
|
const outlineThickness = useStateRef(() => adapter.getOutlineThickness(), true, "vim.outline.thickness");
|
|
@@ -86943,7 +86968,8 @@ function useSharedIsolation(adapter, initialState) {
|
|
|
86943
86968
|
if (v) onAutoIsolate.call();
|
|
86944
86969
|
});
|
|
86945
86970
|
showGhost.useOnChange((v) => adapter.showGhost(v));
|
|
86946
|
-
|
|
86971
|
+
showTransparent.useOnChange((v) => adapter.setShowTransparent(v));
|
|
86972
|
+
transparentOpacity.useOnChange((v) => adapter.setTransparentOpacity(v));
|
|
86947
86973
|
outlineEnabled.useOnChange((v) => adapter.setOutlineEnabled(v));
|
|
86948
86974
|
outlineQuality.useOnChange((v) => adapter.setOutlineQuality(v));
|
|
86949
86975
|
outlineThickness.useOnChange((v) => adapter.setOutlineThickness(v));
|
|
@@ -86961,7 +86987,8 @@ function useSharedIsolation(adapter, initialState) {
|
|
|
86961
86987
|
autoIsolate: autoIsolate2,
|
|
86962
86988
|
showPanel,
|
|
86963
86989
|
showGhost,
|
|
86964
|
-
|
|
86990
|
+
showTransparent,
|
|
86991
|
+
transparentOpacity,
|
|
86965
86992
|
outlineEnabled,
|
|
86966
86993
|
outlineQuality,
|
|
86967
86994
|
outlineThickness,
|
|
@@ -86991,13 +87018,13 @@ function useWebglIsolation(viewer, initialState) {
|
|
|
86991
87018
|
}
|
|
86992
87019
|
function createWebglIsolationAdapter(viewer, initialState) {
|
|
86993
87020
|
var ghost2 = (initialState == null ? void 0 : initialState.showGhost) ?? false;
|
|
86994
|
-
var
|
|
87021
|
+
var showTransparent = (initialState == null ? void 0 : initialState.showTransparent) ?? true;
|
|
86995
87022
|
var rooms = (initialState == null ? void 0 : initialState.showRooms) ?? false;
|
|
86996
87023
|
function updateMaterials() {
|
|
86997
87024
|
const m = viewer.materials;
|
|
86998
87025
|
viewer.renderer.modelMaterial = new MaterialSet(
|
|
86999
87026
|
m.modelOpaqueMaterial,
|
|
87000
|
-
|
|
87027
|
+
showTransparent ? m.modelTransparentMaterial : m.modelOpaqueMaterial,
|
|
87001
87028
|
ghost2 ? m.ghostMaterial : void 0
|
|
87002
87029
|
);
|
|
87003
87030
|
}
|
|
@@ -87064,7 +87091,11 @@ function createWebglIsolationAdapter(viewer, initialState) {
|
|
|
87064
87091
|
getGhostOpacity: () => viewer.materials.ghostOpacity,
|
|
87065
87092
|
setGhostOpacity: (opacity) => viewer.materials.ghostOpacity = opacity,
|
|
87066
87093
|
getShowGhost: () => ghost2,
|
|
87067
|
-
|
|
87094
|
+
getShowTransparent: () => showTransparent,
|
|
87095
|
+
getTransparentOpacity: () => viewer.materials.transparentOpacity,
|
|
87096
|
+
setTransparentOpacity: (opacity) => {
|
|
87097
|
+
viewer.materials.transparentOpacity = opacity;
|
|
87098
|
+
},
|
|
87068
87099
|
getOutlineEnabled: () => viewer.renderer.outlineEnabled,
|
|
87069
87100
|
getOutlineQuality: () => {
|
|
87070
87101
|
const scale = viewer.renderer.outlineScale;
|
|
@@ -87075,8 +87106,8 @@ function createWebglIsolationAdapter(viewer, initialState) {
|
|
|
87075
87106
|
getOutlineThickness: () => viewer.materials.outlineThickness,
|
|
87076
87107
|
getSelectionFillMode: () => viewer.materials.selectionFillMode,
|
|
87077
87108
|
getSelectionOverlayOpacity: () => viewer.materials.selectionOverlayOpacity,
|
|
87078
|
-
|
|
87079
|
-
|
|
87109
|
+
setShowTransparent: (enabled) => {
|
|
87110
|
+
showTransparent = enabled;
|
|
87080
87111
|
updateMaterials();
|
|
87081
87112
|
},
|
|
87082
87113
|
setOutlineEnabled: (enabled) => {
|
|
@@ -87141,7 +87172,7 @@ function getDefaultSettings() {
|
|
|
87141
87172
|
isolation: {
|
|
87142
87173
|
autoIsolate: false,
|
|
87143
87174
|
showGhost: true,
|
|
87144
|
-
|
|
87175
|
+
showTransparent: true,
|
|
87145
87176
|
showRooms: false
|
|
87146
87177
|
},
|
|
87147
87178
|
sectionBox: {
|
|
@@ -87270,9 +87301,18 @@ function getIsolationSettings(isolation) {
|
|
|
87270
87301
|
},
|
|
87271
87302
|
{
|
|
87272
87303
|
type: "bool",
|
|
87273
|
-
id: "
|
|
87274
|
-
label: "
|
|
87275
|
-
state: isolation.
|
|
87304
|
+
id: "showTransparent",
|
|
87305
|
+
label: "Show Transparent",
|
|
87306
|
+
state: isolation.showTransparent
|
|
87307
|
+
},
|
|
87308
|
+
{
|
|
87309
|
+
type: "number",
|
|
87310
|
+
id: "transparentOpacity",
|
|
87311
|
+
label: "Transparent Opacity",
|
|
87312
|
+
info: "[0,1]",
|
|
87313
|
+
step: 0.05,
|
|
87314
|
+
transform: (n) => Math.max(0, Math.min(1, n)),
|
|
87315
|
+
state: isolation.transparentOpacity
|
|
87276
87316
|
},
|
|
87277
87317
|
{
|
|
87278
87318
|
type: "bool",
|
|
@@ -87881,10 +87921,13 @@ function createAdapter(viewer, initialState) {
|
|
|
87881
87921
|
setGhostOpacity: (opacity) => {
|
|
87882
87922
|
viewer.renderer.ghostOpacity = opacity;
|
|
87883
87923
|
},
|
|
87884
|
-
|
|
87924
|
+
setShowTransparent: (_enabled) => {
|
|
87885
87925
|
},
|
|
87886
87926
|
getShowGhost: () => ghost2.get(),
|
|
87887
|
-
|
|
87927
|
+
getShowTransparent: () => true,
|
|
87928
|
+
getTransparentOpacity: () => 0.25,
|
|
87929
|
+
setTransparentOpacity: (_opacity) => {
|
|
87930
|
+
},
|
|
87888
87931
|
getOutlineEnabled: () => true,
|
|
87889
87932
|
getOutlineQuality: () => "high",
|
|
87890
87933
|
getOutlineThickness: () => 2,
|
|
@@ -87947,7 +87990,7 @@ function getDefaultUltraSettings() {
|
|
|
87947
87990
|
isolation: {
|
|
87948
87991
|
autoIsolate: false,
|
|
87949
87992
|
showGhost: false,
|
|
87950
|
-
|
|
87993
|
+
showTransparent: true,
|
|
87951
87994
|
showRooms: false
|
|
87952
87995
|
},
|
|
87953
87996
|
sectionBox: {
|