@cognite/reveal 4.38.0 → 4.39.0

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 (40) hide show
  1. package/dist/assets/{eptBinaryDecoder.worker-AfUP5xy8.js.map → eptBinaryDecoder.worker-DjciQFFi.js.map} +1 -1
  2. package/dist/index.js +5922 -6101
  3. package/dist/index.js.map +1 -1
  4. package/dist/packages/api/src/public/RevealManager.d.ts +9 -1
  5. package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +10 -1
  6. package/dist/packages/api/src/public/migration/types.d.ts +3 -1
  7. package/dist/packages/api/src/public/types.d.ts +1 -1
  8. package/dist/packages/cad-geometry-loaders/src/CadManager.d.ts +3 -1
  9. package/dist/packages/cad-geometry-loaders/src/createCadManager.d.ts +2 -1
  10. package/dist/packages/cad-geometry-loaders/src/sector/SectorDownloadScheduler.d.ts +6 -0
  11. package/dist/packages/cad-geometry-loaders/src/sector/SectorLoader.d.ts +10 -1
  12. package/dist/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV9SectorMap.d.ts +8 -1
  13. package/dist/packages/cad-model/src/CadModelFactory.d.ts +3 -1
  14. package/dist/packages/cad-model/src/picking/CadPickBuffer.d.ts +22 -0
  15. package/dist/packages/cad-model/src/picking/CadPickCache.d.ts +43 -0
  16. package/dist/packages/cad-model/src/picking/PickingHandler.d.ts +11 -19
  17. package/dist/packages/cad-model/src/picking/depthToIntersection.d.ts +12 -0
  18. package/dist/packages/cad-model/src/picking/types.d.ts +9 -0
  19. package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +3 -1
  20. package/dist/packages/cad-styling/src/NodeAppearanceTextureBuilder.d.ts +5 -2
  21. package/dist/packages/data-providers/src/utilities/gzipUtils.d.ts +3 -0
  22. package/dist/packages/pointclouds/src/PointCloudFactory.d.ts +3 -1
  23. package/dist/packages/pointclouds/src/PointCloudManager.d.ts +8 -1
  24. package/dist/packages/pointclouds/src/PointCloudNode.d.ts +4 -2
  25. package/dist/packages/pointclouds/src/PointCloudPickingHandler.d.ts +2 -2
  26. package/dist/packages/pointclouds/src/createPointCloudManager.d.ts +2 -1
  27. package/dist/packages/pointclouds/src/potree-three-loader/tree/PointCloudOctreePicker.d.ts +2 -2
  28. package/dist/packages/rendering/index.d.ts +1 -1
  29. package/dist/packages/rendering/src/CadMaterialManager.d.ts +4 -2
  30. package/dist/packages/rendering/src/pointcloud-rendering/PointCloudObjectAppearanceTexture.d.ts +6 -0
  31. package/dist/packages/rendering/src/render-passes/PostProcessingPass.d.ts +0 -5
  32. package/dist/packages/rendering/src/rendering/CustomObjectEffectMaterial.d.ts +75 -0
  33. package/dist/packages/utilities/index.d.ts +1 -0
  34. package/dist/packages/utilities/src/PickCacheInvalidator.d.ts +17 -0
  35. package/dist/packages/utilities/src/SceneHandler.d.ts +0 -2
  36. package/dist/packages/utilities/src/customObject/CustomObject.d.ts +2 -0
  37. package/dist/packages/utilities/src/customObject/ICustomObject.d.ts +2 -0
  38. package/package.json +6 -6
  39. package/dist/packages/data-providers/src/utilities/brotliDecompressTypes.d.ts +0 -6
  40. package/dist/packages/rendering/src/rendering/CadShadowReceiverForCustomObjectMaterial.d.ts +0 -15
