@x-viewer/core 0.9.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.
Files changed (238) hide show
  1. package/README.md +2 -0
  2. package/dist/index.esm.js +11790 -0
  3. package/dist/types/Locale.d.ts +23 -0
  4. package/dist/types/components/dxf-layout-bar/DxfLayoutBar.d.ts +26 -0
  5. package/dist/types/components/dxf-layout-bar/index.d.ts +1 -0
  6. package/dist/types/components/tool-tip/Tooltip.d.ts +20 -0
  7. package/dist/types/components/tool-tip/index.d.ts +1 -0
  8. package/dist/types/core/Configs.d.ts +288 -0
  9. package/dist/types/core/Constants.d.ts +81 -0
  10. package/dist/types/core/Units.d.ts +16 -0
  11. package/dist/types/core/VersionManager.d.ts +14 -0
  12. package/dist/types/core/camera/CameraManager.d.ts +80 -0
  13. package/dist/types/core/camera/index.d.ts +1 -0
  14. package/dist/types/core/camera-controls/CameraControls.d.ts +744 -0
  15. package/dist/types/core/camera-controls/Constants.d.ts +2 -0
  16. package/dist/types/core/camera-controls/EventDispatcher.d.ts +41 -0
  17. package/dist/types/core/camera-controls/index.d.ts +3 -0
  18. package/dist/types/core/camera-controls/types.d.ts +112 -0
  19. package/dist/types/core/camera-controls/utils/extractClientCoordFromEvent.d.ts +3 -0
  20. package/dist/types/core/camera-controls/utils/math-utils.d.ts +14 -0
  21. package/dist/types/core/camera-controls/utils/notSupportedInOrthographicCamera.d.ts +2 -0
  22. package/dist/types/core/canvas/CanvasRender.d.ts +52 -0
  23. package/dist/types/core/canvas/Constants.d.ts +31 -0
  24. package/dist/types/core/canvas/Drawable.d.ts +98 -0
  25. package/dist/types/core/canvas/DrawableList.d.ts +40 -0
  26. package/dist/types/core/canvas/MarkerDrawable.d.ts +30 -0
  27. package/dist/types/core/canvas/PathDrawable.d.ts +39 -0
  28. package/dist/types/core/canvas/index.d.ts +6 -0
  29. package/dist/types/core/compare/BaseDxfCompareHelper.d.ts +104 -0
  30. package/dist/types/core/compare/CompareDrawable.d.ts +18 -0
  31. package/dist/types/core/compare/DxfCompareHelper.d.ts +69 -0
  32. package/dist/types/core/compare/DxfCompareMarkupManager.d.ts +11 -0
  33. package/dist/types/core/compare/index.d.ts +4 -0
  34. package/dist/types/core/components/Container.d.ts +38 -0
  35. package/dist/types/core/components/ProgressBar.d.ts +31 -0
  36. package/dist/types/core/components/Spinner.d.ts +16 -0
  37. package/dist/types/core/components/index.d.ts +3 -0
  38. package/dist/types/core/controls/CameraControlsEx.d.ts +37 -0
  39. package/dist/types/core/controls/Control.d.ts +17 -0
  40. package/dist/types/core/controls/OrbitControls.d.ts +13 -0
  41. package/dist/types/core/controls/PlanControls.d.ts +13 -0
  42. package/dist/types/core/controls/index.d.ts +4 -0
  43. package/dist/types/core/dxf/DxfCompare.d.ts +151 -0
  44. package/dist/types/core/dxf/DxfConstants.d.ts +33 -0
  45. package/dist/types/core/dxf/DxfLoader.d.ts +557 -0
  46. package/dist/types/core/dxf/DxfObject.d.ts +33 -0
  47. package/dist/types/core/dxf/DxfUtils.d.ts +45 -0
  48. package/dist/types/core/dxf/HatchPatternShaders.d.ts +12 -0
  49. package/dist/types/core/dxf/LinePatternShaders.d.ts +12 -0
  50. package/dist/types/core/dxf/bspline.d.ts +7 -0
  51. package/dist/types/core/dxf/dxfom-mtext.d.ts +46 -0
  52. package/dist/types/core/dxf/dxfom-text.d.ts +16 -0
  53. package/dist/types/core/dxf/index.d.ts +10 -0
  54. package/dist/types/core/dxf/round10.d.ts +1 -0
  55. package/dist/types/core/dxf-parser/AutoCadColorIndex.d.ts +8 -0
  56. package/dist/types/core/dxf-parser/DxfBaseReader.d.ts +12 -0
  57. package/dist/types/core/dxf-parser/DxfBinaryReader.d.ts +14 -0
  58. package/dist/types/core/dxf-parser/DxfParser.d.ts +324 -0
  59. package/dist/types/core/dxf-parser/DxfTextReader.d.ts +31 -0
  60. package/dist/types/core/dxf-parser/ParseHelpers.d.ts +45 -0
  61. package/dist/types/core/dxf-parser/entities/3dface.d.ts +13 -0
  62. package/dist/types/core/dxf-parser/entities/arc.d.ts +18 -0
  63. package/dist/types/core/dxf-parser/entities/attdef.d.ts +33 -0
  64. package/dist/types/core/dxf-parser/entities/attrib.d.ts +33 -0
  65. package/dist/types/core/dxf-parser/entities/circle.d.ts +15 -0
  66. package/dist/types/core/dxf-parser/entities/dimension.d.ts +24 -0
  67. package/dist/types/core/dxf-parser/entities/ellipse.d.ts +17 -0
  68. package/dist/types/core/dxf-parser/entities/geomtry.d.ts +42 -0
  69. package/dist/types/core/dxf-parser/entities/hatch.d.ts +110 -0
  70. package/dist/types/core/dxf-parser/entities/image.d.ts +39 -0
  71. package/dist/types/core/dxf-parser/entities/insert.d.ts +22 -0
  72. package/dist/types/core/dxf-parser/entities/leader.d.ts +23 -0
  73. package/dist/types/core/dxf-parser/entities/line.d.ts +12 -0
  74. package/dist/types/core/dxf-parser/entities/lwpolyline.d.ts +23 -0
  75. package/dist/types/core/dxf-parser/entities/mleader.d.ts +103 -0
  76. package/dist/types/core/dxf-parser/entities/mtext.d.ts +20 -0
  77. package/dist/types/core/dxf-parser/entities/ole2frame.d.ts +22 -0
  78. package/dist/types/core/dxf-parser/entities/point.d.ts +13 -0
  79. package/dist/types/core/dxf-parser/entities/polyline.d.ts +22 -0
  80. package/dist/types/core/dxf-parser/entities/ray.d.ts +12 -0
  81. package/dist/types/core/dxf-parser/entities/region.d.ts +12 -0
  82. package/dist/types/core/dxf-parser/entities/seqend.d.ts +10 -0
  83. package/dist/types/core/dxf-parser/entities/solid.d.ts +12 -0
  84. package/dist/types/core/dxf-parser/entities/spline.d.ts +25 -0
  85. package/dist/types/core/dxf-parser/entities/table.d.ts +44 -0
  86. package/dist/types/core/dxf-parser/entities/text.d.ts +20 -0
  87. package/dist/types/core/dxf-parser/entities/vertex.d.ts +22 -0
  88. package/dist/types/core/dxf-parser/entities/viewport.d.ts +56 -0
  89. package/dist/types/core/dxf-parser/entities/xline.d.ts +12 -0
  90. package/dist/types/core/dxf-parser/index.d.ts +27 -0
  91. package/dist/types/core/dxf-parser/objects/common.d.ts +26 -0
  92. package/dist/types/core/dxf-parser/objects/dictionary.d.ts +23 -0
  93. package/dist/types/core/dxf-parser/objects/imagedef.d.ts +24 -0
  94. package/dist/types/core/dxf-parser/objects/layout.d.ts +29 -0
  95. package/dist/types/core/dxf-parser/objects/sortentstable.d.ts +12 -0
  96. package/dist/types/core/dxf-parser/objects/spatialfilter.d.ts +22 -0
  97. package/dist/types/core/dxf-parser/objects/xrecord.d.ts +11 -0
  98. package/dist/types/core/effect/EffectManager.d.ts +43 -0
  99. package/dist/types/core/effect/index.d.ts +1 -0
  100. package/dist/types/core/font/BaseFont.d.ts +41 -0
  101. package/dist/types/core/font/FontManager.d.ts +52 -0
  102. package/dist/types/core/font/MeshFont.d.ts +14 -0
  103. package/dist/types/core/font/ShxFont.d.ts +49 -0
  104. package/dist/types/core/font/index.d.ts +1 -0
  105. package/dist/types/core/font/shx/ExtraLettersTemplate.d.ts +4 -0
  106. package/dist/types/core/font/shx/Shx.constants.d.ts +20 -0
  107. package/dist/types/core/font/shx/ShxParser.d.ts +18 -0
  108. package/dist/types/core/font/shx/TextShape.d.ts +24 -0
  109. package/dist/types/core/font/shx/gbk/index.d.ts +4 -0
  110. package/dist/types/core/font/shx/index.d.ts +1 -0
  111. package/dist/types/core/font/shx/util/BitConverter.d.ts +18 -0
  112. package/dist/types/core/geometry-offset/Edge.d.ts +27 -0
  113. package/dist/types/core/geometry-offset/Offset.d.ts +46 -0
  114. package/dist/types/core/geometry-offset/index.d.ts +1 -0
  115. package/dist/types/core/helpers/BinaryReader.d.ts +23 -0
  116. package/dist/types/core/helpers/BoxSelectHelper.d.ts +44 -0
  117. package/dist/types/core/helpers/InstantiateHelper.d.ts +26 -0
  118. package/dist/types/core/helpers/LoadingHelper.d.ts +65 -0
  119. package/dist/types/core/helpers/MeshBvhHelper.d.ts +15 -0
  120. package/dist/types/core/helpers/MobileTouchHelperDrawable.d.ts +26 -0
  121. package/dist/types/core/helpers/OSnapHelper.d.ts +159 -0
  122. package/dist/types/core/helpers/ObjectPixelSizeHelper.d.ts +13 -0
  123. package/dist/types/core/helpers/PickMarkupHelper.d.ts +29 -0
  124. package/dist/types/core/helpers/RafHelper.d.ts +18 -0
  125. package/dist/types/core/helpers/ZoomToRectHelper.d.ts +20 -0
  126. package/dist/types/core/helpers/index.d.ts +11 -0
  127. package/dist/types/core/index.d.ts +24 -0
  128. package/dist/types/core/indexeddb/BaseTable.d.ts +36 -0
  129. package/dist/types/core/indexeddb/DxfDataTable.d.ts +22 -0
  130. package/dist/types/core/indexeddb/FontDataTable.d.ts +32 -0
  131. package/dist/types/core/indexeddb/IndexedDbManager.d.ts +49 -0
  132. package/dist/types/core/indexeddb/index.d.ts +4 -0
  133. package/dist/types/core/input-manager/InputManager.d.ts +147 -0
  134. package/dist/types/core/input-manager/index.d.ts +1 -0
  135. package/dist/types/core/interactions/Interaction.d.ts +10 -0
  136. package/dist/types/core/interactions/Viewer2dInteraction.d.ts +17 -0
  137. package/dist/types/core/interactions/Viewer3dInteraction.d.ts +26 -0
  138. package/dist/types/core/interactions/index.d.ts +1 -0
  139. package/dist/types/core/materials/BimTilesHighlightMaterial.d.ts +21 -0
  140. package/dist/types/core/materials/BimTilesMaterial.d.ts +26 -0
  141. package/dist/types/core/materials/BimTilesPickMaterial.d.ts +9 -0
  142. package/dist/types/core/materials/BimTilesTransparentMaterial.d.ts +20 -0
  143. package/dist/types/core/materials/StandardMaterialEx.d.ts +16 -0
  144. package/dist/types/core/materials/constants.d.ts +0 -0
  145. package/dist/types/core/materials/index.d.ts +5 -0
  146. package/dist/types/core/model/Constants.d.ts +58 -0
  147. package/dist/types/core/model/Model.d.ts +18 -0
  148. package/dist/types/core/model/Model2d.d.ts +142 -0
  149. package/dist/types/core/model/Model3d.d.ts +137 -0
  150. package/dist/types/core/model/bimtiles/BatchedMeshesParser.d.ts +26 -0
  151. package/dist/types/core/model/bimtiles/BimTilesConfigParser.d.ts +43 -0
  152. package/dist/types/core/model/bimtiles/BimTilesData.d.ts +280 -0
  153. package/dist/types/core/model/bimtiles/BimTilesMaterialManager.d.ts +139 -0
  154. package/dist/types/core/model/bimtiles/BimTilesModel.d.ts +67 -0
  155. package/dist/types/core/model/bimtiles/BimTilesPropertyParser.d.ts +42 -0
  156. package/dist/types/core/model/bimtiles/BimTilesRenderer.d.ts +49 -0
  157. package/dist/types/core/model/bimtiles/InstancedMeshesParser.d.ts +37 -0
  158. package/dist/types/core/model/bimtiles/TileParser.d.ts +11 -0
  159. package/dist/types/core/model/bimtiles/Utils.d.ts +29 -0
  160. package/dist/types/core/model/index.d.ts +6 -0
  161. package/dist/types/core/patches/Constants.d.ts +6 -0
  162. package/dist/types/core/patches/Line.d.ts +2 -0
  163. package/dist/types/core/patches/Mesh.d.ts +2 -0
  164. package/dist/types/core/patches/Points.d.ts +2 -0
  165. package/dist/types/core/patches/index.d.ts +4 -0
  166. package/dist/types/core/patches/shaders/ShaderChunk.d.ts +2 -0
  167. package/dist/types/core/patches/shaders/shaderChunk/common_ex.glsl.d.ts +2 -0
  168. package/dist/types/core/patches/shaders/shaderChunk/id_pars_vertex.glsl.d.ts +2 -0
  169. package/dist/types/core/patches/shaders/shaderChunk/id_vertex.glsl.d.ts +2 -0
  170. package/dist/types/core/patches/shaders/shaderChunk/outine_bc_vertex.glsl.d.ts +2 -0
  171. package/dist/types/core/patches/shaders/shaderChunk/outline_bc_fragment.glsl.d.ts +2 -0
  172. package/dist/types/core/patches/shaders/shaderChunk/outline_bc_pars_fragment.glsl.d.ts +2 -0
  173. package/dist/types/core/patches/shaders/shaderChunk/outline_bc_pars_vertex.glsl.d.ts +2 -0
  174. package/dist/types/core/patches/shaders/shaderChunk/state_fragment.glsl.d.ts +2 -0
  175. package/dist/types/core/patches/shaders/shaderChunk/state_highlight_fragment.glsl.d.ts +2 -0
  176. package/dist/types/core/patches/shaders/shaderChunk/state_pars_fragment.glsl.d.ts +2 -0
  177. package/dist/types/core/patches/shaders/shaderChunk/state_transparent_fragment.glsl.d.ts +2 -0
  178. package/dist/types/core/patches/shaders/shaderLib/pick_ex.glsl.d.ts +2 -0
  179. package/dist/types/core/patches/shaders/shaderLib/standard_ex.glsl.d.ts +2 -0
  180. package/dist/types/core/pick/PickManager.d.ts +52 -0
  181. package/dist/types/core/pick/index.d.ts +1 -0
  182. package/dist/types/core/scene/SceneManager.d.ts +48 -0
  183. package/dist/types/core/scene/index.d.ts +1 -0
  184. package/dist/types/core/shp-js/BitView.d.ts +12 -0
  185. package/dist/types/core/shp-js/SHPLoader.d.ts +12 -0
  186. package/dist/types/core/shp-js/Shp.d.ts +10 -0
  187. package/dist/types/core/shp-js/ShpThree.d.ts +23 -0
  188. package/dist/types/core/shp-js/index.d.ts +4 -0
  189. package/dist/types/core/text-texture/TextTexture.d.ts +45 -0
  190. package/dist/types/core/text-texture/index.d.ts +1 -0
  191. package/dist/types/core/undo/Command.d.ts +6 -0
  192. package/dist/types/core/undo/UndoManager.d.ts +24 -0
  193. package/dist/types/core/undo/index.d.ts +2 -0
  194. package/dist/types/core/utils/CSS2DObjectUtils.d.ts +14 -0
  195. package/dist/types/core/utils/CancelablePromise.d.ts +6 -0
  196. package/dist/types/core/utils/ColorUtils.d.ts +25 -0
  197. package/dist/types/core/utils/CommonUtils.d.ts +141 -0
  198. package/dist/types/core/utils/CoordinateUtils.d.ts +81 -0
  199. package/dist/types/core/utils/DecimalPrecisionUtils.d.ts +10 -0
  200. package/dist/types/core/utils/DeviceUtils.d.ts +15 -0
  201. package/dist/types/core/utils/EdgeUtils.d.ts +14 -0
  202. package/dist/types/core/utils/Event.d.ts +33 -0
  203. package/dist/types/core/utils/ExportUtils.d.ts +61 -0
  204. package/dist/types/core/utils/FpsUtils.d.ts +13 -0
  205. package/dist/types/core/utils/GeometryUtils.d.ts +78 -0
  206. package/dist/types/core/utils/LodashUtils.d.ts +208 -0
  207. package/dist/types/core/utils/LogUtils.d.ts +29 -0
  208. package/dist/types/core/utils/MaterialUtils.d.ts +40 -0
  209. package/dist/types/core/utils/MathUtils.d.ts +41 -0
  210. package/dist/types/core/utils/MergeUtils.d.ts +126 -0
  211. package/dist/types/core/utils/ObjectUtils.d.ts +216 -0
  212. package/dist/types/core/utils/PolygonUtils.d.ts +9 -0
  213. package/dist/types/core/utils/SVGObjectUtils.d.ts +22 -0
  214. package/dist/types/core/utils/SceneUtils.d.ts +26 -0
  215. package/dist/types/core/utils/SectionUtils.d.ts +11 -0
  216. package/dist/types/core/utils/SimplifyUtils.d.ts +15 -0
  217. package/dist/types/core/utils/TextureUtils.d.ts +16 -0
  218. package/dist/types/core/utils/UVUtils.d.ts +21 -0
  219. package/dist/types/core/utils/UnitConversionUtils.d.ts +31 -0
  220. package/dist/types/core/utils/index.d.ts +26 -0
  221. package/dist/types/core/viewers/BaseViewer.d.ts +253 -0
  222. package/dist/types/core/viewers/BimTilesViewer.d.ts +130 -0
  223. package/dist/types/core/viewers/Constants.d.ts +9 -0
  224. package/dist/types/core/viewers/Plugin.d.ts +30 -0
  225. package/dist/types/core/viewers/Viewer2d.d.ts +413 -0
  226. package/dist/types/core/viewers/Viewer3d.d.ts +136 -0
  227. package/dist/types/core/viewers/Viewer3dLite.d.ts +144 -0
  228. package/dist/types/core/viewers/ViewerEvent.d.ts +108 -0
  229. package/dist/types/core/viewers/index.d.ts +8 -0
  230. package/dist/types/core/webcam/WebCam.d.ts +28 -0
  231. package/dist/types/core/webcam/index.d.ts +1 -0
  232. package/dist/types/core/workers/CreateMeshBvh.worker.d.ts +1 -0
  233. package/dist/types/core/workers/GenerateMeshBvhWorker.d.ts +17 -0
  234. package/dist/types/core/workers/index.d.ts +1 -0
  235. package/dist/types/export.doc.d.ts +9 -0
  236. package/dist/types/index.d.ts +23 -0
  237. package/dist/types/version.d.ts +2 -0
  238. package/package.json +88 -0
