@cognite/reveal 4.0.0-dev.20230111 → 4.0.0-dev.20230112

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.
@@ -5,6 +5,5 @@ export { Cognite3DViewer } from './src/public/migration/Cognite3DViewer';
5
5
  export { CogniteCadModel } from '../cad-model';
6
6
  export { ViewerState, ModelState, ClippingPlanesState } from './src/utilities/ViewStateHelper';
7
7
  export * from './src/public/types';
8
- export { CDF_TO_VIEWER_TRANSFORMATION } from './src/public/constants';
9
8
  declare const REVEAL_VERSION: string;
10
9
  export { REVEAL_VERSION };
@@ -55,7 +55,6 @@ export declare class Cognite3DViewer {
55
55
  private readonly _events;
56
56
  private readonly _mouseHandler;
57
57
  private readonly _models;
58
- private readonly _extraObjects;
59
58
  private isDisposed;
60
59
  private latestRequestId;
61
60
  private readonly clock;
@@ -349,34 +348,45 @@ export declare class Cognite3DViewer {
349
348
  * ```js
350
349
  * // Hide pixels with values less than 0 in the x direction
351
350
  * const plane = new THREE.Plane(new THREE.Vector3(1, 0, 0), 0);
352
- * viewer.setClippingPlanes([plane]);
351
+ * viewer.setGlobalClippingPlanes([plane]);
353
352
  * ```
354
353
  * ```js
355
354
  * // Hide pixels with values greater than 20 in the x direction
356
355
  * const plane = new THREE.Plane(new THREE.Vector3(-1, 0, 0), 20);
357
- * viewer.setClippingPlanes([plane]);
356
+ * viewer.setGlobalClippingPlanes([plane]);
358
357
  * ```
359
358
  * ```js
360
359
  * // Hide pixels with values less than 0 in the x direction or greater than 0 in the y direction
361
360
  * const xPlane = new THREE.Plane(new THREE.Vector3(1, 0, 0), 0);
362
361
  * const yPlane = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0);
363
- * viewer.setClippingPlanes([xPlane, yPlane]);
362
+ * viewer.setGlobalClippingPlanes([xPlane, yPlane]);
364
363
  * ```
365
364
  * ```js
366
365
  * // Hide pixels behind an arbitrary, non axis-aligned plane
367
366
  * const plane = new THREE.Plane(new THREE.Vector3(1.5, 20, -19), 20);
368
- * viewer.setClippingPlanes([plane]);
367
+ * viewer.setGlobalClippingPlanes([plane]);
369
368
  * ```
370
369
  * ```js
371
370
  * // Disable clipping planes
372
- * viewer.setClippingPlanes([]);
371
+ * viewer.setGlobalClippingPlanes([]);
373
372
  * ```
374
373
  */
374
+ setGlobalClippingPlanes(clippingPlanes: THREE.Plane[]): void;
375
+ /**
376
+ * Sets per-pixel clipping planes. Pixels behind any of the planes will be sliced away.
377
+ * @param clippingPlanes
378
+ * @deprecated Use {@link Cognite3DViewer.setGlobalClippingPlanes} instead.
379
+ */
375
380
  setClippingPlanes(clippingPlanes: THREE.Plane[]): void;
376
381
  /**
377
- * Returns the current active clipping planes.
382
+ * Returns the current active global clipping planes.
383
+ * @deprecated Use {@link Cognite3DViewer.getGlobalClippingPlanes} instead.
378
384
  */
379
385
  getClippingPlanes(): THREE.Plane[];
386
+ /**
387
+ * Returns the current active global clipping planes.
388
+ */
389
+ getGlobalClippingPlanes(): THREE.Plane[];
380
390
  /**
381
391
  * Attempts to load the camera settings from the settings stored for the
382
392
  * provided model. See {@link https://docs.cognite.com/api/v1/#operation/get3DRevision}
@@ -9,7 +9,7 @@ import { CadModelBudget } from '../../CadModelBudget';
9
9
  import { CadNode } from '../../../../cad-model';
10
10
  export interface DetermineSectorsInput {
11
11
  camera: THREE.PerspectiveCamera;
12
- clippingPlanes: THREE.Plane[];
12
+ modelClippingPlanes: THREE.Plane[][];
13
13
  cadModelsMetadata: CadModelMetadata[];
14
14
  loadingHints: CadLoadingHints;
15
15
  cameraInMotion: boolean;
@@ -195,6 +195,11 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
195
195
  * @param out Preallocated `THREE.Matrix4` (optional).
196
196
  */
197
197
  getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
198
+ /**
199
+ * Sets the clipping planes for this model. They will be combined with the
200
+ * global clipping planes.
201
+ */
202
+ setModelClippingPlanes(clippingPlanes: THREE.Plane[]): void;
198
203
  /**
199
204
  * Gets transformation from CDF space to ThreeJS space,
200
205
  * which includes any additional "default" transformations assigned to this model.
@@ -80,4 +80,4 @@ export declare const CAMERA_MANAGER_EVENT_TYPE_LIST: readonly ["cameraChange", "
80
80
  /**
81
81
  * Union type of the supported camera manager event types
82
82
  */
83
- export type CameraManagerEventType = typeof CAMERA_MANAGER_EVENT_TYPE_LIST[number];
83
+ export type CameraManagerEventType = (typeof CAMERA_MANAGER_EVENT_TYPE_LIST)[number];
@@ -17,6 +17,5 @@ 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';
21
20
  export { Image360Provider } from './src/Image360Provider';
22
21
  export { BinaryFileProvider, JsonFileProvider, File3dFormat, BlobOutputMetadata, Image360Descriptor, Image360FileProvider, Image360Face } from './src/types';
@@ -3,5 +3,4 @@
3
3
  */
4
4
  import * as THREE from 'three';
5
5
  import { File3dFormat } from '../types';
6
- export declare const cadFromCdfToThreeMatrix: THREE.Matrix4;
7
6
  export declare function applyDefaultModelTransformation(matrix: THREE.Matrix4, format: File3dFormat | string): void;
@@ -143,6 +143,11 @@ export declare class CognitePointCloudModel {
143
143
  * @see {@link PointShape}.
144
144
  */
145
145
  set pointShape(shape: PointShape);
146
+ /**
147
+ * Sets the clipping planes for this model. They will be combined with the
148
+ * global clipping planes.
149
+ */
150
+ setModelClippingPlanes(clippingPlanes: THREE.Plane[]): void;
146
151
  /**
147
152
  * Gets default point appearance
148
153
  */
@@ -82,6 +82,7 @@ export declare class PointCloudNode extends Group {
82
82
  get stylableObjectCount(): number;
83
83
  get defaultAppearance(): CompletePointCloudAppearance;
84
84
  set defaultAppearance(appearance: CompletePointCloudAppearance);
85
+ set clippingPlanes(clippingPlanes: THREE.Plane[]);
85
86
  assignStyledPointCloudObjectCollection(styledCollection: StyledPointCloudObjectCollection): void;
86
87
  removeAllStyledPointCloudObjects(): void;
87
88
  }
@@ -1,4 +1,4 @@
1
- import { Box3, Camera, Object3D, Ray, Sphere, WebGLRenderer } from 'three';
1
+ import { Box3, Camera, Object3D, Plane, Ray, Sphere, WebGLRenderer } from 'three';
2
2
  import { IPointCloudTreeGeometry } from '../geometry/IPointCloudTreeGeometry';
3
3
  import { IPointCloudTreeGeometryNode } from '../geometry/IPointCloudTreeGeometryNode';
4
4
  import { PickParams } from './PointCloudOctreePicker';
@@ -29,8 +29,13 @@ export declare class PointCloudOctree extends PointCloudTree {
29
29
  showBoundingBox: boolean;
30
30
  private readonly visibleBounds;
31
31
  private picker;
32
+ private _globalClippingPlanes;
33
+ private _localClippingPlanes;
32
34
  constructor(potree: IPotree, pcoGeometry: IPointCloudTreeGeometry, material: PointCloudMaterial);
33
35
  private updateMaterial;
36
+ setGlobalClippingPlane(planes: Plane[]): void;
37
+ setModelClippingPlane(planes: Plane[]): void;
38
+ updateClippingPlanes(): void;
34
39
  dispose(): void;
35
40
  get pointSizeType(): PointSizeType;
36
41
  set pointSizeType(value: PointSizeType);
@@ -22,6 +22,7 @@ export declare class CadMaterialManager {
22
22
  getModelNodeAppearanceProvider(modelIdentifier: string): NodeAppearanceProvider;
23
23
  getModelNodeTransformProvider(modelIdentifier: string): NodeTransformProvider;
24
24
  getModelDefaultNodeAppearance(modelIdentifier: string): NodeAppearance;
25
+ getModelClippingPlanes(modelIdentifier: string): THREE.Plane[];
25
26
  setModelClippingPlanes(modelIdentifier: string, clippingPlanes: THREE.Plane[]): void;
26
27
  setModelDefaultNodeAppearance(modelIdentifier: string, defaultAppearance: NodeAppearance): void;
27
28
  getModelBackTreeIndices(modelIdentifier: string): IndexSet;
@@ -6,13 +6,10 @@ import { PointCloudMaterial } from './pointcloud-rendering';
6
6
  import { PointCloudMaterialParameters } from './render-passes/types';
7
7
  export declare class PointCloudMaterialManager {
8
8
  private readonly _modelsMaterialsMap;
9
- private _clippingPlanes;
10
9
  addModelMaterial(modelIdentifier: symbol, objectIdMaps: PointCloudObjectIdMaps): void;
11
10
  removeModelMaterial(modelIdentifier: symbol): void;
12
11
  getModelMaterial(modelIdentifier: symbol): PointCloudMaterial;
13
- get clippingPlanes(): THREE.Plane[];
14
- set clippingPlanes(clippingPlanes: THREE.Plane[]);
15
- setClippingPlanesForPointCloud(modelIdentifier: symbol): void;
12
+ initializeClippingPlanesForPointCloud(modelIdentifier: symbol): void;
16
13
  setModelsMaterialParameters(materialParameters: PointCloudMaterialParameters | undefined): void;
17
14
  setMaterialParameters(material: PointCloudMaterial, parameters: PointCloudMaterialParameters): void;
18
15
  dispose(): void;
@@ -34,6 +34,7 @@ export { calculateVolumeOfMesh } from './src/calculateVolumeOfMesh';
34
34
  export { worldToNormalizedViewportCoordinates, worldToViewportCoordinates, pixelToNormalizedDeviceCoordinates } from './src/worldToViewport';
35
35
  export { DeferredPromise } from './src/DeferredPromise';
36
36
  export { SceneHandler } from './src/SceneHandler';
37
+ export { CDF_TO_VIEWER_TRANSFORMATION } from './src/constants';
37
38
  export * from './src/workers/workerize-transferable';
38
39
  export * from './src/shapes';
39
40
  export * from './src/linalg';
@@ -2,6 +2,7 @@
2
2
  * Copyright 2022 Cognite AS
3
3
  */
4
4
  import { Matrix4 } from 'three';
5
+ export declare const cadFromCdfToThreeMatrix: Matrix4;
5
6
  /**
6
7
  * The transformation matrix from CDF coordinates to ThreeJS/Reveal.
7
8
  * Note that this is already applied to {@link CogniteCadModel} and {@link CognitePointCloudModel}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.0.0-dev.20230111",
3
+ "version": "4.0.0-dev.20230112",
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": {
@@ -127,13 +127,13 @@
127
127
  "jest": "29.3.1",
128
128
  "jest-canvas-mock": "2.4.0",
129
129
  "jest-environment-jsdom": "29.3.1",
130
- "jest-extended": "3.2.1",
130
+ "jest-extended": "3.2.2",
131
131
  "jest-image-snapshot": "6.1.0",
132
132
  "jest-puppeteer": "6.2.0",
133
133
  "jsdom": "20.0.3",
134
134
  "moq.ts": "10.0.2",
135
135
  "nock": "13.2.9",
136
- "prettier": "2.8.1",
136
+ "prettier": "2.8.2",
137
137
  "process": "0.11.10",
138
138
  "puppeteer": "19.4.1",
139
139
  "random-seed": "0.3.0",