@cognite/reveal 4.10.2 → 4.10.4

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 (23) hide show
  1. package/dist/api-entry-points/core.d.ts +1 -1
  2. package/dist/index.js +214 -190
  3. package/dist/index.js.map +1 -1
  4. package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +33 -1
  5. package/dist/packages/camera-manager/src/Flexible/FlexibleCameraManager.d.ts +6 -4
  6. package/dist/packages/camera-manager/src/Flexible/FlexibleControls.d.ts +7 -1
  7. package/dist/packages/camera-manager/src/Flexible/FlexibleControlsOptions.d.ts +4 -2
  8. package/dist/packages/camera-manager/src/Flexible/FlexibleControlsRotationHelper.d.ts +15 -0
  9. package/dist/packages/camera-manager/src/Flexible/IFlexibleCameraManager.d.ts +24 -0
  10. package/dist/packages/tools/index.d.ts +4 -1
  11. package/dist/packages/tools/src/AxisGizmo/AxisGizmoOptions.d.ts +36 -0
  12. package/dist/packages/tools/src/AxisGizmo/AxisGizmoTool.d.ts +55 -0
  13. package/dist/packages/tools/src/AxisGizmo/OneGizmoAxis.d.ts +30 -0
  14. package/dist/packages/tools/src/AxisView/AxisViewTool.d.ts +0 -1
  15. package/dist/packages/tools/src/AxisView/types.d.ts +1 -9
  16. package/dist/packages/tools/src/utilities/Corner.d.ts +12 -0
  17. package/dist/packages/tools/src/utilities/moveCameraTo.d.ts +6 -0
  18. package/dist/packages/utilities/index.d.ts +3 -0
  19. package/dist/packages/utilities/src/SceneHandler.d.ts +6 -3
  20. package/dist/packages/utilities/src/customObject/CustomObject.d.ts +54 -0
  21. package/dist/packages/utilities/src/customObject/CustomObjectIntersectInput.d.ts +16 -0
  22. package/dist/packages/utilities/src/customObject/CustomObjectIntersection.d.ts +25 -0
  23. package/package.json +5 -5
@@ -12,6 +12,7 @@ import { CameraManager, CameraChangeDelegate, CameraStopDelegate } from '../../.
12
12
  import { Image360DataModelIdentifier } from '../../../../data-providers';
13
13
  import { SupportedModelTypes } from '../../../../model-base';
14
14
  import { Image360Collection, Image360, Image360Revision, Image360AnnotationIntersection } from '../../../../360-images';
15
+ import { CustomObject } from '../../../../utilities';
15
16
  /**
16
17
  * @example
17
18
  * ```js
@@ -74,7 +75,7 @@ export declare class Cognite3DViewer {
74
75
  /**
75
76
  * Reusable buffers used by functions in Cognite3dViewer to avoid allocations.
76
77
  */
77
- private readonly _updateNearAndFarPlaneBuffers;
78
+ private readonly _boundingBoxes;
78
79
  /**
79
80
  * Gets the current budget for downloading geometry for CAD models. Note that this
80
81
  * budget is shared between all added CAD models and not a per-model budget.
@@ -365,6 +366,22 @@ export declare class Cognite3DViewer {
365
366
  * ```
366
367
  */
367
368
  addObject3D(object: THREE.Object3D): void;
369
+ /**
370
+ * Add a CustomObject to the viewer.
371
+ * @param customObject
372
+ * @example
373
+ * ```js
374
+ * const sphere = new THREE.Mesh(
375
+ * new THREE.SphereGeometry(),
376
+ * new THREE.MeshBasicMaterial()
377
+ * );
378
+ * const customObject = CustomObject(sphere);
379
+ * customObject.isPartOfBoundingBox = false;
380
+ * viewer.addCustomObject(customObject);
381
+ * ```
382
+ * @beta
383
+ */
384
+ addCustomObject(customObject: CustomObject): void;
368
385
  /**
369
386
  * Remove a THREE.Object3D from the viewer.
370
387
  * @param object
@@ -376,6 +393,19 @@ export declare class Cognite3DViewer {
376
393
  * ```
377
394
  */
378
395
  removeObject3D(object: THREE.Object3D): void;
