@cognite/reveal 4.0.0-dev.20221123 → 4.0.0-dev.20221125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/api-entry-points/core.d.ts +1 -1
  2. package/dist/index.js +156 -160
  3. package/dist/index.js.map +1 -1
  4. package/dist/packages/360-images/index.d.ts +1 -0
  5. package/dist/packages/360-images/src/Image360Entity.d.ts +15 -14
  6. package/dist/packages/360-images/src/Image360Icon.d.ts +4 -1
  7. package/dist/packages/360-images/src/Image360LoadingCache.d.ts +2 -1
  8. package/dist/packages/360-images/src/Image360Visualization.d.ts +22 -0
  9. package/dist/packages/360-images/src/Image360VisualizationBox.d.ts +21 -0
  10. package/dist/packages/api/index.d.ts +1 -0
  11. package/dist/packages/api/src/api-helpers/Image360ApiHelper.d.ts +5 -0
  12. package/dist/packages/api/src/public/constants.d.ts +11 -0
  13. package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +7 -3
  14. package/dist/packages/api/src/public/migration/types.d.ts +1 -1
  15. package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +9 -6
  16. package/dist/packages/cad-model/src/wrappers/CogniteCadModel.d.ts +20 -40
  17. package/dist/packages/cad-styling/src/CdfModelNodeCollectionDataProvider.d.ts +6 -4
  18. package/dist/packages/cad-styling/src/CdfNodeCollectionBase.d.ts +1 -1
  19. package/dist/packages/camera-manager/src/CameraManager.d.ts +17 -2
  20. package/dist/packages/camera-manager/src/DefaultCameraManager.d.ts +4 -14
  21. package/dist/packages/camera-manager/src/ProxyCameraManager.d.ts +3 -2
  22. package/dist/packages/camera-manager/src/StationaryCameraManager.d.ts +6 -4
  23. package/dist/packages/data-providers/index.d.ts +1 -0
  24. package/dist/packages/data-providers/src/utilities/applyDefaultModelTransformation.d.ts +1 -0
  25. package/dist/packages/pointclouds/src/CognitePointCloudModel.d.ts +10 -2
  26. package/dist/packages/pointclouds/src/PointCloudNode.d.ts +7 -4
  27. package/dist/packages/rendering/src/CadMaterialManager.d.ts +1 -0
  28. package/dist/packages/rendering/src/rendering/NodeAppearanceTextureBuilder.d.ts +2 -0
  29. package/dist/packages/sector-parser/src/GltfSectorParser.d.ts +0 -1
  30. package/dist/packages/tools/index.d.ts +0 -1
  31. package/package.json +5 -5
  32. package/dist/packages/sector-parser/src/DracoDecoderHelper.d.ts +0 -32
  33. package/dist/packages/sector-parser/src/lib/draco_decoder_gltf.d.ts +0 -5
  34. package/dist/packages/tools/src/ExplodedViewTool.d.ts +0 -12
@@ -4,3 +4,4 @@
4
4
  export { Image360Facade } from './src/Image360Facade';
5
5
  export { Image360EntityFactory } from './src/Image360EntityFactory';
6
6
  export { Image360Entity } from './src/Image360Entity';
7
+ export { Image360Visualization } from './src/Image360Visualization';
@@ -5,16 +5,15 @@ import * as THREE from 'three';
5
5
  import { SceneHandler } from '../../utilities';
6
6
  import { Image360Descriptor, Image360FileProvider } from '../../data-providers';
7
7
  import { Image360Icon } from './Image360Icon';