@@ -0,0 +1,81 @@
1
+ import * as THREE from "three";
2
+ import type { EventInfo, IPointerEvent } from "../../core/input-manager/InputManager";
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,10 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare const DecimalPrecisionRange: {
5
+ [key: string]: number;
6
+ };
7
+ /**
8
+ * @internal
9
+ */
10
+ export declare const showPrecisionValue: (value: number, precistionType: number) => string;
@@ -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 isMobile: boolean;
12
+ static creatReactNativeCanvas(context: WebGLRenderingContext | WebGL2RenderingContext | CanvasRenderingContext2D): HTMLCanvasElement;
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): Uint16Array | Uint32Array;
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,33 @@
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
+ /**
8
+ * @internal
9
+ */
10
+ addEventListener<EventName extends keyof Events>(name: EventName, handler: Handler<Events[EventName]>): void;
11
+ /**
12
+ * @internal
13
+ */
14
+ dispatchEvent<EventName extends keyof Events>(name: EventName, value?: Events[EventName]): void;
15
+ /**
16
+ * Checks if there is a listener
17
+ * @internal
18
+ */
19
+ hasEventListener<EventName extends keyof Events>(name: EventName): boolean;
20
+ /**
21
+ * Removes all event listeners
22
+ * @internal
23
+ */
24
+ removeEventListener(): void;
25
+ /**
26
+ * @internal
27
+ */
28
+ removeEventListener<EventName extends keyof Events>(name: EventName): void;
29
+ /**
30
+ * @internal
31
+ */
32
+ removeEventListener<EventName extends keyof Events>(name: EventName, handler: Handler<Events[EventName]>): void;
33
+ }
@@ -0,0 +1,61 @@
1
+ import * as THREE from "three";
2
+ import type { DRACOExporterOptions } from "three/examples/jsm/exporters/DRACOExporter";
3
+ import type { GLTFExporterOptions } from "three/examples/jsm/exporters/GLTFExporter";
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,13 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare class FpsUtils {
5
+ private prevTime;
6
+ private beginTime;
7
+ private frames;
8
+ fps: number;
9
+ constructor();
10
+ begin(): void;
11
+ end(): number;
12
+ update(): void;
13
+ }
@@ -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, THREE.BufferGeometryEventMap> | undefined;
74
+ static convertWidthLineToMeshGeometry(points: THREE.Vector2[], width: number): THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap> | 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,208 @@
1
+ /**
2
+ * Creates a shallow clone of an object or array.
3
+ *
4
+ * For primitive values, returns the value as-is. For objects and arrays,
5
+ * creates a new instance with the same properties or elements.
6
+ *
7
+ * @template T - The type of the object to clone.
8
+ * @param {T} obj - The object to clone.
9
+ * @returns {T} A shallow clone of the object.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { clone } from "./LodashUtils"
14
+ *
15
+ * const original = { a: 1, b: 2 }
16
+ * const cloned = clone(original)
17
+ * cloned.a = 3
18
+ * console.log(original.a) // 1 (unchanged)
19
+ * console.log(cloned.a) // 3
20
+ *
21
+ * const arr = [1, 2, 3]
22
+ * const clonedArr = clone(arr) // [1, 2, 3]
23
+ * ```
24
+ */
25
+ export declare function clone<T>(obj: T): T;
26
+ /**
27
+ * Assigns own enumerable properties of source objects to the destination object
28
+ * for all destination properties that resolve to undefined.
29
+ *
30
+ * This function fills in undefined properties in an object with the first value
31
+ * present in any of the source objects. Source objects are applied from left to right.
32
+ *
33
+ * @param {Record<string, unknown>} obj - The destination object.
34
+ * @param {...Record<string, unknown>[]} sources - The source objects.
35
+ * @returns {Record<string, unknown>} The destination object.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * import { defaults } from "./LodashUtils"
40
+ *
41
+ * const object = { a: 1 }
42
+ * const result = defaults(object, { b: 2 }, { a: 3, c: 3 })
43
+ * console.log(result) // { a: 1, b: 2, c: 3 }
44
+ *
45
+ * // undefined properties are filled in
46
+ * const partial = { a: 1, b: undefined }
47
+ * defaults(partial, { b: 2, c: 3 })
48
+ * console.log(partial) // { a: 1, b: 2, c: 3 }
49
+ * ```
50
+ */
51
+ export declare function defaults(obj: Record<string, unknown>, ...sources: Record<string, unknown>[]): Record<string, unknown>;
52
+ /**
53
+ * Checks if path is a direct property of object.
54
+ *
55
+ * This function checks whether the specified property exists directly on the object
56
+ * (not inherited from its prototype chain).
57
+ *
58
+ * @param {Record<string, unknown>} obj - The object to query.
59
+ * @param {string} path - The path to check.
60
+ * @returns {boolean} Returns true if path exists, else false.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * import { has } from "./LodashUtils"
65
+ *
66
+ * const object = { a: 1, b: 2 }
67
+ * has(object, "a") // true
68
+ * has(object, "c") // false
69
+ * has(object, "toString") // false (inherited property)
70
+ * ```
71
+ */
72
+ export declare function has(obj: Record<string, unknown>, path: string): boolean;
73
+ /**
74
+ * Checks if value is an empty object, collection, map, or set.
75
+ *
76
+ * Values are considered empty if they are:
77
+ * - null or undefined
78
+ * - Arrays or strings with length 0
79
+ * - Maps or Sets with size 0
80
+ * - Objects with no enumerable properties
81
+ *
82
+ * @param {unknown} value - The value to check.
83
+ * @returns {boolean} Returns true if value is empty, else false.
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * import { isEmpty } from "./LodashUtils"
88
+ *
89
+ * isEmpty(null) // true
90
+ * isEmpty(undefined) // true
91
+ * isEmpty("") // true
92
+ * isEmpty([]) // true
93
+ * isEmpty({}) // true
94
+ * isEmpty(new Map()) // true
95
+ * isEmpty(new Set()) // true
96
+ * isEmpty("hello") // false
97
+ * isEmpty([1, 2, 3]) // false
98
+ * isEmpty({ a: 1 }) // false
99
+ * ```
100
+ */
101
+ export declare function isEmpty(value: unknown): boolean;
102
+ /**
103
+ * Performs a deep comparison between two values to determine if they are equivalent.
104
+ *
105
+ * This function recursively compares objects and arrays, checking that all nested
106
+ * properties and elements are equal. Handles null/undefined values, primitive types,
107
+ * arrays, and plain objects.
108
+ *
109
+ * @param {unknown} value - The value to compare.
110
+ * @param {unknown} other - The other value to compare.
111
+ * @returns {boolean} Returns true if the values are equivalent, else false.
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * import { isEqual } from "./LodashUtils"
116
+ *
117
+ * isEqual(1, 1) // true
118
+ * isEqual("hello", "hello") // true
119
+ * isEqual([1, 2], [1, 2]) // true
120
+ * isEqual({ a: 1 }, { a: 1 }) // true
121
+ * isEqual([1, 2], [2, 1]) // false
122
+ * isEqual({ a: 1 }, { a: 2 }) // false
123
+ *
124
+ * // Deep comparison
125
+ * const obj1 = { a: { b: 1 } }
126
+ * const obj2 = { a: { b: 1 } }
127
+ * isEqual(obj1, obj2) // true
128
+ * ```
129
+ */
130
+ export declare function isEqual(value: unknown, other: unknown): boolean;
131
+ /**
132
+ * Copies all enumerable own properties from one or more source objects to a target object.
133
+ * @param target The destination object.
134
+ * @param sources The source objects.
135
+ * @returns Returns the modified target object.
136
+ */
137
+ export declare function assign<T extends Record<string, any>>(target: T, ...sources: Partial<T>[]): T;
138
+ /**
139
+ *
140
+ */
141
+ export declare function get<T = unknown>(obj: unknown, path: string | string[], defaultValue?: T): T;
142
+ /**
143
+ *
144
+ */
145
+ export declare function includes<T>(collection: T[] | string | Record<string, T>, value: T, fromIndex?: number): boolean;
146
+ /**
147
+ * Iterates over elements of `collection` and invokes `iteratee` for each element.
148
+ * @param collection The collection to iterate over (array or object).
149
+ * @param iteratee The function invoked per iteration.
150
+ */
151
+ export declare function forEach<T>(collection: T[] | Record<string, T>, iteratee: (value: T, key: string | number, collection: any) => void): void;
152
+ /**
153
+ * Creates an array of values by running each element in collection thru iteratee.
154
+ * @param collection The collection to iterate over.
155
+ * @param iteratee The function invoked per iteration.
156
+ * @returns Returns the new mapped array.
157
+ */
158
+ export declare function map<T, U>(collection: T[] | Record<string, T>, iteratee: (value: T, key: string | number, collection: any) => U): U[];
159
+ /**
160
+ * Recursively merges own and inherited enumerable string keyed properties of source
161
+ * objects into the destination object. Source properties that resolve to undefined
162
+ * are skipped if a destination value exists.
163
+ * @param target The destination object.
164
+ * @param sources The source objects.
165
+ * @returns Returns the destination object.
166
+ */
167
+ export declare function merge<T extends Record<string, any>>(target: T, ...sources: Partial<T>[]): T;
168
+ /**
169
+ * Merges `defaults` into `obj` (shallow clone) and returns the result.
170
+ * Properties in `obj` overwrite those in `defaults`.
171
+ * @param obj - Target object (can be empty)
172
+ * @param defaults - Default values
173
+ * @returns New object with merged values
174
+ */
175
+ export declare const output: <T extends Record<string, unknown>>(obj: Partial<T>, defaults: T) => T;
176
+ /**
177
+ * Creates a new array concatenating the input arrays and/or values.
178
+ * @param arrays Arrays and/or values to concatenate.
179
+ * @returns Returns the new concatenated array.
180
+ */
181
+ export declare function concat<T>(...arrays: (T[] | T)[]): T[];
182
+ /**
183
+ * Iterates over all enumerable properties (own + inherited) of an object.
184
+ * Behaviour matches Lodash `forIn`.
185
+ * @param obj - Object to iterate
186
+ * @param fn - Function to execute for each property (value, key, object)
187
+ */
188
+ export declare const forIn: <T extends Record<string, unknown>>(obj: T, fn: (value: T[keyof T], key: string, object: T) => void) => void;
189
+ /**
190
+ * Returns an array of the object's own enumerable property keys.
191
+ * @param obj - Any object
192
+ * @returns Array of keys
193
+ */
194
+ export declare const keys: <T extends Record<string, unknown>>(obj: T) => string[];
195
+ /**
196
+ * Returns the first `n` elements of an array.
197
+ * @param arr - Source array
198
+ * @param n - Number of elements to take (default: 1)
199
+ * @returns New array containing the taken elements
200
+ */
201
+ export declare const take: <T>(arr: T[], n?: number) => T[];
202
+ /**
203
+ * Returns the last `n` elements of an array.
204
+ * @param arr - Source array
205
+ * @param n - Number of elements to take (default: 1)
206
+ * @returns New array containing the taken elements
207
+ */
208
+ export declare const takeRight: <T>(arr: T[], n?: number) => T[];
@@ -0,0 +1,29 @@
1
+ import * as loglevel from "loglevel";
2
+ export declare const log: {
3
+ default: loglevel.RootLogger;
4
+ noConflict(): any;
5
+ getLogger(name: string | symbol): loglevel.Logger;
6
+ getLoggers(): {
7
+ [name: string]: loglevel.Logger;
8
+ };
9
+ levels: loglevel.LogLevel;
10
+ methodFactory: loglevel.MethodFactory;
11
+ trace(...msg: any[]): void;
12
+ debug(...msg: any[]): void;
13
+ log(...msg: any[]): void;
14
+ info(...msg: any[]): void;
15
+ warn(...msg: any[]): void;
16
+ error(...msg: any[]): void;
17
+ setLevel(level: loglevel.LogLevelDesc, persist?: boolean | undefined): void;
18
+ getLevel(): 0 | 1 | 2 | 3 | 4 | 5;
19
+ setDefaultLevel(level: loglevel.LogLevelDesc): void;
20
+ resetLevel(): void;
21
+ enableAll(persist?: boolean | undefined): void;
22
+ disableAll(persist?: boolean | undefined): void;
23
+ rebuild(): void;
24
+ };
25
+ /**
26
+ * Sets log level.
27
+ * Note that, we limit user to set only some of the levels.
28
+ */
29
+ export declare const setLogLevel: (level: string) => void;
@@ -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
+ }