@maqiuyao/dxf-viewer 0.1.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/README.md +79 -0
- package/dist/assets/vite-project.css +1 -0
- package/dist/dxf-viewer.cjs +1533 -0
- package/dist/dxf-viewer.js +33490 -0
- package/dist/src/dxfViewer/core/Configs.d.ts +250 -0
- package/dist/src/dxfViewer/core/Constants.d.ts +76 -0
- package/dist/src/dxfViewer/core/Units.d.ts +16 -0
- package/dist/src/dxfViewer/core/VersionManager.d.ts +14 -0
- package/dist/src/dxfViewer/core/camera/CameraManager.d.ts +81 -0
- package/dist/src/dxfViewer/core/camera/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/camera-controls/CameraControls.d.ts +744 -0
- package/dist/src/dxfViewer/core/camera-controls/Constants.d.ts +2 -0
- package/dist/src/dxfViewer/core/camera-controls/EventDispatcher.d.ts +42 -0
- package/dist/src/dxfViewer/core/camera-controls/index.d.ts +2 -0
- package/dist/src/dxfViewer/core/camera-controls/types.d.ts +112 -0
- package/dist/src/dxfViewer/core/camera-controls/utils/extractClientCoordFromEvent.d.ts +7 -0
- package/dist/src/dxfViewer/core/camera-controls/utils/math-utils.d.ts +14 -0
- package/dist/src/dxfViewer/core/camera-controls/utils/notSupportedInOrthographicCamera.d.ts +2 -0
- package/dist/src/dxfViewer/core/canvas/CanvasRender.d.ts +49 -0
- package/dist/src/dxfViewer/core/canvas/Constants.d.ts +28 -0
- package/dist/src/dxfViewer/core/canvas/Drawable.d.ts +87 -0
- package/dist/src/dxfViewer/core/canvas/DrawableList.d.ts +40 -0
- package/dist/src/dxfViewer/core/canvas/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/compare/BaseDxfCompareHelper.d.ts +104 -0
- package/dist/src/dxfViewer/core/compare/CompareDrawable.d.ts +30 -0
- package/dist/src/dxfViewer/core/compare/DxfCompareHelper.d.ts +76 -0
- package/dist/src/dxfViewer/core/compare/DxfCompareMarkupManager.d.ts +11 -0
- package/dist/src/dxfViewer/core/compare/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/components/Container.d.ts +38 -0
- package/dist/src/dxfViewer/core/components/ProgressBar.d.ts +31 -0
- package/dist/src/dxfViewer/core/components/Spinner.d.ts +13 -0
- package/dist/src/dxfViewer/core/components/index.d.ts +3 -0
- package/dist/src/dxfViewer/core/controls/CameraControlsEx.d.ts +33 -0
- package/dist/src/dxfViewer/core/controls/Control.d.ts +17 -0
- package/dist/src/dxfViewer/core/controls/OrbitControls.d.ts +13 -0
- package/dist/src/dxfViewer/core/controls/PlanControls.d.ts +13 -0
- package/dist/src/dxfViewer/core/controls/index.d.ts +3 -0
- package/dist/src/dxfViewer/core/dxf/DxfCompare.d.ts +170 -0
- package/dist/src/dxfViewer/core/dxf/DxfConstants.d.ts +24 -0
- package/dist/src/dxfViewer/core/dxf/DxfLoader.d.ts +569 -0
- package/dist/src/dxfViewer/core/dxf/DxfObject.d.ts +44 -0
- package/dist/src/dxfViewer/core/dxf/DxfUtils.d.ts +79 -0
- package/dist/src/dxfViewer/core/dxf/HatchPatternShaders.d.ts +12 -0
- package/dist/src/dxfViewer/core/dxf/LinePatternShaders.d.ts +12 -0
- package/dist/src/dxfViewer/core/dxf/bspline.d.ts +7 -0
- package/dist/src/dxfViewer/core/dxf/dxfom-mtext.d.ts +46 -0
- package/dist/src/dxfViewer/core/dxf/dxfom-text.d.ts +16 -0
- package/dist/src/dxfViewer/core/dxf/index.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf/round10.d.ts +1 -0
- package/dist/src/dxfViewer/core/dxf-parser/AutoCadColorIndex.d.ts +8 -0
- package/dist/src/dxfViewer/core/dxf-parser/DxfBaseReader.d.ts +13 -0
- package/dist/src/dxfViewer/core/dxf-parser/DxfBinaryReader.d.ts +14 -0
- package/dist/src/dxfViewer/core/dxf-parser/DxfParser.d.ts +321 -0
- package/dist/src/dxfViewer/core/dxf-parser/DxfTextReader.d.ts +30 -0
- package/dist/src/dxfViewer/core/dxf-parser/ParseHelpers.d.ts +18 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/3dface.d.ts +11 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/arc.d.ts +16 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/attdef.d.ts +31 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/attrib.d.ts +31 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/circle.d.ts +13 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/dimension.d.ts +22 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/ellipse.d.ts +15 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/geomtry.d.ts +40 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/hatch.d.ts +104 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/image.d.ts +37 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/insert.d.ts +21 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/leader.d.ts +20 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/line.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/lwpolyline.d.ts +17 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/mleader.d.ts +97 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/mtext.d.ts +18 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/ole2frame.d.ts +18 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/point.d.ts +11 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/polyline.d.ts +19 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/ray.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/region.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/seqend.d.ts +8 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/solid.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/spline.d.ts +23 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/table.d.ts +44 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/text.d.ts +18 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/vertex.d.ts +23 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/viewport.d.ts +46 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/xline.d.ts +10 -0
- package/dist/src/dxfViewer/core/dxf-parser/index.d.ts +27 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/common.d.ts +15 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/dictionary.d.ts +19 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/imagedef.d.ts +24 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/layout.d.ts +26 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/sortentstable.d.ts +12 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/spatialfilter.d.ts +22 -0
- package/dist/src/dxfViewer/core/dxf-parser/objects/xrecord.d.ts +11 -0
- package/dist/src/dxfViewer/core/effect/EffectManager.d.ts +43 -0
- package/dist/src/dxfViewer/core/effect/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/font/BaseFont.d.ts +41 -0
- package/dist/src/dxfViewer/core/font/FontManager.d.ts +52 -0
- package/dist/src/dxfViewer/core/font/MeshFont.d.ts +14 -0
- package/dist/src/dxfViewer/core/font/ShxFont.d.ts +49 -0
- package/dist/src/dxfViewer/core/font/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/font/shx/ExtraLettersTemplate.d.ts +4 -0
- package/dist/src/dxfViewer/core/font/shx/Shx.constants.d.ts +20 -0
- package/dist/src/dxfViewer/core/font/shx/ShxParser.d.ts +18 -0
- package/dist/src/dxfViewer/core/font/shx/TextShape.d.ts +24 -0
- package/dist/src/dxfViewer/core/font/shx/gbk/index.d.ts +3 -0
- package/dist/src/dxfViewer/core/font/shx/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/font/shx/util/BitConverter.d.ts +21 -0
- package/dist/src/dxfViewer/core/geometry-offset/Edge.d.ts +27 -0
- package/dist/src/dxfViewer/core/geometry-offset/Offset.d.ts +46 -0
- package/dist/src/dxfViewer/core/geometry-offset/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/helpers/BinaryReader.d.ts +23 -0
- package/dist/src/dxfViewer/core/helpers/BoxSelectHelper.d.ts +44 -0
- package/dist/src/dxfViewer/core/helpers/InstantiateHelper.d.ts +26 -0
- package/dist/src/dxfViewer/core/helpers/LoadingHelper.d.ts +59 -0
- package/dist/src/dxfViewer/core/helpers/MeshBvhHelper.d.ts +15 -0
- package/dist/src/dxfViewer/core/helpers/MobileTouchHelperDrawable.d.ts +26 -0
- package/dist/src/dxfViewer/core/helpers/OSnapHelper.d.ts +158 -0
- package/dist/src/dxfViewer/core/helpers/ObjectPixelSizeHelper.d.ts +13 -0
- package/dist/src/dxfViewer/core/helpers/PickMarkupHelper.d.ts +29 -0
- package/dist/src/dxfViewer/core/helpers/RafHelper.d.ts +18 -0
- package/dist/src/dxfViewer/core/helpers/ZoomToRectHelper.d.ts +24 -0
- package/dist/src/dxfViewer/core/helpers/index.d.ts +11 -0
- package/dist/src/dxfViewer/core/index.d.ts +19 -0
- package/dist/src/dxfViewer/core/indexeddb/BaseTable.d.ts +36 -0
- package/dist/src/dxfViewer/core/indexeddb/DxfDataTable.d.ts +22 -0
- package/dist/src/dxfViewer/core/indexeddb/FontDataTable.d.ts +32 -0
- package/dist/src/dxfViewer/core/indexeddb/IndexedDbManager.d.ts +50 -0
- package/dist/src/dxfViewer/core/indexeddb/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/input-manager/InputManager.d.ts +146 -0
- package/dist/src/dxfViewer/core/input-manager/index.d.ts +2 -0
- package/dist/src/dxfViewer/core/materials/BimTilesHighlightMaterial.d.ts +21 -0
- package/dist/src/dxfViewer/core/materials/BimTilesMaterial.d.ts +32 -0
- package/dist/src/dxfViewer/core/materials/BimTilesPickMaterial.d.ts +14 -0
- package/dist/src/dxfViewer/core/materials/BimTilesTransparentMaterial.d.ts +20 -0
- package/dist/src/dxfViewer/core/materials/StandardMaterialEx.d.ts +29 -0
- package/dist/src/dxfViewer/core/materials/constants.d.ts +4 -0
- package/dist/src/dxfViewer/core/materials/index.d.ts +5 -0
- package/dist/src/dxfViewer/core/model/Constants.d.ts +58 -0
- package/dist/src/dxfViewer/core/model/Model.d.ts +18 -0
- package/dist/src/dxfViewer/core/model/Model2d.d.ts +144 -0
- package/dist/src/dxfViewer/core/model/Model3d.d.ts +111 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BatchedMeshesParser.d.ts +26 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesConfigParser.d.ts +43 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesData.d.ts +280 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesMaterialManager.d.ts +139 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesModel.d.ts +70 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesPropertyParser.d.ts +45 -0
- package/dist/src/dxfViewer/core/model/bimtiles/BimTilesRenderer.d.ts +59 -0
- package/dist/src/dxfViewer/core/model/bimtiles/InstancedMeshesParser.d.ts +41 -0
- package/dist/src/dxfViewer/core/model/bimtiles/TileParser.d.ts +14 -0
- package/dist/src/dxfViewer/core/model/bimtiles/Utils.d.ts +29 -0
- package/dist/src/dxfViewer/core/model/index.d.ts +6 -0
- package/dist/src/dxfViewer/core/patches/Constants.d.ts +6 -0
- package/dist/src/dxfViewer/core/patches/Line.d.ts +3 -0
- package/dist/src/dxfViewer/core/patches/Mesh.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/Points.d.ts +3 -0
- package/dist/src/dxfViewer/core/patches/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/patches/shaders/ShaderChunk.d.ts +143 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/common_ex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/id_pars_vertex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/id_vertex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/outine_bc_vertex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/outline_bc_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/outline_bc_pars_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/outline_bc_pars_vertex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/state_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/state_highlight_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/state_pars_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderChunk/state_transparent_fragment.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderLib/pick_ex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/patches/shaders/shaderLib/standard_ex.glsl.d.ts +2 -0
- package/dist/src/dxfViewer/core/pick/PickManager.d.ts +54 -0
- package/dist/src/dxfViewer/core/pick/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/scene/SceneManager.d.ts +43 -0
- package/dist/src/dxfViewer/core/scene/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/shp-js/BitView.d.ts +12 -0
- package/dist/src/dxfViewer/core/shp-js/SHPLoader.d.ts +12 -0
- package/dist/src/dxfViewer/core/shp-js/Shp.d.ts +10 -0
- package/dist/src/dxfViewer/core/shp-js/ShpThree.d.ts +24 -0
- package/dist/src/dxfViewer/core/shp-js/index.d.ts +4 -0
- package/dist/src/dxfViewer/core/text-texture/TextTexture.d.ts +45 -0
- package/dist/src/dxfViewer/core/undo/Command.d.ts +6 -0
- package/dist/src/dxfViewer/core/undo/UndoManager.d.ts +24 -0
- package/dist/src/dxfViewer/core/undo/index.d.ts +2 -0
- package/dist/src/dxfViewer/core/utils/CSS2DObjectUtils.d.ts +14 -0
- package/dist/src/dxfViewer/core/utils/CancelablePromise.d.ts +6 -0
- package/dist/src/dxfViewer/core/utils/ColorUtils.d.ts +21 -0
- package/dist/src/dxfViewer/core/utils/CommonUtils.d.ts +129 -0
- package/dist/src/dxfViewer/core/utils/CoordinateUtils.d.ts +81 -0
- package/dist/src/dxfViewer/core/utils/DecimalPrecisionUtils.d.ts +10 -0
- package/dist/src/dxfViewer/core/utils/DeviceUtils.d.ts +15 -0
- package/dist/src/dxfViewer/core/utils/EdgeUtils.d.ts +14 -0
- package/dist/src/dxfViewer/core/utils/Event.d.ts +34 -0
- package/dist/src/dxfViewer/core/utils/ExportUtils.d.ts +61 -0
- package/dist/src/dxfViewer/core/utils/FpsUtils.d.ts +13 -0
- package/dist/src/dxfViewer/core/utils/GeometryUtils.d.ts +78 -0
- package/dist/src/dxfViewer/core/utils/Locale.d.ts +22 -0
- package/dist/src/dxfViewer/core/utils/LogUtils.d.ts +7 -0
- package/dist/src/dxfViewer/core/utils/MaterialUtils.d.ts +40 -0
- package/dist/src/dxfViewer/core/utils/MathUtils.d.ts +41 -0
- package/dist/src/dxfViewer/core/utils/MergeUtils.d.ts +120 -0
- package/dist/src/dxfViewer/core/utils/ObjectUtils.d.ts +215 -0
- package/dist/src/dxfViewer/core/utils/PolygonUtils.d.ts +9 -0
- package/dist/src/dxfViewer/core/utils/SVGObjectUtils.d.ts +22 -0
- package/dist/src/dxfViewer/core/utils/SceneUtils.d.ts +26 -0
- package/dist/src/dxfViewer/core/utils/SectionUtils.d.ts +11 -0
- package/dist/src/dxfViewer/core/utils/SimplifyUtils.d.ts +15 -0
- package/dist/src/dxfViewer/core/utils/TextUtils.d.ts +37 -0
- package/dist/src/dxfViewer/core/utils/TextureUtils.d.ts +16 -0
- package/dist/src/dxfViewer/core/utils/UnitConversionUtils.d.ts +31 -0
- package/dist/src/dxfViewer/core/utils/Viewer3dUtils.d.ts +25 -0
- package/dist/src/dxfViewer/core/utils/index.d.ts +26 -0
- package/dist/src/dxfViewer/core/viewers/BaseViewer.d.ts +248 -0
- package/dist/src/dxfViewer/core/viewers/BimTilesViewer.d.ts +126 -0
- package/dist/src/dxfViewer/core/viewers/Constants.d.ts +9 -0
- package/dist/src/dxfViewer/core/viewers/Plugin.d.ts +29 -0
- package/dist/src/dxfViewer/core/viewers/Viewer2d.d.ts +405 -0
- package/dist/src/dxfViewer/core/viewers/Viewer3d.d.ts +130 -0
- package/dist/src/dxfViewer/core/viewers/Viewer3dLite.d.ts +143 -0
- package/dist/src/dxfViewer/core/viewers/ViewerEvent.d.ts +96 -0
- package/dist/src/dxfViewer/core/viewers/index.d.ts +8 -0
- package/dist/src/dxfViewer/core/webcam/WebCam.d.ts +27 -0
- package/dist/src/dxfViewer/core/webcam/index.d.ts +1 -0
- package/dist/src/dxfViewer/core/workers/CreateMeshBvh.worker.d.ts +1 -0
- package/dist/src/dxfViewer/core/workers/GenerateMeshBvhWorker.d.ts +17 -0
- package/dist/src/dxfViewer/core/workers/index.d.ts +1 -0
- package/dist/src/dxfViewer/lib.d.ts +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { IconClass } from '../Configs';
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class CommonUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Checks full screen mode
|
|
9
|
+
*/
|
|
10
|
+
static isFullScreen(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Enters full screen mode
|
|
13
|
+
*/
|
|
14
|
+
static fullScreen(element?: HTMLElement): void;
|
|
15
|
+
/**
|
|
16
|
+
* Exits full screen mode
|
|
17
|
+
*/
|
|
18
|
+
static exitFullscreen(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Join strings
|
|
21
|
+
* @param args
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
static joinStrings(...args: string[]): string;
|
|
25
|
+
/**
|
|
26
|
+
* Converts a number to a string with proper fraction digits
|
|
27
|
+
*/
|
|
28
|
+
static numberToString(num: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Converts a byte number to proper units(Kilobyte, Megabyte, Gigabyte, etc.)
|
|
31
|
+
* @param num
|
|
32
|
+
*/
|
|
33
|
+
static byteCountToString(num: number): string;
|
|
34
|
+
static hexToBase64(hexstring: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Converts vector to a string with proper fraction digits
|
|
37
|
+
*/
|
|
38
|
+
static vectorToString(vec: THREE.Vector2 | THREE.Vector3 | number[]): string;
|
|
39
|
+
/**
|
|
40
|
+
* Converts number array to THREE.Vector2
|
|
41
|
+
*/
|
|
42
|
+
static arrayToVector2(arr: number[] | THREE.Vector2 | undefined): THREE.Vector2 | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Converts number array to THREE.Vector3
|
|
45
|
+
* If length of arr is 2, will assign z value to 0
|
|
46
|
+
*/
|
|
47
|
+
static arrayToVector3(arr: number[] | THREE.Vector3 | undefined): THREE.Vector3 | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Converts number array to THREE.Euler
|
|
50
|
+
*/
|
|
51
|
+
static arrayToEuler(arr: number[] | THREE.Euler | undefined): THREE.Euler | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Converts number array to THREE.Vector3
|
|
54
|
+
*/
|
|
55
|
+
static arrayOrObjectToVector3(arrOrObj: number[] | THREE.Vector2 | THREE.Vector3 | undefined): THREE.Vector3 | undefined;
|
|
56
|
+
static isVectorValid(vec: THREE.Vector2 | THREE.Vector3): boolean;
|
|
57
|
+
static isBoxValid(box: THREE.Box2 | THREE.Box3): boolean;
|
|
58
|
+
static isMatrixValid(matrix: THREE.Matrix4): boolean;
|
|
59
|
+
static guid(): string;
|
|
60
|
+
/**
|
|
61
|
+
* Expands given box by a scale factor
|
|
62
|
+
*/
|
|
63
|
+
static expandBoxByScale(box: THREE.Box3, scale: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* Expands given box by a min size
|
|
66
|
+
*/
|
|
67
|
+
static expandBoxByMinSize(box: THREE.Box3, minSize: number): void;
|
|
68
|
+
/**
|
|
69
|
+
* Generate random integers in the range [min, max]
|
|
70
|
+
*/
|
|
71
|
+
static generateRandomInt(min: number, max: number): number;
|
|
72
|
+
/**
|
|
73
|
+
* Round to N decimal places
|
|
74
|
+
*/
|
|
75
|
+
static roundNumber(value: number, n: number): number;
|
|
76
|
+
static convertDecimalToHex(decimal: number | string): string;
|
|
77
|
+
static canvasToImage(canvas: HTMLCanvasElement): Promise<HTMLImageElement>;
|
|
78
|
+
/**
|
|
79
|
+
* Takes screenshot to given rendering context and return base64 string in png/jpeg format.
|
|
80
|
+
* @param bbox If valid, takes screenshot of a sub image with given bounding box in screen coordinate.
|
|
81
|
+
*/
|
|
82
|
+
static renderingContextToImage(context: CanvasRenderingContext2D, bbox?: THREE.Box2, type?: string, quality?: number): string;
|
|
83
|
+
/**
|
|
84
|
+
* Prints memory usage
|
|
85
|
+
*/
|
|
86
|
+
static printMemory(title: string): void;
|
|
87
|
+
static printGpuInfo(webgl: WebGLRenderingContext): void;
|
|
88
|
+
static getExtension(url: string): string;
|
|
89
|
+
static isBinaryFile(url: string): boolean;
|
|
90
|
+
static isGzip(data: Uint8Array): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Sleep a while
|
|
93
|
+
*/
|
|
94
|
+
static sleep(ms: number): Promise<void>;
|
|
95
|
+
private static twinklingObjectIds;
|
|
96
|
+
/**
|
|
97
|
+
* Twinkle the object several times
|
|
98
|
+
*/
|
|
99
|
+
static twinkle(obj: THREE.Object3D, ms?: number): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Gets a function to update progress.
|
|
102
|
+
* @param onProgress onProgress callback.
|
|
103
|
+
*/
|
|
104
|
+
static getUpdateProgressFunc(onProgress?: (e: ProgressEvent) => void): (progress: number) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Gets an async function to update progress.
|
|
107
|
+
* The reason to use async function is, in order to give UI thread chance to update the progress!
|
|
108
|
+
* @param onProgress onProgress callback.
|
|
109
|
+
*/
|
|
110
|
+
static getUpdateProgressFuncAsync(onProgress?: (e: ProgressEvent) => void): (progress: number) => Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Gets an async function to update progress for a for/while loop.
|
|
113
|
+
* @param total Total number of a for/while loop.
|
|
114
|
+
* @param onProgress onProgress callback.
|
|
115
|
+
*/
|
|
116
|
+
static getUpdateProgressFuncForLoop(total: number, onProgress?: (e: ProgressEvent) => void): (i: number) => Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Gets a function to update sub progress, which has a progress range limitation according to its parent progress.
|
|
119
|
+
* @param min Min range number between 0-100
|
|
120
|
+
* @param max Max range number between 0-100
|
|
121
|
+
* @param onProgress onProgress callback.
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
static getUpdateSubProgressFunc(min: number, max: number, onProgress?: (e: ProgressEvent) => void): (e: ProgressEvent) => void;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
export declare const setIcon: (classList: DOMTokenList, iconClass: IconClass, active: boolean) => void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { EventInfo, IPointerEvent } from '../../core/input-manager/InputManager';
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* Some concepts:
|
|
6
|
+
*
|
|
7
|
+
* 1. Screen coordinate:
|
|
8
|
+
* (0, 0)
|
|
9
|
+
* ----------------------> x
|
|
10
|
+
* | |
|
|
11
|
+
* | |
|
|
12
|
+
* | |
|
|
13
|
+
* | |
|
|
14
|
+
* |___________________|
|
|
15
|
+
* y (1024, 768) e.g.
|
|
16
|
+
*
|
|
17
|
+
* 2. Normalized screen coordinate:
|
|
18
|
+
* (0, 0)
|
|
19
|
+
* ----------------------> x
|
|
20
|
+
* | |
|
|
21
|
+
* | |
|
|
22
|
+
* | |
|
|
23
|
+
* | |
|
|
24
|
+
* |___________________|
|
|
25
|
+
* y (1, 1)
|
|
26
|
+
*
|
|
27
|
+
* 3. NDC: Normalized Device Coordinates
|
|
28
|
+
* ^ y (1, 1)
|
|
29
|
+
* |
|
|
30
|
+
* (-1, 0) |(0, 0) (1, 0)
|
|
31
|
+
* ----------------------> x
|
|
32
|
+
* |
|
|
33
|
+
* |
|
|
34
|
+
* (-1, -1)
|
|
35
|
+
*
|
|
36
|
+
* 4. World Coordinates
|
|
37
|
+
* ^ y
|
|
38
|
+
* |
|
|
39
|
+
* | / x
|
|
40
|
+
* | /
|
|
41
|
+
* | /
|
|
42
|
+
* ---------------> z
|
|
43
|
+
* (0, 0)
|
|
44
|
+
*/
|
|
45
|
+
export declare class CoordinateUtils {
|
|
46
|
+
/**
|
|
47
|
+
* Gets screen coordinate by pointer event.
|
|
48
|
+
*/
|
|
49
|
+
static getScreenCoordinateByEvent(event: IPointerEvent | EventInfo | MouseEvent | PointerEvent, container: HTMLElement): THREE.Vector2;
|
|
50
|
+
/**
|
|
51
|
+
* Gets screen coordinate by touch event.
|
|
52
|
+
*/
|
|
53
|
+
static getScreenCoordinateByTouchEvent(event: TouchEvent, container: HTMLElement): THREE.Vector2;
|
|
54
|
+
/**
|
|
55
|
+
* Converts world to screen coordinate.
|
|
56
|
+
*/
|
|
57
|
+
static world2Screen(vector: THREE.Vector3, camera: THREE.Camera, container: HTMLElement): THREE.Vector2;
|
|
58
|
+
/**
|
|
59
|
+
* Converts a bbox under world coordinate to screen coordinate.
|
|
60
|
+
*/
|
|
61
|
+
static worldBBox2Screen(bbox: THREE.Box3, camera: THREE.Camera, container: HTMLElement): THREE.Box2;
|
|
62
|
+
/**
|
|
63
|
+
* Converts screen to world coordinate.
|
|
64
|
+
*/
|
|
65
|
+
static screen2World(vector: THREE.Vector2, camera: THREE.Camera, container: HTMLElement): THREE.Vector3;
|
|
66
|
+
/**
|
|
67
|
+
* Converts screen point to NDC coordinate.
|
|
68
|
+
* @description {en} Normalized screen coordinate: bottom-left(-1, -1), top-right(1, 1).
|
|
69
|
+
* @description {zh} 标准化屏幕坐标:左下角(-1, -1), 右上角(1, 1)。
|
|
70
|
+
* @description {en} World coordinate to normalized screen coordinate(0-1).
|
|
71
|
+
* @description {zh} 世界坐标转标准化屏幕坐标(0-1)。
|
|
72
|
+
*/
|
|
73
|
+
static screen2Ndc(vector: THREE.Vector2, camera: THREE.Camera, container: HTMLElement): THREE.Vector2;
|
|
74
|
+
/**
|
|
75
|
+
* @description {en} Normalized screen coordinate: top-left(0, 0), bottom-right(1, 1).
|
|
76
|
+
* @description {zh} 标准化屏幕坐标:左上角(0, 0), 右下角(1, 1)。
|
|
77
|
+
* @description {en} World coordinate to normalized screen coordinate(0-1).
|
|
78
|
+
* @description {zh} 世界坐标转标准化屏幕坐标(0-1)。
|
|
79
|
+
*/
|
|
80
|
+
static world2NormalizedScreen(worldCoord: THREE.Vector2 | THREE.Vector3, camera: THREE.Camera, container: HTMLElement): THREE.Vector2;
|
|
81
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device util class
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare class DeviceUtils {
|
|
6
|
+
/**
|
|
7
|
+
* Checks if it is opened in touch screen device, like iphone, ipad, etc.
|
|
8
|
+
*/
|
|
9
|
+
static isTouchScreenDevice(): boolean;
|
|
10
|
+
static printDeviceInfo(): void;
|
|
11
|
+
static creatReactNativeCanvas(context: WebGLRenderingContext | WebGL2RenderingContext | CanvasRenderingContext2D): HTMLCanvasElement;
|
|
12
|
+
static isMobile: boolean;
|
|
13
|
+
static isBrowser: boolean;
|
|
14
|
+
static isNode: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export declare class EdgeUtils {
|
|
3
|
+
/**
|
|
4
|
+
* reference to buildEdgeIndices from xeokit
|
|
5
|
+
*/
|
|
6
|
+
static buildEdge(positions: Float32Array, indices: Uint32Array | Uint16Array | Uint8Array, edgeThreshold?: number): Uint32Array | Uint16Array;
|
|
7
|
+
/**
|
|
8
|
+
* Calculate the barycentric coordinates of each vertex of the geometry
|
|
9
|
+
* TODO: Temporarily do not handle the following cases.
|
|
10
|
+
* - When there is no solution, it is necessary to expand the vertices
|
|
11
|
+
* The algorithm also has performance issues!
|
|
12
|
+
*/
|
|
13
|
+
static buildBarycentrics(geometry: THREE.BufferGeometry): boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type Handler<T = any> = (val: T) => void;
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare class Event<Events extends Record<string, any> = {}> {
|
|
6
|
+
private map;
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
addEventListener<EventName extends keyof Events>(name: EventName, handler: Handler<Events[EventName]>): void;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
dispatchEvent<EventName extends keyof Events>(name: EventName, value?: Events[EventName]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Checks if there is a listener
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
hasEventListener<EventName extends keyof Events>(name: EventName): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Removes all event listeners
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
removeEventListener(): void;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
removeEventListener<EventName extends keyof Events>(name: EventName): void;
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
removeEventListener<EventName extends keyof Events>(name: EventName, handler: Handler<Events[EventName]>): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DRACOExporterOptions } from 'three/examples/jsm/exporters/DRACOExporter';
|
|
2
|
+
import { GLTFExporterOptions } from 'three/examples/jsm/exporters/GLTFExporter';
|
|
3
|
+
import * as THREE from "three";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class ExportUtils {
|
|
8
|
+
static EXTENSION_GLTF: string;
|
|
9
|
+
static EXTENSION_GLB: string;
|
|
10
|
+
static EXTENSION_OBJ: string;
|
|
11
|
+
static EXTENSION_DRACO: string;
|
|
12
|
+
static EXTENSION_JSON: string;
|
|
13
|
+
static EXTENSION_STL: string;
|
|
14
|
+
private static downloadLink;
|
|
15
|
+
/**
|
|
16
|
+
* Exports given object to gltf file
|
|
17
|
+
*/
|
|
18
|
+
static exportToGltf(input: THREE.Object3D, filename: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Exports given object to glb file
|
|
21
|
+
*/
|
|
22
|
+
static exportToGlb(input: THREE.Object3D, filename: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Exports given object to gltf/glb file
|
|
25
|
+
* @param input given object
|
|
26
|
+
* @param filename filename without path, nor extension
|
|
27
|
+
* @param options
|
|
28
|
+
*/
|
|
29
|
+
static exportToGltfOrGlb(input: THREE.Object3D, filename: string, options?: GLTFExporterOptions): void;
|
|
30
|
+
/**
|
|
31
|
+
* Exports given object to obj file
|
|
32
|
+
*/
|
|
33
|
+
static exportToObj(input: THREE.Object3D, filename: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Exports given object to draco(drc) file
|
|
36
|
+
*/
|
|
37
|
+
static exportToDraco(input: THREE.Mesh, filename: string, options?: DRACOExporterOptions): void;
|
|
38
|
+
/**
|
|
39
|
+
* Exports given object to stl file
|
|
40
|
+
*/
|
|
41
|
+
static exportToStl(input: THREE.Object3D, filename: string, binary?: boolean): void;
|
|
42
|
+
/**
|
|
43
|
+
* Exports to threejs json
|
|
44
|
+
* @param input
|
|
45
|
+
* @param filename
|
|
46
|
+
*/
|
|
47
|
+
static exportToThreeJsJson(input: THREE.Object3D, filename: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Saves blob as file
|
|
50
|
+
*/
|
|
51
|
+
static save(blob: Blob, filename: string): void;
|
|
52
|
+
static saveArrayBuffer(buffer: ArrayBuffer, filename: string): void;
|
|
53
|
+
static saveJson(json: object, filename: string): void;
|
|
54
|
+
static saveJsonString(jsonString: string, filename: string): void;
|
|
55
|
+
static saveString(str: string, filename: string): void;
|
|
56
|
+
static saveDataView(dataView: DataView, filename: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Adds extention if missing
|
|
59
|
+
*/
|
|
60
|
+
private static addExtention;
|
|
61
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export interface ILine {
|
|
6
|
+
start: THREE.Vector3;
|
|
7
|
+
end: THREE.Vector3;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* GeometryUtils class
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare class GeometryUtils {
|
|
14
|
+
/**
|
|
15
|
+
* Compares two materials
|
|
16
|
+
*/
|
|
17
|
+
static geometriesEqual(g1: THREE.BufferGeometry, g2: THREE.BufferGeometry): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if two types equal each other.
|
|
20
|
+
* This method requires type T defined 'equals' method.
|
|
21
|
+
*/
|
|
22
|
+
private static equal;
|
|
23
|
+
private static attributesEqual;
|
|
24
|
+
private static bufferAttributesEqual;
|
|
25
|
+
/**
|
|
26
|
+
* Converts InterleavedBufferAttribute to BufferAttribute, because mergeGeometries doesn't support InterleavedBufferAttribute.
|
|
27
|
+
* If it is supported by Three.js one day, we should remove this method.
|
|
28
|
+
*/
|
|
29
|
+
static tryConvertInterleavedBufferAttributes(geometry: THREE.BufferGeometry): void;
|
|
30
|
+
/**
|
|
31
|
+
* Determines if the 2d point is inside the polygon
|
|
32
|
+
*/
|
|
33
|
+
static isPointInPolygon(point: THREE.Vector2, polygon: THREE.Vector2[], includeOnSide?: boolean): boolean;
|
|
34
|
+
static caculateGeometryCenter(geometry: THREE.BufferGeometry): THREE.Vector3 | null;
|
|
35
|
+
static isConvex(polygon: THREE.Vector2[]): boolean;
|
|
36
|
+
static areLineSegmentsIntersecting(line1: ILine, line2: ILine): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Tries to get intersection point of two line segments.
|
|
39
|
+
* Returns undefined in case two line segments don't intersect with each other.
|
|
40
|
+
*/
|
|
41
|
+
static getLineSegmentsIntersectingPoint(line1: ILine, line2: ILine): THREE.Vector3 | null | undefined;
|
|
42
|
+
static isPointOnLineSegment(point: THREE.Vector3, line: ILine, epsilon?: number): boolean;
|
|
43
|
+
static isPointOnLineSegments(point: THREE.Vector3, lines: THREE.Vector3[], epsilon?: number): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if we should rebase points in case their values are big, and do rebase if necessary
|
|
46
|
+
*/
|
|
47
|
+
static checkAndRebasePositionsOnRTC(positions: THREE.Vector3[] | THREE.Vector2[], offset: THREE.Vector3): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Checks if we should rebase a point in case its value is too large
|
|
50
|
+
*/
|
|
51
|
+
static shouldRebasePositionOnRTC(vector: THREE.Vector3 | THREE.Vector2): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Calculates surface area
|
|
54
|
+
*/
|
|
55
|
+
static calculateSurfaceArea(geometry: THREE.BufferGeometry): number;
|
|
56
|
+
/**
|
|
57
|
+
* Converts indexes of type line_strip to line
|
|
58
|
+
* for merge
|
|
59
|
+
*/
|
|
60
|
+
static convertLineStripToLine(geometry: THREE.BufferGeometry, bLoop?: boolean): void;
|
|
61
|
+
/**
|
|
62
|
+
* Convert an indexed geometry to a non-indexed geometry. Can be used for dashed line style.
|
|
63
|
+
*/
|
|
64
|
+
static convertGeometryWithIndexedToNonIndexed(geometry: THREE.BufferGeometry): THREE.BufferGeometry;
|
|
65
|
+
static createGeometryAttributeByIndex(attribute: THREE.BufferAttribute, indexBuffer: THREE.BufferAttribute): THREE.BufferAttribute;
|
|
66
|
+
/**
|
|
67
|
+
* Gets start/end point of a line segment by given index
|
|
68
|
+
*/
|
|
69
|
+
static getLineEndPointsByIndex(line: THREE.Line, index: number): THREE.Vector3[];
|
|
70
|
+
static arePolygonsIntersect(polygon1: THREE.Vector2[], polygon2: THREE.Vector2[]): boolean;
|
|
71
|
+
static getLineLineIntersectionPoint(a: THREE.Vector2, b: THREE.Vector2, c: THREE.Vector2, d: THREE.Vector2, epsilon?: number): THREE.Vector2 | undefined;
|
|
72
|
+
static getOffsetPoint(a: THREE.Vector2, b: THREE.Vector2, offset: number): THREE.Vector2;
|
|
73
|
+
static convertSimpleWidthLineToMeshGeometry(points: THREE.Vector2[], width: number): THREE.BufferGeometry<THREE.NormalBufferAttributes> | undefined;
|
|
74
|
+
static convertWidthLineToMeshGeometry(points: THREE.Vector2[], width: number): THREE.BufferGeometry<THREE.NormalBufferAttributes> | undefined;
|
|
75
|
+
static releaseGeometryManually(geometry: THREE.BufferGeometry): void;
|
|
76
|
+
static getAdjacentNonRepeatPoints(points: THREE.Vector3[], epsilon?: number): THREE.Vector3[];
|
|
77
|
+
static mergeBBoxes(bboxes: THREE.Box3[]): THREE.Box3[];
|
|
78
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as i18next } from 'i18next';
|
|
2
|
+
export declare const en: {
|
|
3
|
+
ProgressBar: {
|
|
4
|
+
Loading: string;
|
|
5
|
+
Comparing: string;
|
|
6
|
+
};
|
|
7
|
+
Tooltip: {
|
|
8
|
+
boxSelect: string;
|
|
9
|
+
pickMarkup: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const cn: {
|
|
13
|
+
ProgressBar: {
|
|
14
|
+
Loading: string;
|
|
15
|
+
Comparing: string;
|
|
16
|
+
};
|
|
17
|
+
Tooltip: {
|
|
18
|
+
boxSelect: string;
|
|
19
|
+
pickMarkup: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const i18n: ReturnType<typeof i18next.createInstance>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* MaterialUtils class
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class MaterialUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Compares two materials
|
|
9
|
+
*/
|
|
10
|
+
static materialEquals(m1: THREE.Material, m2: THREE.Material): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Compares two materials, which could be material or material array
|
|
13
|
+
*/
|
|
14
|
+
static materialsEquals(m1: THREE.Material | THREE.Material[], m2: THREE.Material | THREE.Material[]): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Compares two colors
|
|
17
|
+
*/
|
|
18
|
+
static colorEquals(c1: THREE.Color, c2: THREE.Color): boolean;
|
|
19
|
+
static clonedHighlightMaterials(mesh: THREE.Mesh | THREE.Line | THREE.Points, options?: {
|
|
20
|
+
depthTest?: boolean;
|
|
21
|
+
highlightColor?: THREE.Color;
|
|
22
|
+
opacity?: number;
|
|
23
|
+
}): THREE.Material | THREE.Material[] | undefined;
|
|
24
|
+
static clonedHighlightMaterial(material: THREE.Material, options?: {
|
|
25
|
+
depthTest?: boolean;
|
|
26
|
+
highlightColor?: THREE.Color;
|
|
27
|
+
opacity?: number;
|
|
28
|
+
}): THREE.Material;
|
|
29
|
+
/**
|
|
30
|
+
* Clone given material(s)
|
|
31
|
+
*/
|
|
32
|
+
static cloneMaterial(material: THREE.Material | THREE.Material[]): THREE.Material | THREE.Material[];
|
|
33
|
+
static getMaterialColor(material: THREE.Material | THREE.Material[]): THREE.Color;
|
|
34
|
+
static setMaterialColor(material: THREE.Material | THREE.Material[], color: THREE.Color): void;
|
|
35
|
+
static setMaterialOpacity(material: THREE.Material | THREE.Material[], opacity: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Clone object's materials
|
|
38
|
+
*/
|
|
39
|
+
static cloneMaterials(object: THREE.Object3D): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare class MathUtils {
|
|
6
|
+
static roundNumber(value: number, n: number): number;
|
|
7
|
+
static floorNumber(value: number, n: number): number;
|
|
8
|
+
static areNumbersEqual(a: number, b: number, epsilon?: number): boolean;
|
|
9
|
+
static areVector2sEqual(a: THREE.Vector2, b: THREE.Vector2, epsilon?: number): boolean;
|
|
10
|
+
static areVector3sEqual(a: THREE.Vector3, b: THREE.Vector3, epsilon?: number): boolean;
|
|
11
|
+
static areNumbersClose(a: number, b: number, ref_tol?: number, abs_tol?: number): boolean;
|
|
12
|
+
static areVector2sClose(point1: THREE.Vector2, point2: THREE.Vector2, ref_tol?: number, abs_tol?: number): boolean;
|
|
13
|
+
static areVectorsClose(point1: THREE.Vector3, point2: THREE.Vector3, ref_tol?: number, abs_tol?: number): boolean;
|
|
14
|
+
static getArcAngleSpanInRadian(startAngle: number, endAngle: number): number;
|
|
15
|
+
static getIntegerPartLength(num: number): number;
|
|
16
|
+
static getRelativeEps(num: number, epsilon?: number): number;
|
|
17
|
+
static getVector2RelativeEps(vec: THREE.Vector2, epsilon?: number): number;
|
|
18
|
+
static getControlPointByTwoPoints(p1: THREE.Vector2, p2: THREE.Vector2): THREE.Vector2;
|
|
19
|
+
static convertPointFromUEToGltf(point: THREE.Vector3): THREE.Vector3;
|
|
20
|
+
static convertPointFromGltfToUE(point: THREE.Vector3): THREE.Vector3;
|
|
21
|
+
static convertPointFromUEToRevit(point: THREE.Vector3): THREE.Vector3;
|
|
22
|
+
static convertPointFromRevitToUE(point: THREE.Vector3): THREE.Vector3;
|
|
23
|
+
static getBox(point1: THREE.Vector3, point2: THREE.Vector3): number[];
|
|
24
|
+
static getCenter(box: THREE.Box3): {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
z: number;
|
|
28
|
+
};
|
|
29
|
+
static convertBoxFromGltfToUE(box: THREE.Box3): number[];
|
|
30
|
+
static convertBoxFromUEToGltf(box: THREE.Box3): number[];
|
|
31
|
+
static convertBoxFromRevitToUE(box: THREE.Box3): number[];
|
|
32
|
+
static convertBoxFromUEToRevit(box: THREE.Box3): number[];
|
|
33
|
+
static clamp(value: number, min: number, max: number): number;
|
|
34
|
+
static getLookAtMatrix(eye: THREE.Vector3, target: THREE.Vector3, up: THREE.Vector3): number[];
|
|
35
|
+
static getLocationFromMatrix(matrix: THREE.Matrix4): THREE.Vector3;
|
|
36
|
+
static toDegrees(radians: number): number;
|
|
37
|
+
static toRadians(degrees: number): number;
|
|
38
|
+
static signNotZero(v: number): 1 | -1;
|
|
39
|
+
static fromSnorm(value: number, maxRange: number): number;
|
|
40
|
+
static OctDecode(vec2: THREE.Vector2, vec3: THREE.Vector3, maxRange: number): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* Used for merged mesh
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface Batch {
|
|
7
|
+
batchId: number;
|
|
8
|
+
name?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
positionStart: number;
|
|
11
|
+
positionCount: number;
|
|
12
|
+
indexStart: number;
|
|
13
|
+
indexCount: number;
|
|
14
|
+
boundingSphere?: THREE.Sphere;
|
|
15
|
+
userData?: object;
|
|
16
|
+
parentUserData?: object;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* MergeHelper class is used to merge child objects for a given object
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare class MergeUtils {
|
|
23
|
+
static MergeInfo: {
|
|
24
|
+
removedObjects: number;
|
|
25
|
+
mergedMeshes: number;
|
|
26
|
+
mergedLines: number;
|
|
27
|
+
mergedPoints: number;
|
|
28
|
+
mergedUnknownTypeObjects: number;
|
|
29
|
+
elapsedTime: number;
|
|
30
|
+
};
|
|
31
|
+
static resetMergeInfo(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Merges child objects for given object.
|
|
34
|
+
* it tries to merge objects in the same level and with the same parent;
|
|
35
|
+
* @param saveBatchInfo caller can set saveBatchInfo to true, so that s/he can
|
|
36
|
+
* get the object's original data before merged.
|
|
37
|
+
* While this takes some extra space, so, we'd like to add a flag here.
|
|
38
|
+
*/
|
|
39
|
+
static merge(object: THREE.Object3D, saveBatchInfo?: boolean): void;
|
|
40
|
+
/**
|
|
41
|
+
* Merges child objects of given object.
|
|
42
|
+
* If objects' material are the same, they can be merged.
|
|
43
|
+
*/
|
|
44
|
+
private static mergeInner;
|
|
45
|
+
/**
|
|
46
|
+
* @param object parent object or THREE.Object3D[]
|
|
47
|
+
* @param i index of for object.children[]
|
|
48
|
+
* @param k index of for object.children[]
|
|
49
|
+
* @param dict to store merge-able object
|
|
50
|
+
* @param nonMergeIndexes used in order to improve performance
|
|
51
|
+
*/
|
|
52
|
+
private static tryHandleMergeableObjects;
|
|
53
|
+
/**
|
|
54
|
+
* TODO: Filters XC etc.
|
|
55
|
+
* there are cases where entities with xc and without xc are merged together
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* Merges all objects of given object, just leaf children.
|
|
59
|
+
* If objects' material are the same, they can be merged.
|
|
60
|
+
* Better to call mergeInner first then deepMerge for a better performance.
|
|
61
|
+
* return { "added": THREE.Object3D[], "removed": THREE.Object3D[] }
|
|
62
|
+
*/
|
|
63
|
+
static deepMerge(objects: THREE.Object3D[], levelObject?: THREE.Object3D | undefined, bRemovedAndAddedAfterMerge?: boolean, bRemoveEmptyObjectsAfterMerge?: boolean, saveBatchInfo?: boolean): {
|
|
64
|
+
added: THREE.Object3D[];
|
|
65
|
+
removed: THREE.Object3D[];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* since we'll move geometry to another merged mesh under a group, below is the structure:
|
|
69
|
+
- root object
|
|
70
|
+
- merged objects group
|
|
71
|
+
- merged object 1
|
|
72
|
+
* need to consider a geomery's matrix for each level of ancestor
|
|
73
|
+
*/
|
|
74
|
+
private static applyMatrix;
|
|
75
|
+
/**
|
|
76
|
+
* Merges geometries for lines
|
|
77
|
+
*/
|
|
78
|
+
static mergeLineGeometries(geometries: THREE.BufferGeometry[], saveBatchInfo: boolean, isDashedMaterial: boolean, batches?: Batch[]): THREE.BufferGeometry | undefined;
|
|
79
|
+
private static mergeBufferGeometriesWithLinesToLineSegments;
|
|
80
|
+
private static mergeBufferAttributesWithLinesToLineSegments;
|
|
81
|
+
/**
|
|
82
|
+
* Removes a number from array
|
|
83
|
+
*/
|
|
84
|
+
private static removeFromArray;
|
|
85
|
+
/**
|
|
86
|
+
* Removes object from objects
|
|
87
|
+
*/
|
|
88
|
+
static removeObjectFromArray(arr: THREE.Object3D[], toBeDeleted: THREE.Object3D): void;
|
|
89
|
+
/**
|
|
90
|
+
* Checks if two geometries are mergable.
|
|
91
|
+
* It requires they have the same type and the same attributes.
|
|
92
|
+
*/
|
|
93
|
+
static areGeometriesMergeable(g1: THREE.BufferGeometry, g2: THREE.BufferGeometry): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Checks if two objects are mergable.
|
|
96
|
+
* It requires
|
|
97
|
+
* - They are with the same masks.
|
|
98
|
+
* - Their userData.layerName must be the same if there is. This is useful for Dxf.
|
|
99
|
+
* - They have the same type or the same draw type( Mesh or Line or Point).
|
|
100
|
+
*/
|
|
101
|
+
static areObjectsMergeable(o1: THREE.Object3D, o2: THREE.Object3D): any;
|
|
102
|
+
/**
|
|
103
|
+
* Checks if it is a merged object
|
|
104
|
+
*/
|
|
105
|
+
static isMergedMesh(mesh: THREE.Mesh): boolean;
|
|
106
|
+
static isFaceIndexInBatch(geometry: THREE.BufferGeometry, batch: Batch, faceIndex: number): boolean;
|
|
107
|
+
static getBatchByFaceIndex(mesh: THREE.Mesh, faceIndex: number): Batch | undefined;
|
|
108
|
+
static getBatchByLineIndex(line: THREE.Line, index: number): Batch | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Gets batchId by faceIndex for a merged mesh
|
|
111
|
+
*/
|
|
112
|
+
static getBatchIdByFaceIndex(mesh: THREE.Mesh, faceIndex: number): number;
|
|
113
|
+
static getBatchByBatchId(mesh: THREE.Mesh, batchId: number): Batch | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Clones corresponding geometry for given batch.
|
|
116
|
+
* To do this, we'll clone the geometry so the matrix, material, normal, uv, etc.
|
|
117
|
+
* will be correct, and we'll remove extra index and position.
|
|
118
|
+
*/
|
|
119
|
+
static cloneGeometryForBatch(mesh: THREE.Mesh, batch: Batch): THREE.BufferGeometry | undefined;
|
|
120
|
+
}
|