396
+ /**
397
+ * Remove a CustomObject from the viewer.
398
+ * @param customObject
399
+ * @example
400
+ * ```js
401
+ * const sphere = new THREE.Mesh(new THREE.SphereGeometry(), new THREE.MeshBasicMaterial());
402
+ * const customObject = CustomObject(sphere);
403
+ * viewer.addCustomObject(sphere);
404
+ * viewer.removeCustomObject(sphere);
405
+ * ```
406
+ * @beta
407
+ */
408
+ removeCustomObject(customObject: CustomObject): void;
379
409
  /**
380
410
  * Sets the color used as the clear color of the renderer.
381
411
  * @param backgroundColor
@@ -604,6 +634,8 @@ export declare class Cognite3DViewer {
604
634
  private animate;
605
635
  /** @private */
606
636
  private intersectModels;
637
+ private getCustomObjectIntersectionIfCloser;
638
+ private createCustomObjectIntersectInput;
607
639
  /**
608
640
  * Callback used by DefaultCameraManager to do model intersection. Made synchronous to avoid
609
641
  * input lag when zooming in and out. Default implementation is async. See PR #2405 for more info.
@@ -25,8 +25,8 @@ export declare class FlexibleCameraManager implements IFlexibleCameraManager {
25
25
  private readonly _markers?;
26
26
  private readonly _currentBoundingBox;
27
27
  private _isDisposed;
28
+ private _isEnableClickAndDoubleClick;
28
29
  private _nearAndFarNeedsUpdate;
29
- private _isEnabled;
30
30
  private _prevTime;
31
31
  private readonly _prevCoords;
32
32
  private readonly _raycastCallback;
@@ -45,23 +45,25 @@ export declare class FlexibleCameraManager implements IFlexibleCameraManager {
45
45
  on(event: CameraManagerEventType, callback: CameraEventDelegate): void;
46
46
  off(event: CameraManagerEventType, callback: CameraEventDelegate): void;
47
47
  fitCameraToBoundingBox(boundingBox: Box3, duration?: number, radiusFactor?: number): void;
48
- update(deltaTime: number, boundingBox: Box3): void;
48
+ update(deltaTime: number, nearFarBoundingBox: Box3): void;
49
49
  dispose(): void;
50
50
  get controlsType(): FlexibleControlsType;
51
51
  set controlsType(value: FlexibleControlsType);
52
+ rotateCameraTo(direction: Vector3, animationDuration: number): void;
52
53
  addControlsTypeChangeListener(callback: FlexibleControlsTypeChangeDelegate): void;
53
54
  removeControlsTypeChangeListener(callback: FlexibleControlsTypeChangeDelegate): void;
55
+ updateModelBoundingBox(modelBoundingBox: Box3): void;
54
56
  get options(): FlexibleControlsOptions;
55
57
  get controls(): FlexibleControls;
56
58
  get camera(): PerspectiveCamera;
57
59
  get domElement(): HTMLElement;
58
60
  get isEnabled(): boolean;
61
+ get isEnableClickAndDoubleClick(): boolean;
59
62
  get isDisposed(): boolean;
60
63
  private set isEnabled(value);
64
+ set isEnableClickAndDoubleClick(value: boolean);
61
65
  private getPosition;
62
66
  private getTarget;
63
- getBoundingBoxDiagonal(): number;
64
- getHorizontalDiagonal(): number;
65
67
  setPositionAndTarget(position: Vector3, target: Vector3): void;
66
68
  private readonly getPickedPointByPixelCoordinates;
67
69
  private getTargetByBoundingBox;
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2024 Cognite AS
3
3
  */
4
- import { EventDispatcher, OrthographicCamera, PerspectiveCamera, Quaternion, Vector2, Vector3 } from 'three';
4
+ import { EventDispatcher, OrthographicCamera, PerspectiveCamera, Quaternion, Spherical, Vector2, Vector3 } from 'three';
5
5
  import { FlexibleControlsType } from './FlexibleControlsType';
6
6
  import { FlexibleControlsOptions } from './FlexibleControlsOptions';
7
7
  import { DampedVector3 } from './DampedVector3';
@@ -27,11 +27,14 @@ export declare class FlexibleControls extends EventDispatcher<FlexibleControlsEv
27
27
  private readonly _keyboard;
