@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.
- package/README.md +2 -0
- package/dist/index.esm.js +11790 -0
- package/dist/types/Locale.d.ts +23 -0
- package/dist/types/components/dxf-layout-bar/DxfLayoutBar.d.ts +26 -0
- package/dist/types/components/dxf-layout-bar/index.d.ts +1 -0
- package/dist/types/components/tool-tip/Tooltip.d.ts +20 -0
- package/dist/types/components/tool-tip/index.d.ts +1 -0
- package/dist/types/core/Configs.d.ts +288 -0
- package/dist/types/core/Constants.d.ts +81 -0
- package/dist/types/core/Units.d.ts +16 -0
- package/dist/types/core/VersionManager.d.ts +14 -0
- package/dist/types/core/camera/CameraManager.d.ts +80 -0
- package/dist/types/core/camera/index.d.ts +1 -0
- package/dist/types/core/camera-controls/CameraControls.d.ts +744 -0
- package/dist/types/core/camera-controls/Constants.d.ts +2 -0
- package/dist/types/core/camera-controls/EventDispatcher.d.ts +41 -0
- package/dist/types/core/camera-controls/index.d.ts +3 -0
- package/dist/types/core/camera-controls/types.d.ts +112 -0
- package/dist/types/core/camera-controls/utils/extractClientCoordFromEvent.d.ts +3 -0
- package/dist/types/core/camera-controls/utils/math-utils.d.ts +14 -0
- package/dist/types/core/camera-controls/utils/notSupportedInOrthographicCamera.d.ts +2 -0
- package/dist/types/core/canvas/CanvasRender.d.ts +52 -0
- package/dist/types/core/canvas/Constants.d.ts +31 -0
- package/dist/types/core/canvas/Drawable.d.ts +98 -0
- package/dist/types/core/canvas/DrawableList.d.ts +40 -0
- package/dist/types/core/canvas/MarkerDrawable.d.ts +30 -0
- package/dist/types/core/canvas/PathDrawable.d.ts +39 -0
- package/dist/types/core/canvas/index.d.ts +6 -0
- package/dist/types/core/compare/BaseDxfCompareHelper.d.ts +104 -0
- package/dist/types/core/compare/CompareDrawable.d.ts +18 -0
- package/dist/types/core/compare/DxfCompareHelper.d.ts +69 -0
- package/dist/types/core/compare/DxfCompareMarkupManager.d.ts +11 -0
- package/dist/types/core/compare/index.d.ts +4 -0
- package/dist/types/core/components/Container.d.ts +38 -0
- package/dist/types/core/components/ProgressBar.d.ts +31 -0
- package/dist/types/core/components/Spinner.d.ts +16 -0
- package/dist/types/core/components/index.d.ts +3 -0
- package/dist/types/core/controls/CameraControlsEx.d.ts +37 -0
- package/dist/types/core/controls/Control.d.ts +17 -0
- package/dist/types/core/controls/OrbitControls.d.ts +13 -0
- package/dist/types/core/controls/PlanControls.d.ts +13 -0
- package/dist/types/core/controls/index.d.ts +4 -0
- package/dist/types/core/dxf/DxfCompare.d.ts +151 -0
- package/dist/types/core/dxf/DxfConstants.d.ts +33 -0
- package/dist/types/core/dxf/DxfLoader.d.ts +557 -0
- package/dist/types/core/dxf/DxfObject.d.ts +33 -0
- package/dist/types/core/dxf/DxfUtils.d.ts +45 -0
- package/dist/types/core/dxf/HatchPatternShaders.d.ts +12 -0
- package/dist/types/core/dxf/LinePatternShaders.d.ts +12 -0
- package/dist/types/core/dxf/bspline.d.ts +7 -0
- package/dist/types/core/dxf/dxfom-mtext.d.ts +46 -0
- package/dist/types/core/dxf/dxfom-text.d.ts +16 -0
- package/dist/types/core/dxf/index.d.ts +10 -0
- package/dist/types/core/dxf/round10.d.ts +1 -0
- package/dist/types/core/dxf-parser/AutoCadColorIndex.d.ts +8 -0
- package/dist/types/core/dxf-parser/DxfBaseReader.d.ts +12 -0
- package/dist/types/core/dxf-parser/DxfBinaryReader.d.ts +14 -0
- package/dist/types/core/dxf-parser/DxfParser.d.ts +324 -0
- package/dist/types/core/dxf-parser/DxfTextReader.d.ts +31 -0
- package/dist/types/core/dxf-parser/ParseHelpers.d.ts +45 -0
- package/dist/types/core/dxf-parser/entities/3dface.d.ts +13 -0
- package/dist/types/core/dxf-parser/entities/arc.d.ts +18 -0
- package/dist/types/core/dxf-parser/entities/attdef.d.ts +33 -0
- package/dist/types/core/dxf-parser/entities/attrib.d.ts +33 -0
- package/dist/types/core/dxf-parser/entities/circle.d.ts +15 -0
- package/dist/types/core/dxf-parser/entities/dimension.d.ts +24 -0
- package/dist/types/core/dxf-parser/entities/ellipse.d.ts +17 -0
- package/dist/types/core/dxf-parser/entities/geomtry.d.ts +42 -0
- package/dist/types/core/dxf-parser/entities/hatch.d.ts +110 -0
- package/dist/types/core/dxf-parser/entities/image.d.ts +39 -0
- package/dist/types/core/dxf-parser/entities/insert.d.ts +22 -0
- package/dist/types/core/dxf-parser/entities/leader.d.ts +23 -0
- package/dist/types/core/dxf-parser/entities/line.d.ts +12 -0
- package/dist/types/core/dxf-parser/entities/lwpolyline.d.ts +23 -0
- package/dist/types/core/dxf-parser/entities/mleader.d.ts +103 -0
- package/dist/types/core/dxf-parser/entities/mtext.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/ole2frame.d.ts +22 -0
- package/dist/types/core/dxf-parser/entities/point.d.ts +13 -0
- package/dist/types/core/dxf-parser/entities/polyline.d.ts +22 -0
- package/dist/types/core/dxf-parser/entities/ray.d.ts +12 -0
- package/dist/types/core/dxf-parser/entities/region.d.ts +12 -0
- package/dist/types/core/dxf-parser/entities/seqend.d.ts +10 -0
- package/dist/types/core/dxf-parser/entities/solid.d.ts +12 -0
- package/dist/types/core/dxf-parser/entities/spline.d.ts +25 -0
- package/dist/types/core/dxf-parser/entities/table.d.ts +44 -0
- package/dist/types/core/dxf-parser/entities/text.d.ts +20 -0
- package/dist/types/core/dxf-parser/entities/vertex.d.ts +22 -0
- package/dist/types/core/dxf-parser/entities/viewport.d.ts +56 -0
- package/dist/types/core/dxf-parser/entities/xline.d.ts +12 -0
- package/dist/types/core/dxf-parser/index.d.ts +27 -0
- package/dist/types/core/dxf-parser/objects/common.d.ts +26 -0
- package/dist/types/core/dxf-parser/objects/dictionary.d.ts +23 -0
- package/dist/types/core/dxf-parser/objects/imagedef.d.ts +24 -0
- package/dist/types/core/dxf-parser/objects/layout.d.ts +29 -0
- package/dist/types/core/dxf-parser/objects/sortentstable.d.ts +12 -0
- package/dist/types/core/dxf-parser/objects/spatialfilter.d.ts +22 -0
- package/dist/types/core/dxf-parser/objects/xrecord.d.ts +11 -0
- package/dist/types/core/effect/EffectManager.d.ts +43 -0
- package/dist/types/core/effect/index.d.ts +1 -0
- package/dist/types/core/font/BaseFont.d.ts +41 -0
- package/dist/types/core/font/FontManager.d.ts +52 -0
- package/dist/types/core/font/MeshFont.d.ts +14 -0
- package/dist/types/core/font/ShxFont.d.ts +49 -0
- package/dist/types/core/font/index.d.ts +1 -0
- package/dist/types/core/font/shx/ExtraLettersTemplate.d.ts +4 -0
- package/dist/types/core/font/shx/Shx.constants.d.ts +20 -0
- package/dist/types/core/font/shx/ShxParser.d.ts +18 -0
- package/dist/types/core/font/shx/TextShape.d.ts +24 -0
- package/dist/types/core/font/shx/gbk/index.d.ts +4 -0
- package/dist/types/core/font/shx/index.d.ts +1 -0
- package/dist/types/core/font/shx/util/BitConverter.d.ts +18 -0
- package/dist/types/core/geometry-offset/Edge.d.ts +27 -0
- package/dist/types/core/geometry-offset/Offset.d.ts +46 -0
- package/dist/types/core/geometry-offset/index.d.ts +1 -0
- package/dist/types/core/helpers/BinaryReader.d.ts +23 -0
- package/dist/types/core/helpers/BoxSelectHelper.d.ts +44 -0
- package/dist/types/core/helpers/InstantiateHelper.d.ts +26 -0
- package/dist/types/core/helpers/LoadingHelper.d.ts +65 -0
- package/dist/types/core/helpers/MeshBvhHelper.d.ts +15 -0
- package/dist/types/core/helpers/MobileTouchHelperDrawable.d.ts +26 -0
- package/dist/types/core/helpers/OSnapHelper.d.ts +159 -0
- package/dist/types/core/helpers/ObjectPixelSizeHelper.d.ts +13 -0
- package/dist/types/core/helpers/PickMarkupHelper.d.ts +29 -0
- package/dist/types/core/helpers/RafHelper.d.ts +18 -0
- package/dist/types/core/helpers/ZoomToRectHelper.d.ts +20 -0
- package/dist/types/core/helpers/index.d.ts +11 -0
- package/dist/types/core/index.d.ts +24 -0
- package/dist/types/core/indexeddb/BaseTable.d.ts +36 -0
- package/dist/types/core/indexeddb/DxfDataTable.d.ts +22 -0
- package/dist/types/core/indexeddb/FontDataTable.d.ts +32 -0
- package/dist/types/core/indexeddb/IndexedDbManager.d.ts +49 -0
- package/dist/types/core/indexeddb/index.d.ts +4 -0
- package/dist/types/core/input-manager/InputManager.d.ts +147 -0
- package/dist/types/core/input-manager/index.d.ts +1 -0
- package/dist/types/core/interactions/Interaction.d.ts +10 -0
- package/dist/types/core/interactions/Viewer2dInteraction.d.ts +17 -0
- package/dist/types/core/interactions/Viewer3dInteraction.d.ts +26 -0
- package/dist/types/core/interactions/index.d.ts +1 -0
- package/dist/types/core/materials/BimTilesHighlightMaterial.d.ts +21 -0
- package/dist/types/core/materials/BimTilesMaterial.d.ts +26 -0
- package/dist/types/core/materials/BimTilesPickMaterial.d.ts +9 -0
- package/dist/types/core/materials/BimTilesTransparentMaterial.d.ts +20 -0
- package/dist/types/core/materials/StandardMaterialEx.d.ts +16 -0
- package/dist/types/core/materials/constants.d.ts +0 -0
- package/dist/types/core/materials/index.d.ts +5 -0
- package/dist/types/core/model/Constants.d.ts +58 -0
- package/dist/types/core/model/Model.d.ts +18 -0
- package/dist/types/core/model/Model2d.d.ts +142 -0
- package/dist/types/core/model/Model3d.d.ts +137 -0
- package/dist/types/core/model/bimtiles/BatchedMeshesParser.d.ts +26 -0
- package/dist/types/core/model/bimtiles/BimTilesConfigParser.d.ts +43 -0
- package/dist/types/core/model/bimtiles/BimTilesData.d.ts +280 -0
- package/dist/types/core/model/bimtiles/BimTilesMaterialManager.d.ts +139 -0
- package/dist/types/core/model/bimtiles/BimTilesModel.d.ts +67 -0
- package/dist/types/core/model/bimtiles/BimTilesPropertyParser.d.ts +42 -0
- package/dist/types/core/model/bimtiles/BimTilesRenderer.d.ts +49 -0
- package/dist/types/core/model/bimtiles/InstancedMeshesParser.d.ts +37 -0
- package/dist/types/core/model/bimtiles/TileParser.d.ts +11 -0
- package/dist/types/core/model/bimtiles/Utils.d.ts +29 -0
- package/dist/types/core/model/index.d.ts +6 -0
- package/dist/types/core/patches/Constants.d.ts +6 -0
- package/dist/types/core/patches/Line.d.ts +2 -0
- package/dist/types/core/patches/Mesh.d.ts +2 -0
- package/dist/types/core/patches/Points.d.ts +2 -0
- package/dist/types/core/patches/index.d.ts +4 -0
- package/dist/types/core/patches/shaders/ShaderChunk.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/common_ex.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/id_pars_vertex.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/id_vertex.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/outine_bc_vertex.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/outline_bc_fragment.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/outline_bc_pars_fragment.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/outline_bc_pars_vertex.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/state_fragment.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/state_highlight_fragment.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/state_pars_fragment.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderChunk/state_transparent_fragment.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderLib/pick_ex.glsl.d.ts +2 -0
- package/dist/types/core/patches/shaders/shaderLib/standard_ex.glsl.d.ts +2 -0
- package/dist/types/core/pick/PickManager.d.ts +52 -0
- package/dist/types/core/pick/index.d.ts +1 -0
- package/dist/types/core/scene/SceneManager.d.ts +48 -0
- package/dist/types/core/scene/index.d.ts +1 -0
- package/dist/types/core/shp-js/BitView.d.ts +12 -0
- package/dist/types/core/shp-js/SHPLoader.d.ts +12 -0
- package/dist/types/core/shp-js/Shp.d.ts +10 -0
- package/dist/types/core/shp-js/ShpThree.d.ts +23 -0
- package/dist/types/core/shp-js/index.d.ts +4 -0
- package/dist/types/core/text-texture/TextTexture.d.ts +45 -0
- package/dist/types/core/text-texture/index.d.ts +1 -0
- package/dist/types/core/undo/Command.d.ts +6 -0
- package/dist/types/core/undo/UndoManager.d.ts +24 -0
- package/dist/types/core/undo/index.d.ts +2 -0
- package/dist/types/core/utils/CSS2DObjectUtils.d.ts +14 -0
- package/dist/types/core/utils/CancelablePromise.d.ts +6 -0
- package/dist/types/core/utils/ColorUtils.d.ts +25 -0
- package/dist/types/core/utils/CommonUtils.d.ts +141 -0
- package/dist/types/core/utils/CoordinateUtils.d.ts +81 -0
- package/dist/types/core/utils/DecimalPrecisionUtils.d.ts +10 -0
- package/dist/types/core/utils/DeviceUtils.d.ts +15 -0
- package/dist/types/core/utils/EdgeUtils.d.ts +14 -0
- package/dist/types/core/utils/Event.d.ts +33 -0
- package/dist/types/core/utils/ExportUtils.d.ts +61 -0
- package/dist/types/core/utils/FpsUtils.d.ts +13 -0
- package/dist/types/core/utils/GeometryUtils.d.ts +78 -0
- package/dist/types/core/utils/LodashUtils.d.ts +208 -0
- package/dist/types/core/utils/LogUtils.d.ts +29 -0
- package/dist/types/core/utils/MaterialUtils.d.ts +40 -0
- package/dist/types/core/utils/MathUtils.d.ts +41 -0
- package/dist/types/core/utils/MergeUtils.d.ts +126 -0
- package/dist/types/core/utils/ObjectUtils.d.ts +216 -0
- package/dist/types/core/utils/PolygonUtils.d.ts +9 -0
- package/dist/types/core/utils/SVGObjectUtils.d.ts +22 -0
- package/dist/types/core/utils/SceneUtils.d.ts +26 -0
- package/dist/types/core/utils/SectionUtils.d.ts +11 -0
- package/dist/types/core/utils/SimplifyUtils.d.ts +15 -0
- package/dist/types/core/utils/TextureUtils.d.ts +16 -0
- package/dist/types/core/utils/UVUtils.d.ts +21 -0
- package/dist/types/core/utils/UnitConversionUtils.d.ts +31 -0
- package/dist/types/core/utils/index.d.ts +26 -0
- package/dist/types/core/viewers/BaseViewer.d.ts +253 -0
- package/dist/types/core/viewers/BimTilesViewer.d.ts +130 -0
- package/dist/types/core/viewers/Constants.d.ts +9 -0
- package/dist/types/core/viewers/Plugin.d.ts +30 -0
- package/dist/types/core/viewers/Viewer2d.d.ts +413 -0
- package/dist/types/core/viewers/Viewer3d.d.ts +136 -0
- package/dist/types/core/viewers/Viewer3dLite.d.ts +144 -0
- package/dist/types/core/viewers/ViewerEvent.d.ts +108 -0
- package/dist/types/core/viewers/index.d.ts +8 -0
- package/dist/types/core/webcam/WebCam.d.ts +28 -0
- package/dist/types/core/webcam/index.d.ts +1 -0
- package/dist/types/core/workers/CreateMeshBvh.worker.d.ts +1 -0
- package/dist/types/core/workers/GenerateMeshBvhWorker.d.ts +17 -0
- package/dist/types/core/workers/index.d.ts +1 -0
- package/dist/types/export.doc.d.ts +9 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/version.d.ts +2 -0
- package/package.json +88 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* Decodes an array (Uint8Array, etc.) to string.
|
|
4
|
+
*/
|
|
5
|
+
export declare function arrayToString(array: ArrayBufferLike): string;
|
|
6
|
+
/**
|
|
7
|
+
* Gets tileObjectId by tilesetId and userId.
|
|
8
|
+
* A tileObjectId is a 32-bit float number composed of an 8-bit tilesetId and 24-bit userId.
|
|
9
|
+
* @param tilesetId A 8-bit number represents model's id, valid value is 0-255.
|
|
10
|
+
* This means we can support a maximum of 255 bimtiles models.
|
|
11
|
+
* @param userId A 24-bit number, valid value is 0-16777215 (0xffffff).
|
|
12
|
+
* This means we can support a maximum of 16777215 primitives ( A familyinstance may have multiple primitives ) in a bimtiles model.
|
|
13
|
+
*/
|
|
14
|
+
export declare function tilesetAndUserId2TileObjectId(tilesetId: number, userId: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* Gets userId by tileObjectId.
|
|
17
|
+
*/
|
|
18
|
+
export declare function tileObjectId2UserId(tileObjectId: number): number;
|
|
19
|
+
/**
|
|
20
|
+
* Gets tilesetId from color.
|
|
21
|
+
* @param rgba Color value between 0 and 255.
|
|
22
|
+
*/
|
|
23
|
+
export declare function color2TilesetId(rgba: number[]): number;
|
|
24
|
+
/**
|
|
25
|
+
* Gets userId from color.
|
|
26
|
+
* @param rgba Color value between 0 and 255.
|
|
27
|
+
*/
|
|
28
|
+
export declare function color2UserId(rgba: number[]): number;
|
|
29
|
+
export declare function decodeNormal(normals: THREE.TypedArray): Float32Array;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\n // When an object is transparent, we'll change its alpha value,\n // but we should not assign a fixed value because it may already\n // has an alpha value that is lower than 1.\n // So, let's multiply a factor.\n // const float TRANSPARENT_FACTOR = 0.5;\n // Object color when isolated.\n // const vec4 ISOLATE_COLOR = vec4(0.5, 0.5, 0.5, 0.2);\n const vec4 HIGHLIGHT_COLOR = vec4(0.031, 0.906, 0.867, 0.5); // 0x08e8de\n\n // a value between 1-2, a bigger value results in more significant effect\n const float HOVER_FACTOR = 1.2;\n\n // need to make sure the value is the same as in StateType enum.\n const int StateType_Hidden = 0;\n const int StateType_Transparent = 1;\n const int StateType_Highlighted = 2;\n const int StateType_Hovered = 3;\n\n /**\n * Converts a tileObjectId(tilesetId + userId) to color.\n */\n vec4 tileObjectId2Color(int id) {\n int r = id >> 16 & 0xff;\n int g = id >> 8 & 0xff;\n int b = id >> 0 & 0xff;\n int a = id >> 24 & 0xff;\n return vec4(float(r) / 255.0, float(g) / 255.0, float(b) / 255.0, float(a) / 255.0);\n }\n\n // /**\n // * Gets tilesetId and userId from a color.\n // * (rgb, a) => (userId, tilesetId)\n // */\n // vec2 color2Id(vec4 color) {\n // int userId = (int(color.r) << 16) + (int(color.g) << 8) + (int(color.b) << 0);\n // int tilesetId = (int(color.a) << 24);\n // return vec2(userId, tilesetId);\n // }\n\n /**\n * Gets userId by tileObjectId.\n */\n int tileObjectId2UserId(int tileObjectId) {\n return tileObjectId & 0x00ffffff;\n }\n\n /**\n * Gets texture color (which contains hidden/transparent/highlight status) form a userId\n */\n vec4 getTextureColorByTileObjectId(sampler2D sampler, float textureWidth, float textureHeight, int tileObjectId) {\n float userId = float(tileObjectId2UserId(tileObjectId));\n float indexX = mod(userId, textureWidth);\n float indexY = floor(userId / textureWidth);\n vec2 texCoord = vec2(indexX / textureWidth, indexY / textureHeight);\n return texture2D(sampler, texCoord);\n }\n\n /**\n * Gets the flag(0 or 1) from a number by given StateType.\n * @param num A uint8 number.\n */\n bool getFlagByStateType(int num, int state) {\n // the bit index is the state itself\n int bitIdx = state;\n return (num & (0x1 << bitIdx)) != 0;\n }\n\n /**\n * Flags(Hidden/Transparent/Hovered/Highlighted) are in textureColor.r value.\n */\n bool getFlagByColor(vec4 textureColor, int state) {\n // map a color value from 0-1 to range 0-255\n int num = int(textureColor.r * 255.0);\n return getFlagByStateType(num, state);\n }\n\n /**\n * Checks if an object is hidden by transparent cloned mesh.\n */\n bool isTransparentHidden(vec4 textureColor) {\n int num = int(textureColor.b * 255.0);\n return getFlagByStateType(num, StateType_Hidden);\n }\n\n /**\n * Checks if an object is hidden by the \"color\".\n */\n bool isHidden(vec4 textureColor) {\n return getFlagByColor(textureColor, StateType_Hidden);\n }\n\n /**\n * Checks if an object is transparent by the \"color\".\n */\n bool isTransparent(vec4 textureColor) {\n return getFlagByColor(textureColor, StateType_Transparent);\n }\n\n /**\n * Gets opacity value between 0-1.\n */\n lowp float getOpacity(vec4 textureColor) {\n return textureColor.g;\n }\n\n /**\n * Checks if an object is hovered by the \"color\".\n */\n bool isHovered(vec4 textureColor) {\n return getFlagByColor(textureColor, StateType_Hovered);\n }\n\n // bool isIsolated(vec4 textureColor) {\n // return textureColor.b > 0.5;\n // }\n\n /**\n * Checks if an object is highlighted by the \"color\".\n */\n bool isHighlighted(vec4 textureColor) {\n return getFlagByColor(textureColor, StateType_Highlighted);\n }\n\n /**\n * Changes a color value by some means. Here, we either multiply or devide a HOVER_FACTOR.\n */\n float getChangedValueForHoverEffect(float val) {\n return (val < 0.5) ? (val * HOVER_FACTOR) : (val / HOVER_FACTOR);\n }\n\n /**\n * Gets hovered color by original color.\n */\n vec4 getHoveredColor(vec4 color) {\n color.r = getChangedValueForHoverEffect(color.r);\n color.g = getChangedValueForHoverEffect(color.g);\n color.b = getChangedValueForHoverEffect(color.b);\n return color;\n }\n\n // TODO: isHighlighted isOverride isHovered\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\n #ifdef USE_BC_OUTLINE\n // Restore barycentric coordinates\n int barycentricX = int(barycentric) & 0x1;\n int barycentricY = int(barycentric) & 0x2;\n int barycentricZ = int(barycentric) & 0x4;\n vBarycentric = vec3(float(barycentricX), float(barycentricY), float(barycentricZ));\n #endif\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\n #ifdef USE_BC_OUTLINE\n varying vec3 vBarycentric;\n uniform vec3 outlineColor;\n\n float edgeFactor3() {\n vec3 d = fwidth(vBarycentric);\n float minValue = 0.0000001;\n // make sure d is not 0\n d = clamp(d, vec3(minValue), vec3(10.0));\n vec3 a3 = smoothstep(vec3(0.0), d * 0.8, vBarycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n #endif\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\n vec4 textureColor = getTextureColorByTileObjectId(uStateTexture, uTextureWidth, uTextureHeight, vTileObjectId);\n // if (uHoverId == tileObjectId) {\n // gl_FragColor = uHoverColor;\n // }\n // if(uIsIsolating) {\n // // hide others\n // if (!isIsolated(textureColor)) {\n // // transparent others\n // if (uTransparentOthersForIsolation) {\n // gl_FragColor = vec4(0.9, 0.9, 0.9, 0.3);\n // } else {\n // // hide others when isolating.\n // discard;\n // }\n // }\n // } else {\n // TODO: Status priority and mutual exclusion\n if (isHidden(textureColor)) {\n discard;\n }\n // If entity is transparent just discard, draw in transparent material\n if (isTransparent(textureColor)) {\n discard;\n }\n if (isHighlighted(textureColor)) {\n discard;\n }\n if (isHovered(textureColor)) {\n gl_FragColor = getHoveredColor(diffuseColor);\n return;\n }\n // TODO:custom color\n // if (isOverride(textureColor)) {\n // gl_FragColor = vec4(0.5, 0.5, 0.5, 0.8);\n // }\n // }\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\n vec4 textureColor = getTextureColorByTileObjectId(uStateTexture, uTextureWidth, uTextureHeight, vTileObjectId);\n // State priority (high to low):\n // - Hidden\n // - Transparent\n // - Highlighted: A transparent object should not highlighted in the same time!\n // - Hovered\n if (isHidden(textureColor)) {\n discard;\n } else if (isTransparent(textureColor)) {\n lowp float opacity = getOpacity(textureColor);\n diffuseColor.a *= opacity;\n gl_FragColor = diffuseColor;\n return;\n } else if (isHighlighted(textureColor)) {\n gl_FragColor = HIGHLIGHT_COLOR;\n return;\n }\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\n flat varying int vTileObjectId;\n uniform float uTextureWidth;\n uniform float uTextureHeight;\n uniform sampler2D uStateTexture;\n // uniform vec4 uHoverColor;\n // uniform int uHoverId;\n // uniform bool uIsIsolating;\n // uniform bool uTransparentOthersForIsolation;\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\n vec4 textureColor = getTextureColorByTileObjectId(uStateTexture, uTextureWidth, uTextureHeight, vTileObjectId);\n // State priority (high to low):\n // - Hidden\n // - Transparent\n // - Highlighted: A transparent object should not highlighted in the same time!\n // - Hovered\n if (isTransparentHidden(textureColor)) {\n discard;\n } else if (isTransparent(textureColor)) {\n lowp float opacity = getOpacity(textureColor);\n diffuseColor.a *= opacity;\n gl_FragColor = diffuseColor;\n return;\n } else if (isHighlighted(textureColor)) {\n gl_FragColor = HIGHLIGHT_COLOR;\n return;\n }\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const vertex = "\n #include <clipping_planes_pars_vertex>\n\n attribute int tileObjectId;\n flat varying int vTileObjectId;\n #include <common_ex>\n void main() {\n\n vec4 mvPosition = vec4(position, 1.0);\n #include <clipping_planes_vertex>\n vTileObjectId = tileObjectId;\n\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n #endif\n gl_Position = projectionMatrix * modelViewMatrix * mvPosition;\n }\n";
|
|
2
|
+
export declare const fragment = "\n #include <clipping_planes_pars_fragment>\n\n flat varying int vTileObjectId;\n uniform sampler2D uStateTexture;\n uniform float uTextureWidth;\n uniform float uTextureHeight;\n // uniform bool uIsIsolating;\n #include <common_ex>\n void main() {\n #include <clipping_planes_fragment>\n vec4 textureColor = getTextureColorByTileObjectId(uStateTexture, uTextureWidth, uTextureHeight, vTileObjectId);\n // If is isolating, other objects(which is hidden or transparent) are not pickable.\n // if (uIsIsolating && !isIsolated(textureColor)) {\n // discard;\n // }\n // if an object is hidden, it is not pickable\n if (isHidden(textureColor)) {\n discard;\n }\n // if an object is transparent, it is not pickable\n if (isTransparent(textureColor)) {\n discard;\n }\n\n gl_FragColor = tileObjectId2Color(vTileObjectId);\n }\n";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const vertex = "\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\n#include <outline_bc_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\n #include <outline_bc_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n}\n";
|
|
2
|
+
export declare const fragment = "\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#include <outline_bc_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4(diffuse, opacity);\n\tReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include <transmission_fragment>\n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n\t#ifdef USE_SHEEN\n\n\t\t// Sheen energy compensation approximation calculation can be found at the end of\n\t\t// https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3(material.sheenColor);\n\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate(dot(geometry.clearcoatNormal, geometry.viewDir));\n\n\t\tvec3 Fcc = F_Schlick(material.clearcoatF0, material.clearcoatF90, dotNVcc);\n\n\t\toutgoingLight = outgoingLight * (1.0 - material.clearcoat * Fcc) + clearcoatSpecular * material.clearcoat;\n\n\t#endif\n\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\n #include <outline_bc_fragment>\n}\n";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { TileObject } from "../model";
|
|
3
|
+
import type { BaseViewer } from "../../core/viewers";
|
|
4
|
+
export declare class PickManager {
|
|
5
|
+
private readonly CLEAR_COLOR;
|
|
6
|
+
private readonly CLEAR_COLOR_ALPHA;
|
|
7
|
+
private readonly EMPTY_MODEL_ID;
|
|
8
|
+
private viewer;
|
|
9
|
+
private raycaster;
|
|
10
|
+
private pickingTexture;
|
|
11
|
+
constructor(viewer: BaseViewer);
|
|
12
|
+
get scene(): THREE.Scene<THREE.Object3DEventMap>;
|
|
13
|
+
get camera(): THREE.OrthographicCamera;
|
|
14
|
+
get renderer(): THREE.WebGLRenderer;
|
|
15
|
+
get overlayRender(): import("..").CanvasRender;
|
|
16
|
+
get viewerContainer(): HTMLElement;
|
|
17
|
+
getRaycaster(): THREE.Raycaster;
|
|
18
|
+
/**
|
|
19
|
+
* Picks objects by NDC coordinate.
|
|
20
|
+
*/
|
|
21
|
+
pickObjectsByNdc(ndcCoord: THREE.Vector2, objects: THREE.Object3D[], layerChannels?: number[]): THREE.Intersection[];
|
|
22
|
+
/**
|
|
23
|
+
* Picks the closest object by mouse position.
|
|
24
|
+
*/
|
|
25
|
+
pickObject(mousePosition: THREE.Vector2, objects: THREE.Object3D[], layerChannels?: number[]): THREE.Intersection | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Picks objects by mouse position.
|
|
28
|
+
*/
|
|
29
|
+
pickObjects(mousePosition: THREE.Vector2, objects: THREE.Object3D[], layerChannels?: number[]): THREE.Intersection[];
|
|
30
|
+
/**
|
|
31
|
+
* Picks a drawable by world position.
|
|
32
|
+
*/
|
|
33
|
+
pickDrawable(worldPosition: THREE.Vector3): import("..").Drawable<Record<string, unknown>>[];
|
|
34
|
+
/**
|
|
35
|
+
* Picks an object by mouse position.
|
|
36
|
+
*/
|
|
37
|
+
pick(mousePosition: THREE.Vector2, pickScene: THREE.Scene): TileObject | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Sets raycaster's layer channels.
|
|
40
|
+
*/
|
|
41
|
+
private setLayerChannels;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param mousePosition
|
|
45
|
+
* @param width
|
|
46
|
+
* @param height
|
|
47
|
+
* @param pickScene
|
|
48
|
+
* @returns
|
|
49
|
+
* @description pick rect area buffer
|
|
50
|
+
*/
|
|
51
|
+
private pickBuffer;
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PickManager";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { Model } from "../../core/model";
|
|
3
|
+
import type { BaseViewer } from "../../core/viewers/BaseViewer";
|
|
4
|
+
export declare class SceneManager {
|
|
5
|
+
private viewer;
|
|
6
|
+
scene: THREE.Scene;
|
|
7
|
+
renderer: THREE.WebGLRenderer;
|
|
8
|
+
private pmremGenerator?;
|
|
9
|
+
private lights?;
|
|
10
|
+
private modelGroup;
|
|
11
|
+
constructor(viewer: BaseViewer);
|
|
12
|
+
private initLights;
|
|
13
|
+
private initPMREMGenerator;
|
|
14
|
+
get maxFragmentUniforms(): number;
|
|
15
|
+
addModel(model: Model): void;
|
|
16
|
+
removeModel(model: Model): void;
|
|
17
|
+
/**
|
|
18
|
+
* Get the root Three.js objects of all loaded models.
|
|
19
|
+
*/
|
|
20
|
+
getModelsRoot(): THREE.Group;
|
|
21
|
+
enableShadow(enable: boolean): void;
|
|
22
|
+
enableClipping(enable: boolean): void;
|
|
23
|
+
setClipPlanes(planes: THREE.Plane[]): void;
|
|
24
|
+
enableLights(enable: boolean): void;
|
|
25
|
+
debugLights(enable: boolean): void;
|
|
26
|
+
setBackground(background: THREE.Color | THREE.CubeTexture | THREE.Texture | null): void;
|
|
27
|
+
get directionalLight(): THREE.DirectionalLight;
|
|
28
|
+
get ambientLight(): THREE.Object3D<THREE.Object3DEventMap> | undefined;
|
|
29
|
+
get hemisphereLight(): THREE.Object3D<THREE.Object3DEventMap> | undefined;
|
|
30
|
+
get lightHelpers(): THREE.Object3D<THREE.Object3DEventMap> | undefined;
|
|
31
|
+
get directionalLightHelper(): THREE.DirectionalLightHelper;
|
|
32
|
+
get cameraHelper(): THREE.CameraHelper;
|
|
33
|
+
setEnvironmentFromData(data?: Uint16Array): Promise<void>;
|
|
34
|
+
setEnvironment(hdrUrl: string): Promise<void>;
|
|
35
|
+
resize(): void;
|
|
36
|
+
getRaycastableObjects(): THREE.Object3D<THREE.Object3DEventMap>[];
|
|
37
|
+
tryAdjustDirectionalLight(): void;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
updateDirectionalLight(): void;
|
|
42
|
+
private updateDirectionalLightShadow;
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
showDirectionalLightHelper(visible: boolean): void;
|
|
47
|
+
destroy(): void;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SceneManager";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class BitView {
|
|
2
|
+
buffer: any;
|
|
3
|
+
u8: any;
|
|
4
|
+
constructor(buf: any);
|
|
5
|
+
getBit(idx: any): number;
|
|
6
|
+
setBit(idx: any, val: any): void;
|
|
7
|
+
getInt12(idx: any): number;
|
|
8
|
+
setInt12(idx: any, val: any): void;
|
|
9
|
+
getInt6(idx: any): number;
|
|
10
|
+
setInt6(idx: any, val: any): void;
|
|
11
|
+
test(): BitView;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* ArcGIS SHP file loader
|
|
4
|
+
*/
|
|
5
|
+
export declare class SHPLoader {
|
|
6
|
+
load(url: string, onLoad: (object: THREE.Object3D) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param percent a number between [0, 100]
|
|
10
|
+
*/
|
|
11
|
+
private updateProgress;
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* Three.js extensions for SHP parser.
|
|
4
|
+
* Code is converted from JS to TS based on: https://github.com/kig/shp.js/
|
|
5
|
+
*/
|
|
6
|
+
export declare class ShpThree {
|
|
7
|
+
readonly LINE_MATERIAL: THREE.LineBasicMaterial;
|
|
8
|
+
readonly MESH_MATERIAL: THREE.MeshBasicMaterial;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param shp
|
|
12
|
+
* @param spherize is spherize or not. This only works well for the sameple shp for now!
|
|
13
|
+
*/
|
|
14
|
+
createModel(shp: any): THREE.Object3D;
|
|
15
|
+
loadCompressed(deltaEncoded: any): THREE.Object3D<THREE.Object3DEventMap>;
|
|
16
|
+
compress(shp: any): ArrayBuffer;
|
|
17
|
+
deltaEncode(arr: any): ArrayBuffer;
|
|
18
|
+
deltaEncode6(arr: any): ArrayBuffer;
|
|
19
|
+
storeDeltas(byteLen: any, polys: any): ArrayBuffer;
|
|
20
|
+
deltaDecode(buf: any): number[];
|
|
21
|
+
storeDeltas6(byteLen: any, polys: any): ArrayBuffer;
|
|
22
|
+
deltaDecode6(buf: any): number[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export interface TextTextureConfig {
|
|
3
|
+
text?: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
alignment?: string;
|
|
6
|
+
backgroundColor?: number;
|
|
7
|
+
fontFamily?: string;
|
|
8
|
+
/**
|
|
9
|
+
* With fontSize 18 it generates a 64x64 image, 20 generates 128x128 one.
|
|
10
|
+
*/
|
|
11
|
+
fontSize?: number;
|
|
12
|
+
fontStyle?: string;
|
|
13
|
+
fontVariant?: string;
|
|
14
|
+
fontWeight?: string;
|
|
15
|
+
lineGap?: number;
|
|
16
|
+
padding?: number;
|
|
17
|
+
strokeColor?: string;
|
|
18
|
+
strokeWidth?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function toCssFont(family: string, size: number, style: string, variant: string, weight: string): string;
|
|
21
|
+
export declare class TextTexture extends THREE.Texture {
|
|
22
|
+
private readonly canvas;
|
|
23
|
+
readonly textTexture = true;
|
|
24
|
+
private needsRedraw;
|
|
25
|
+
private contentOffset;
|
|
26
|
+
private lineOffset;
|
|
27
|
+
private _width;
|
|
28
|
+
private _height;
|
|
29
|
+
private lines;
|
|
30
|
+
private font;
|
|
31
|
+
private pixelRatio;
|
|
32
|
+
cfg: Required<TextTextureConfig>;
|
|
33
|
+
constructor(cfg: TextTextureConfig, canvas?: HTMLCanvasElement);
|
|
34
|
+
private getContentWidth;
|
|
35
|
+
private initDraw;
|
|
36
|
+
private getDrawPosition;
|
|
37
|
+
private draw;
|
|
38
|
+
private getDrawingBufferWidth;
|
|
39
|
+
private getDrawingBufferHeight;
|
|
40
|
+
private computeOptimalPixelRatio;
|
|
41
|
+
redrew(): void;
|
|
42
|
+
setPixelRatio(value: number): void;
|
|
43
|
+
setOptimalPixelRatio(object: THREE.Object3D, renderer: THREE.WebGLRenderer, camera: THREE.PerspectiveCamera | THREE.OrthographicCamera): void;
|
|
44
|
+
updateConfig(cfg: TextTextureConfig): void;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TextTexture";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Command } from "./Command";
|
|
2
|
+
type CommandData = Command | Command[];
|
|
3
|
+
/**
|
|
4
|
+
* Undo/redo manager.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UndoManager {
|
|
7
|
+
private history;
|
|
8
|
+
private step;
|
|
9
|
+
private maxCount;
|
|
10
|
+
private isBatchCommand;
|
|
11
|
+
private batchCommands;
|
|
12
|
+
constructor(maxCount?: number);
|
|
13
|
+
addCommand(command: Command): void;
|
|
14
|
+
startTransaction(): void;
|
|
15
|
+
endTransaction(): void;
|
|
16
|
+
undo(): boolean;
|
|
17
|
+
redo(): boolean;
|
|
18
|
+
getCommands(): CommandData[];
|
|
19
|
+
canUndo(): boolean;
|
|
20
|
+
canRedo(): boolean;
|
|
21
|
+
clear(): void;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSS2DObject } from "three/examples/jsm/renderers/CSS2DRenderer.js";
|
|
2
|
+
export declare class CSS2DObjectUtils {
|
|
3
|
+
/**
|
|
4
|
+
* Creates CSS2DObject with HTMLElement
|
|
5
|
+
*/
|
|
6
|
+
static createCSS2DObject(element: HTMLElement): CSS2DObject;
|
|
7
|
+
static createDefaultHotpoint(size?: number): CSS2DObject;
|
|
8
|
+
static createHotpoint(html?: string): CSS2DObject;
|
|
9
|
+
static createLabel(label: string, cssClass?: string): CSS2DObject;
|
|
10
|
+
/**
|
|
11
|
+
* Recursively find "dataset.objectId" of a HTMLElement
|
|
12
|
+
*/
|
|
13
|
+
static tryFindObjectId(element: HTMLElement): number | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare class ColorUtils {
|
|
2
|
+
static color2rgba(style: string): [number, number, number, number];
|
|
3
|
+
/**
|
|
4
|
+
* Converts float color array in format "[0.0, 1.0, 0.0, 1.0]" to css color "rgba(0, 255, 0, 1.0)".
|
|
5
|
+
*/
|
|
6
|
+
static floatArray2CssColor(rgba: number[]): string;
|
|
7
|
+
/**
|
|
8
|
+
* Converts color string in format "rgba(255, 255, 255, 1)" to float number array.
|
|
9
|
+
*/
|
|
10
|
+
static cssColor2FloatArray(colorStr: string): number[];
|
|
11
|
+
/**
|
|
12
|
+
* Converts rgb or rgba to hex number.
|
|
13
|
+
* E.g., [0.0, 1.0, 0.0] to 0x00ff00
|
|
14
|
+
* @param rgba Color value is between 0 and 1.
|
|
15
|
+
*/
|
|
16
|
+
static floatArray2Hex(rgba: number[]): number;
|
|
17
|
+
/**
|
|
18
|
+
* Converts color value from float(0.0-1.0) to int (0-255)
|
|
19
|
+
*/
|
|
20
|
+
private static float2Int;
|
|
21
|
+
/**
|
|
22
|
+
* Converts color value from int (0-255) to float(0.0-1.0)
|
|
23
|
+
*/
|
|
24
|
+
private static int2Float;
|
|
25
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { IconClass } from "../Configs";
|
|
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
|
+
* Displays a pointer marker in a period of time.
|
|
21
|
+
* @param duration display time in ms. 0/null/undefined means always display.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Join strings
|
|
25
|
+
* @param args
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
static joinStrings(...args: string[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* Converts a number to a string with proper fraction digits
|
|
31
|
+
*/
|
|
32
|
+
static numberToString(num: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* Converts a byte number to proper units(Kilobyte, Megabyte, Gigabyte, etc.)
|
|
35
|
+
* @param num
|
|
36
|
+
*/
|
|
37
|
+
static byteCountToString(num: number): string;
|
|
38
|
+
static hexToBase64(hexstring: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Converts vector to a string with proper fraction digits
|
|
41
|
+
*/
|
|
42
|
+
static vectorToString(vec: THREE.Vector2 | THREE.Vector3 | number[]): string;
|
|
43
|
+
/**
|
|
44
|
+
* Converts number array to THREE.Vector2
|
|
45
|
+
*/
|
|
46
|
+
static arrayToVector2(arr: number[] | THREE.Vector2 | undefined): THREE.Vector2 | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Converts number array to THREE.Vector3
|
|
49
|
+
* If length of arr is 2, will assign z value to 0
|
|
50
|
+
*/
|
|
51
|
+
static arrayToVector3(arr: number[] | THREE.Vector3 | undefined): THREE.Vector3 | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Converts number array to THREE.Euler
|
|
54
|
+
*/
|
|
55
|
+
static arrayToEuler(arr: number[] | THREE.Euler | undefined): THREE.Euler | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Converts number array to THREE.Vector3
|
|
58
|
+
*/
|
|
59
|
+
static arrayOrObjectToVector3(arrOrObj: number[] | THREE.Vector3 | undefined): THREE.Vector3 | undefined;
|
|
60
|
+
static isVectorValid(vec: THREE.Vector2 | THREE.Vector3): boolean;
|
|
61
|
+
static isBoxValid(box: THREE.Box2 | THREE.Box3): boolean;
|
|
62
|
+
static isMatrixValid(matrix: THREE.Matrix4): boolean;
|
|
63
|
+
static guid(): string;
|
|
64
|
+
/**
|
|
65
|
+
* Expands given box by a scale factor
|
|
66
|
+
*/
|
|
67
|
+
static expandBoxByScale(box: THREE.Box3, scale: number): void;
|
|
68
|
+
/**
|
|
69
|
+
* Expands given box by a min size
|
|
70
|
+
*/
|
|
71
|
+
static expandBoxByMinSize(box: THREE.Box3, minSize: number): void;
|
|
72
|
+
/**
|
|
73
|
+
* Generate random integers in the range [min, max]
|
|
74
|
+
*/
|
|
75
|
+
static generateRandomInt(min: number, max: number): number;
|
|
76
|
+
/**
|
|
77
|
+
* Round to N decimal places
|
|
78
|
+
*/
|
|
79
|
+
static roundNumber(value: number, n: number): number;
|
|
80
|
+
/**
|
|
81
|
+
* Converts a decimal number or string to a hexadecimal color string.
|
|
82
|
+
* @param decimal Decimal number or string
|
|
83
|
+
*/
|
|
84
|
+
static convertDecimalToHex(decimal: number | string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Converts a canvas to an image
|
|
87
|
+
* @param canvas
|
|
88
|
+
*/
|
|
89
|
+
static canvasToImage(canvas: HTMLCanvasElement): Promise<HTMLImageElement>;
|
|
90
|
+
/**
|
|
91
|
+
* Takes screenshot to given rendering context and return base64 string in png/jpeg format.
|
|
92
|
+
* @param bbox If valid, takes screenshot of a sub image with given bounding box in screen coordinate.
|
|
93
|
+
*/
|
|
94
|
+
static renderingContextToImage(context: CanvasRenderingContext2D, bbox?: THREE.Box2, type?: string, quality?: number): string;
|
|
95
|
+
/**
|
|
96
|
+
* Prints memory usage
|
|
97
|
+
*/
|
|
98
|
+
static printMemory(title: string): void;
|
|
99
|
+
static printGpuInfo(webgl: WebGLRenderingContext): void;
|
|
100
|
+
static getExtension(url: string): string;
|
|
101
|
+
static isBinaryFile(url: string): boolean;
|
|
102
|
+
static isGzip(data: Uint8Array): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Sleep a while
|
|
105
|
+
*/
|
|
106
|
+
static sleep(ms: number): Promise<void>;
|
|
107
|
+
private static twinklingObjectIds;
|
|
108
|
+
/**
|
|
109
|
+
* Twinkle the object several times
|
|
110
|
+
*/
|
|
111
|
+
static twinkle(obj: THREE.Object3D, ms?: number): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Gets a function to update progress.
|
|
114
|
+
* @param onProgress onProgress callback.
|
|
115
|
+
*/
|
|
116
|
+
static getUpdateProgressFunc(onProgress?: (e: ProgressEvent) => void): (progress: number) => void;
|
|
117
|
+
/**
|
|
118
|
+
* Gets an async function to update progress.
|
|
119
|
+
* The reason to use async function is, in order to give UI thread chance to update the progress!
|
|
120
|
+
* @param onProgress onProgress callback.
|
|
121
|
+
*/
|
|
122
|
+
static getUpdateProgressFuncAsync(onProgress?: (e: ProgressEvent) => void): (progress: number) => Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Gets an async function to update progress for a for/while loop.
|
|
125
|
+
* @param total Total number of a for/while loop.
|
|
126
|
+
* @param onProgress onProgress callback.
|
|
127
|
+
*/
|
|
128
|
+
static getUpdateProgressFuncForLoop(total: number, onProgress?: (e: ProgressEvent) => void): (i: number) => Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Gets a function to update sub progress, which has a progress range limitation according to its parent progress.
|
|
131
|
+
* @param min Min range number between 0-100
|
|
132
|
+
* @param max Max range number between 0-100
|
|
133
|
+
* @param onProgress onProgress callback.
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
static getUpdateSubProgressFunc(min: number, max: number, onProgress?: (e: ProgressEvent) => void): (e: ProgressEvent) => void;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @internal
|
|
140
|
+
*/
|
|
141
|
+
export declare const setIcon: (classList: DOMTokenList, iconClass: IconClass, active: boolean) => void;
|