@cognite/reveal 4.3.4 → 4.4.0-dev.20230803
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/dist/index.js +163 -155
- package/dist/index.js.map +1 -1
- package/dist/packages/cad-geometry-loaders/src/CadManager.d.ts +1 -0
- package/dist/packages/cad-model/src/batching/MultiBufferBatchingManager.d.ts +4 -1
- package/dist/packages/cad-model/src/utilities/CustomSectorBounds.d.ts +68 -0
- package/dist/packages/cad-model/src/utilities/TreeIndexToSectorsMap.d.ts +40 -0
- package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +2 -0
- package/dist/packages/cad-model/src/wrappers/CogniteCadModel.d.ts +3 -1
- package/dist/packages/camera-manager/src/CameraManagerHelper.d.ts +2 -1
- package/dist/packages/pointclouds/src/PointCloudManager.d.ts +1 -0
- package/dist/packages/rendering/src/PointCloudMaterialManager.d.ts +2 -1
- package/dist/packages/utilities/src/three/VariableWidthLine.d.ts +2 -3
- package/package.json +32 -32
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Group } from 'three';
|
|
2
2
|
import { Materials, StyledTreeIndexSets } from '../../../rendering';
|
|
3
3
|
import { ParsedGeometry } from '../../../sector-parser';
|
|
4
|
+
import { TreeIndexToSectorsMap } from '../utilities/TreeIndexToSectorsMap';
|
|
4
5
|
import { DrawCallBatchingManager } from './DrawCallBatchingManager';
|
|
5
6
|
/**
|
|
6
7
|
* The objective of this class is to batch together instances
|
|
@@ -10,6 +11,7 @@ import { DrawCallBatchingManager } from './DrawCallBatchingManager';
|
|
|
10
11
|
* and continually filling / ejecting data from those buffers when new sectors are added / removed.
|
|
11
12
|
*/
|
|
12
13
|
export declare class MultiBufferBatchingManager implements DrawCallBatchingManager {
|
|
14
|
+
private readonly treeIndexToSectorsMap;
|
|
13
15
|
private readonly initialBufferSize;
|
|
14
16
|
private readonly numberOfInstanceBatches;
|
|
15
17
|
private readonly _sectorBatches;
|
|
@@ -17,7 +19,7 @@ export declare class MultiBufferBatchingManager implements DrawCallBatchingManag
|
|
|
17
19
|
private readonly _materials;
|
|
18
20
|
private readonly _batchGroup;
|
|
19
21
|
private readonly _styledTreeIndexSets;
|
|
20
|
-
constructor(batchGroup: Group, materials: Materials, styleTreeIndexSets: StyledTreeIndexSets, initialBufferSize?: number, numberOfInstanceBatches?: number);
|
|
22
|
+
constructor(batchGroup: Group, materials: Materials, styleTreeIndexSets: StyledTreeIndexSets, treeIndexToSectorsMap: TreeIndexToSectorsMap, initialBufferSize?: number, numberOfInstanceBatches?: number);
|
|
21
23
|
batchGeometries(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
|
|
22
24
|
removeSectorBatches(sectorId: number): void;
|
|
23
25
|
dispose(): void;
|
|
@@ -25,6 +27,7 @@ export declare class MultiBufferBatchingManager implements DrawCallBatchingManag
|
|
|
25
27
|
private processGeometries;
|
|
26
28
|
private batchInstanceAttributes;
|
|
27
29
|
private addTreeIndicesToMeshUserData;
|
|
30
|
+
private updateTreeIndexToSectorsMap;
|
|
28
31
|
private reallocateBufferGeometry;
|
|
29
32
|
private updateInstanceAttributes;
|
|
30
33
|
private extendUpdateRange;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { CadNode } from '../wrappers/CadNode';
|
|
6
|
+
/**
|
|
7
|
+
* An instance of this class is used to dynamically alter the sector bounding boxes to adapt to custom node transforms.
|
|
8
|
+
* The bounding box of a sector is kept equal to its original value, unless:
|
|
9
|
+
* - A node with geometry in the sector is transformed such that the original bounds would not fully contain the node geometry
|
|
10
|
+
* - Descendants of the sector have grown, and are no longer contained within the original bounds.
|
|
11
|
+
* The set of sectors a tree index has geometry in does not need to be known upfront. This set of sectors, and the node transform,
|
|
12
|
+
* are set independently of each other.
|
|
13
|
+
*/
|
|
14
|
+
export declare class CustomSectorBounds {
|
|
15
|
+
private readonly cadNode;
|
|
16
|
+
private readonly _treeIndexToTransformedNodeMap;
|
|
17
|
+
private readonly _sectorIdToTransformedNodesMap;
|
|
18
|
+
private readonly _originalSectorBounds;
|
|
19
|
+
private readonly _sectorsWithInvalidBounds;
|
|
20
|
+
private readonly _allSectorsSortedByDepth;
|
|
21
|
+
constructor(cadNode: CadNode);
|
|
22
|
+
/**
|
|
23
|
+
* Returns whether or not the given node is registered
|
|
24
|
+
* @param treeIndex Tree index of the node to check
|
|
25
|
+
* @returns True if node is registered, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
isRegistered(treeIndex: number): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Registers a node as transformed, meaning it'll be taken into account when sector bounds are recomputed
|
|
30
|
+
* @param treeIndex Tree index of the transformed node
|
|
31
|
+
* @param originalBoundingBox The original bounding box of this node
|
|
32
|
+
*/
|
|
33
|
+
registerTransformedNode(treeIndex: number, originalBoundingBox?: THREE.Box3): void;
|
|
34
|
+
/**
|
|
35
|
+
* Updates the transform for a registered node. Sector bounds will not be changed until recomputeSectorBounds() is called
|
|
36
|
+
* @param treeIndex Tree index of the transformed node
|
|
37
|
+
* @param newTransform The transform
|
|
38
|
+
*/
|
|
39
|
+
updateNodeTransform(treeIndex: number, newTransform: THREE.Matrix4): void;
|
|
40
|
+
/**
|
|
41
|
+
* Updates the set of sectors a node is known to have geometry in. Addition of new sectors is the only possible operation.
|
|
42
|
+
* Sector bounds will not be changed until recomputeSectorBounds() is called
|
|
43
|
+
* @param treeIndex Tree index of the transformed node
|
|
44
|
+
* @param newSectors The new sector(s) that this node is discovered to have geometry in
|
|
45
|
+
*/
|
|
46
|
+
updateNodeSectors(treeIndex: number, newSectors: number[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* Unregisters a node, meaning it will no longer be taken into account when sector bounds are recomputed
|
|
49
|
+
* @param treeIndex Tree index of the node to be unregistered
|
|
50
|
+
*/
|
|
51
|
+
unregisterTransformedNode(treeIndex: number): void;
|
|
52
|
+
/**
|
|
53
|
+
* Recomputes the sector bounds making all registered nodes fully contained in their respective sectors. This
|
|
54
|
+
* is the only time the sector bounds are actually altered.
|
|
55
|
+
*/
|
|
56
|
+
recomputeSectorBounds(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the bounding box of a given sector by expanding the original bounds to include the given custom bounding boxes
|
|
59
|
+
* @param sectorId The sector id
|
|
60
|
+
* @param customBoundingBoxes An array of bounding boxes this sector should contain
|
|
61
|
+
* @returns True if the new sector bounds are different from the original values. False otherwise
|
|
62
|
+
*/
|
|
63
|
+
private updateSector;
|
|
64
|
+
private getOriginalSectorBounds;
|
|
65
|
+
private setCustomSectorBounds;
|
|
66
|
+
private clearCustomSectorBounds;
|
|
67
|
+
private sectorMetadata;
|
|
68
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { RevealGeometryCollectionType } from '../../../sector-parser';
|
|
5
|
+
/**
|
|
6
|
+
* Map between a tree index and the set of sectors it has geometry in. Also contains helper functions to keep track of whether or not
|
|
7
|
+
* a given sector has had all its tree indices added to the map. This means iterating over all tree indices in a sector will only be
|
|
8
|
+
* done on first load.
|
|
9
|
+
*/
|
|
10
|
+
export declare class TreeIndexToSectorsMap {
|
|
11
|
+
onChange?: (treeIndex: number, newSectorId: number) => void;
|
|
12
|
+
private readonly _treeIndexToSectorIds;
|
|
13
|
+
private readonly _parsedSectors;
|
|
14
|
+
/**
|
|
15
|
+
* Store the fact that a tree index is found to have geometry in a certain sector
|
|
16
|
+
* @param treeIndex Tree index
|
|
17
|
+
* @param sectorId The sector id where the tree index was found
|
|
18
|
+
*/
|
|
19
|
+
set(treeIndex: number, sectorId: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get the set of sectors a tree index is known to have geometry in
|
|
22
|
+
* @param treeIndex Tree index
|
|
23
|
+
* @returns The set of sectors
|
|
24
|
+
*/
|
|
25
|
+
getSectorIdsForTreeIndex(treeIndex: number): Set<number>;
|
|
26
|
+
/**
|
|
27
|
+
* Mark a sector as completed for a given geometry type. This will make subsequent calls to isCompleted
|
|
28
|
+
* for this geometry type return true
|
|
29
|
+
* @param sectorId The sector id
|
|
30
|
+
* @param type The geometry type
|
|
31
|
+
*/
|
|
32
|
+
markCompleted(sectorId: number, type: RevealGeometryCollectionType): void;
|
|
33
|
+
/**
|
|
34
|
+
* Check whether or not a sector is completely processed, for a given geometry type
|
|
35
|
+
* @param sectorId The sector id
|
|
36
|
+
* @param type The geometry type
|
|
37
|
+
* @returns True if completed, false otherwise
|
|
38
|
+
*/
|
|
39
|
+
isCompleted(sectorId: number, type: RevealGeometryCollectionType): boolean;
|
|
40
|
+
}
|
|
@@ -7,6 +7,7 @@ import { SectorRepository } from '../../../sector-loader';
|
|
|
7
7
|
import { ParsedGeometry } from '../../../sector-parser';
|
|
8
8
|
import { CadMaterialManager, NodeTransformProvider, RenderMode } from '../../../rendering';
|
|
9
9
|
import { Object3D, Plane, Matrix4 } from 'three';
|
|
10
|
+
import { TreeIndexToSectorsMap } from '../utilities/TreeIndexToSectorsMap';
|
|
10
11
|
export declare class CadNode extends Object3D {
|
|
11
12
|
private readonly _cadModelMetadata;
|
|
12
13
|
private readonly _materialManager;
|
|
@@ -20,6 +21,7 @@ export declare class CadNode extends Object3D {
|
|
|
20
21
|
private readonly _batchedGeometryMeshGroup;
|
|
21
22
|
private readonly _styledTreeIndexSets;
|
|
22
23
|
private _needsRedraw;
|
|
24
|
+
readonly treeIndexToSectorsMap: TreeIndexToSectorsMap;
|
|
23
25
|
readonly type = "CadNode";
|
|
24
26
|
constructor(model: CadModelMetadata, materialManager: CadMaterialManager, sectorRepository: SectorRepository);
|
|
25
27
|
get needsRedraw(): boolean;
|
|
@@ -49,6 +49,7 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
|
|
|
49
49
|
private readonly nodesApiClient;
|
|
50
50
|
private readonly nodeIdAndTreeIndexMaps;
|
|
51
51
|
private readonly _styledNodeCollections;
|
|
52
|
+
private readonly customSectorBounds;
|
|
52
53
|
/**
|
|
53
54
|
* Sets the default appearance for nodes that are not styled using
|
|
54
55
|
* {@link CogniteCadModel.assignStyledNodeCollection}. Updating the default style can be an
|
|
@@ -117,8 +118,9 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
|
|
|
117
118
|
* node isn't supported and might lead to undefined results.
|
|
118
119
|
* @param treeIndices Tree indices of nodes to apply the transformation to.
|
|
119
120
|
* @param transformMatrix Transformation to apply.
|
|
121
|
+
* @param boundingBox Optional bounding box for the nodes before any transformation is applied. If given, it is assumed that all the nodes' geometry fit inside.
|
|
120
122
|
*/
|
|
121
|
-
setNodeTransform(treeIndices: NumericRange, transformMatrix: THREE.Matrix4): void;
|
|
123
|
+
setNodeTransform(treeIndices: NumericRange, transformMatrix: THREE.Matrix4, boundingBox?: THREE.Box3): void;
|
|
122
124
|
/**
|
|
123
125
|
* Set override transform of the node by tree index.
|
|
124
126
|
* @param treeIndex
|
|
@@ -16,9 +16,10 @@ export declare class CameraManagerHelper {
|
|
|
16
16
|
* @param camera Used camera instance.
|
|
17
17
|
* @param rotation New camera rotation in quaternion form.
|
|
18
18
|
* @param currentTarget Current camera target.
|
|
19
|
+
* @param position New camera position.
|
|
19
20
|
* @returns
|
|
20
21
|
*/
|
|
21
|
-
static calculateNewTargetFromRotation(camera: THREE.PerspectiveCamera, rotation: THREE.Quaternion, currentTarget: THREE.Vector3): THREE.Vector3;
|
|
22
|
+
static calculateNewTargetFromRotation(camera: THREE.PerspectiveCamera, rotation: THREE.Quaternion, currentTarget: THREE.Vector3, position: THREE.Vector3): THREE.Vector3;
|
|
22
23
|
/**
|
|
23
24
|
* Calculates camera rotation from target
|
|
24
25
|
* @param camera Used Camera instance
|
|
@@ -18,6 +18,7 @@ export declare class PointCloudManager {
|
|
|
18
18
|
private readonly _loadingStateHandler;
|
|
19
19
|
private readonly _potreeInstance;
|
|
20
20
|
private readonly _pointCloudNodes;
|
|
21
|
+
private _globalClippingPlanes;
|
|
21
22
|
private readonly _cameraSubject;
|
|
22
23
|
private readonly _modelSubject;
|
|
23
24
|
private readonly _budgetSubject;
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
import { PointCloudObjectIdMaps } from './pointcloud-rendering/PointCloudObjectIdMaps';
|
|
5
5
|
import { PointCloudMaterial } from './pointcloud-rendering';
|
|
6
6
|
import { PointCloudMaterialParameters } from './render-passes/types';
|
|
7
|
+
import { Plane } from 'three';
|
|
7
8
|
export declare class PointCloudMaterialManager {
|
|
8
9
|
private readonly _modelsMaterialsMap;
|
|
9
10
|
addModelMaterial(modelIdentifier: symbol, objectIdMaps: PointCloudObjectIdMaps): void;
|
|
10
11
|
removeModelMaterial(modelIdentifier: symbol): void;
|
|
11
12
|
getModelMaterial(modelIdentifier: symbol): PointCloudMaterial;
|
|
12
|
-
initializeClippingPlanesForPointCloud(modelIdentifier: symbol): void;
|
|
13
|
+
initializeClippingPlanesForPointCloud(modelIdentifier: symbol, clippingPlanes: Plane[]): void;
|
|
13
14
|
setModelsMaterialParameters(materialParameters: PointCloudMaterialParameters | undefined): void;
|
|
14
15
|
setMaterialParameters(material: PointCloudMaterial, parameters: PointCloudMaterialParameters): void;
|
|
15
16
|
dispose(): void;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2023 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import { Color, Vector3 } from 'three';
|
|
5
|
-
import { Line2 } from 'three/examples/jsm/lines/Line2';
|
|
4
|
+
import { Color, Object3D, Vector3 } from 'three';
|
|
6
5
|
export declare class VariableWidthLine {
|
|
7
6
|
private readonly _geometry;
|
|
8
7
|
private readonly _lineMaterial;
|
|
9
8
|
private readonly _mesh;
|
|
10
9
|
constructor(lineWidth: number, lineColor: Color, points: Vector3[]);
|
|
11
|
-
get mesh():
|
|
10
|
+
get mesh(): Object3D;
|
|
12
11
|
setLineColor(color: Color): void;
|
|
13
12
|
setVisibility(visibility: boolean): void;
|
|
14
13
|
dispose(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0-dev.20230803",
|
|
4
4
|
"description": "WebGL based 3D viewer for CAD and point clouds processed in Cognite Data Fusion.",
|
|
5
5
|
"homepage": "https://github.com/cognitedata/reveal/tree/master/viewer",
|
|
6
6
|
"repository": {
|
|
@@ -78,75 +78,75 @@
|
|
|
78
78
|
"sparse-octree": "7.1.8"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@azure/msal-browser": "2.
|
|
82
|
-
"@cognite/sdk": "8.
|
|
81
|
+
"@azure/msal-browser": "2.38.0",
|
|
82
|
+
"@cognite/sdk": "8.2.0",
|
|
83
83
|
"@microsoft/api-extractor": "^7.33.6",
|
|
84
84
|
"@types/dat.gui": "0.7.10",
|
|
85
85
|
"@types/gl": "^6.0.2",
|
|
86
86
|
"@types/glob": "8.1.0",
|
|
87
|
-
"@types/jest": "29.5.
|
|
87
|
+
"@types/jest": "29.5.3",
|
|
88
88
|
"@types/jest-environment-puppeteer": "5.0.3",
|
|
89
89
|
"@types/jest-image-snapshot": "6.1.0",
|
|
90
90
|
"@types/jsdom": "21.1.1",
|
|
91
|
-
"@types/lodash": "4.14.
|
|
92
|
-
"@types/mixpanel-browser": "2.
|
|
93
|
-
"@types/node": "18.
|
|
91
|
+
"@types/lodash": "4.14.196",
|
|
92
|
+
"@types/mixpanel-browser": "2.47.1",
|
|
93
|
+
"@types/node": "18.17.1",
|
|
94
94
|
"@types/random-seed": "0.3.3",
|
|
95
95
|
"@types/skmeans": "0.11.4",
|
|
96
96
|
"@types/stats": "0.16.30",
|
|
97
|
-
"@types/three": "0.
|
|
97
|
+
"@types/three": "0.154.0",
|
|
98
98
|
"@types/tween.js": "18.5.1",
|
|
99
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
100
|
-
"@typescript-eslint/parser": "5.
|
|
99
|
+
"@typescript-eslint/eslint-plugin": "5.62.0",
|
|
100
|
+
"@typescript-eslint/parser": "5.62.0",
|
|
101
101
|
"concurrently": "8.2.0",
|
|
102
102
|
"cross-env": "7.0.3",
|
|
103
103
|
"dat.gui": "0.7.9",
|
|
104
|
-
"eslint": "8.
|
|
105
|
-
"eslint-config-prettier": "8.
|
|
104
|
+
"eslint": "8.46.0",
|
|
105
|
+
"eslint-config-prettier": "8.9.0",
|
|
106
106
|
"eslint-plugin-header": "3.1.1",
|
|
107
|
-
"eslint-plugin-jsdoc": "46.
|
|
107
|
+
"eslint-plugin-jsdoc": "46.4.5",
|
|
108
108
|
"eslint-plugin-lodash": "7.4.0",
|
|
109
|
-
"eslint-plugin-prettier": "
|
|
110
|
-
"eslint-plugin-unused-imports": "
|
|
109
|
+
"eslint-plugin-prettier": "5.0.0",
|
|
110
|
+
"eslint-plugin-unused-imports": "3.0.0",
|
|
111
111
|
"file-loader": "6.2.0",
|
|
112
112
|
"gl": "6.0.2",
|
|
113
|
-
"glob": "10.
|
|
113
|
+
"glob": "10.3.3",
|
|
114
114
|
"glslify-loader": "2.0.0",
|
|
115
115
|
"html-webpack-plugin": "5.5.3",
|
|
116
|
-
"jest": "29.
|
|
117
|
-
"jest-canvas-mock": "2.5.
|
|
118
|
-
"jest-environment-jsdom": "29.
|
|
116
|
+
"jest": "29.6.2",
|
|
117
|
+
"jest-canvas-mock": "2.5.2",
|
|
118
|
+
"jest-environment-jsdom": "29.6.2",
|
|
119
119
|
"jest-extended": "4.0.0",
|
|
120
|
-
"jest-image-snapshot": "6.
|
|
120
|
+
"jest-image-snapshot": "6.2.0",
|
|
121
121
|
"jest-puppeteer": "9.0.0",
|
|
122
122
|
"jsdom": "22.1.0",
|
|
123
123
|
"moq.ts": "10.0.6",
|
|
124
|
-
"nock": "13.3.
|
|
125
|
-
"prettier": "
|
|
124
|
+
"nock": "13.3.2",
|
|
125
|
+
"prettier": "3.0.0",
|
|
126
126
|
"process": "0.11.10",
|
|
127
|
-
"puppeteer": "20.
|
|
127
|
+
"puppeteer": "20.9.0",
|
|
128
128
|
"random-seed": "0.3.0",
|
|
129
129
|
"raw-loader": "4.0.2",
|
|
130
130
|
"remove-files-webpack-plugin": "1.5.0",
|
|
131
131
|
"resize-observer-polyfill": "1.5.1",
|
|
132
132
|
"shx": "0.3.4",
|
|
133
133
|
"stats.js": "0.17.0",
|
|
134
|
-
"three": "0.
|
|
135
|
-
"ts-jest": "29.1.
|
|
134
|
+
"three": "0.154.0",
|
|
135
|
+
"ts-jest": "29.1.1",
|
|
136
136
|
"ts-loader": "9.4.3",
|
|
137
|
-
"tsc-alias": "1.8.
|
|
138
|
-
"typescript": "5.1.
|
|
139
|
-
"wasm-pack": "0.12.
|
|
140
|
-
"webpack": "5.
|
|
137
|
+
"tsc-alias": "1.8.7",
|
|
138
|
+
"typescript": "5.1.6",
|
|
139
|
+
"wasm-pack": "0.12.1",
|
|
140
|
+
"webpack": "5.88.2",
|
|
141
141
|
"webpack-cli": "5.1.4",
|
|
142
142
|
"webpack-dev-server": "4.15.1",
|
|
143
143
|
"webpack-node-externals": "3.0.0",
|
|
144
|
-
"whatwg-fetch": "3.6.
|
|
144
|
+
"whatwg-fetch": "3.6.17",
|
|
145
145
|
"workerize-loader": "2.0.2"
|
|
146
146
|
},
|
|
147
147
|
"peerDependencies": {
|
|
148
148
|
"@cognite/sdk": "^7.16.0 || ^8.0.0",
|
|
149
|
-
"three": "0.
|
|
149
|
+
"three": "0.154.0"
|
|
150
150
|
},
|
|
151
151
|
"glslify": {
|
|
152
152
|
"transform": [
|
|
@@ -156,5 +156,5 @@
|
|
|
156
156
|
"files": [
|
|
157
157
|
"./dist/*"
|
|
158
158
|
],
|
|
159
|
-
"packageManager": "yarn@3.6.
|
|
159
|
+
"packageManager": "yarn@3.6.1"
|
|
160
160
|
}
|