28
28
  private readonly _pointEventCache;
29
29
  private _getPickedPointByPixelCoordinates;
30
+ private _rawCameraRotation;
30
31
  private readonly _reusableVector3s;
32
+ private readonly _rotationHelper;
31
33
  constructor(camera: PerspectiveCamera | OrthographicCamera, domElement: HTMLElement, options: FlexibleControlsOptions);
32
34
  dispose(): void;
33
35
  get options(): FlexibleControlsOptions;
34
36
  get camera(): PerspectiveCamera | OrthographicCamera;
37
+ get target(): DampedVector3;
35
38
  get cameraVector(): DampedSpherical;
36
39
  get cameraPosition(): DampedVector3;
37
40
  get isEnabled(): boolean;
@@ -63,6 +66,7 @@ export declare class FlexibleControls extends EventDispatcher<FlexibleControlsEv
63
66
  update(deltaTimeS: number, forceUpdate?: boolean): boolean;
64
67
  triggerCameraChangeEvent(): void;
65
68
  triggerControlsTypeChangeEvent(): void;
69
+ rotateCameraTo(startDirection: Spherical, endDirection: Spherical, factor: number): void;
66
70
  private readonly onPointerDown;
67
71
  private readonly onMouseDown;
68
72
  private startMouse;
@@ -73,6 +77,8 @@ export declare class FlexibleControls extends EventDispatcher<FlexibleControlsEv
73
77
  private readonly onContextMenu;
74
78
  addEventListeners(): void;
75
79
  private removeEventListeners;
80
+ updateCameraAndTriggerCameraChangeEvent(): void;
81
+ updateCamera(deltaTimeS: number, forceUpdate?: boolean, useDampening?: boolean): boolean;
76
82
  private startTouchRotation;
77
83
  private rotate;
78
84
  getAzimuthCompensationFactor(): number;
@@ -9,7 +9,6 @@ import { FlexibleWheelZoomType } from './FlexibleWheelZoomType';
9
9
  */