@@ -0,0 +1,75 @@
1
+ import { ColorRepresentation, Texture, RawShaderMaterial } from 'three';
2
+ /**
3
+ * Technique that hides the repeat of a tiled texture.
4
+ * - `'none'`: the texture is sampled as is.
5
+ * - `'hexTiling'`: cells rotate and shift the texture. Suits ground such as concrete, gravel and grass.
6
+ * - `'waterTiling'`: cells shift the texture without rotating it, so waves keep their direction.
7
+ * A second, larger copy of the texture is blended in and the contrast is kept. Suits water and ocean.
8
+ * @public
9
+ */
10
+ export type TextureVariationType = 'none' | 'hexTiling' | 'waterTiling';
11
+ /**
12
+ * Opt-in material for custom objects: an effect is compiled into the shader only while requested.
13
+ *
14
+ * {@link CustomObjectEffectMaterial.setReceivesShadow} requests the CAD shadow; the shader recompiles whenever the
15
+ * viewer's shadow map appears or disappears, so give each viewer its own material if shadow state can differ.
16
+ *
17
+ * Only the methods declared here are supported; inherited `RawShaderMaterial` internals may change.
18
+ * @public
19
+ */
20
+ export declare class CustomObjectEffectMaterial extends RawShaderMaterial {
21
+ private _receivesShadow;
22
+ private _textureVariation;
23
+ /**
24
+ * White and no texture when omitted. Effects are requested afterwards through their setters.
25
+ * @param color - Diffuse color.
26
+ * @param diffuseTexture - Diffuse texture.
27
+ */
28
+ constructor(color?: ColorRepresentation, diffuseTexture?: Texture | null);
29
+ /** Whether this material requested the CAD shadow. */
30
+ get receivesShadow(): boolean;
31
+ /**
32
+ * Sets the diffuse texture. Pass null to clear it. A requested texture variation follows the
33
+ * new texture.
34
+ */
35
+ setDiffuseTexture(texture: Texture | null): void;
36
+ /**
37
+ * Sets the diffuse texture.
38
+ * @deprecated Use {@link CustomObjectEffectMaterial.setDiffuseTexture}.
39
+ */
40
+ setMap(map: Texture | null): void;
41
+ /**
42
+ * Chooses the technique that hides the repeat of the texture. It is drawn only while the material has a
43
+ * texture; the choice itself is kept, so it may be made before or after the texture is set.
44
+ */
45
+ setTextureVariation(type: TextureVariationType): void;
46
+ /** The texture variation this material requested. */
47
+ get textureVariation(): TextureVariationType;
48
+ private applyTextureVariation;
49
+ private setEffectEnabled;
50
+ /**
51
+ * Requests or drops the CAD shadow for this material; the request is kept and drawn only while the viewer has
52
+ * shadows enabled (`Cognite3DViewer.shadowsEnabled`), taking effect on the next draw.
53
+ */
54
+ setReceivesShadow(receivesShadow: boolean): void;
55
+ /**
56
+ * Sets the diffuse color. With a texture, the color multiplies it: white leaves the texture
57
+ * unchanged and any other color tints it.
58
+ */
59
+ setColor(color: ColorRepresentation): void;
60
+ private updateShadowUniforms;
61
+ private clearShadowUniforms;
62
+ private refreshMapTransform;
63
+ }
64
+ /**
65
+ * Alias for {@link CustomObjectEffectMaterial}.
66
+ * @deprecated Use {@link CustomObjectEffectMaterial}.
67
+ * @public
68
+ */
69
+ export declare const CadShadowReceiverForCustomObjectMaterial: typeof CustomObjectEffectMaterial;
70
+ /**
71
+ * Alias for {@link CustomObjectEffectMaterial}, so the old name still works as a type.
72
+ * @deprecated Use {@link CustomObjectEffectMaterial}.
73
+ * @public
74
+ */
75
+ export type CadShadowReceiverForCustomObjectMaterial = CustomObjectEffectMaterial;
@@ -51,6 +51,7 @@ export { LineGeometry } from './src/three/lines/LineGeometry';
51
51
  export { LineMaterial } from './src/three/lines/LineMaterial';
52
52
  export { DeferredPromise } from './src/DeferredPromise';
53
53
  export { SceneHandler } from './src/SceneHandler';
54
+ export { PickCacheInvalidator } from './src/PickCacheInvalidator';
54
55
  export { CustomObject } from './src/customObject/CustomObject';
55
56
  export type { ICustomObject } from './src/customObject/ICustomObject';
