@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,26 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { BatchData, MeshJsonData } from "./BimTilesData";
|
|
3
|
+
/**
|
|
4
|
+
* Batched mesh.
|
|
5
|
+
*/
|
|
6
|
+
export interface BatchedMesh {
|
|
7
|
+
type: number;
|
|
8
|
+
position: THREE.TypedArray;
|
|
9
|
+
color: THREE.TypedArray;
|
|
10
|
+
normal: THREE.TypedArray;
|
|
11
|
+
indice: THREE.TypedArray;
|
|
12
|
+
uv: THREE.TypedArray;
|
|
13
|
+
tangent: THREE.TypedArray;
|
|
14
|
+
barycentric: THREE.TypedArray;
|
|
15
|
+
materialId: string;
|
|
16
|
+
userIds: number[];
|
|
17
|
+
batchTable: BatchData[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parses batched meshes of a tile.
|
|
21
|
+
*/
|
|
22
|
+
export declare class BatchedMeshesParser {
|
|
23
|
+
parse(buffer: ArrayBuffer, meshes: MeshJsonData[]): BatchedMesh[];
|
|
24
|
+
private parseMesh;
|
|
25
|
+
private parseTypedArray;
|
|
26
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export interface BimTilesConfigMetadata {
|
|
3
|
+
asset: string;
|
|
4
|
+
version: string;
|
|
5
|
+
generateTool?: string;
|
|
6
|
+
datetime: string;
|
|
7
|
+
root: string;
|
|
8
|
+
modelSize: number;
|
|
9
|
+
}
|
|
10
|
+
export interface BimTilesConfigStatistics {
|
|
11
|
+
elementCount: number;
|
|
12
|
+
batchElementCount: number;
|
|
13
|
+
instanceElementCount: number;
|
|
14
|
+
batchCount: number;
|
|
15
|
+
instanceCount: number;
|
|
16
|
+
tileCount: number;
|
|
17
|
+
userDataCount: number;
|
|
18
|
+
materialCount: number;
|
|
19
|
+
meshVertexCount: number;
|
|
20
|
+
meshFaceCount: number;
|
|
21
|
+
textureCount: number;
|
|
22
|
+
texturePixels: number;
|
|
23
|
+
}
|
|
24
|
+
interface BimTilesConfigView {
|
|
25
|
+
transform: THREE.Matrix4;
|
|
26
|
+
boundingVolume: THREE.Box3;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* BimTiles config definition.
|
|
30
|
+
* A bimtiles has one config file.
|
|
31
|
+
*/
|
|
32
|
+
export declare class BimTilesConfigParser {
|
|
33
|
+
private url;
|
|
34
|
+
private metadata;
|
|
35
|
+
private statistics;
|
|
36
|
+
private view;
|
|
37
|
+
constructor(url: string);
|
|
38
|
+
parse(): Promise<boolean>;
|
|
39
|
+
getMetadata(): BimTilesConfigMetadata;
|
|
40
|
+
getStatistics(): BimTilesConfigStatistics;
|
|
41
|
+
getView(): BimTilesConfigView;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export declare const WEBGL_MAG_FILTERS: Record<number, THREE.MagnificationTextureFilter>;
|
|
3
|
+
export declare const WEBGL_MIN_FILTERS: Record<number, THREE.MinificationTextureFilter>;
|
|
4
|
+
export declare const WEBGL_WRAPPINGS: Record<number, THREE.Wrapping>;
|
|
5
|
+
/**
|
|
6
|
+
* "Alpha mode" refers to the way in which transparency is handled.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum AlphaMode {
|
|
9
|
+
/**
|
|
10
|
+
* No transparency, and the image is fully visible.
|
|
11
|
+
*/
|
|
12
|
+
Opaque = "OPAQUE",
|
|
13
|
+
/**
|
|
14
|
+
* Transparency is achieved by using a separate mask layer that specifies which parts of the image should be transparent.
|
|
15
|
+
*/
|
|
16
|
+
Mask = "MASK",
|
|
17
|
+
/**
|
|
18
|
+
* Transparency is achieved by blending the image with the background based on the alpha channel values of the image.
|
|
19
|
+
*/
|
|
20
|
+
Blend = "BLEND"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* BimTiles definition.
|
|
24
|
+
*/
|
|
25
|
+
export interface BimTilesJson {
|
|
26
|
+
asset: {
|
|
27
|
+
version: string;
|
|
28
|
+
generateTool: string;
|
|
29
|
+
datetime: string;
|
|
30
|
+
};
|
|
31
|
+
properties: {
|
|
32
|
+
material: {
|
|
33
|
+
url: string;
|
|
34
|
+
};
|
|
35
|
+
userData: {
|
|
36
|
+
url: string;
|
|
37
|
+
};
|
|
38
|
+
userId: {
|
|
39
|
+
url: string;
|
|
40
|
+
maxUserIdIndex: number;
|
|
41
|
+
};
|
|
42
|
+
userIdBox: {
|
|
43
|
+
url: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
root: {
|
|
47
|
+
id: string;
|
|
48
|
+
transform: number[];
|
|
49
|
+
boundingVolume: number[];
|
|
50
|
+
refine: "replace" | "add";
|
|
51
|
+
geometricError: number;
|
|
52
|
+
content: {
|
|
53
|
+
uri: string;
|
|
54
|
+
};
|
|
55
|
+
children: [];
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* BimTiles material texture definition.
|
|
60
|
+
*/
|
|
61
|
+
export interface BimTilesMaterialTextureJson {
|
|
62
|
+
index: number;
|
|
63
|
+
texCoord: number;
|
|
64
|
+
transform?: {
|
|
65
|
+
offset: [number, number];
|
|
66
|
+
rotation: number;
|
|
67
|
+
scale: [number, number];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* BimTiles materials definition.
|
|
72
|
+
*/
|
|
73
|
+
export interface BimTilesMaterialJson {
|
|
74
|
+
materials: {
|
|
75
|
+
/**
|
|
76
|
+
* The key is material id.
|
|
77
|
+
*/
|
|
78
|
+
[key: string]: {
|
|
79
|
+
/**
|
|
80
|
+
* Material id, unique in this tile set
|
|
81
|
+
*/
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
baseColorFactor: number[];
|
|
85
|
+
baseColorTexture: BimTilesMaterialTextureJson;
|
|
86
|
+
metallicFactor: number;
|
|
87
|
+
roughnessFactor: number;
|
|
88
|
+
metallicRoughnessTexture: BimTilesMaterialTextureJson;
|
|
89
|
+
doubleSided: boolean;
|
|
90
|
+
alphaMode: AlphaMode;
|
|
91
|
+
alphaCutoff: number;
|
|
92
|
+
normalTexture: BimTilesMaterialTextureJson;
|
|
93
|
+
emissiveFactor: number[];
|
|
94
|
+
emissiveTexture: BimTilesMaterialTextureJson;
|
|
95
|
+
occlusionTexture: BimTilesMaterialTextureJson;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
textures: {
|
|
99
|
+
image: number;
|
|
100
|
+
sampler: number;
|
|
101
|
+
}[];
|
|
102
|
+
images: {
|
|
103
|
+
uri: string;
|
|
104
|
+
type: string;
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
dimensions: number;
|
|
108
|
+
}[];
|
|
109
|
+
samplers: {
|
|
110
|
+
magFilter: number;
|
|
111
|
+
minFilter: number;
|
|
112
|
+
wrapS: number;
|
|
113
|
+
wrapT: number;
|
|
114
|
+
}[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* BimTiles UserData definition.
|
|
118
|
+
* These userData are usually familyInstance attributes.
|
|
119
|
+
*/
|
|
120
|
+
export interface BimTilesUserDataJson {
|
|
121
|
+
/**
|
|
122
|
+
* Stores all userData's keys, case-sensitive.
|
|
123
|
+
* Because a lot of userData keys are the same, we can save space this way.
|
|
124
|
+
*/
|
|
125
|
+
userDataKeys: string[];
|
|
126
|
+
/**
|
|
127
|
+
* Stores all userData's values, case-sensitive.
|
|
128
|
+
* Because a lot of userData values are the same, we can save space this way.
|
|
129
|
+
*/
|
|
130
|
+
userDataValues: any[];
|
|
131
|
+
userDataItems: Record<number, number>[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* BimTiles UserId definition.
|
|
135
|
+
* A tile set has one userId file.
|
|
136
|
+
*/
|
|
137
|
+
export interface BimTilesUserIdJson {
|
|
138
|
+
/**
|
|
139
|
+
* Stores all modelIds of this tile set.
|
|
140
|
+
* ModelId is required, and must be unique in a tile set.
|
|
141
|
+
*/
|
|
142
|
+
modelIds: string[];
|
|
143
|
+
/**
|
|
144
|
+
* Stores all familyInstanceIds for all models of this tile set.
|
|
145
|
+
* FamilyInstanceId is nice to have, otherwise, it'll generate one, but it won't be able to
|
|
146
|
+
* find an object's userData.
|
|
147
|
+
* A familyInstance may contain more than one primitives, thus may have more than one userIds.
|
|
148
|
+
*/
|
|
149
|
+
familyInstanceIds: string[];
|
|
150
|
+
/**
|
|
151
|
+
* ModelId and familyInstanceIds map.
|
|
152
|
+
* One modelId contains at least one familyInstanceIds.
|
|
153
|
+
* The key is the index of modelIds array, we can find the modelId by this index.
|
|
154
|
+
* The value is the index array of familyInstanceIds, we can find familyInstanceIds by these indexes.
|
|
155
|
+
*/
|
|
156
|
+
modelTable: Record<number, number[]>;
|
|
157
|
+
/**
|
|
158
|
+
* UserId and userData map.
|
|
159
|
+
* One userId maps to 0 or 1 userData.
|
|
160
|
+
* The key is userId.
|
|
161
|
+
* In order to get proper userData, we also need to know modelId and familyInstanceId.
|
|
162
|
+
* So, the value is a tuple of modelId index, familyInstanceId index and userData index.
|
|
163
|
+
* If a primitive doesn't has userData, the userData index is -1.
|
|
164
|
+
*/
|
|
165
|
+
userIdTable: Record<number, [number, number, number]>;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* UserId bounding box definition.
|
|
169
|
+
* The key is userId.
|
|
170
|
+
* The vlaue is bounding box value, in order of xmin, ymin, zmin, xmax, ymax, zmax.
|
|
171
|
+
*/
|
|
172
|
+
export type BimTilesUserIdBoxJson = Record<number, number[]>;
|
|
173
|
+
export type BimTilesProperty = BimTilesMaterialJson | BimTilesUserDataJson | BimTilesUserIdJson | BimTilesUserIdBoxJson;
|
|
174
|
+
export declare const WEBGL_COMPONENT_TYPES: {
|
|
175
|
+
int8: Int8ArrayConstructor;
|
|
176
|
+
uint8: Uint8ArrayConstructor;
|
|
177
|
+
int16: Int16ArrayConstructor;
|
|
178
|
+
uint16: Uint16ArrayConstructor;
|
|
179
|
+
int32: Int32ArrayConstructor;
|
|
180
|
+
uint32: Uint32ArrayConstructor;
|
|
181
|
+
float: Float32ArrayConstructor;
|
|
182
|
+
double: Float64ArrayConstructor;
|
|
183
|
+
};
|
|
184
|
+
interface ComponentTypes {
|
|
185
|
+
int8: Int8ArrayConstructor;
|
|
186
|
+
uint8: Uint8ArrayConstructor;
|
|
187
|
+
int16: Int16ArrayConstructor;
|
|
188
|
+
uint16: Uint16ArrayConstructor;
|
|
189
|
+
int32: Int32ArrayConstructor;
|
|
190
|
+
uint32: Uint32ArrayConstructor;
|
|
191
|
+
float: Float32ArrayConstructor;
|
|
192
|
+
double: Float64ArrayConstructor;
|
|
193
|
+
}
|
|
194
|
+
export declare enum WEBGL_TYPE_SIZES {
|
|
195
|
+
scalar = 1,
|
|
196
|
+
vec2 = 2,
|
|
197
|
+
vec3 = 3,
|
|
198
|
+
vec4 = 4,
|
|
199
|
+
mat2 = 4,
|
|
200
|
+
mat3 = 9,
|
|
201
|
+
mat4 = 16
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Definition of a concrete instance.
|
|
205
|
+
*/
|
|
206
|
+
export interface Instance {
|
|
207
|
+
/**
|
|
208
|
+
* The transform of the instance.
|
|
209
|
+
*/
|
|
210
|
+
transform: number[];
|
|
211
|
+
/**
|
|
212
|
+
* The userId of the instance.
|
|
213
|
+
*/
|
|
214
|
+
userId: number;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Definition of an instanced mesh data and concrete instances.
|
|
218
|
+
*/
|
|
219
|
+
export interface InstancedMeshData {
|
|
220
|
+
blobId: number;
|
|
221
|
+
url: string;
|
|
222
|
+
instances: Instance[];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Definition of a buffer.
|
|
226
|
+
*/
|
|
227
|
+
export interface MeshBufferData {
|
|
228
|
+
byteOffset: number;
|
|
229
|
+
byteLength: number;
|
|
230
|
+
componentType: keyof ComponentTypes;
|
|
231
|
+
type: WEBGL_TYPE_SIZES;
|
|
232
|
+
count: number;
|
|
233
|
+
max?: number[];
|
|
234
|
+
min?: number[];
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Definition for a primitive of a batch.
|
|
238
|
+
*/
|
|
239
|
+
export interface BatchData {
|
|
240
|
+
userId: number;
|
|
241
|
+
indexStart: number;
|
|
242
|
+
indexCount: number;
|
|
243
|
+
positionStart: number;
|
|
244
|
+
positionCount: number;
|
|
245
|
+
}
|
|
246
|
+
export interface MeshJsonData {
|
|
247
|
+
byteOffset: number;
|
|
248
|
+
byteLength: number;
|
|
249
|
+
buffers: MeshBufferData[];
|
|
250
|
+
primitive: {
|
|
251
|
+
type: number;
|
|
252
|
+
position: number;
|
|
253
|
+
normal: number;
|
|
254
|
+
tangent: number;
|
|
255
|
+
indice: number;
|
|
256
|
+
uv_0: number;
|
|
257
|
+
color?: number;
|
|
258
|
+
barycentric: number;
|
|
259
|
+
material: string;
|
|
260
|
+
materialId: string;
|
|
261
|
+
normalCompressed: boolean;
|
|
262
|
+
};
|
|
263
|
+
batchTable: BatchData[];
|
|
264
|
+
}
|
|
265
|
+
export interface InstancedMeshJsonData {
|
|
266
|
+
meshes: MeshJsonData[];
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Definition of a tile.
|
|
270
|
+
* A tile can contain both instanced and batched mesh.
|
|
271
|
+
* A tile may contain part of (not all) primitives of an instance.
|
|
272
|
+
* e.g., an instance has 10 concrete primitives, a tile may contain 3 of them.
|
|
273
|
+
* A tile may contain part of (not all) primitives of a batch.
|
|
274
|
+
* e.g., a batch has 10 primitives, a tile may contain 3 of them.
|
|
275
|
+
*/
|
|
276
|
+
export interface TileJsonData {
|
|
277
|
+
instancedMeshes: InstancedMeshData[];
|
|
278
|
+
batchedMeshes: MeshJsonData[];
|
|
279
|
+
}
|
|
280
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import type { BimTilesRenderer } from "./BimTilesRenderer";
|
|
3
|
+
import { TileObject } from "../Constants";
|
|
4
|
+
import { BimTilesMaterial, BimTilesPickMaterial, BimTilesTransparentMaterial, BimTilesHighlightMaterial } from "../../../core/materials";
|
|
5
|
+
/**
|
|
6
|
+
* Object state type, which can be "Hidden", "Transparent", "Highlighted" or "Hovered".
|
|
7
|
+
* Each tile object (maps to a userId) has a "color" (8 bytes) value that contains
|
|
8
|
+
* State types, opacity value, etc.
|
|
9
|
+
* - State types are stored in color.r
|
|
10
|
+
* - bit 0: Hidden
|
|
11
|
+
* - bit 1: Transparent
|
|
12
|
+
* - bit 2: Hovered
|
|
13
|
+
* - bit 3: Highlighted
|
|
14
|
+
* - bit 4-7: not used for now
|
|
15
|
+
* - Opacity value is stored in color.g (value between 0 to 1)
|
|
16
|
+
* - color.b for transparent effect ( used by cloned mesh), currently only bit 0 is used.
|
|
17
|
+
* - color.a is not used for now
|
|
18
|
+
*
|
|
19
|
+
* All tile object states of a tileset are stored in a stateTexture,
|
|
20
|
+
* which will be send to GPU, thus GPU knows which tile object should
|
|
21
|
+
* be hidden/transparent/hovered/highlighted.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum StateType {
|
|
24
|
+
/**
|
|
25
|
+
* Hide a tile object.
|
|
26
|
+
*/
|
|
27
|
+
Hidden = 0,
|
|
28
|
+
/**
|
|
29
|
+
* Transparent is implemented by cloning objects' mesh (don't clone geometry) and
|
|
30
|
+
* apply a transparent material.
|
|
31
|
+
*/
|
|
32
|
+
Transparent = 1,
|
|
33
|
+
/**
|
|
34
|
+
* We implement highlight by cloning mesh and apply a highlight material.
|
|
35
|
+
* There can be transparent objects and highlighted objects in the same time.
|
|
36
|
+
* But, one object is either transparent or highlighted.
|
|
37
|
+
*/
|
|
38
|
+
Highlighted = 2,
|
|
39
|
+
/**
|
|
40
|
+
* There should only one object being hovered!
|
|
41
|
+
* We implement hover effect by blending an object's color in shader.
|
|
42
|
+
*/
|
|
43
|
+
Hovered = 3
|
|
44
|
+
}
|
|
45
|
+
export declare class BimTilesMaterialManager {
|
|
46
|
+
private _pickMaterial?;
|
|
47
|
+
private _highlightMaterial?;
|
|
48
|
+
private _transparentMaterial?;
|
|
49
|
+
private stateTexture;
|
|
50
|
+
protected batchMaterialMap: Map<string, BimTilesMaterial>;
|
|
51
|
+
protected instanceMaterialMap: Map<string, BimTilesMaterial>;
|
|
52
|
+
tileRenderer: BimTilesRenderer;
|
|
53
|
+
highlightMesh?: THREE.Mesh;
|
|
54
|
+
constructor(tileRenderer: BimTilesRenderer, modelCfg: any);
|
|
55
|
+
createBatchMaterial(materialId: string, params?: THREE.MeshStandardMaterialParameters, hasBarycentric?: boolean): BimTilesMaterial | undefined;
|
|
56
|
+
createInstanceMaterial(materialId: string, params?: THREE.MeshStandardMaterialParameters, hasBarycentric?: boolean): BimTilesMaterial | undefined;
|
|
57
|
+
get highlightMaterial(): BimTilesHighlightMaterial;
|
|
58
|
+
get transparentMaterial(): BimTilesTransparentMaterial;
|
|
59
|
+
get pickMaterial(): BimTilesPickMaterial;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a DataTexture to store objects' states.
|
|
62
|
+
* todo: The width and height of texture can't exceed the maximum size supported by the current gpu.
|
|
63
|
+
*/
|
|
64
|
+
private createStateTexture;
|
|
65
|
+
/**
|
|
66
|
+
* Updates state.
|
|
67
|
+
* @param opacity Useful for StateType.Transparent, and when flag is true.
|
|
68
|
+
*/
|
|
69
|
+
updateState(state: StateType, userIds: number[], flag: boolean, opacity?: number): void;
|
|
70
|
+
private setHiddenForTransparent;
|
|
71
|
+
private updateClonedTransparentMesh;
|
|
72
|
+
private clearClonedTransparentMesh;
|
|
73
|
+
private cloneMeshForTransparent;
|
|
74
|
+
private disposeClonedTransparentMesh;
|
|
75
|
+
private updateAllClonedTransparentMesh;
|
|
76
|
+
private clearAllClonedTransparentMesh;
|
|
77
|
+
/**
|
|
78
|
+
* Sets current tileset visible or invisible.
|
|
79
|
+
*/
|
|
80
|
+
setHidden(flag: boolean): void;
|
|
81
|
+
/**
|
|
82
|
+
* Sets current tileset's opacity.
|
|
83
|
+
* @param opacity A value between 0 and 1, and will be converted to 0-255.
|
|
84
|
+
* opacity is 1 means to clear opacity.
|
|
85
|
+
*/
|
|
86
|
+
setOpacity(opacity: number): void;
|
|
87
|
+
/**
|
|
88
|
+
* Clears hovered object.
|
|
89
|
+
* We don't store the hovered userId, simply clear the flag for all userIds.
|
|
90
|
+
*/
|
|
91
|
+
clearHovered(): void;
|
|
92
|
+
updateHighlightMesh(): void;
|
|
93
|
+
clearHighlightMesh(): void;
|
|
94
|
+
clearState(state: StateType): void;
|
|
95
|
+
setDoubleSidedMaterials(): void;
|
|
96
|
+
revertDoubleSidedMaterials(): void;
|
|
97
|
+
setClipPlanes(planes: THREE.Plane[]): void;
|
|
98
|
+
resetState(): void;
|
|
99
|
+
updateMaterialStates(): void;
|
|
100
|
+
dispose(): void;
|
|
101
|
+
private disposeMesh;
|
|
102
|
+
/**
|
|
103
|
+
* Checks if there is any visible object.
|
|
104
|
+
*/
|
|
105
|
+
hasVisibleObject(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Checks if there is any invisible object.
|
|
108
|
+
*/
|
|
109
|
+
hasInvisibleObject(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Get transparent userIds.
|
|
112
|
+
*/
|
|
113
|
+
getTransparentUserIds(): number[];
|
|
114
|
+
/**
|
|
115
|
+
* Get highlight userIds.
|
|
116
|
+
*/
|
|
117
|
+
getHighlightUserIds(): number[];
|
|
118
|
+
/**
|
|
119
|
+
* Gets the hovered object if any.
|
|
120
|
+
*/
|
|
121
|
+
getHoveredObject(): TileObject | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Converts an opacity value between 0-1 to value 0-255. For values:
|
|
124
|
+
* 0: actually equals to hidden, we'll convert it to 1 in shader.
|
|
125
|
+
* [0, 1): will be mapped to integer between [1, 255]
|
|
126
|
+
* 1: will be mapped to 0 in shader.
|
|
127
|
+
*/
|
|
128
|
+
private opacity2Int8;
|
|
129
|
+
/**
|
|
130
|
+
* Sets the flag(0 or 1) of a number by given StateType.
|
|
131
|
+
* @param num A number between 0 and 255.
|
|
132
|
+
*/
|
|
133
|
+
private setFlag;
|
|
134
|
+
/**
|
|
135
|
+
* Gets the flag(0 or 1) from a number by given StateType.
|
|
136
|
+
* @param num A number between 0 and 255.
|
|
137
|
+
*/
|
|
138
|
+
private getFlag;
|
|
139
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { BimTilesConfigMetadata, BimTilesConfigParser, BimTilesConfigStatistics } from "./BimTilesConfigParser";
|
|
3
|
+
import { BimTilesMaterialManager } from "./BimTilesMaterialManager";
|
|
4
|
+
import { BimTilesRenderer } from "./BimTilesRenderer";
|
|
5
|
+
import { TileObject, ModelData3d } from "../Constants";
|
|
6
|
+
import { Model } from "../Model";
|
|
7
|
+
export declare class BimTilesModel extends Model {
|
|
8
|
+
/**
|
|
9
|
+
* ModelId for BimTiles is actually tilesetId, it is a number (0-255), but we use it as a string.
|
|
10
|
+
*/
|
|
11
|
+
modelId: string;
|
|
12
|
+
_bbox?: THREE.Box3;
|
|
13
|
+
tilesRenderer: BimTilesRenderer;
|
|
14
|
+
metadata: BimTilesConfigMetadata;
|
|
15
|
+
statistics: BimTilesConfigStatistics;
|
|
16
|
+
constructor(modelData: ModelData3d, baseUrl: string, bimTilesCfg: BimTilesConfigParser);
|
|
17
|
+
getTilesRenderer(): BimTilesRenderer;
|
|
18
|
+
get materialManager(): BimTilesMaterialManager;
|
|
19
|
+
get propertyParser(): import("./BimTilesPropertyParser").BimTilesPropertyParser;
|
|
20
|
+
get highlighUsageGroup(): THREE.Group<THREE.Object3DEventMap>;
|
|
21
|
+
get transparentUsageGroup(): THREE.Group<THREE.Object3DEventMap>;
|
|
22
|
+
get pickUsageGroup(): THREE.Group<THREE.Object3DEventMap>;
|
|
23
|
+
getModelObject(): THREE.Object3D;
|
|
24
|
+
private traverseObjectByUserId;
|
|
25
|
+
getObjectByUserId(userId: number): THREE.Object3D | undefined;
|
|
26
|
+
getBBox(): THREE.Box3;
|
|
27
|
+
setObjectHoveredByUserId(userId: number, hovered: boolean): void;
|
|
28
|
+
clearHovered(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Highlights an object by userId.
|
|
31
|
+
*/
|
|
32
|
+
setObjectHighlightedByUserIds(userIds: number[], highlight: boolean): void;
|
|
33
|
+
clearHighlight(): void;
|
|
34
|
+
setDoubleSidedMaterials(): void;
|
|
35
|
+
revertDoubleSidedMaterials(): void;
|
|
36
|
+
setObjectOpacityByUserIds(userIds: number[], opacity: number): void;
|
|
37
|
+
clearObjectOpacityByUserIds(userIds: number[]): void;
|
|
38
|
+
setOpacity(opacity: number): void;
|
|
39
|
+
clearOpacity(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Sets current tileset visible or invisible.
|
|
42
|
+
*/
|
|
43
|
+
setVisible(visible: boolean): void;
|
|
44
|
+
setObjectVisibleByUserIds(userIds: number[], visible: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* Checks if there is any visible object.
|
|
47
|
+
*/
|
|
48
|
+
hasVisibleObject(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Checks if there is any invisible object.
|
|
51
|
+
*/
|
|
52
|
+
hasInvisibleObject(): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the hovered object if any.
|
|
55
|
+
*/
|
|
56
|
+
getHoveredObject(): TileObject | undefined;
|
|
57
|
+
getBBoxByUserId(userId: number): THREE.Box3 | undefined;
|
|
58
|
+
getUserDataByUserId(userId: number): Record<string, any> | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Gets all userIds of a tileset.
|
|
61
|
+
*/
|
|
62
|
+
getUserIds(): number[];
|
|
63
|
+
getUserId(modelId: string, familyInstanceId: string): number[];
|
|
64
|
+
getUserData(modelId: string, familyInstanceId: string): Record<string, any> | undefined;
|
|
65
|
+
getUserIdByFilter(filter: (userData: Record<string, any>) => boolean): number[];
|
|
66
|
+
setClipPlanes(planes: THREE.Plane[]): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as protobuf from "protobufjs";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { BimTilesMaterialJson, BimTilesUserDataJson, BimTilesUserIdJson, BimTilesUserIdBoxJson } from "./BimTilesData";
|
|
4
|
+
export declare class BimTilesPropertyParser {
|
|
5
|
+
private baseUrl;
|
|
6
|
+
private textureLoaderCache;
|
|
7
|
+
private materialCache;
|
|
8
|
+
private textureCache;
|
|
9
|
+
private userDataCache;
|
|
10
|
+
private familyInstanceIdCache;
|
|
11
|
+
private familyInstanceAndUserIdsCache;
|
|
12
|
+
private userIdAndUserDataCache;
|
|
13
|
+
private userBoxCache;
|
|
14
|
+
private protoRoot;
|
|
15
|
+
preprocessURL: ((uri: string | URL) => string) | null;
|
|
16
|
+
constructor(baseUrl: string, protoRoot: protobuf.Root);
|
|
17
|
+
getProperty(url: string, fetchOptions: RequestInit | undefined, protobufType: string): Promise<any>;
|
|
18
|
+
private getPropertyFromJson;
|
|
19
|
+
private getPropertyFromBinary;
|
|
20
|
+
private getTextureLoader;
|
|
21
|
+
private loadTexture;
|
|
22
|
+
private assignTexture;
|
|
23
|
+
parseMaterial(json: BimTilesMaterialJson): Promise<void>;
|
|
24
|
+
parseUserData(json: BimTilesUserDataJson): void;
|
|
25
|
+
parseUserId(json: BimTilesUserIdJson): void;
|
|
26
|
+
parseUserIdBox(json: BimTilesUserIdBoxJson, parentMatrix?: THREE.Matrix4): void;
|
|
27
|
+
getMaterialParameters(userId: string): THREE.MeshStandardMaterialParameters | undefined;
|
|
28
|
+
getUserData(userId: number): Record<string, any> | undefined;
|
|
29
|
+
getFamilyInstanceIdsByModelId(modelId: string): string[] | undefined;
|
|
30
|
+
getUserIdBox(userId: number): THREE.Box3 | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Gets all userIds of a model.
|
|
33
|
+
*/
|
|
34
|
+
getUserIds(): number[];
|
|
35
|
+
/**
|
|
36
|
+
* Gets all userIds of the modelId and familyInstanceId
|
|
37
|
+
*/
|
|
38
|
+
getUserIdsByFamilyInstanceId(modelId: string, familyInstanceId: string): number[];
|
|
39
|
+
private getUserIdByUserDataIndex;
|
|
40
|
+
getUserIdByFilter(filter: (userData: Record<string, any>) => boolean): number[];
|
|
41
|
+
dispose(): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Tile, TilesRenderer } from "3d-tiles-renderer";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { BimTilesJson } from "./BimTilesData";
|
|
4
|
+
import { BimTilesMaterialManager } from "./BimTilesMaterialManager";
|
|
5
|
+
import { BimTilesPropertyParser } from "./BimTilesPropertyParser";
|
|
6
|
+
/**
|
|
7
|
+
* @link https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/v0.3.32/src/three/TilesRenderer.js
|
|
8
|
+
* @example
|
|
9
|
+
* BimTilesRenderer
|
|
10
|
+
* |
|
|
11
|
+
* tileRender.loadRootTileSet(tileSet)
|
|
12
|
+
* |
|
|
13
|
+
* tileRender.update()
|
|
14
|
+
* |
|
|
15
|
+
* traverse tile
|
|
16
|
+
* |
|
|
17
|
+
* tileRender.requestTileContents(tile) --------- downloadQueue, parseQueue
|
|
18
|
+
* |
|
|
19
|
+
* tileRender.tileInView(tile)
|
|
20
|
+
* |
|
|
21
|
+
* tileRender.setTileVisible(tile, visible)------- tileRender.calculateError(tile)
|
|
22
|
+
*/
|
|
23
|
+
export declare class BimTilesRenderer extends TilesRenderer {
|
|
24
|
+
highlighUsage: THREE.Group;
|
|
25
|
+
transparentUsage: THREE.Group;
|
|
26
|
+
pickUsage: THREE.Group;
|
|
27
|
+
materialManager?: BimTilesMaterialManager;
|
|
28
|
+
baseUrl: string;
|
|
29
|
+
propertyParser: BimTilesPropertyParser;
|
|
30
|
+
tilesetId: number;
|
|
31
|
+
onBeforeParseTile?: (tile: Tile) => void;
|
|
32
|
+
private protoRoot;
|
|
33
|
+
constructor(url: string, tilesetId: number);
|
|
34
|
+
private getVertexColorArray;
|
|
35
|
+
private createBatchedMesh;
|
|
36
|
+
private createInstancedMesh;
|
|
37
|
+
/**
|
|
38
|
+
* Gets cloned geometries by given userIds.
|
|
39
|
+
*/
|
|
40
|
+
getGeometryByUserIds(userIds: number[]): THREE.BufferGeometry;
|
|
41
|
+
parseTile(buffer: ArrayBuffer, tile: any, extension: any): Promise<void>;
|
|
42
|
+
disposeTile(tile: any): void;
|
|
43
|
+
preprocessNode(tile: any, tileSetDir: string, parentTile?: Tile): void;
|
|
44
|
+
fetchTileSet(url: string, fetchOptions: RequestInit, parent?: undefined): Promise<BimTilesJson>;
|
|
45
|
+
loadRootTileSet(url: string): Promise<any>;
|
|
46
|
+
update(): void;
|
|
47
|
+
setTileVisible(tile: any, visible: boolean): void;
|
|
48
|
+
calculateError(tile: Tile): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { InstancedMeshData } from "./BimTilesData";
|
|
3
|
+
export interface InstancedMesh {
|
|
4
|
+
type: number;
|
|
5
|
+
position: THREE.TypedArray;
|
|
6
|
+
color: THREE.TypedArray;
|
|
7
|
+
normal: THREE.TypedArray;
|
|
8
|
+
indice: THREE.TypedArray;
|
|
9
|
+
uv: THREE.TypedArray;
|
|
10
|
+
tangent: THREE.TypedArray;
|
|
11
|
+
barycentric: THREE.TypedArray;
|
|
12
|
+
userIds: number[];
|
|
13
|
+
matrices: number[];
|
|
14
|
+
materialId: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parses instanced meshes of a tile.
|
|
18
|
+
*/
|
|
19
|
+
export declare class InstancedMeshesParser {
|
|
20
|
+
header?: {
|
|
21
|
+
magic: string;
|
|
22
|
+
version: number;
|
|
23
|
+
byteLength: number;
|
|
24
|
+
};
|
|
25
|
+
static instanceDataMap: Record<string, InstancedMesh[]>;
|
|
26
|
+
parse(instMeshDataArray: InstancedMeshData[], baseUrl: string, protoRoot?: protobuf.Root): Promise<InstancedMesh[]>;
|
|
27
|
+
private parseInstanceBuffer;
|
|
28
|
+
private parseInstanceProto;
|
|
29
|
+
private parseMeshes;
|
|
30
|
+
private parseMesh;
|
|
31
|
+
private parseTypedArray;
|
|
32
|
+
/**
|
|
33
|
+
* Get InstancedMesh from cache or online.
|
|
34
|
+
* @param url Instance full url for a particular LoD.
|
|
35
|
+
*/
|
|
36
|
+
private getInstancedMeshByUrlAndBlobId;
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a tile.
|
|
3
|
+
*/
|
|
4
|
+
export declare class TileParser {
|
|
5
|
+
parse(buffer: ArrayBuffer, baseUrl: string, protoRoot: protobuf.Root): Promise<{
|
|
6
|
+
batchedMeshes: import("./BatchedMeshesParser").BatchedMesh[];
|
|
7
|
+
instancedMeshes: import("./InstancedMeshesParser").InstancedMesh[];
|
|
8
|
+
}>;
|
|
9
|
+
private parseBinary;
|
|
10
|
+
private parseProto;
|
|
11
|
+
}
|