@inweb/viewer-three 26.11.0 → 26.11.1
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/README.md +4 -7
- package/dist/plugins/components/AxesHelperComponent.js.map +1 -0
- package/dist/plugins/components/AxesHelperComponent.module.js.map +1 -0
- package/dist/plugins/components/ExtentsHelperComponent.js.map +1 -0
- package/dist/plugins/components/ExtentsHelperComponent.module.js.map +1 -0
- package/dist/plugins/components/GridHelperComponent.js.map +1 -0
- package/dist/plugins/components/GridHelperComponent.module.js.map +1 -0
- package/dist/plugins/components/LightHelperComponent.js.map +1 -0
- package/dist/plugins/components/LightHelperComponent.module.js.map +1 -0
- package/dist/plugins/components/RoomEnvironmentComponent.js.map +1 -0
- package/dist/plugins/components/RoomEnvironmentComponent.module.js.map +1 -0
- package/dist/plugins/components/StatsPanelComponent.js.map +1 -0
- package/dist/plugins/components/StatsPanelComponent.module.js.map +1 -0
- package/dist/plugins/loaders/GLTFCloudLoader.js.map +1 -0
- package/dist/plugins/loaders/GLTFCloudLoader.module.js.map +1 -0
- package/dist/{extensions → plugins}/loaders/GLTFFileLoader.js +1 -1
- package/dist/plugins/loaders/GLTFFileLoader.js.map +1 -0
- package/dist/plugins/loaders/GLTFFileLoader.min.js +24 -0
- package/dist/plugins/loaders/GLTFFileLoader.module.js.map +1 -0
- package/dist/plugins/loaders/IFCXLoader.js.map +1 -0
- package/dist/plugins/loaders/IFCXLoader.module.js.map +1 -0
- package/dist/plugins/loaders/PotreeLoader.js.map +1 -0
- package/dist/plugins/loaders/PotreeLoader.module.js.map +1 -0
- package/dist/viewer-three.js +153 -249
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +3 -3
- package/dist/viewer-three.module.js +155 -243
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/Viewer.d.ts +1 -1
- package/lib/Viewer/components/SelectionComponent.d.ts +3 -1
- package/lib/Viewer/draggers/MeasureLineDragger.d.ts +1 -7
- package/lib/Viewer/models/IModelImpl.d.ts +0 -4
- package/lib/Viewer/models/ModelImpl.d.ts +0 -4
- package/package.json +11 -11
- package/src/Viewer/Viewer.ts +1 -1
- package/src/Viewer/components/SelectionComponent.ts +30 -5
- package/src/Viewer/draggers/MeasureLineDragger.ts +226 -84
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicGltfLoader.js +16 -14
- package/src/Viewer/loaders/DynamicGltfLoader/GltfStructure.js +0 -1
- package/src/Viewer/models/IModelImpl.ts +0 -8
- package/src/Viewer/models/ModelImpl.ts +0 -18
- package/src/index-umd.ts +1 -1
- package/dist/extensions/components/AxesHelperComponent.js.map +0 -1
- package/dist/extensions/components/AxesHelperComponent.module.js.map +0 -1
- package/dist/extensions/components/ExtentsHelperComponent.js.map +0 -1
- package/dist/extensions/components/ExtentsHelperComponent.module.js.map +0 -1
- package/dist/extensions/components/GridHelperComponent.js.map +0 -1
- package/dist/extensions/components/GridHelperComponent.module.js.map +0 -1
- package/dist/extensions/components/LightHelperComponent.js.map +0 -1
- package/dist/extensions/components/LightHelperComponent.module.js.map +0 -1
- package/dist/extensions/components/RoomEnvironmentComponent.js.map +0 -1
- package/dist/extensions/components/RoomEnvironmentComponent.module.js.map +0 -1
- package/dist/extensions/components/StatsPanelComponent.js.map +0 -1
- package/dist/extensions/components/StatsPanelComponent.module.js.map +0 -1
- package/dist/extensions/loaders/GLTFCloudLoader.js.map +0 -1
- package/dist/extensions/loaders/GLTFCloudLoader.module.js.map +0 -1
- package/dist/extensions/loaders/GLTFFileLoader.js.map +0 -1
- package/dist/extensions/loaders/GLTFFileLoader.min.js +0 -24
- package/dist/extensions/loaders/GLTFFileLoader.module.js.map +0 -1
- package/dist/extensions/loaders/IFCXLoader.js.map +0 -1
- package/dist/extensions/loaders/IFCXLoader.module.js.map +0 -1
- package/dist/extensions/loaders/PotreeLoader.js.map +0 -1
- package/dist/extensions/loaders/PotreeLoader.module.js.map +0 -1
- package/lib/Viewer/measurement/Snapper.d.ts +0 -15
- package/lib/Viewer/measurement/UnitConverter.d.ts +0 -63
- package/lib/Viewer/measurement/UnitFormatter.d.ts +0 -4
- package/src/Viewer/measurement/Snapper.ts +0 -208
- package/src/Viewer/measurement/UnitConverter.ts +0 -47
- package/src/Viewer/measurement/UnitFormatter.ts +0 -95
- /package/dist/{extensions → plugins}/components/AxesHelperComponent.js +0 -0
- /package/dist/{extensions → plugins}/components/AxesHelperComponent.min.js +0 -0
- /package/dist/{extensions → plugins}/components/AxesHelperComponent.module.js +0 -0
- /package/dist/{extensions → plugins}/components/ExtentsHelperComponent.js +0 -0
- /package/dist/{extensions → plugins}/components/ExtentsHelperComponent.min.js +0 -0
- /package/dist/{extensions → plugins}/components/ExtentsHelperComponent.module.js +0 -0
- /package/dist/{extensions → plugins}/components/GridHelperComponent.js +0 -0
- /package/dist/{extensions → plugins}/components/GridHelperComponent.min.js +0 -0
- /package/dist/{extensions → plugins}/components/GridHelperComponent.module.js +0 -0
- /package/dist/{extensions → plugins}/components/LightHelperComponent.js +0 -0
- /package/dist/{extensions → plugins}/components/LightHelperComponent.min.js +0 -0
- /package/dist/{extensions → plugins}/components/LightHelperComponent.module.js +0 -0
- /package/dist/{extensions → plugins}/components/RoomEnvironmentComponent.js +0 -0
- /package/dist/{extensions → plugins}/components/RoomEnvironmentComponent.min.js +0 -0
- /package/dist/{extensions → plugins}/components/RoomEnvironmentComponent.module.js +0 -0
- /package/dist/{extensions → plugins}/components/StatsPanelComponent.js +0 -0
- /package/dist/{extensions → plugins}/components/StatsPanelComponent.min.js +0 -0
- /package/dist/{extensions → plugins}/components/StatsPanelComponent.module.js +0 -0
- /package/dist/{extensions → plugins}/loaders/GLTFCloudLoader.js +0 -0
- /package/dist/{extensions → plugins}/loaders/GLTFCloudLoader.min.js +0 -0
- /package/dist/{extensions → plugins}/loaders/GLTFCloudLoader.module.js +0 -0
- /package/dist/{extensions → plugins}/loaders/GLTFFileLoader.module.js +0 -0
- /package/dist/{extensions → plugins}/loaders/IFCXLoader.js +0 -0
- /package/dist/{extensions → plugins}/loaders/IFCXLoader.min.js +0 -0
- /package/dist/{extensions → plugins}/loaders/IFCXLoader.module.js +0 -0
- /package/dist/{extensions → plugins}/loaders/PotreeLoader.js +0 -0
- /package/dist/{extensions → plugins}/loaders/PotreeLoader.min.js +0 -0
- /package/dist/{extensions → plugins}/loaders/PotreeLoader.module.js +0 -0
- /package/{extensions → plugins}/components/AxesHelperComponent.ts +0 -0
- /package/{extensions → plugins}/components/ExtentsHelperComponent.ts +0 -0
- /package/{extensions → plugins}/components/GridHelperComponent.ts +0 -0
- /package/{extensions → plugins}/components/LightHelperComponent.ts +0 -0
- /package/{extensions → plugins}/components/RoomEnvironmentComponent.ts +0 -0
- /package/{extensions → plugins}/components/StatsPanelComponent.ts +0 -0
- /package/{extensions → plugins}/loaders/GLTFCloudLoader.ts +0 -0
- /package/{extensions → plugins}/loaders/GLTFFileLoader.ts +0 -0
- /package/{extensions → plugins}/loaders/IFCX/IFCXCloudLoader.ts +0 -0
- /package/{extensions → plugins}/loaders/IFCX/IFCXFileLoader.ts +0 -0
- /package/{extensions → plugins}/loaders/IFCX/IFCXLoader.ts +0 -0
- /package/{extensions → plugins}/loaders/IFCX/index.ts +0 -0
- /package/{extensions → plugins}/loaders/IFCX/render.js +0 -0
- /package/{extensions → plugins}/loaders/Potree/PotreeFileLoader.ts +0 -0
- /package/{extensions → plugins}/loaders/Potree/PotreeModelImpl.ts +0 -0
- /package/{extensions → plugins}/loaders/Potree/index.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PotreeLoader.module.js","sources":["../../../plugins/loaders/Potree/PotreeModelImpl.ts","../../../plugins/loaders/Potree/PotreeFileLoader.ts","../../../plugins/loaders/Potree/index.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Box3 } from \"three\";\nimport { PointCloudOctree } from \"potree-core\";\nimport { ModelImpl } from \"@inweb/viewer-three\";\n\n// Potree model implementation.\n\nexport class PotreeModelImpl extends ModelImpl {\n public pco: PointCloudOctree;\n\n override getExtents(target: Box3): Box3 {\n return target.union(this.pco.pcoGeometry.boundingBox);\n }\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { Euler, Vector3 } from \"three\";\nimport { PointColorType, PointCloudOctree, PointSizeType, PointShape, Potree } from \"potree-core\";\nimport { Loader, LoadParams, Viewer } from \"@inweb/viewer-three\";\n\nimport { PotreeModelImpl } from \"./PotreeModelImpl\";\n\nexport type PotreeLoadParams = LoadParams & {\n path?: string;\n position?: Vector3;\n rotation?: Euler;\n scale?: Vector3;\n};\n\nexport class PotreeFileLoader extends Loader {\n public viewer: Viewer;\n public potree: Potree;\n public pointClouds: PointCloudOctree[];\n\n constructor(viewer: Viewer) {\n super();\n this.viewer = viewer;\n\n this.potree = new Potree();\n this.pointClouds = [];\n\n this.viewer.addEventListener(\"render\", this.updatePointClouds);\n this.viewer.addEventListener(\"changecamera\", this.updatePointClouds);\n }\n\n override dispose() {\n this.pointClouds.forEach((pco) => pco.dispose());\n\n this.viewer.removeEventListener(\"render\", this.updatePointClouds);\n this.viewer.removeEventListener(\"changecamera\", this.updatePointClouds);\n }\n\n override isSupport(file: any, format?: string): boolean {\n return typeof file === \"string\" && /(cloud.js|metadata.json)$/i.test(file);\n }\n\n override async load(file: any, format?: string, params: PotreeLoadParams = {}): Promise<this> {\n const path = (params.path || \"\") + file;\n const index = path.lastIndexOf(\"/\");\n const baseUrl = path.slice(0, index + 1);\n const url = path.slice(index + 1);\n\n const pco = await this.potree.loadPointCloud(url, baseUrl);\n pco.material.size = 1.0;\n pco.material.shape = 2;\n pco.material.inputColorEncoding = 1;\n pco.material.outputColorEncoding = 1;\n pco.material.pointColorType = PointColorType.RGB; // RGB | DEPTH | HEIGHT | POINT_INDEX | LOD | CLASSIFICATION\n pco.material.pointSizeType = PointSizeType.ADAPTIVE; // ADAPTIVE | FIXED\n pco.material.shape = PointShape.CIRCLE; // CIRCLE | SQUARE\n\n if (params.position) pco.position.copy(params.position);\n if (params.rotation) pco.rotation.copy(params.rotation);\n if (params.scale) pco.scale.copy(params.scale);\n\n this.pointClouds.push(pco);\n\n const modelImpl = new PotreeModelImpl(pco);\n modelImpl.id = params.modelId || this.extractFileName(file);\n modelImpl.pco = pco;\n\n this.viewer.scene.add(pco);\n this.viewer.models.push(modelImpl);\n\n this.viewer.syncOptions();\n this.viewer.syncOverlay();\n this.viewer.update();\n\n this.viewer.emitEvent({ type: \"databasechunk\", data: pco, file });\n\n return this;\n }\n\n updatePointClouds = () => {\n const result = this.potree.updatePointClouds(this.pointClouds, this.viewer.camera, this.viewer.renderer);\n if (result.exceededMaxLoadsToGPU || result.nodeLoadPromises.length > 0) this.viewer.update();\n };\n}\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { loaders } from \"@inweb/viewer-three\";\n\nimport { PotreeFileLoader } from \"./PotreeFileLoader\";\n\nloaders.registerLoader(\"potree-file\", (viewer: any) => new PotreeFileLoader(viewer));\n"],"names":[],"mappings":"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"}
|
package/dist/viewer-three.js
CHANGED
|
@@ -244,7 +244,6 @@
|
|
|
244
244
|
enableGestures: true,
|
|
245
245
|
geometryType: "vsfx",
|
|
246
246
|
rulerUnit: "Default",
|
|
247
|
-
rulerPrecision: 2,
|
|
248
247
|
cameraMode: "perspective",
|
|
249
248
|
};
|
|
250
249
|
}
|
|
@@ -501,13 +500,6 @@
|
|
|
501
500
|
this._data.rulerUnit = value;
|
|
502
501
|
this.change();
|
|
503
502
|
}
|
|
504
|
-
get rulerPrecision() {
|
|
505
|
-
return this._data.rulerPrecision;
|
|
506
|
-
}
|
|
507
|
-
set rulerPrecision(value) {
|
|
508
|
-
this._data.rulerPrecision = value;
|
|
509
|
-
this.change();
|
|
510
|
-
}
|
|
511
503
|
get cameraMode() {
|
|
512
504
|
return this._data.cameraMode || "perspective";
|
|
513
505
|
}
|
|
@@ -33892,91 +33884,116 @@ void main() {
|
|
|
33892
33884
|
}
|
|
33893
33885
|
}
|
|
33894
33886
|
|
|
33895
|
-
const
|
|
33896
|
-
|
|
33897
|
-
|
|
33898
|
-
|
|
33899
|
-
|
|
33900
|
-
|
|
33901
|
-
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
|
|
33905
|
-
|
|
33906
|
-
|
|
33907
|
-
|
|
33908
|
-
|
|
33909
|
-
|
|
33910
|
-
|
|
33911
|
-
|
|
33912
|
-
|
|
33913
|
-
|
|
33914
|
-
|
|
33915
|
-
|
|
33916
|
-
|
|
33917
|
-
|
|
33918
|
-
|
|
33919
|
-
|
|
33920
|
-
|
|
33921
|
-
|
|
33922
|
-
|
|
33923
|
-
|
|
33924
|
-
|
|
33925
|
-
|
|
33926
|
-
|
|
33927
|
-
|
|
33928
|
-
|
|
33929
|
-
|
|
33930
|
-
|
|
33931
|
-
|
|
33932
|
-
|
|
33933
|
-
|
|
33934
|
-
|
|
33935
|
-
|
|
33936
|
-
|
|
33937
|
-
|
|
33938
|
-
|
|
33939
|
-
|
|
33940
|
-
|
|
33941
|
-
|
|
33942
|
-
|
|
33943
|
-
|
|
33944
|
-
|
|
33945
|
-
|
|
33946
|
-
|
|
33947
|
-
|
|
33948
|
-
|
|
33949
|
-
|
|
33950
|
-
|
|
33951
|
-
|
|
33952
|
-
|
|
33953
|
-
|
|
33954
|
-
|
|
33955
|
-
|
|
33956
|
-
|
|
33887
|
+
const PRECISION = 0.01;
|
|
33888
|
+
const DESKTOP_SNAP_DISTANCE = 10;
|
|
33889
|
+
const MOBILE_SNAP_DISTANCE = 50;
|
|
33890
|
+
class MeasureLineDragger extends OrbitDragger {
|
|
33891
|
+
constructor(viewer) {
|
|
33892
|
+
super(viewer);
|
|
33893
|
+
this.onPointerDown = (event) => {
|
|
33894
|
+
if (event.button !== 0)
|
|
33895
|
+
return;
|
|
33896
|
+
this.line.startPoint = this.snapper.getSnapPoint(event);
|
|
33897
|
+
this.line.render();
|
|
33898
|
+
this.viewer.canvas.setPointerCapture(event.pointerId);
|
|
33899
|
+
this.orbit.enabled = !this.line.startPoint;
|
|
33900
|
+
};
|
|
33901
|
+
this.onPointerMove = (event) => {
|
|
33902
|
+
if (this.orbit.enabled && this.orbit.state !== -1)
|
|
33903
|
+
return;
|
|
33904
|
+
const snapPoint = this.snapper.getSnapPoint(event);
|
|
33905
|
+
if (snapPoint && this.line.endPoint && snapPoint.equals(this.line.endPoint))
|
|
33906
|
+
return;
|
|
33907
|
+
this.line.endPoint = snapPoint;
|
|
33908
|
+
this.line.render();
|
|
33909
|
+
if (this.line.startPoint)
|
|
33910
|
+
this.changed = true;
|
|
33911
|
+
};
|
|
33912
|
+
this.onPointerUp = (event) => {
|
|
33913
|
+
if (this.line.startPoint && this.line.endPoint && this.line.getDistance() >= PRECISION) {
|
|
33914
|
+
this.line = new MeasureLine(this.overlay);
|
|
33915
|
+
this.overlay.addLine(this.line);
|
|
33916
|
+
}
|
|
33917
|
+
else {
|
|
33918
|
+
this.line.startPoint = undefined;
|
|
33919
|
+
this.line.endPoint = undefined;
|
|
33920
|
+
this.line.render();
|
|
33921
|
+
}
|
|
33922
|
+
this.viewer.canvas.releasePointerCapture(event.pointerId);
|
|
33923
|
+
this.orbit.enabled = true;
|
|
33924
|
+
};
|
|
33925
|
+
this.onPointerCancel = (event) => {
|
|
33926
|
+
this.viewer.canvas.dispatchEvent(new PointerEvent("pointerup", event));
|
|
33927
|
+
};
|
|
33928
|
+
this.onPointerLeave = () => {
|
|
33929
|
+
this.line.endPoint = undefined;
|
|
33930
|
+
this.line.render();
|
|
33931
|
+
};
|
|
33932
|
+
this.renderOverlay = () => {
|
|
33933
|
+
this.overlay.render();
|
|
33934
|
+
};
|
|
33935
|
+
this.updateSnapper = () => {
|
|
33936
|
+
this.snapper.setFromViewer(this.viewer);
|
|
33937
|
+
};
|
|
33938
|
+
this.updateSnapperCamera = () => {
|
|
33939
|
+
this.snapper.camera = this.viewer.camera;
|
|
33940
|
+
this.overlay.camera = this.viewer.camera;
|
|
33941
|
+
};
|
|
33942
|
+
this.overlay = new MeasureOverlay(viewer.camera, viewer.canvas);
|
|
33943
|
+
this.overlay.attach();
|
|
33944
|
+
this.line = new MeasureLine(this.overlay);
|
|
33945
|
+
this.overlay.addLine(this.line);
|
|
33946
|
+
this.snapper = new MeasureSnapper(viewer.camera, viewer.canvas);
|
|
33947
|
+
this.updateSnapper();
|
|
33948
|
+
this.viewer.canvas.addEventListener("pointerdown", this.onPointerDown);
|
|
33949
|
+
this.viewer.canvas.addEventListener("pointermove", this.onPointerMove);
|
|
33950
|
+
this.viewer.canvas.addEventListener("pointerup", this.onPointerUp);
|
|
33951
|
+
this.viewer.canvas.addEventListener("pointercancel", this.onPointerCancel);
|
|
33952
|
+
this.viewer.canvas.addEventListener("pointerleave", this.onPointerLeave);
|
|
33953
|
+
this.viewer.addEventListener("render", this.renderOverlay);
|
|
33954
|
+
this.viewer.addEventListener("hide", this.updateSnapper);
|
|
33955
|
+
this.viewer.addEventListener("isolate", this.updateSnapper);
|
|
33956
|
+
this.viewer.addEventListener("show", this.updateSnapper);
|
|
33957
|
+
this.viewer.addEventListener("showall", this.updateSnapper);
|
|
33958
|
+
this.viewer.addEventListener("changecameramode", this.updateSnapperCamera);
|
|
33957
33959
|
}
|
|
33958
|
-
|
|
33959
|
-
|
|
33960
|
+
dispose() {
|
|
33961
|
+
this.viewer.canvas.removeEventListener("pointerdown", this.onPointerDown);
|
|
33962
|
+
this.viewer.canvas.removeEventListener("pointermove", this.onPointerMove);
|
|
33963
|
+
this.viewer.canvas.removeEventListener("pointerup", this.onPointerUp);
|
|
33964
|
+
this.viewer.canvas.removeEventListener("pointercancel", this.onPointerCancel);
|
|
33965
|
+
this.viewer.canvas.removeEventListener("pointerleave", this.onPointerLeave);
|
|
33966
|
+
this.viewer.removeEventListener("render", this.renderOverlay);
|
|
33967
|
+
this.viewer.removeEventListener("hide", this.updateSnapper);
|
|
33968
|
+
this.viewer.removeEventListener("isolate", this.updateSnapper);
|
|
33969
|
+
this.viewer.removeEventListener("show", this.updateSnapper);
|
|
33970
|
+
this.viewer.removeEventListener("showall", this.updateSnapper);
|
|
33971
|
+
this.viewer.removeEventListener("changecameramode", this.updateSnapperCamera);
|
|
33972
|
+
this.snapper.dispose();
|
|
33973
|
+
this.overlay.detach();
|
|
33974
|
+
this.overlay.dispose();
|
|
33975
|
+
super.dispose();
|
|
33960
33976
|
}
|
|
33961
33977
|
}
|
|
33962
|
-
|
|
33963
|
-
const DESKTOP_SNAP_DISTANCE = 10;
|
|
33964
|
-
const MOBILE_SNAP_DISTANCE = 50;
|
|
33965
33978
|
const _vertex = new Vector3();
|
|
33966
33979
|
const _start$1 = new Vector3();
|
|
33967
33980
|
const _end$1 = new Vector3();
|
|
33968
33981
|
const _line = new Line3();
|
|
33969
33982
|
const _center = new Vector3();
|
|
33970
33983
|
const _projection = new Vector3();
|
|
33971
|
-
class
|
|
33972
|
-
constructor(camera,
|
|
33984
|
+
class MeasureSnapper {
|
|
33985
|
+
constructor(camera, canvas) {
|
|
33973
33986
|
this.camera = camera;
|
|
33974
|
-
this.renderer = renderer;
|
|
33975
33987
|
this.canvas = canvas;
|
|
33988
|
+
this.objects = [];
|
|
33989
|
+
this.clippingPlanes = [];
|
|
33976
33990
|
this.raycaster = new Raycaster();
|
|
33977
33991
|
this.detectRadiusInPixels = this.isMobile() ? MOBILE_SNAP_DISTANCE : DESKTOP_SNAP_DISTANCE;
|
|
33978
33992
|
this.edgesCache = new WeakMap();
|
|
33979
33993
|
}
|
|
33994
|
+
dispose() {
|
|
33995
|
+
this.objects = [];
|
|
33996
|
+
}
|
|
33980
33997
|
isMobile() {
|
|
33981
33998
|
if (typeof navigator === "undefined")
|
|
33982
33999
|
return false;
|
|
@@ -33985,7 +34002,7 @@ void main() {
|
|
|
33985
34002
|
getMousePosition(event, target) {
|
|
33986
34003
|
return target.set(event.clientX, event.clientY);
|
|
33987
34004
|
}
|
|
33988
|
-
getPointerIntersects(mouse
|
|
34005
|
+
getPointerIntersects(mouse) {
|
|
33989
34006
|
const rect = this.canvas.getBoundingClientRect();
|
|
33990
34007
|
const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;
|
|
33991
34008
|
const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;
|
|
@@ -33999,8 +34016,8 @@ void main() {
|
|
|
33999
34016
|
Points: { threshold: 0.01 },
|
|
34000
34017
|
Sprite: {},
|
|
34001
34018
|
};
|
|
34002
|
-
let intersects = this.raycaster.intersectObjects(objects, false);
|
|
34003
|
-
|
|
34019
|
+
let intersects = this.raycaster.intersectObjects(this.objects, false);
|
|
34020
|
+
this.clippingPlanes.forEach((plane) => {
|
|
34004
34021
|
intersects = intersects.filter((intersect) => plane.distanceToPoint(intersect.point) >= 0);
|
|
34005
34022
|
});
|
|
34006
34023
|
return intersects;
|
|
@@ -34022,8 +34039,9 @@ void main() {
|
|
|
34022
34039
|
}
|
|
34023
34040
|
return 0.1;
|
|
34024
34041
|
}
|
|
34025
|
-
getSnapPoint(
|
|
34026
|
-
const
|
|
34042
|
+
getSnapPoint(event) {
|
|
34043
|
+
const mouse = this.getMousePosition(event, new Vector2());
|
|
34044
|
+
const intersections = this.getPointerIntersects(mouse);
|
|
34027
34045
|
if (intersections.length === 0)
|
|
34028
34046
|
return undefined;
|
|
34029
34047
|
const object = intersections[0].object;
|
|
@@ -34071,133 +34089,13 @@ void main() {
|
|
|
34071
34089
|
return object.localToWorld(snapPoint);
|
|
34072
34090
|
return intersectionPoint.clone();
|
|
34073
34091
|
}
|
|
34074
|
-
|
|
34075
|
-
|
|
34076
|
-
const _downPoint = new Vector2();
|
|
34077
|
-
class MeasureLineDragger extends OrbitDragger {
|
|
34078
|
-
constructor(viewer) {
|
|
34079
|
-
super(viewer);
|
|
34080
|
-
this.scale = 1.0;
|
|
34081
|
-
this.units = "";
|
|
34082
|
-
this.precision = 2;
|
|
34083
|
-
this.onPointerDown = (event) => {
|
|
34084
|
-
if (event.button !== 0)
|
|
34085
|
-
return;
|
|
34086
|
-
const mouse = this.snapper.getMousePosition(event, _downPoint);
|
|
34087
|
-
this.line.startPoint = this.snapper.getSnapPoint(mouse, this.objects);
|
|
34088
|
-
this.line.render();
|
|
34089
|
-
this.viewer.canvas.setPointerCapture(event.pointerId);
|
|
34090
|
-
this.orbit.enabled = !this.line.startPoint;
|
|
34091
|
-
};
|
|
34092
|
-
this.onPointerMove = (event) => {
|
|
34093
|
-
if (this.orbit.enabled && this.orbit.state !== -1)
|
|
34094
|
-
return;
|
|
34095
|
-
const mouse = this.snapper.getMousePosition(event, _downPoint);
|
|
34096
|
-
const snapPoint = this.snapper.getSnapPoint(mouse, this.objects);
|
|
34097
|
-
if (snapPoint && this.line.endPoint && snapPoint.equals(this.line.endPoint))
|
|
34098
|
-
return;
|
|
34099
|
-
this.line.endPoint = snapPoint;
|
|
34100
|
-
this.line.render();
|
|
34101
|
-
if (this.line.startPoint)
|
|
34102
|
-
this.changed = true;
|
|
34103
|
-
};
|
|
34104
|
-
this.onPointerUp = (event) => {
|
|
34105
|
-
if (this.line.startPoint && this.line.endPoint && this.line.getDistance() > 0) {
|
|
34106
|
-
this.line = new MeasureLine(this.overlay, this.scale, this.units, this.precision);
|
|
34107
|
-
this.overlay.addLine(this.line);
|
|
34108
|
-
}
|
|
34109
|
-
else {
|
|
34110
|
-
this.line.startPoint = undefined;
|
|
34111
|
-
this.line.endPoint = undefined;
|
|
34112
|
-
this.line.render();
|
|
34113
|
-
}
|
|
34114
|
-
this.viewer.canvas.releasePointerCapture(event.pointerId);
|
|
34115
|
-
this.orbit.enabled = true;
|
|
34116
|
-
};
|
|
34117
|
-
this.onPointerCancel = (event) => {
|
|
34118
|
-
this.viewer.canvas.dispatchEvent(new PointerEvent("pointerup", event));
|
|
34119
|
-
};
|
|
34120
|
-
this.onPointerLeave = () => {
|
|
34121
|
-
this.line.endPoint = undefined;
|
|
34122
|
-
this.line.render();
|
|
34123
|
-
};
|
|
34124
|
-
this.clearOverlay = () => {
|
|
34125
|
-
this.overlay.clear();
|
|
34126
|
-
this.line = new MeasureLine(this.overlay, this.scale, this.units, this.precision);
|
|
34127
|
-
this.overlay.addLine(this.line);
|
|
34128
|
-
};
|
|
34129
|
-
this.renderOverlay = () => {
|
|
34130
|
-
this.overlay.render();
|
|
34131
|
-
};
|
|
34132
|
-
this.updateObjects = () => {
|
|
34133
|
-
this.objects.length = 0;
|
|
34134
|
-
this.viewer.models.forEach((model) => {
|
|
34135
|
-
model.getVisibleObjects().forEach((object) => this.objects.push(object));
|
|
34136
|
-
});
|
|
34137
|
-
};
|
|
34138
|
-
this.updateSnapperCamera = () => {
|
|
34139
|
-
this.snapper.camera = this.viewer.camera;
|
|
34140
|
-
this.overlay.camera = this.viewer.camera;
|
|
34141
|
-
};
|
|
34142
|
-
this.updateUnits = () => {
|
|
34143
|
-
var _a, _b;
|
|
34144
|
-
const model = this.viewer.models[0];
|
|
34145
|
-
const units = (_a = this.viewer.options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
|
|
34146
|
-
const precision = (_b = this.viewer.options.rulerPrecision) !== null && _b !== void 0 ? _b : "Default";
|
|
34147
|
-
if (units === "Default") {
|
|
34148
|
-
this.scale = model.getUnitScale();
|
|
34149
|
-
this.units = model.getUnitString();
|
|
34150
|
-
}
|
|
34151
|
-
else {
|
|
34152
|
-
this.scale = convertUnits(model.getUnits(), units, 1);
|
|
34153
|
-
this.units = units;
|
|
34154
|
-
}
|
|
34155
|
-
if (precision === "Default") {
|
|
34156
|
-
this.precision = model.getPrecision();
|
|
34157
|
-
}
|
|
34158
|
-
else {
|
|
34159
|
-
this.precision = precision;
|
|
34160
|
-
}
|
|
34161
|
-
this.overlay.updateLineUnits(this.scale, this.units, this.precision);
|
|
34162
|
-
};
|
|
34163
|
-
this.overlay = new MeasureOverlay(viewer.camera, viewer.canvas);
|
|
34164
|
-
this.overlay.attach();
|
|
34165
|
-
this.line = new MeasureLine(this.overlay, this.scale, this.units, this.precision);
|
|
34166
|
-
this.overlay.addLine(this.line);
|
|
34167
|
-
this.snapper = new Snapper(viewer.camera, viewer.renderer, viewer.canvas);
|
|
34168
|
-
this.objects = [];
|
|
34169
|
-
this.updateObjects();
|
|
34170
|
-
this.updateUnits();
|
|
34171
|
-
this.viewer.canvas.addEventListener("pointerdown", this.onPointerDown);
|
|
34172
|
-
this.viewer.canvas.addEventListener("pointermove", this.onPointerMove);
|
|
34173
|
-
this.viewer.canvas.addEventListener("pointerup", this.onPointerUp);
|
|
34174
|
-
this.viewer.canvas.addEventListener("pointercancel", this.onPointerCancel);
|
|
34175
|
-
this.viewer.canvas.addEventListener("pointerleave", this.onPointerLeave);
|
|
34176
|
-
this.viewer.addEventListener("render", this.renderOverlay);
|
|
34177
|
-
this.viewer.addEventListener("hide", this.updateObjects);
|
|
34178
|
-
this.viewer.addEventListener("isolate", this.updateObjects);
|
|
34179
|
-
this.viewer.addEventListener("show", this.updateObjects);
|
|
34180
|
-
this.viewer.addEventListener("showall", this.updateObjects);
|
|
34181
|
-
this.viewer.addEventListener("changecameramode", this.updateSnapperCamera);
|
|
34182
|
-
this.viewer.addEventListener("optionschange", this.updateUnits);
|
|
34183
|
-
}
|
|
34184
|
-
dispose() {
|
|
34185
|
-
this.viewer.canvas.removeEventListener("pointerdown", this.onPointerDown);
|
|
34186
|
-
this.viewer.canvas.removeEventListener("pointermove", this.onPointerMove);
|
|
34187
|
-
this.viewer.canvas.removeEventListener("pointerup", this.onPointerUp);
|
|
34188
|
-
this.viewer.canvas.removeEventListener("pointercancel", this.onPointerCancel);
|
|
34189
|
-
this.viewer.canvas.removeEventListener("pointerleave", this.onPointerLeave);
|
|
34190
|
-
this.viewer.removeEventListener("render", this.renderOverlay);
|
|
34191
|
-
this.viewer.removeEventListener("hide", this.updateObjects);
|
|
34192
|
-
this.viewer.removeEventListener("isolate", this.updateObjects);
|
|
34193
|
-
this.viewer.removeEventListener("show", this.updateObjects);
|
|
34194
|
-
this.viewer.removeEventListener("showall", this.updateObjects);
|
|
34195
|
-
this.viewer.removeEventListener("changecameramode", this.updateSnapperCamera);
|
|
34196
|
-
this.viewer.removeEventListener("optionschange", this.updateUnits);
|
|
34092
|
+
setFromViewer(viewer) {
|
|
34197
34093
|
this.objects.length = 0;
|
|
34198
|
-
|
|
34199
|
-
|
|
34200
|
-
|
|
34094
|
+
viewer.models.forEach((model) => {
|
|
34095
|
+
model.getVisibleObjects().forEach((object) => this.objects.push(object));
|
|
34096
|
+
});
|
|
34097
|
+
this.camera = viewer.camera;
|
|
34098
|
+
this.clippingPlanes = viewer.renderer.clippingPlanes || [];
|
|
34201
34099
|
}
|
|
34202
34100
|
}
|
|
34203
34101
|
class MeasureOverlay {
|
|
@@ -34217,9 +34115,6 @@ void main() {
|
|
|
34217
34115
|
this.projector = new MeasureProjector(camera, canvas);
|
|
34218
34116
|
this.resizeObserver = new ResizeObserver(this.resizeContainer);
|
|
34219
34117
|
}
|
|
34220
|
-
dispose() {
|
|
34221
|
-
this.clear();
|
|
34222
|
-
}
|
|
34223
34118
|
attach() {
|
|
34224
34119
|
this.container = document.createElement("div");
|
|
34225
34120
|
this.container.id = "measure-container";
|
|
@@ -34232,6 +34127,9 @@ void main() {
|
|
|
34232
34127
|
this.canvas.parentElement.appendChild(this.container);
|
|
34233
34128
|
this.resizeObserver.observe(this.canvas);
|
|
34234
34129
|
}
|
|
34130
|
+
dispose() {
|
|
34131
|
+
this.clear();
|
|
34132
|
+
}
|
|
34235
34133
|
detach() {
|
|
34236
34134
|
this.resizeObserver.disconnect();
|
|
34237
34135
|
this.container.remove();
|
|
@@ -34239,7 +34137,7 @@ void main() {
|
|
|
34239
34137
|
}
|
|
34240
34138
|
clear() {
|
|
34241
34139
|
this.lines.forEach((line) => line.dispose());
|
|
34242
|
-
this.lines
|
|
34140
|
+
this.lines = [];
|
|
34243
34141
|
}
|
|
34244
34142
|
render() {
|
|
34245
34143
|
this.projector.setFromCamera(this.camera);
|
|
@@ -34254,18 +34152,13 @@ void main() {
|
|
|
34254
34152
|
removeLine(line) {
|
|
34255
34153
|
this.lines = this.lines.filter((x) => x !== line);
|
|
34256
34154
|
}
|
|
34257
|
-
updateLineUnits(scale, units, precision) {
|
|
34258
|
-
this.lines.forEach((line) => {
|
|
34259
|
-
line.scale = scale;
|
|
34260
|
-
line.units = units;
|
|
34261
|
-
line.precision = precision;
|
|
34262
|
-
});
|
|
34263
|
-
}
|
|
34264
34155
|
}
|
|
34265
34156
|
const _middlePoint = new Vector3();
|
|
34266
34157
|
class MeasureLine {
|
|
34267
|
-
constructor(overlay
|
|
34158
|
+
constructor(overlay) {
|
|
34268
34159
|
this.id = MathUtils.generateUUID();
|
|
34160
|
+
this.unit = "";
|
|
34161
|
+
this.scale = 1.0;
|
|
34269
34162
|
this.size = 10.0;
|
|
34270
34163
|
this.lineWidth = 2;
|
|
34271
34164
|
this.style = {
|
|
@@ -34276,9 +34169,6 @@ void main() {
|
|
|
34276
34169
|
font: "1rem system-ui",
|
|
34277
34170
|
};
|
|
34278
34171
|
this.overlay = overlay;
|
|
34279
|
-
this.scale = scale;
|
|
34280
|
-
this.units = units;
|
|
34281
|
-
this.precision = precision;
|
|
34282
34172
|
this.elementStartPoint = overlay.container.appendChild(document.createElement("div"));
|
|
34283
34173
|
this.elementEndPoint = overlay.container.appendChild(document.createElement("div"));
|
|
34284
34174
|
this.elementLine = overlay.container.appendChild(document.createElement("div"));
|
|
@@ -34333,10 +34223,10 @@ void main() {
|
|
|
34333
34223
|
_middlePoint.lerpVectors(this.startPoint, this.endPoint, 0.5);
|
|
34334
34224
|
const { point, visible } = projector.projectPoint(_middlePoint);
|
|
34335
34225
|
const distance = this.getDistance();
|
|
34336
|
-
this.elementLabel.style.display = visible && distance
|
|
34226
|
+
this.elementLabel.style.display = visible && distance >= PRECISION ? "block" : "none";
|
|
34337
34227
|
this.elementLabel.style.left = `${point.x}px`;
|
|
34338
34228
|
this.elementLabel.style.top = `${point.y}px`;
|
|
34339
|
-
this.elementLabel.innerHTML =
|
|
34229
|
+
this.elementLabel.innerHTML = `${distance.toFixed(2)} ${this.unit}`;
|
|
34340
34230
|
}
|
|
34341
34231
|
else {
|
|
34342
34232
|
this.elementLabel.style.display = "none";
|
|
@@ -36498,11 +36388,10 @@ void main() {
|
|
|
36498
36388
|
const upPosition = this.getMousePosition(event, new Vector2());
|
|
36499
36389
|
if (upPosition.distanceTo(this.downPosition) !== 0)
|
|
36500
36390
|
return;
|
|
36501
|
-
const snapper = new Snapper(this.viewer.camera, this.viewer.renderer, this.viewer.canvas);
|
|
36502
36391
|
let intersections = [];
|
|
36503
36392
|
this.viewer.models.forEach((model) => {
|
|
36504
36393
|
const objects = model.getVisibleObjects();
|
|
36505
|
-
const intersects =
|
|
36394
|
+
const intersects = this.getPointerIntersects(upPosition, objects);
|
|
36506
36395
|
if (intersects.length > 0)
|
|
36507
36396
|
intersections.push({ ...intersects[0], model });
|
|
36508
36397
|
});
|
|
@@ -36531,6 +36420,7 @@ void main() {
|
|
|
36531
36420
|
this.highlighter = this.viewer.getComponent("HighlighterComponent");
|
|
36532
36421
|
};
|
|
36533
36422
|
this.viewer = viewer;
|
|
36423
|
+
this.raycaster = new Raycaster();
|
|
36534
36424
|
this.downPosition = new Vector2();
|
|
36535
36425
|
this.viewer.addEventListener("pointerdown", this.onPointerDown);
|
|
36536
36426
|
this.viewer.addEventListener("pointerup", this.onPointerUp);
|
|
@@ -36546,6 +36436,26 @@ void main() {
|
|
|
36546
36436
|
getMousePosition(event, target) {
|
|
36547
36437
|
return target.set(event.clientX, event.clientY);
|
|
36548
36438
|
}
|
|
36439
|
+
getPointerIntersects(mouse, objects) {
|
|
36440
|
+
const rect = this.viewer.canvas.getBoundingClientRect();
|
|
36441
|
+
const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;
|
|
36442
|
+
const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;
|
|
36443
|
+
const coords = new Vector2(x, y);
|
|
36444
|
+
this.raycaster.setFromCamera(coords, this.viewer.camera);
|
|
36445
|
+
this.raycaster.params = {
|
|
36446
|
+
Mesh: {},
|
|
36447
|
+
Line: { threshold: 0.05 },
|
|
36448
|
+
Line2: { threshold: 0.05 },
|
|
36449
|
+
LOD: {},
|
|
36450
|
+
Points: { threshold: 0.01 },
|
|
36451
|
+
Sprite: {},
|
|
36452
|
+
};
|
|
36453
|
+
let intersects = this.raycaster.intersectObjects(objects, false);
|
|
36454
|
+
(this.viewer.renderer.clippingPlanes || []).forEach((plane) => {
|
|
36455
|
+
intersects = intersects.filter((intersect) => plane.distanceToPoint(intersect.point) >= 0);
|
|
36456
|
+
});
|
|
36457
|
+
return intersects;
|
|
36458
|
+
}
|
|
36549
36459
|
select(objects, model) {
|
|
36550
36460
|
if (!model) {
|
|
36551
36461
|
this.viewer.models.forEach((model) => this.select(objects, model));
|
|
@@ -36765,18 +36675,6 @@ void main() {
|
|
|
36765
36675
|
this.scene.traverse(disposeObject);
|
|
36766
36676
|
this.scene.clear();
|
|
36767
36677
|
}
|
|
36768
|
-
getUnits() {
|
|
36769
|
-
return "Meters";
|
|
36770
|
-
}
|
|
36771
|
-
getUnitScale() {
|
|
36772
|
-
return convertUnits(this.getUnits(), "Meters", 1);
|
|
36773
|
-
}
|
|
36774
|
-
getUnitString() {
|
|
36775
|
-
return getDisplayUnit(this.getUnits());
|
|
36776
|
-
}
|
|
36777
|
-
getPrecision() {
|
|
36778
|
-
return 2;
|
|
36779
|
-
}
|
|
36780
36678
|
getExtents(target) {
|
|
36781
36679
|
this.scene.traverseVisible((object) => !object.children.length && target.expandByObject(object));
|
|
36782
36680
|
return target;
|
|
@@ -37024,7 +36922,6 @@ void main() {
|
|
|
37024
36922
|
this.textureCache = new Map();
|
|
37025
36923
|
this.materialCache = new Map();
|
|
37026
36924
|
this.uri = "";
|
|
37027
|
-
this._nextObjectId = 0;
|
|
37028
36925
|
}
|
|
37029
36926
|
async initialize(loader) {
|
|
37030
36927
|
this.json = await this.loadController.loadJson();
|
|
@@ -38044,7 +37941,7 @@ void main() {
|
|
|
38044
37941
|
if (node.handle) {
|
|
38045
37942
|
mesh.userData.handle = node.handle;
|
|
38046
37943
|
} else {
|
|
38047
|
-
mesh.userData.handle =
|
|
37944
|
+
mesh.userData.handle = `${node.structure.id}${STRUCTURE_ID_SEPARATOR}${mesh.userData.handle}`;
|
|
38048
37945
|
}
|
|
38049
37946
|
if (mesh.material.name === "edges") {
|
|
38050
37947
|
mesh.userData.isEdge = true;
|
|
@@ -38185,15 +38082,12 @@ void main() {
|
|
|
38185
38082
|
})),
|
|
38186
38083
|
});
|
|
38187
38084
|
}
|
|
38188
|
-
getFullHandle(structureId, originalHandle) {
|
|
38189
|
-
return `${structureId}${STRUCTURE_ID_SEPARATOR}${originalHandle}`;
|
|
38190
|
-
}
|
|
38191
38085
|
async processNodeHierarchy(structure, nodeId, parentGroup) {
|
|
38192
38086
|
const nodeDef = structure.json.nodes[nodeId];
|
|
38193
38087
|
let nodeGroup = null;
|
|
38194
38088
|
let handle = null;
|
|
38195
38089
|
if (nodeDef.extras?.handle) {
|
|
38196
|
-
handle =
|
|
38090
|
+
handle = `${structure.id}${STRUCTURE_ID_SEPARATOR}${nodeDef.extras.handle}`;
|
|
38197
38091
|
}
|
|
38198
38092
|
if (nodeDef.camera !== undefined) {
|
|
38199
38093
|
const camera = this.loadCamera(structure, nodeDef.camera, nodeDef);
|
|
@@ -38210,7 +38104,7 @@ void main() {
|
|
|
38210
38104
|
if (nodeDef.extras) {
|
|
38211
38105
|
nodeGroup.userData = { ...nodeDef.extras };
|
|
38212
38106
|
if (nodeGroup.userData.handle) {
|
|
38213
|
-
nodeGroup.userData.handle =
|
|
38107
|
+
nodeGroup.userData.handle = `${structure.id}${STRUCTURE_ID_SEPARATOR}${nodeGroup.userData.handle}`;
|
|
38214
38108
|
}
|
|
38215
38109
|
}
|
|
38216
38110
|
if (nodeDef.matrix) {
|
|
@@ -38255,7 +38149,7 @@ void main() {
|
|
|
38255
38149
|
this.edgeNodes.push(uniqueNodeId);
|
|
38256
38150
|
}
|
|
38257
38151
|
if (meshDef.extras && meshDef.extras.handle) {
|
|
38258
|
-
handle =
|
|
38152
|
+
handle = `${structure.id}${STRUCTURE_ID_SEPARATOR}${meshDef.extras.handle}`;
|
|
38259
38153
|
}
|
|
38260
38154
|
this.nodes.set(uniqueNodeId, {
|
|
38261
38155
|
position: nodeGroup ? nodeGroup.position.clone() : new Vector3().setFromMatrixPosition(nodeMatrix),
|
|
@@ -38268,7 +38162,7 @@ void main() {
|
|
|
38268
38162
|
structure,
|
|
38269
38163
|
extras: nodeDef.extras,
|
|
38270
38164
|
geometryExtents,
|
|
38271
|
-
handle
|
|
38165
|
+
handle,
|
|
38272
38166
|
});
|
|
38273
38167
|
}
|
|
38274
38168
|
if (nodeDef.children) {
|
|
@@ -38851,6 +38745,8 @@ void main() {
|
|
|
38851
38745
|
let currentVertexOffset = 0;
|
|
38852
38746
|
for (const mesh of group.objects) {
|
|
38853
38747
|
const geometry = mesh.geometry.clone();
|
|
38748
|
+
mesh.updateWorldMatrix(true, false);
|
|
38749
|
+
geometry.applyMatrix4(mesh.matrixWorld);
|
|
38854
38750
|
const handle = mesh.userData.handle;
|
|
38855
38751
|
if (!this.objectIdToIndex.has(handle)) {
|
|
38856
38752
|
this.objectIdToIndex.set(handle, this.maxObjectId++);
|
|
@@ -38956,9 +38852,12 @@ void main() {
|
|
|
38956
38852
|
vertexCount,
|
|
38957
38853
|
});
|
|
38958
38854
|
currentVertexOffset += vertexCount;
|
|
38855
|
+
line.updateWorldMatrix(true, false);
|
|
38856
|
+
const matrix = line.matrixWorld;
|
|
38959
38857
|
const vector = new Vector3();
|
|
38960
38858
|
for (let i = 0; i < vertexCount; i++) {
|
|
38961
38859
|
vector.fromBufferAttribute(positionAttr, i);
|
|
38860
|
+
vector.applyMatrix4(matrix);
|
|
38962
38861
|
positions[posOffset++] = vector.x;
|
|
38963
38862
|
positions[posOffset++] = vector.y;
|
|
38964
38863
|
positions[posOffset++] = vector.z;
|
|
@@ -39037,6 +38936,8 @@ void main() {
|
|
|
39037
38936
|
for (const line of group.objects) {
|
|
39038
38937
|
isEdge = line.userData.isEdge;
|
|
39039
38938
|
const geometry = line.geometry.clone();
|
|
38939
|
+
line.updateWorldMatrix(true, false);
|
|
38940
|
+
geometry.applyMatrix4(line.matrixWorld);
|
|
39040
38941
|
const handle = line.userData.handle;
|
|
39041
38942
|
if (!this.objectIdToIndex.has(handle)) {
|
|
39042
38943
|
this.objectIdToIndex.set(handle, this.maxObjectId++);
|
|
@@ -39121,6 +39022,8 @@ void main() {
|
|
|
39121
39022
|
const handles = new Set();
|
|
39122
39023
|
for (const points of group.objects) {
|
|
39123
39024
|
const geometry = points.geometry.clone();
|
|
39025
|
+
points.updateWorldMatrix(true, false);
|
|
39026
|
+
geometry.applyMatrix4(points.matrixWorld);
|
|
39124
39027
|
geometries.push(geometry);
|
|
39125
39028
|
optimizedObjects.push(points);
|
|
39126
39029
|
handles.add(points.userData.handle);
|
|
@@ -39171,6 +39074,7 @@ void main() {
|
|
|
39171
39074
|
const hasNormals = lineSegmentsArray.some((segment) => segment.geometry.attributes.normal !== undefined);
|
|
39172
39075
|
lineSegmentsArray.forEach((segment) => {
|
|
39173
39076
|
const clonedGeometry = segment.geometry.clone();
|
|
39077
|
+
segment.updateWorldMatrix(true, false);
|
|
39174
39078
|
clonedGeometry.applyMatrix4(segment.matrixWorld);
|
|
39175
39079
|
if (hasNormals && !clonedGeometry.attributes.normal) {
|
|
39176
39080
|
clonedGeometry.computeVertexNormals();
|