8
+ import { Image360Visualization } from './Image360Visualization';
8
9
  export declare class Image360Entity {
9
10
  private readonly _imageProvider;
10
11
  private readonly _image360Metadata;
11
- private readonly _sceneHandler;
12
12
  private readonly _transform;
13
13
  private readonly _image360Icon;
14
- private _faceMaterials;
15
- private _imageContainer;
14
+ private readonly _image360VisualzationBox;
16
15
  /**
17
- * Get the model-to-world transformation matrix
16
+ * Get a copy of the model-to-world transformation matrix
18
17
  * of the given 360 image.
19
18
  * @returns model-to-world transform of the 360 Image
20
19
  */
@@ -26,21 +25,23 @@ export declare class Image360Entity {
26
25
  */
27
26
  get icon(): Image360Icon;
28
27
  /**
29
- * Sets the opacity of this 360 image.
28
+ * The object containing the unit cube with the 360 images.
29
+ * @returns Image360Visualization
30
30
  */
31
- set opacity(alpha: number);
31
+ get image360Visualization(): Image360Visualization;
32
32
  constructor(image360Metadata: Image360Descriptor, sceneHandler: SceneHandler, imageProvider: Image360FileProvider, postTransform: THREE.Matrix4, preComputedRotation: boolean);
33
33
  /**
34
- * Enables a unit inverted cube which contains the 360 image.
34
+ * Loads the 360 image (6 faces) into the visualization object.
35
35
  */
36
- activate360Image(): Promise<void>;
36
+ load360Image(): Promise<void>;
37
37
  /**
38
- * Disables the unit inverted cube which contains the 360 image.
38
+ * Drops the GPU resources for the 360 image
39
+ * the icon will be preserved.
39
40
  */
40
- deactivate360Image(): Promise<void>;
41
- load360Image(): Promise<void>;
42
- unload360Image(): Promise<void>;
43
- dispose(): Promise<void>;
44
- private createImage360VisualizationObject;
41
+ unload360Image(): void;
42
+ /**
43
+ * @obvious
44
+ */
45
+ dispose(): void;
45
46
  private computeTransform;
46
47
  }
@@ -1,15 +1,18 @@
1
1
  /*!
2
2
  * Copyright 2022 Cognite AS
3
3
  */
4
+ import { SceneHandler } from '../../utilities';
4
5
  import * as THREE from 'three';
5
6
  export declare class Image360Icon extends THREE.Group {
6
7
  private readonly MIN_PIXEL_SIZE;
7
8
  private readonly MAX_PIXEL_SIZE;
8
9
  private readonly _hoverSprite;
9
10
  private readonly _outerSprite;
10
- constructor(modelToWorldTransform: THREE.Matrix4);
11
+ private readonly _sceneHandler;
12
+ constructor(modelToWorldTransform: THREE.Matrix4, sceneHandler: SceneHandler);
11
13
  set hoverSpriteVisible(visible: boolean);
12
14
  raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
15
+ dispose(): void;
13
16
  private setupAdaptiveScaling;
14
17
  private createOuterRingsSprite;
15
18
  private createHoverSprite;
@@ -7,7 +7,8 @@ export declare class Image360LoadingCache {
7
7
  private readonly _loaded360Images;
8
8
  private readonly _inFlightEntities;
9
9
  get cachedEntities(): Image360Entity[];
10
- get currentlyLoadingEntities(): Set<Image360Entity>;
10
+ get currentlyLoadingEntities(): Map<Image360Entity, Promise<void>>;
11
11
  constructor(_cacheSize?: number);
12
12
  cachedPreload(entity: Image360Entity): Promise<void>;
13
+ purge(entity: Image360Entity): Promise<void>;
13
14
  }
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * Copyright 2022 Cognite AS
3
+ */
4
+ import * as THREE from 'three';
5
+ export interface Image360Visualization {
6
+ /**
7
+ * Opaqueness of the 360 image
8
+ */
9
+ opacity: number;
10
+ /**
11
+ * Visibility of the 360 image
12
+ */
13
+ visible: boolean;
14
+ /**
15
+ * Scale of the box containing the 360 image
16
+ */
17
+ scale: THREE.Vector3;
18
+ /**
19
+ * Render order of the mesh containing the 360 image
20
+ */
21
+ renderOrder: number;
22
+ }
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright 2022 Cognite AS
3
+ */
4
+ import * as THREE from 'three';
5
+ import { SceneHandler } from '../../utilities';
6
+ import { Image360Face } from '../../data-providers';
7
+ import { Image360Visualization } from './Image360Visualization';
8
+ export declare class Image360VisualizationBox implements Image360Visualization {
9
+ private readonly _worldTransform;
10
+ private _visualizationMesh;
11
+ private _faceMaterials;
12
+ private readonly _sceneHandler;
13
+ private readonly _visualizationState;
14
+ set opacity(alpha: number);
15
+ set visible(isVisible: boolean);
16
+ set scale(newScale: THREE.Vector3);
17
+ set renderOrder(newRenderOrder: number);
18
+ constructor(worldTransform: THREE.Matrix4, sceneHandler: SceneHandler);
19
+ loadImages(faces: Image360Face[]): Promise<void>;
20
+ unloadImages(): void;
21
+ }
@@ -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 };
@@ -9,6 +9,7 @@ import { ProxyCameraManager } from '../../../camera-manager';
9
9
  export declare class Image360ApiHelper {
10
10
  private readonly _image360Facade;
11
11
  private readonly _domElement;
12
+ private _transitionInProgress;
12
13
  private readonly _interactionState;
13
14
  private readonly _domEventHandlers;
14
15
  private readonly _requestRedraw;
@@ -19,7 +20,11 @@ export declare class Image360ApiHelper {
19
20
  add360ImageSet(eventFilter: {
20
21
  [key: string]: string;
21
22
  }, collectionTransform: THREE.Matrix4, preMultipliedRotation: boolean): Promise<Image360Entity[]>;
23
+ remove360Images(entities: Image360Entity[]): Promise<void>;
22
24
  enter360Image(image360Entity: Image360Entity): Promise<void>;
25
+ private transition;
26
+ private tweenVisualizationAlpha;
27
+ private set360CameraManager;
23
28
  exit360Image(): void;
24
29
  dispose(): void;
25
30
  private enter360ImageOnIntersect;
@@ -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;
@@ -178,9 +178,8 @@ export declare class Cognite3DViewer {
178
178
  /**
179
179
  * Sets the active camera manager instance for current Cognite3Dviewer.
180
180
  * @param cameraManager Camera manager instance.
181
- * @param preserveCameraState Whether to set current camera state to new camera manager.
182
181
  */
183
- setCameraManager(cameraManager: CameraManager, preserveCameraState?: boolean): void;
182
+ setCameraManager(cameraManager: CameraManager): void;
184
183
  /**
185
184
  * Gets the current viewer state which includes the camera pose as well as applied styling.
186
185
  * @returns JSON object containing viewer state.
@@ -248,12 +247,17 @@ export declare class Cognite3DViewer {
248
247
  * @example
249
248
  * ```js
250
249
  * const eventFilter = { site_id: "12345" };
251
- * await viewer.add360ImageSet(eventFilter);
250
+ * await viewer.add360ImageSet('events', eventFilter);
252
251
  * ```
253
252
  */
254
253
  add360ImageSet(datasource: 'events', eventFilter: {
255
254
  [key: string]: string;
256
255
  }, add360ImageOptions?: AddImage360Options): Promise<Image360Entity[]>;
256
+ /**
257
+ * Remove a set of 360 images.
258
+ * @param image360Entities
259
+ */
260
+ remove360Images(...image360Entities: Image360Entity[]): Promise<void>;
257
261
  /**
258
262
  * Enter visualization of a 360 image.
259
263
  * @param image360
@@ -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 false.
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
- export declare class CadNode extends THREE.Object3D {
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(): THREE.Plane[];
23
- set clippingPlanes(planes: THREE.Plane[]);
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: THREE.Matrix4): void;
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?: THREE.Matrix4): THREE.Matrix4;
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;
@@ -25,6 +25,18 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
25
25
  * return undefined if the model has been stored in an unsupported unit.
26
26
  */
27
27
  get modelUnitToMetersFactor(): number | undefined;
28
+ /**
29
+ * Sets the model visibility.
30
+ * @example
31
+ * ```js
32
+ * model.visible = false
33
+ * ```
34
+ */
35
+ set visible(value: boolean);
36
+ /**
37
+ * Returns the model visibility.
38
+ */
39
+ get visible(): boolean;
28
40
  /**
29
41
  * The CDF model ID of the model.
30
42
  */
@@ -125,45 +137,6 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
125
137
  * @param applyToChildren
126
138
  */
127
139
  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
140
  /**
168
141
  * Cleans up used resources.
169
142
  */
@@ -218,10 +191,17 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
218
191
  */
219
192
  setModelTransformation(matrix: THREE.Matrix4): void;
220
193
  /**
221
- * Gets transformation matrix of the model.
194
+ * Gets transformation matrix that has previously been set with {@link CogniteCadModel.setModelTransformation}.
222
195
  * @param out Preallocated `THREE.Matrix4` (optional).
223
196
  */
224
197
  getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
198
+ /**
199
+ * Gets transformation from CDF space to ThreeJS space,
200
+ * which includes any additional "default" transformations assigned to this model.
201
+ * Does not include any custom transformations set by {@link CognitePointcloudmodel.setModelTransformation}
202
+ * @param out Preallocated `THREE.Matrix4` (optional)
203
+ */
204
+ getCdfToDefaultModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
225
205
  /**
226
206
  * Fetches a bounding box from the CDF by the nodeId.
227
207
  * @param nodeId
@@ -7,13 +7,15 @@ import * as THREE from 'three';
7
7
  */
8
8
  export interface CdfModelNodeCollectionDataProvider {
9
9
  /**
10
- * Maps a box from Reveal space to CDF space
10
+ * Gets the transformation of the model in ThreeJS space
11
11
  */
12
- mapBoxFromModelToCdfCoordinates: (box: THREE.Box3, out?: THREE.Box3) => THREE.Box3;
12
+ getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
13
13
  /**
14
- * Maps a box from CDF space to Reveal space
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
- mapBoxFromCdfToModelCoordinates: (box: THREE.Box3, out?: THREE.Box3) => THREE.Box3;
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 _boundsMapper;
9
+ private readonly _cadModelData;
10
10
  private _fetchResultHelper;
11
11
  constructor(classToken: string, model: CdfModelNodeCollectionDataProvider);
12
12
  get isLoading(): boolean;
@@ -40,6 +40,21 @@ export interface CameraManager {
40
40
  * @returns Camera state: position, target and rotation.
41
41
  */
42
42
  getCameraState(): Required<CameraState>;
43
+ /**
44
+ * Set this manager as active and enable controls.
45
+ *
46
+ * Should update {@link CameraManager.enabled} to reflect the state of the manager.
47
+ * Note that this is called automatically when a new CameraManager is set on the {@link Cognite3DViewer}.
48
+ * @param cameraManager Previously used camera manager.
49
+ */
50
+ activate(cameraManager?: CameraManager): void;
51
+ /**
52
+ * Deactivate this manager and disable controls.
53
+ *
54
+ * Should update {@link CameraManager.enabled} to reflect the state of the manager.
55
+ * Note that this is called automatically when a new CameraManager is set on the {@link Cognite3DViewer}.
56
+ */
57
+ deactivate(): void;
43
58
  /**
44
59
  * Subscribes to changes of the camera event. This is used by Reveal to react on changes of the camera.
45
60
  * @param event Name of the event.
@@ -72,7 +87,7 @@ export interface CameraManager {
72
87
  */
73
88
  dispose(): void;
74
89
  /**
75
- * Enables or disables camera manager. When disabled, camera manager shouldn't consume or react to any DOM events.
90
+ * Enabled is true if this camera manager is active. When disabled, the camera manager shouldn't consume or react to any DOM events.
76
91
  */
77
- enabled?: boolean;
92
+ enabled: boolean;
78
93
  }
@@ -19,7 +19,7 @@ export declare class DefaultCameraManager implements CameraManager {
19
19
  private readonly _raycaster;
20
20
  private isDisposed;
21
21
  private _nearAndFarNeedsUpdate;
22
- private _enabledCopy;
22
+ private isEnabled;
23
23
  private readonly _modelRaycastCallback;
24
24
  private _onClick;
25
25
  private _onWheel;
@@ -69,23 +69,11 @@ export declare class DefaultCameraManager implements CameraManager {
69
69
  /**
70
70
  * Sets whether camera controls through mouse, touch and keyboard are enabled.
71
71
  */
72
- set enabled(enabled: boolean);
72
+ private set enabled(value);
73
73
  /**
74
74
  * Gets whether camera controls through mouse, touch and keyboard are enabled.
75
75
  */
76
76
  get enabled(): boolean;
77
- /**
78
- * Sets whether camera controls through mouse, touch and keyboard are enabled.
79
- * This can be useful to e.g. temporarily disable navigation when manipulating other
80
- * objects in the scene or when implementing a "cinematic" viewer.
81
- * @deprecated Will be removed in 4.0.0. Use {@link DefaultCameraManager.enabled} instead.
82
- */
83
- set cameraControlsEnabled(enabled: boolean);
84
- /**
85
- * Gets whether camera controls through mouse, touch and keyboard are enabled.
86
- * @deprecated Will be removed in 4.0.0. Use {@link DefaultCameraManager.enabled} instead.
87
- */
88
- get cameraControlsEnabled(): boolean;
89
77
  /**
90
78
  * Sets whether keyboard control of the camera is enabled/disabled.
91
79
  */
@@ -103,6 +91,8 @@ export declare class DefaultCameraManager implements CameraManager {
103
91
  * **/
104
92
  setCameraState(state: CameraState): void;
105
93
  getCameraState(): Required<CameraState>;
94
+ activate(cameraManager?: CameraManager): void;
95
+ deactivate(): void;
106
96
  /**
107
97
  * Gets current camera controls options.
108
98
  */
@@ -8,14 +8,15 @@ export declare class ProxyCameraManager implements CameraManager {
8
8
  private readonly _cameraChangedListeners;
9
9
  private _activeCameraManager;
10
10
  private readonly _activeCameraEventHandler;
11
- set enabled(value: boolean);
12
11
  get enabled(): boolean;
13
12
  get innerCameraManager(): CameraManager;
14
13
  constructor(initialActiveCamera: CameraManager);
15
- setActiveCameraManager(cameraManager: CameraManager, preserveCameraState?: boolean): void;
14
+ setActiveCameraManager(cameraManager: CameraManager): void;
16
15
  getCamera(): THREE.PerspectiveCamera;
17
16
  setCameraState(state: CameraState): void;
18
17
  getCameraState(): Required<CameraState>;
18
+ activate(cameraManager?: CameraManager): void;
19
+ deactivate(): void;
19
20
  on(_: 'cameraChange', callback: CameraChangeDelegate): void;
20
21
  off(_: 'cameraChange', callback: CameraChangeDelegate): void;
21
22
  fitCameraToBoundingBox(boundingBox: THREE.Box3, duration?: number | undefined, radiusFactor?: number | undefined): void;
@@ -11,17 +11,19 @@ export declare class StationaryCameraManager implements CameraManager {
11
11
  private _isEnabled;
12
12
  private _isDragging;
13
13
  constructor(domElement: HTMLElement, camera: THREE.PerspectiveCamera);
14
- set enabled(value: boolean);
15
14
  get enabled(): boolean;
16
15
  getCamera(): THREE.PerspectiveCamera;
17
16
  setCameraState(state: CameraState): void;
18
17
  getCameraState(): Required<CameraState>;
18
+ activate(): void;
19
+ deactivate(): void;
19
20
  on(_: 'cameraChange', callback: CameraChangeDelegate): void;
20
21
  off(_: 'cameraChange', callback: CameraChangeDelegate): void;
21
22
  fitCameraToBoundingBox(boundingBox: THREE.Box3, _?: number, radiusFactor?: number): void;
23
+ moveTo(targetPosition: THREE.Vector3, duration?: number): Promise<void>;
22
24
  update(_: number, boundingBox: THREE.Box3): void;
23
25
  dispose(): void;
24
- private enableDragging;
25
- private disableDragging;
26
- private rotateCamera;
26
+ private readonly enableDragging;
27
+ private readonly disableDragging;
28
+ private readonly rotateCamera;
27
29
  }
@@ -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';
@@ -3,4 +3,5 @@
3
3
  */
4
4
  import * as THREE from 'three';
5
5
  import { File3dFormat } from '../types';
6
+ export declare const cadFromCdfToThreeMatrix: THREE.Matrix4;
6
7
  export declare function applyDefaultModelTransformation(matrix: THREE.Matrix4, format: File3dFormat | string): void;
@@ -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 of the model.
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
- export declare class PointCloudNode extends THREE.Group {
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
- constructor(modelIdentifier: symbol, octree: PointCloudOctree, annotations: PointCloudObject[], classificationInfo: ClassificationInfo, cameraConfiguration?: CameraConfiguration);
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?: THREE.Matrix4): THREE.Matrix4;
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
@@ -1,7 +1,6 @@
1
1
  import { ParsedGeometry } from './types';
2
2
  export declare class GltfSectorParser {
3
3
  private readonly _glbMetadataParser;
4
- private readonly _dracoDecoderHelper;
5
4
  constructor();
6
5
  parseSector(data: ArrayBuffer): Promise<ParsedGeometry[]>;
7
6
  private traverseDefaultSceneNodes;
@@ -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';