@cognite/reveal 4.14.5 → 4.14.6-dev.20240606

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.
@@ -649,12 +649,14 @@ export declare class Cognite3DViewer {
649
649
  * @param pixelCoords Pixel coordinate in pixels (relative to the domElement).
650
650
  * @param options
651
651
  * @param options.stopOnHitting360Icon
652
+ * @param options.predicate Check whether a CustomObject should be intersected.
652
653
  * @returns A promise that if there was an intersection then return the intersection object - otherwise it
653
654
  * returns `null` if there were no intersections.
654
655
  * @beta
655
656
  */
656
657
  getAnyIntersectionFromPixel(pixelCoords: THREE.Vector2, options?: {
657
658
  stopOnHitting360Icon?: boolean;
659
+ predicate?: (customObject: ICustomObject) => boolean;
658
660
  }): Promise<AnyIntersection | undefined>;
659
661
  private isIntersecting360Icon;
660
662
  /**
@@ -25,7 +25,7 @@ export declare class PickingHandler {
25
25
  private readonly _treeIndexRenderPipeline;
26
26
  private readonly _mutex;
27
27
  constructor(renderer: THREE.WebGLRenderer, materialManager: CadMaterialManager, sceneHandler: SceneHandler);
28
- intersectCadNodes(cadNodes: CadNode[], input: IntersectInput, async?: boolean): Promise<IntersectCadNodesResult[]>;
28
+ intersectCadNodes(cadNodes: CadNode[], input: IntersectInput, shouldRunAsync?: boolean): Promise<IntersectCadNodesResult[]>;
29
29
  private filterOutOfBoundCadNodes;
30
30
  private intersectCadNodeDepth;
31
31
  private intersectCadNodeTreeIndex;
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2024 Cognite AS
3
3
  */
4
- import { Object3D, Box3 } from 'three';
4
+ import { Object3D, Box3, PerspectiveCamera } from 'three';
5
5
  import { CustomObjectIntersection } from './CustomObjectIntersection';
6
6
  import { CustomObjectIntersectInput } from './CustomObjectIntersectInput';
7
7
  import { ICustomObject } from './ICustomObject';
@@ -15,6 +15,7 @@ export declare class CustomObject implements ICustomObject {
15
15
  private _isPartOfBoundingBox;
16
16
  private _shouldPick;
17
17
  private _shouldPickBoundingBox;
18
+ private _useDepthTest;
18
19
  /**
19
20
  * Constructor
20
21
  * @beta
@@ -39,11 +40,6 @@ export declare class CustomObject implements ICustomObject {
39
40
  */
40
41
  get shouldPick(): boolean;
41
42
  set shouldPick(value: boolean);
42
- /**
43
- * Get the bounding box from the object
44
- * @beta
45
- */
46
- getBoundingBox(target: Box3): Box3;
47
43
  /**
48
44
  * Set or get whether it should be also give the bounding box when picked by the camera
49
45
  * Default is false.
@@ -51,10 +47,27 @@ export declare class CustomObject implements ICustomObject {
51
47
  */
52
48
  get shouldPickBoundingBox(): boolean;
53
49
  set shouldPickBoundingBox(value: boolean);
50
+ /**
51
+ * Get whether it should be rendered with depth test (on top on other objects)
52
+ * Default is true.
53
+ * @beta
54
+ */
55
+ get useDepthTest(): boolean;
56
+ set useDepthTest(value: boolean);
57
+ /**
58
+ * Get the bounding box from the object
59
+ * @beta
60
+ */
61
+ getBoundingBox(target: Box3): Box3;
54
62
  /**
55
63
  * Intersect the object with the raycaster.
56
64
  * This function can be overridden to provide custom intersection logic.
57
65
  * @beta
58
66
  */
59
67
  intersectIfCloser(intersectInput: CustomObjectIntersectInput, closestDistance: number | undefined): undefined | CustomObjectIntersection;
68
+ /**
69
+ * This method is called before rendering of the custom object
70
+ * @beta
71
+ */
72
+ beforeRender(_camera: PerspectiveCamera): void;
60
73
  }
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2024 Cognite AS
3
3
  */
4
- import { Object3D, Box3 } from 'three';
4
+ import { Object3D, Box3, PerspectiveCamera } from 'three';
5
5
  import { CustomObjectIntersection } from './CustomObjectIntersection';
6
6
  import { CustomObjectIntersectInput } from './CustomObjectIntersectInput';
7
7
  /**
@@ -33,6 +33,12 @@ export interface ICustomObject {
33
33
  * @beta
34
34
  */
35
35
  get shouldPickBoundingBox(): boolean;
36
+ /**
37
+ * Get whether it should be rendered with depth test (on top on other objects)
38
+ * Default is true.
39
+ * @beta
40
+ */
41
+ get useDepthTest(): boolean;
36
42
  /**
37
43
  * Get the bounding box from the object
38
44
  * @beta
@@ -44,4 +50,9 @@ export interface ICustomObject {
44
50
  * @beta
45
51
  */
46
52
  intersectIfCloser(intersectInput: CustomObjectIntersectInput, closestDistance: number | undefined): undefined | CustomObjectIntersection;
53
+ /**
54
+ * This method is called before rendering of the custom object
55
+ * @beta
56
+ */
57
+ beforeRender(camera: PerspectiveCamera): void;
47
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.14.5",
3
+ "version": "4.14.6-dev.20240606",
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": {
@@ -95,7 +95,7 @@
95
95
  "@types/random-seed": "^0.3.5",
96
96
  "@types/skmeans": "^0.11.7",
97
97
  "@types/stats": "^0.16.30",
98
- "@types/three": "^0.164.0",
98
+ "@types/three": "^0.165.0",
99
99
  "@types/tween.js": "^18.6.1",
100
100
  "@typescript-eslint/eslint-plugin": "^7.7.1",
101
101
  "@typescript-eslint/parser": "^7.7.1",
@@ -131,7 +131,7 @@
131
131
  "resize-observer-polyfill": "^1.5.1",
132
132
  "shx": "^0.3.4",
133
133
  "stats.js": "^0.17.0",
134
- "three": "0.164.1",
134
+ "three": "0.165.0",
135
135
  "ts-jest": "^29.1.2",
136
136
  "ts-loader": "^9.5.1",
137
137
  "tsc-alias": "^1.8.8",
@@ -146,7 +146,7 @@
146
146
  },
147
147
  "peerDependencies": {
148
148
  "@cognite/sdk": "^7.16.0 || ^8.0.0",
149
- "three": "0.164.1"
149
+ "three": "0.165.0"
150
150
  },
151
151
  "glslify": {
152
152
  "transform": [
@@ -1,17 +0,0 @@
1
- /*!
2
- * Copyright 2022 Cognite AS
3
- */
4
- import * as THREE from 'three';
5
- /**
6
- * Does the same as THREE.WebGlRenderer.readRenderTargetPixels(), but does this
7
- * asynchronously when used on WebGL2.
8
- * @param renderer
9
- * @param renderTarget
10
- * @param x
11
- * @param y
12
- * @param w
13
- * @param h
14
- * @param dest
15
- * @returns
16
- */
17
- export declare function readPixelsFromTargetAsync(renderer: THREE.WebGLRenderer, renderTarget: THREE.WebGLRenderTarget, x: number, y: number, w: number, h: number, dest: ArrayBufferView, forceSync?: boolean): Promise<void>;