10
10
  export declare class FlexibleControlsOptions {
11
11
  controlsType: FlexibleControlsType;
12
- showTarget: boolean;
13
12
  mouseWheelAction: FlexibleWheelZoomType;
14
13
  mouseClickType: FlexibleMouseActionType;
15
14
  mouseDoubleClickType: FlexibleMouseActionType;
@@ -46,8 +45,11 @@ export declare class FlexibleControlsOptions {
46
45
  keyboardFastMoveFactor: number;
47
46
  pinchEpsilon: number;
48
47
  pinchPanSpeed: number;
49
- EPSILON: number;
50
48
  orthographicCameraDollyFactor: number;
49
+ showTarget: boolean;
50
+ relativeMarkerSize: number;
51
+ outerMarkerColor: string;
52
+ innerMarkerColor: string;
51
53
  get realMouseWheelAction(): FlexibleWheelZoomType;
52
54
  get shouldPick(): boolean;
53
55
  getLegalAzimuthAngle(azimuthAngle: number): number;
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Copyright 2024 Cognite AS
3
+ */
4
+ import { FlexibleControls } from './FlexibleControls';
5
+ /**
6
+ * Helper class for rotating the camera. Call begin() before rotation,
7
+ * and end() after so the camera position updates correcly
8
+ * @beta
9
+ */
10
+ export declare class FlexibleControlsRotationHelper {
11
+ private readonly oldOffset;
12
+ private readonly oldCameraVectorEnd;
13
+ begin(controls: FlexibleControls): void;
14
+ end(controls: FlexibleControls): void;
15
+ }
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { CameraManager } from '../CameraManager';
5
5
  import { FlexibleControlsType } from './FlexibleControlsType';
6
+ import { Vector3 } from 'three';
6
7
  /**
7
8
  * @beta
8
9
  */
@@ -10,11 +11,34 @@ export type FlexibleControlsTypeChangeDelegate = (controlsType: FlexibleControls
10
11
  /**
11
12
  * Flexible implementation of {@link CameraManager}. The user can switch between Orbit, FirstPersion or OrbitInCenter
12
13
  * Supports automatic update of camera near and far planes and animated change of camera position and target.
14
+ * It provides additional functionality for controlling camera behavior and rotation.
13
15
  * @beta
14
16
  */
15
17
  export interface IFlexibleCameraManager extends CameraManager {
18
+ /**
19
+ * Get curent FlexibleControlsType type
20
+ */
16
21
  get controlsType(): FlexibleControlsType;
22
+ /**
23
+ * Set curent FlexibleControlsType type
24
+ */
17
25
  set controlsType(value: FlexibleControlsType);
26
+ /**
27
+ * Rotates the camera to look in the specified direction.
28
+ * Supports automatic update of camera near and far planes and animated change of camera position and target.
29
+ * @beta
30
+ * @param direction - The direction to rotate the camera towards.
31
+ * @param animationDuration - The duration of the rotation animation in milliseconds.
32
+ */
33
+ rotateCameraTo(direction: Vector3, animationDuration: number): void;
34
+ /**
35
+ * Adds a listener for changes in the controls type of the camera manager.
36
+ * @param callback - The callback function to be invoked when the controls type changes.
37
+ */
18
38
  addControlsTypeChangeListener(callback: FlexibleControlsTypeChangeDelegate): void;
39
+ /**
40
+ * Removes a listener for changes in the controls type of the camera manager.
41
+ * @param callback - The callback function to be removed from the controls type change listeners.
42
+ */
19
43
  removeControlsTypeChangeListener(callback: FlexibleControlsTypeChangeDelegate): void;
20
44
  }
@@ -4,7 +4,10 @@
4
4
  export { HtmlOverlayTool, HtmlOverlayOptions, HtmlOverlayToolOptions, HtmlOverlayToolClusteringOptions, HtmlOverlayPositionUpdatedDelegate, HtmlOverlayCreateClusterDelegate } from './src/HtmlOverlay/HtmlOverlayTool';
5
5
  export { DebugCameraTool } from './src/DebugCameraTool';
6
6
  export { AxisViewTool } from './src/AxisView/AxisViewTool';
7
- export { AxisBoxConfig, AxisBoxCompassConfig, AxisBoxFaceConfig, Corner, AbsolutePosition, RelativePosition } from './src/AxisView/types';
7
+ export { AxisGizmoTool } from './src/AxisGizmo/AxisGizmoTool';
8
+ export { AxisGizmoOptions } from './src/AxisGizmo/AxisGizmoOptions';
9
+ export { AxisBoxConfig, AxisBoxCompassConfig, AxisBoxFaceConfig, AbsolutePosition, RelativePosition } from './src/AxisView/types';
10
+ export { Corner } from './src/utilities/Corner';
8
11
  export { Overlay3DTool, Overlay3DToolParameters, OverlayEventHandler, OverlayToolEvent, OverlayCollectionOptions } from './src/Overlay3D/Overlay3DTool';
9
12
  export { TimelineTool } from './src/Timeline/TimelineTool';
10
13
  export { Keyframe } from './src/Timeline/Keyframe';
@@ -0,0 +1,36 @@
1
+ import { Corner } from '../utilities/Corner';
2
+ /**
3
+ * Options for styling the AxisGizmoTool
4
+ * @beta
5
+ */
6
+ export declare class AxisGizmoOptions {
7
+ size: number;
8
+ corner: Corner;
9
+ xMargin: number;
10
+ yMargin: number;
11
+ bubbleRadius: number;
12
+ insideMargin: number;
13
+ primaryLineWidth: number;
14
+ secondaryLineWidth: number;
15
+ bobbleLineWidth: number;
16
+ useGeoLabels: boolean;
17
+ yUp: boolean;
18
+ fontSize: string;
19
+ fontFamily: string;
20
+ fontWeight: string;
21
+ normalTextColor: string;
22
+ selectedTextColor: string;
23
+ focusCircleColor: string;
24
+ focusCircleAlpha: number;
25
+ fontYAdjust: number;
26
+ lightColors: number[];
27
+ darkColors: number[];
28
+ animationDuration: number;
29
+ private _font;
30
+ get radius(): number;
31
+ /**
32
+ * Get the font style.
33
+ * @returns The font style.
34
+ */
35
+ getFont(): string;
36
+ }
@@ -0,0 +1,55 @@
1
+ import { AxisGizmoOptions } from './AxisGizmoOptions';
2
+ import { Cognite3DViewer } from '../../../api';
3
+ import { Cognite3DViewerToolBase } from '../Cognite3DViewerToolBase';
4
+ /**
5
+ * Class for axis gizmo like the one in Blender
6
+ * @beta
7
+ */
8
+ export declare class AxisGizmoTool extends Cognite3DViewerToolBase {
9
+ private readonly _options;
10
+ private readonly _axes;
11
+ private readonly _center;
12
+ private _mousePosition;
13
+ private _selectedAxis;
14
+ private _isMouseOver;
15
+ private _inDragging;
16
+ private _viewer;
17
+ private _element;
18
+ private _canvas;
19
+ private _context;
20
+ private readonly _onPointerDown;
21
+ private readonly _onPointerUp;
22
+ private readonly _onPointerMove;
23
+ private readonly _onPointerOut;
24
+ private readonly _onMouseClick;
25
+ private readonly _onMouseDoubleClick;
26
+ constructor(option?: AxisGizmoOptions);
27
+ dispose(): void;
28
+ /**
29
+ * Connects the AxisGizmoTool to a Cognite3DViewer instance.
30
+ * @param viewer The Cognite3DViewer instance to connect to.
31
+ * Note: After it is connected to the viewer the tool can not be moved or
32
+ * changed size by changing the fields: size, corner, yMargin and yMargin
33
+ * in the AxisGizmoOptions
34
+ */
35
+ connect(viewer: Cognite3DViewer): void;
36
+ get options(): AxisGizmoOptions;
37
+ private onPointerDown;
38
+ private onPointerUp;
39
+ private onPointerMove;
40
+ private onPointerOut;
41
+ private onMouseClick;
42
+ private onMouseDoubleClick;
43
+ private readonly onCameraChange;
44
+ private getTextColor;
45
+ private isMouseOver;
46
+ private getAxisToUse;
47
+ private getSelectedAxis;
48
+ private updateSelectedAxis;
49
+ private updateAndRender;
50
+ private updateAxisPosition;
51
+ private addEventListeners;
52
+ private removeEventListeners;
53
+ private createElement;
54
+ private render;
55
+ }
@@ -0,0 +1,30 @@
1
+ import { Vector3 } from 'three';
2
+ import { AxisGizmoOptions } from './AxisGizmoOptions';
3
+ /**
4
+ * This class is used internally in AxisGizmoTool
5
+ * @beta
6
+ */
7
+ export declare class OneGizmoAxis {
8
+ readonly axis: number;
9
+ readonly isPrimary: boolean;
10
+ readonly direction: Vector3;
11
+ readonly upAxis: Vector3;
12
+ readonly bubblePosition: Vector3;
13
+ readonly label: string;
14
+ private readonly _lightColor;
15
+ private readonly _darkColor;
16
+ private readonly _mixedLightColor;
17
+ private readonly _mixedDarkColor;
18
+ private constructor();
19
+ getLightColorInHex(): string;
20
+ getDarkColorInHex(): string;
21
+ private getLightColor;
22
+ private getDarkColor;
23
+ private getColorFraction;
24
+ private createGeoLabel;
25
+ private createMathLabel;
26
+ private getMathAxisName;
27
+ private createUpAxis;
28
+ private createDirection;
29
+ static createAllAxes(options: AxisGizmoOptions): OneGizmoAxis[];
30
+ }
@@ -27,5 +27,4 @@ export declare class AxisViewTool extends Cognite3DViewerToolBase {
27
27
  private createCompassTexture;
28
28
  private getFaceTexture;
29
29
  private createBoxFace;
30
- private moveCameraTo;
31
30
  }
@@ -2,6 +2,7 @@
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
4
  import * as THREE from 'three';
5
+ import { Corner } from '../utilities/Corner';
5
6
  /**
6
7
  * Configuration of {@link AxisViewTool}.
7
8
  */
@@ -84,15 +85,6 @@ export type AxisBoxCompassConfig = {
84
85
  fontColor?: THREE.Color;
85
86
  tickColor?: THREE.Color;
86
87
  };
87
- /**
88
- * A corner of the viewer.
89
- */
90
- export declare enum Corner {
91
- TopRight = 0,
92
- TopLeft = 1,
93
- BottomLeft = 2,
94
- BottomRight = 3
95
- }
96
88
  export declare const defaultAxisBoxCompassConfig: AxisBoxCompassConfig;
97
89
  export declare const defaultFaceConfig: AxisBoxFaceConfig;
98
90
  export declare const defaultAxisBoxConfig: Required<AxisBoxConfig>;
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright 2024 Cognite AS
3
+ */
4
+ /**
5
+ * A corner of the anything.
6
+ */
7
+ export declare enum Corner {
8
+ TopRight = 0,
9
+ TopLeft = 1,
10
+ BottomLeft = 2,
11
+ BottomRight = 3
12
+ }
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright 2021 Cognite AS
3
+ */
4
+ import { CameraManager } from '../../../camera-manager';
5
+ import { Vector3 } from 'three';
6
+ export declare function moveCameraTo(cameraManager: CameraManager, targetAxis: Vector3, targetUpAxis: Vector3, duration: number): void;
@@ -39,6 +39,9 @@ export { LineGeometry } from './src/three/lines/LineGeometry';
39
39
  export { LineMaterial } from './src/three/lines/LineMaterial';
40
40
  export { DeferredPromise } from './src/DeferredPromise';
41
41
  export { SceneHandler } from './src/SceneHandler';
42
+ export { CustomObject } from './src/customObject/CustomObject';
43
+ export { CustomObjectIntersectInput } from './src/customObject/CustomObjectIntersectInput';
44
+ export { CustomObjectIntersection } from './src/customObject/CustomObjectIntersection';
42
45
  export { CDF_TO_VIEWER_TRANSFORMATION } from './src/constants';
43
46
  export * from './src/workers/workerize-transferable';
44
47
  export * from './src/shapes';
@@ -2,6 +2,7 @@
2
2
  * Copyright 2022 Cognite AS
3
3
  */
4
4
  import * as THREE from 'three';
5
+ import { CustomObject } from './customObject/CustomObject';
5
6
  export declare class SceneHandler {
6
7
  private readonly _scene;
7
8
  private readonly _cadModels;
@@ -16,13 +17,15 @@ export declare class SceneHandler {
16
17
  pointCloudNode: THREE.Object3D;
17
18
  modelIdentifier: symbol;
18
19
  }[];
19
- get customObjects(): THREE.Object3D[];
20
+ get customObjects(): CustomObject[];
20
21
  constructor();
21
22
  addCadModel(cadNode: THREE.Object3D, modelIdentifier: string): void;
22
23
  addPointCloudModel(pointCloudNode: THREE.Object3D, modelIdentifier: symbol): void;
23
24
  removePointCloudModel(pointCloudNode: THREE.Object3D): void;
24
25
  removeCadModel(cadNode: THREE.Object3D): void;
25
- addCustomObject(object: THREE.Object3D): void;
26
- removeCustomObject(object: THREE.Object3D): void;
26
+ addObject3D(object: THREE.Object3D): void;
27
+ addCustomObject(customObject: CustomObject): void;
28
+ removeObject3D(object: THREE.Object3D): void;
29
+ removeCustomObject(customObject: CustomObject): void;
27
30
  dispose(): void;
28
31
  }
@@ -0,0 +1,54 @@
1
+ /*!
2
+ * Copyright 2024 Cognite AS
3
+ */
4
+ import { Object3D } from 'three';
5
+ import { CustomObjectIntersection } from './CustomObjectIntersection';
6
+ import { CustomObjectIntersectInput } from './CustomObjectIntersectInput';
7
+ /**
8
+ * This class encasulate a Object3D, and made it possible to add flags to it.
9
+ * It might be extended with more flags in the future.
10
+ * @beta
11
+ */
12
+ export declare class CustomObject {
13
+ private readonly _object;
14
+ private _isPartOfBoundingBox;
15
+ private _shouldPick;
16
+ private _shouldPickBoundingBox;
17
+ /**
18
+ * Constructor
19
+ * @beta
20
+ */
21
+ constructor(object: Object3D);
22
+ /**
23
+ * Get the Object3D
24
+ * @beta
25
+ */
26
+ get object(): Object3D;
27
+ /**
28
+ * Set or get whether it should be part of the combined bounding box or not.
29
+ * Default is true.
30
+ * @beta
31
+ */
32
+ get isPartOfBoundingBox(): boolean;
33
+ set isPartOfBoundingBox(value: boolean);
34
+ /**
35
+ * Set or get whether it should be picked by the camera manager
36
+ * Default is false.
37
+ * @beta
38
+ */
39
+ get shouldPick(): boolean;
40
+ set shouldPick(value: boolean);
41
+ /**
42
+ * Set or get whether it should be also give the bounding box when picked by the camera
43
+ * Default is false.
44
+ * @beta
45
+ */
46
+ get shouldPickBoundingBox(): boolean;
47
+ set shouldPickBoundingBox(value: boolean);
48
+ /**
49
+ * Intersect the object with the raycaster.
50
+ * This function can be overridden to provide custom intersection logic.
51
+ * @beta
52
+ */
53
+ intersectIfCloser(intersectInput: CustomObjectIntersectInput, closestDistance: number | undefined): undefined | CustomObjectIntersection;
54
+ }
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Copyright 2024 Cognite AS
3
+ */
4
+ import { Raycaster, Vector3, Vector2, PerspectiveCamera, Plane } from 'three';
5
+ /**
6
+ * This class is used as input for intersecting custom objects
7
+ * @beta
8
+ */
9
+ export declare class CustomObjectIntersectInput {
10
+ readonly normalizedCoords: Vector2;
11
+ readonly camera: PerspectiveCamera;
12
+ readonly clippingPlanes: Plane[] | undefined;
13
+ readonly raycaster: Raycaster;
14
+ constructor(normalizedCoords: Vector2, camera: PerspectiveCamera, clippingPlanes?: Plane[] | undefined);
15
+ isVisible(point: Vector3): boolean;
16
+ }
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * Copyright 2024 Cognite AS
3
+ */
4
+ import { Vector3, Box3 } from 'three';
5
+ import { CustomObject } from './CustomObject';
6
+ /**
7
+ * This class is used as output intersecting custom objects
8
+ * @beta
9
+ */
10
+ export type CustomObjectIntersection = {
11
+ /**
12
+ * The intersection type.
13
+ */
14
+ type: 'customObject';
15
+ /**
16
+ * Coordinate of the intersection.
17
+ */
18
+ point: Vector3;
19
+ /**
20
+ * Distance from the camera to the intersection.
21
+ */
22
+ distanceToCamera: number;
23
+ customObject: CustomObject;
24
+ boundingBox?: Box3;
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.10.2",
3
+ "version": "4.10.4",
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,7 +81,7 @@
81
81
  "devDependencies": {
82
82
  "@azure/msal-browser": "2.38.3",
83
83
  "@cognite/sdk": "8.3.0",
84
- "@microsoft/api-extractor": "7.40.1",
84
+ "@microsoft/api-extractor": "7.40.6",
85
85
  "@types/dat.gui": "0.7.12",
86
86
  "@types/gl": "^6.0.2",
87
87
  "@types/glob": "8.1.0",
@@ -91,7 +91,7 @@
91
91
  "@types/jsdom": "21.1.6",
92
92
  "@types/lodash": "4.14.202",
93
93
  "@types/mixpanel-browser": "2.49.0",
94
- "@types/node": "18.19.15",
94
+ "@types/node": "18.19.18",
95
95
  "@types/random-seed": "0.3.5",
96
96
  "@types/skmeans": "0.11.7",
97
97
  "@types/stats": "0.16.30",
@@ -122,7 +122,7 @@
122
122
  "jest-puppeteer": "9.0.2",
123
123
  "jsdom": "23.2.0",
124
124
  "moq.ts": "10.0.8",
125
- "nock": "13.5.1",
125
+ "nock": "13.5.3",
126
126
  "prettier": "3.2.5",
127
127
  "process": "0.11.10",
128
128
  "puppeteer": "21.11.0",
@@ -138,7 +138,7 @@
138
138
  "tsc-alias": "1.8.8",
139
139
  "typescript": "5.3.3",
140
140
  "wasm-pack": "0.12.1",
141
- "webpack": "5.90.1",
141
+ "webpack": "5.90.3",
142
142
  "webpack-cli": "5.1.4",
143
143
  "webpack-dev-server": "4.15.1",
144
144
  "webpack-node-externals": "3.0.0",