@cognite/reveal 4.0.0-dev.20221123 → 4.0.0-dev.20221124
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 +38 -42
- package/dist/index.js.map +1 -1
- package/dist/packages/api/index.d.ts +1 -0
- package/dist/packages/api/src/public/constants.d.ts +11 -0
- package/dist/packages/api/src/public/migration/types.d.ts +1 -1
- package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +9 -6
- package/dist/packages/cad-model/src/wrappers/CogniteCadModel.d.ts +8 -40
- package/dist/packages/cad-styling/src/CdfModelNodeCollectionDataProvider.d.ts +6 -4
- package/dist/packages/cad-styling/src/CdfNodeCollectionBase.d.ts +1 -1
- package/dist/packages/data-providers/index.d.ts +1 -0
- package/dist/packages/data-providers/src/utilities/applyDefaultModelTransformation.d.ts +1 -0
- package/dist/packages/pointclouds/src/CognitePointCloudModel.d.ts +10 -2
- package/dist/packages/pointclouds/src/PointCloudNode.d.ts +7 -4
- package/dist/packages/rendering/src/CadMaterialManager.d.ts +1 -0
- package/dist/packages/rendering/src/rendering/NodeAppearanceTextureBuilder.d.ts +2 -0
- package/dist/packages/tools/index.d.ts +0 -1
- package/package.json +4 -4
- package/dist/packages/tools/src/ExplodedViewTool.d.ts +0 -12
|
@@ -5,5 +5,6 @@ export { Cognite3DViewer } from './src/public/migration/Cognite3DViewer';
|
|
|
5
5
|
export { CogniteCadModel } from '../cad-model';
|
|
6
6
|
export { ViewerState, ModelState } from './src/utilities/ViewStateHelper';
|
|
7
7
|
export * from './src/public/types';
|
|
8
|
+
export { CDF_TO_VIEWER_TRANSFORMATION } from './src/public/constants';
|
|
8
9
|
declare const REVEAL_VERSION: string;
|
|
9
10
|
export { REVEAL_VERSION };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Matrix4 } from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* The transformation matrix from CDF coordinates to ThreeJS/Reveal.
|
|
7
|
+
* Note that this is already applied to {@link CogniteCadModel} and {@link CognitePointCloudModel}
|
|
8
|
+
* automatically, as it is factored into the matrix returned from e.g.
|
|
9
|
+
* the {@link CogniteCadModel.getCdfToDefaultModelTransformation} method.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CDF_TO_VIEWER_TRANSFORMATION: Matrix4;
|
|
@@ -129,7 +129,7 @@ export interface Cognite3DViewerOptions {
|
|
|
129
129
|
* the camera is moving. Note that this option should left to false on
|
|
130
130
|
* low-end devices as more loading can cause frame drops.
|
|
131
131
|
*
|
|
132
|
-
* Default value is set to
|
|
132
|
+
* Default value is set to true.
|
|
133
133
|
*/
|
|
134
134
|
continuousModelStreaming?: boolean;
|
|
135
135
|
}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
4
|
import { NodeAppearanceProvider, NodeAppearance, PrioritizedArea } from '../../../cad-styling';
|
|
6
5
|
import { SectorScene, CadModelMetadata, RootSectorNode, WantedSector, ConsumedSector } from '../../../cad-parsers';
|
|
7
6
|
import { SectorRepository } from '../../../sector-loader';
|
|
8
7
|
import { ParsedGeometry } from '../../../sector-parser';
|
|
9
8
|
import { CadMaterialManager, NodeTransformProvider, RenderMode } from '../../../rendering';
|
|
10
|
-
|
|
9
|
+
import { Object3D, Plane, Matrix4 } from 'three';
|
|
10
|
+
export declare class CadNode extends Object3D {
|
|
11
11
|
private readonly _cadModelMetadata;
|
|
12
12
|
private readonly _materialManager;
|
|
13
13
|
private readonly _sectorRepository;
|
|
14
14
|
private _rootSector;
|
|
15
15
|
private _sectorScene;
|
|
16
16
|
private _geometryBatchingManager?;
|
|
17
|
+
private readonly _sourceTransform;
|
|
18
|
+
private readonly _customTransform;
|
|
17
19
|
constructor(model: CadModelMetadata, materialManager: CadMaterialManager, sectorRepository: SectorRepository);
|
|
18
20
|
get nodeTransformProvider(): NodeTransformProvider;
|
|
19
21
|
get nodeAppearanceProvider(): NodeAppearanceProvider;
|
|
20
22
|
get defaultNodeAppearance(): NodeAppearance;
|
|
21
23
|
set defaultNodeAppearance(appearance: NodeAppearance);
|
|
22
|
-
get clippingPlanes():
|
|
23
|
-
set clippingPlanes(planes:
|
|
24
|
+
get clippingPlanes(): Plane[];
|
|
25
|
+
set clippingPlanes(planes: Plane[]);
|
|
24
26
|
get cadModelMetadata(): CadModelMetadata;
|
|
25
27
|
get cadModelIdentifier(): string;
|
|
26
28
|
get sectorScene(): SectorScene;
|
|
@@ -33,12 +35,13 @@ export declare class CadNode extends THREE.Object3D {
|
|
|
33
35
|
* Sets transformation matrix of the model. This overrides the current transformation.
|
|
34
36
|
* @param matrix Transformation matrix.
|
|
35
37
|
*/
|
|
36
|
-
setModelTransformation(matrix:
|
|
38
|
+
setModelTransformation(matrix: Matrix4): void;
|
|
37
39
|
/**
|
|
38
40
|
* Gets transformation matrix of the model
|
|
39
41
|
* @param out Preallocated `THREE.Matrix4` (optional).
|
|
40
42
|
*/
|
|
41
|
-
getModelTransformation(out?:
|
|
43
|
+
getModelTransformation(out?: Matrix4): Matrix4;
|
|
44
|
+
getCdfToDefaultModelTransformation(out?: Matrix4): Matrix4;
|
|
42
45
|
get prioritizedAreas(): PrioritizedArea[];
|
|
43
46
|
batchGeometry(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
|
|
44
47
|
removeBatchedSectorGeometries(sectorId: number): void;
|
|
@@ -125,45 +125,6 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
|
|
|
125
125
|
* @param applyToChildren
|
|
126
126
|
*/
|
|
127
127
|
resetNodeTransformByTreeIndex(treeIndex: number, applyToChildren?: boolean): Promise<number>;
|
|
128
|
-
/**
|
|
129
|
-
* Maps a position retrieved from the CDF API (e.g. 3D node information) to
|
|
130
|
-
* coordinates in "ThreeJS model space". This is necessary because CDF has a right-handed
|
|
131
|
-
* Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system.
|
|
132
|
-
* @param p The CDF coordinate to transform.
|
|
133
|
-
* @param out Optional preallocated buffer for storing the result. May be `p`.
|
|
134
|
-
* @returns Transformed position.
|
|
135
|
-
*/
|
|
136
|
-
mapFromCdfToModelCoordinates(p: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
|
|
137
|
-
/**
|
|
138
|
-
* Maps from a 3D position in "ThreeJS model space" (e.g. a ray intersection coordinate)
|
|
139
|
-
* to coordinates in "CDF space". This is necessary because CDF has a right-handed
|
|
140
|
-
* Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system.
|
|
141
|
-
* This function also accounts for transformation applied to the model.
|
|
142
|
-
* @param p The ThreeJS coordinate to transform.
|
|
143
|
-
* @param out Optional preallocated buffer for storing the result. May be `p`.
|
|
144
|
-
* @returns Transformed position.
|
|
145
|
-
*/
|
|
146
|
-
mapPositionFromModelToCdfCoordinates(p: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
|
|
147
|
-
/**
|
|
148
|
-
* Maps from a 3D position in "ThreeJS model space" to coordinates in "CDF space".
|
|
149
|
-
* This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS
|
|
150
|
-
* uses a right-hand Y-up coordinate system. This function also accounts for transformation
|
|
151
|
-
* applied to the model.
|
|
152
|
-
* @param box The box in ThreeJS/model coordinates.
|
|
153
|
-
* @param out Optional preallocated buffer for storing the result. May be same input as `box`.
|
|
154
|
-
* @returns Transformed box.
|
|
155
|
-
*/
|
|
156
|
-
mapBoxFromModelToCdfCoordinates(box: THREE.Box3, out?: THREE.Box3): THREE.Box3;
|
|
157
|
-
/**
|
|
158
|
-
* Maps from a 3D position in "CDF space" to coordinates in "ThreeJS model space".
|
|
159
|
-
* This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS
|
|
160
|
-
* uses a right-hand Y-up coordinate system. This function also accounts for transformation
|
|
161
|
-
* applied to the model.
|
|
162
|
-
* @param box The box in CDF model coordinates.
|
|
163
|
-
* @param out Optional preallocated buffer for storing the result. May be same input as `box`.
|
|
164
|
-
* @returns Transformed box.
|
|
165
|
-
*/
|
|
166
|
-
mapBoxFromCdfToModelCoordinates(box: THREE.Box3, out?: THREE.Box3): THREE.Box3;
|
|
167
128
|
/**
|
|
168
129
|
* Cleans up used resources.
|
|
169
130
|
*/
|
|
@@ -218,10 +179,17 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
|
|
|
218
179
|
*/
|
|
219
180
|
setModelTransformation(matrix: THREE.Matrix4): void;
|
|
220
181
|
/**
|
|
221
|
-
* Gets transformation matrix
|
|
182
|
+
* Gets transformation matrix that has previously been set with {@link CogniteCadModel.setModelTransformation}.
|
|
222
183
|
* @param out Preallocated `THREE.Matrix4` (optional).
|
|
223
184
|
*/
|
|
224
185
|
getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
|
|
186
|
+
/**
|
|
187
|
+
* Gets transformation from CDF space to ThreeJS space,
|
|
188
|
+
* which includes any additional "default" transformations assigned to this model.
|
|
189
|
+
* Does not include any custom transformations set by {@link CognitePointcloudmodel.setModelTransformation}
|
|
190
|
+
* @param out Preallocated `THREE.Matrix4` (optional)
|
|
191
|
+
*/
|
|
192
|
+
getCdfToDefaultModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
|
|
225
193
|
/**
|
|
226
194
|
* Fetches a bounding box from the CDF by the nodeId.
|
|
227
195
|
* @param nodeId
|
|
@@ -7,13 +7,15 @@ import * as THREE from 'three';
|
|
|
7
7
|
*/
|
|
8
8
|
export interface CdfModelNodeCollectionDataProvider {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Gets the transformation of the model in ThreeJS space
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Gets the default transformation of the model from CDF space.
|
|
15
|
+
* The current total transformation of the model from the backend to its transform in ThreeJS space
|
|
16
|
+
* is thus `model.getCdfToDefaultModelTransformation() * model.getModelTransformation()`.
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
getCdfToDefaultModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
|
|
17
19
|
/**
|
|
18
20
|
* Total count of nodes in the model
|
|
19
21
|
*/
|
|
@@ -6,7 +6,7 @@ import { IndexSet } from '../../utilities';
|
|
|
6
6
|
export declare abstract class CdfNodeCollectionBase extends NodeCollection {
|
|
7
7
|
private _indexSet;
|
|
8
8
|
private _areas;
|
|
9
|
-
private readonly
|
|
9
|
+
private readonly _cadModelData;
|
|
10
10
|
private _fetchResultHelper;
|
|
11
11
|
constructor(classToken: string, model: CdfModelNodeCollectionDataProvider);
|
|
12
12
|
get isLoading(): boolean;
|
|
@@ -17,5 +17,6 @@ export { PointCloudStylableObjectProvider } from './src/PointCloudStylableObject
|
|
|
17
17
|
export { StylableObject, SerializableStylableObject } from './src/pointcloud-stylable-object-providers/StylableObject';
|
|
18
18
|
export { CdfPointCloudStylableObjectProvider } from './src/pointcloud-stylable-object-providers/CdfPointCloudStylableObjectProvider';
|
|
19
19
|
export { DummyPointCloudStylableObjectProvider } from './src/pointcloud-stylable-object-providers/DummyPointCloudStylableObjectProvider';
|
|
20
|
+
export { cadFromCdfToThreeMatrix } from './src/utilities/applyDefaultModelTransformation';
|
|
20
21
|
export { Image360Provider } from './src/Image360Provider';
|
|
21
22
|
export { BinaryFileProvider, JsonFileProvider, File3dFormat, BlobOutputMetadata, Image360Descriptor, Image360FileProvider, Image360Face } from './src/types';
|
|
@@ -48,14 +48,22 @@ export declare class CognitePointCloudModel {
|
|
|
48
48
|
getCameraConfiguration(): CameraConfiguration | undefined;
|
|
49
49
|
/**
|
|
50
50
|
* Sets transformation matrix of the model. This overrides the current transformation.
|
|
51
|
-
* @param transformationMatrix
|
|
51
|
+
* @param transformationMatrix The new transformation matrix
|
|
52
52
|
*/
|
|
53
53
|
setModelTransformation(transformationMatrix: THREE.Matrix4): void;
|
|
54
54
|
/**
|
|
55
|
-
* Gets transformation matrix
|
|
55
|
+
* Gets transformation matrix that has previously been
|
|
56
|
+
* set with {@link CognitePointCloudmodel.setModelTransformation}.
|
|
56
57
|
* @param out Preallocated `THREE.Matrix4` (optional).
|
|
57
58
|
*/
|
|
58
59
|
getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
|
|
60
|
+
/**
|
|
61
|
+
* Gets transformation from CDF space to ThreeJS space,
|
|
62
|
+
* which includes any additional "default" transformations assigned to this model.
|
|
63
|
+
* Does not include any custom transformations set by {@link CognitePointcloudmodel.setModelTransformation}
|
|
64
|
+
* @param out Preallocated `THREE.Matrix4` (optional)
|
|
65
|
+
*/
|
|
66
|
+
getCdfToDefaultModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
|
|
59
67
|
/**
|
|
60
68
|
* Sets a visible filter on points of a given class.
|
|
61
69
|
* @param pointClass ASPRS classification class code. Either one of the well known
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
4
|
import { CameraConfiguration } from '../../utilities';
|
|
6
5
|
import { ClassificationInfo, PointCloudOctree, PickPoint } from './potree-three-loader';
|
|
7
6
|
import { WellKnownAsprsPointClassCodes } from './types';
|
|
8
7
|
import { PointColorType, PointShape, PointSizeType } from '../../rendering';
|
|
9
8
|
import { PointCloudObjectMetadata, PointCloudObject } from '../../data-providers';
|
|
10
9
|
import { CompletePointCloudAppearance, StyledPointCloudObjectCollection } from '../../pointcloud-styling';
|
|
11
|
-
|
|
10
|
+
import { Matrix4, Group } from 'three';
|
|
11
|
+
export declare class PointCloudNode extends Group {
|
|
12
12
|
private readonly _cameraConfiguration?;
|
|
13
13
|
private readonly _octree;
|
|
14
14
|
private readonly _annotations;
|
|
@@ -16,7 +16,9 @@ export declare class PointCloudNode extends THREE.Group {
|
|
|
16
16
|
private _needsRedraw;
|
|
17
17
|
private static readonly pickingWindowSize;
|
|
18
18
|
private readonly _modelIdentifier;
|
|
19
|
-
|
|
19
|
+
private readonly _sourceTransform;
|
|
20
|
+
private readonly _customTransform;
|
|
21
|
+
constructor(modelIdentifier: symbol, sourceTransform: Matrix4, octree: PointCloudOctree, annotations: PointCloudObject[], classificationInfo: ClassificationInfo, cameraConfiguration?: CameraConfiguration);
|
|
20
22
|
get modelIdentifier(): symbol;
|
|
21
23
|
get octree(): PointCloudOctree;
|
|
22
24
|
get needsRedraw(): boolean;
|
|
@@ -73,7 +75,8 @@ export declare class PointCloudNode extends THREE.Group {
|
|
|
73
75
|
}>;
|
|
74
76
|
getBoundingBox(outBbox?: THREE.Box3): THREE.Box3;
|
|
75
77
|
setModelTransformation(matrix: THREE.Matrix4): void;
|
|
76
|
-
getModelTransformation(out?:
|
|
78
|
+
getModelTransformation(out?: Matrix4): THREE.Matrix4;
|
|
79
|
+
getCdfToDefaultModelTransformation(out?: Matrix4): Matrix4;
|
|
77
80
|
get stylableObjectAnnotationMetadata(): Iterable<PointCloudObjectMetadata>;
|
|
78
81
|
get stylableObjects(): PointCloudObject[];
|
|
79
82
|
get defaultAppearance(): CompletePointCloudAppearance;
|
|
@@ -27,6 +27,7 @@ export declare class CadMaterialManager {
|
|
|
27
27
|
getModelBackTreeIndices(modelIdentifier: string): IndexSet;
|
|
28
28
|
getModelInFrontTreeIndices(modelIdentifier: string): IndexSet;
|
|
29
29
|
getModelGhostedTreeIndices(modelIdentifier: string): IndexSet;
|
|
30
|
+
getModelVisibleTreeIndices(modelIdentifier: string): IndexSet;
|
|
30
31
|
setRenderMode(mode: RenderMode): void;
|
|
31
32
|
getRenderMode(): RenderMode;
|
|
32
33
|
dispose(): void;
|
|
@@ -15,6 +15,7 @@ export declare class NodeAppearanceTextureBuilder {
|
|
|
15
15
|
private readonly _regularNodesTreeIndices;
|
|
16
16
|
private readonly _ghostedNodesTreeIndices;
|
|
17
17
|
private readonly _infrontNodesTreeIndices;
|
|
18
|
+
private readonly _visibleNodesTreeIndices;
|
|
18
19
|
constructor(treeIndexCount: number, styleProvider: NodeAppearanceProvider);
|
|
19
20
|
getDefaultAppearance(): NodeAppearance;
|
|
20
21
|
/**
|
|
@@ -27,6 +28,7 @@ export declare class NodeAppearanceTextureBuilder {
|
|
|
27
28
|
get regularNodeTreeIndices(): IndexSet;
|
|
28
29
|
get ghostedNodeTreeIndices(): IndexSet;
|
|
29
30
|
get infrontNodeTreeIndices(): IndexSet;
|
|
31
|
+
get visibleNodeTreeIndices(): IndexSet;
|
|
30
32
|
get needsUpdate(): boolean;
|
|
31
33
|
/**
|
|
32
34
|
* A texture holding at least one element per node with color override
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
export { HtmlOverlayTool, HtmlOverlayOptions, HtmlOverlayPositionUpdatedDelegate, HtmlOverlayCreateClusterDelegate } from './src/HtmlOverlay/HtmlOverlayTool';
|
|
5
|
-
export { ExplodedViewTool } from './src/ExplodedViewTool';
|
|
6
5
|
export { DebugCameraTool } from './src/DebugCameraTool';
|
|
7
6
|
export { AxisViewTool } from './src/AxisView/AxisViewTool';
|
|
8
7
|
export { AxisBoxConfig, AxisBoxCompassConfig, AxisBoxFaceConfig, Corner, AbsolutePosition, RelativePosition } from './src/AxisView/types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.20221124",
|
|
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": {
|
|
@@ -81,11 +81,11 @@
|
|
|
81
81
|
"proj4": "2.8.0",
|
|
82
82
|
"rxjs": "7.5.7",
|
|
83
83
|
"skmeans": "0.11.3",
|
|
84
|
-
"three-stdlib": "2.
|
|
84
|
+
"three-stdlib": "2.18.1"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@azure/msal-browser": "2.31.0",
|
|
88
|
-
"@cognite/sdk": "7.
|
|
88
|
+
"@cognite/sdk": "7.12.0",
|
|
89
89
|
"@cognite/sdk-core": "4.4.0",
|
|
90
90
|
"@types/dat.gui": "0.7.7",
|
|
91
91
|
"@types/expect-puppeteer": "5.0.2",
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"workerize-loader": "2.0.2"
|
|
153
153
|
},
|
|
154
154
|
"peerDependencies": {
|
|
155
|
-
"@cognite/sdk": "7.
|
|
155
|
+
"@cognite/sdk": "7.12.0",
|
|
156
156
|
"@cognite/sdk-core": "^4.1.0",
|
|
157
157
|
"three": "0.146.0"
|
|
158
158
|
},
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Cognite3DViewerToolBase } from './Cognite3DViewerToolBase';
|
|
2
|
-
import { CogniteCadModel } from '../../api';
|
|
3
|
-
export declare class ExplodedViewTool extends Cognite3DViewerToolBase {
|
|
4
|
-
private readonly _cadModel;
|
|
5
|
-
private _treeBoundingBoxdata;
|
|
6
|
-
private readonly _rootTreeIndex;
|
|
7
|
-
get readyPromise(): Promise<void>;
|
|
8
|
-
constructor(treeIndex: number, cadModel: CogniteCadModel);
|
|
9
|
-
expand(expandRadius: number): Promise<void>;
|
|
10
|
-
reset(): void;
|
|
11
|
-
private preloadBoundingBoxData;
|
|
12
|
-
}
|