56
57
  export { CustomObjectIntersectInput } from './src/customObject/CustomObjectIntersectInput';
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright 2026 Cognite AS
3
+ */
4
+ /**
5
+ * Flag for whether the cached picking results are stale. Set it with {@link PickCacheInvalidator.request} wherever
6
+ * something that can change what a pick hits changes (models, sectors, clipping, transforms, or styling that hides or
7
+ * ghosts objects). Changes that are only drawn but never picked, such as colors or custom objects, should not set it.
8
+ * The camera and canvas size do not need to be set, as the pick caches compare them on every pick.
9
+ */
10
+ export declare class PickCacheInvalidator {
11
+ private _requested;
12
+ request(): void;
13
+ /**
14
+ * Returns whether an invalidation was requested since the last call, and clears the flag.
15
+ */
16
+ consume(): boolean;
17
+ }
@@ -5,8 +5,6 @@ export declare class SceneHandler {
5
5
  private readonly _cadModels;
6
6
  private readonly _pointCloudModels;
7
7
  private readonly _customObjects;
8
- onCustomObjectAdded: ((customObject: ICustomObject) => void) | undefined;
9
- onCustomObjectRemoved: ((customObject: ICustomObject) => void) | undefined;
10
8
  get scene(): Scene;
11
9
  get cadModels(): {
12
10
  cadNode: Object3D;
@@ -55,6 +55,8 @@ export declare class CustomObject implements ICustomObject {
55
55
  /**
56
56
  * Whether CAD shadows fall on this object.
57
57
  * Default is false.
58
+ * @deprecated No longer read. Request the shadow on the material instead with
59
+ * `CustomObjectEffectMaterial.setReceivesShadow`.
58
60
  * @beta
59
61
  */
60
62
  get receiveShadow(): boolean;
@@ -39,6 +39,8 @@ export interface ICustomObject {
39
39
  /**
40
40
  * Whether CAD shadows fall on this object.
41
41
  * Optional. When omitted, the object does not receive shadows.
42
+ * @deprecated No longer read. Request the shadow on the material instead with
43
+ * `CustomObjectEffectMaterial.setReceivesShadow`.
42
44
  * @beta
43
45
  */
44
46
  readonly receiveShadow?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.38.0",
3
+ "version": "4.39.0",
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,12 +81,12 @@
81
81
  "@types/jsdom": "^30.0.0",
82
82
  "@types/lodash-es": "^4.17.12",
83
83
  "@types/mixpanel-browser": "^2.49.0",
84
- "@types/node": "^25.9.3",
84
+ "@types/node": "^26.0.0",
85
85
  "@types/random-seed": "^0.3.5",
86
86
  "@types/skmeans": "^0.11.7",
87
87
  "@types/stats": "^0.16.30",
88
88
  "@types/three": "^0.186.0",
89
- "@vitest/coverage-v8": "^4.1.7",
89
+ "@vitest/coverage-v8": "^5.0.0",
90
90
  "dat.gui": "^0.7.9",
91
91
  "eslint": "^10.5.0",
92
92
  "eslint-config-prettier": "^10.0.0",
@@ -96,7 +96,7 @@
96
96
  "globals": "^17.0.0",
97
97
  "typescript-eslint": "^8.0.0",
98
98
  "glob": "^13.0.0",
99
- "happy-dom": "^20.10.6",
99
+ "happy-dom": "^21.0.0",
100
100
  "moq.ts": "10.0.8",
101
101
  "prettier": "^3.2.5",
102
102
  "shx": "^0.4.0",
@@ -106,7 +106,7 @@
106
106
  "unplugin-dts": "^1.0.2",
107
107
  "vite": "^8.1.0",
108
108
  "vite-plugin-glsl": "^1.6.0",
109
- "vitest": "^4.1.7",
109
+ "vitest": "^5.0.0",
110
110
  "vitest-canvas-mock": "^1.1.4",
111
111
  "wasm-pack": "^0.15.0"
112
112
  },
@@ -117,5 +117,5 @@
117
117
  "files": [
118
118
  "dist"
119
119
  ],
120
- "packageManager": "pnpm@12.11.2"
120
+ "packageManager": "pnpm@12.15.0"
121
121
  }
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright 2026 Cognite AS
3
- */
4
- declare module 'brotli/decompress' {
5
- export default function decompress(buffer: Uint8Array, outputSize?: number): Uint8Array;
6
- }
@@ -1,15 +0,0 @@
1
- import { Camera, ColorRepresentation, Texture, WebGLRenderer, Scene, RawShaderMaterial } from 'three';
2
- /**
3
- * Surface on a custom object that samples a color or texture and receives CAD shadows.
4
- * The viewer creates one for each up-facing plane that receives shadows.
5
- * A skybox stays on its own material when `receiveShadow` is false.
6
- * @public
7
- */
8
- export declare class CadShadowReceiverForCustomObjectMaterial extends RawShaderMaterial {
9
- private static frameShadowMap;
10
- constructor(color?: ColorRepresentation, map?: Texture | null);
11
- onBeforeRender(_renderer: WebGLRenderer, _scene: Scene, camera: Camera, _geometry: unknown, _object: unknown, _group: unknown): void;
12
- setMap(map: Texture | null): void;
13
- setColor(color: ColorRepresentation): void;
14
- private refreshMapTransform;
15
- }