@cognite/reveal 4.0.0-dev.20230117 → 4.0.0-dev.20230119

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.
@@ -25,6 +25,7 @@ export declare class Image360ApiHelper {
25
25
  enter360Image(image360Entity: Image360Entity): Promise<void>;
26
26
  private transition;
27
27
  private tweenVisualizationAlpha;
28
+ private tweenVisualizationZoom;
28
29
  private set360CameraManager;
29
30
  exit360Image(): void;
30
31
  dispose(): void;
@@ -8,7 +8,7 @@ import { PointCloudManager, PointCloudNode } from '../../../pointclouds';
8
8
  import { LoadingState } from '../../../model-base';
9
9
  import { CadManager, CadModelBudget } from '../../../cad-geometry-loaders';
10
10
  import { NodeAppearanceProvider } from '../../../cad-styling';
11
- import { RenderMode, RenderPipelineExecutor, CadMaterialManager, RenderPipelineProvider, ResizeHandler } from '../../../rendering';
11
+ import { RenderMode, RenderPipelineExecutor, CadMaterialManager, RenderPipelineProvider, ResizeHandler, SettableRenderTarget } from '../../../rendering';
12
12
  import { CameraManager } from '../../../camera-manager';
13
13
  import { ModelIdentifier } from '../../../data-providers';
14
14
  export type AddCadModelOptions = {
@@ -33,10 +33,11 @@ export declare class RevealManager {
33
33
  private readonly _cameraManager;
34
34
  private readonly _onCameraChange;
35
35
  private readonly _onCameraStop;
36
- constructor(cadManager: CadManager, pointCloudManager: PointCloudManager, pipelineExecutor: RenderPipelineExecutor, renderPipeline: RenderPipelineProvider, resizeHandler: ResizeHandler, cameraManager: CameraManager);
36
+ constructor(cadManager: CadManager, pointCloudManager: PointCloudManager, pipelineExecutor: RenderPipelineExecutor, renderPipeline: RenderPipelineProvider & SettableRenderTarget, resizeHandler: ResizeHandler, cameraManager: CameraManager);
37
37
  dispose(): void;
38
38
  requestRedraw(): void;
39
39
  resetRedraw(): void;
40
+ setOutputRenderTarget(target: THREE.WebGLRenderTarget | null, autoSizeRenderTarget?: boolean): void;
40
41
  get materialManager(): CadMaterialManager;
41
42
  get needsRedraw(): boolean;
42
43
  update(camera: THREE.PerspectiveCamera): void;
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright 2023 Cognite AS
3
+ */
4
+ import { ParsedGeometry } from '../../../sector-parser';
5
+ export interface DrawCallBatchingManager {
6
+ batchGeometries(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
7
+ removeSectorBatches(sectorId: number): void;
8
+ dispose(): void;
9
+ }
@@ -0,0 +1,37 @@
1
+ import { Group } from 'three';
2
+ import { Materials } from '../../../rendering';
3
+ import { ParsedGeometry } from '../../../sector-parser';
4
+ import { DrawCallBatchingManager } from './DrawCallBatchingManager';
5
+ /**
6
+ * The objective of this class is to batch together instances
7
+ * of the same type from different sectors.
8
+ * This is done to reduce the number of draw calls that have to be issued during rendering.
9
+ * Essentially this works by allocating n (numberOfInstanceBatches) buffers for each unique instanced type
10
+ * and continually filling / ejecting data from those buffers when new sectors are added / removed.
11
+ */
12
+ export declare class MultiBufferBatchingManager implements DrawCallBatchingManager {
13
+ private readonly initialBufferSize;
14
+ private readonly numberOfInstanceBatches;
15
+ private readonly _sectorBatches;
16
+ private readonly _instanceBatches;
17
+ private readonly _materials;
18
+ private readonly _batchGroup;
19
+ constructor(batchGroup: Group, materials: Materials, initialBufferSize?: number, numberOfInstanceBatches?: number);
20
+ batchGeometries(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
21
+ removeSectorBatches(sectorId: number): void;
22
+ dispose(): void;
23
+ private removeTreeIndicesFromMeshUserData;
24
+ private processGeometries;
25
+ private batchInstanceAttributes;
26
+ private addTreeIndicesToMeshUserData;
27
+ private reallocateBufferGeometry;
28
+ private updateInstanceAttributes;
29
+ private extendUpdateRange;
30
+ private getBatchBufferToFill;
31
+ private getOrCreateInstanceBatch;
32
+ private createBatchBuffer;
33
+ private createInstanceMesh;
34
+ private createDefragmentedBufferGeometry;
35
+ private getTreeIndexAttribute;
36
+ private createSectorBatch;
37
+ }
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Copyright 2023 Cognite AS
3
+ */
4
+ import { TypedArray } from '../../../utilities';
5
+ import { BufferAttribute, InterleavedBufferAttribute, BufferGeometry } from 'three';
6
+ export declare class GeometryBufferUtils {
7
+ private static readonly TypedArrayViews;
8
+ static getAttributes<T extends BufferAttribute | InterleavedBufferAttribute>(geometry: BufferGeometry, filterType: new (...args: any[]) => T): {
9
+ name: string;
10
+ attribute: T;
11
+ }[];
12
+ static copyGeometryWithBufferAttributes(geometry: BufferGeometry): THREE.BufferGeometry;
13
+ static setInstanceAttributeDescriptors(instanceAttributes: {
14
+ name: string;
15
+ attribute: InterleavedBufferAttribute;
16
+ }[], bufferGeometry: BufferGeometry, backingBuffer: ArrayBufferLike): void;
17
+ static getInstanceAttributesSharedView(geometry: BufferGeometry): TypedArray;
18
+ }
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright 2023 Cognite AS
3
+ */
4
+ import { Materials } from '../../../rendering';
5
+ import { RevealGeometryCollectionType } from '../../../sector-parser';
6
+ import { RawShaderMaterial } from 'three';
7
+ export declare function getShaderMaterial(type: RevealGeometryCollectionType, materials: Materials): RawShaderMaterial;
@@ -9,10 +9,12 @@ export declare class StationaryCameraManager implements CameraManager {
9
9
  private readonly _cameraChangedListeners;
10
10
  private readonly _domElement;
11
11
  private _defaultFOV;
12
+ private readonly _minFOV;
12
13
  private readonly _stopEventTrigger;
13
14
  private _isDragging;
14
15
  constructor(domElement: HTMLElement, camera: THREE.PerspectiveCamera);
15
16
  getCamera(): THREE.PerspectiveCamera;
17
+ get defaultFOV(): number;
16
18
  setCameraState(state: CameraState): void;
17
19
  getCameraState(): Required<CameraState>;
18
20
  activate(cameraManager: CameraManager): void;
@@ -21,10 +23,13 @@ export declare class StationaryCameraManager implements CameraManager {
21
23
  off(eventType: CameraManagerEventType, callback: CameraChangeDelegate): void;
22
24
  fitCameraToBoundingBox(boundingBox: THREE.Box3, _?: number, radiusFactor?: number): void;
23
25
  moveTo(targetPosition: THREE.Vector3, duration?: number): Promise<void>;
26
+ setFOV(fov: number): void;
24
27
  update(_: number, boundingBox: THREE.Box3): void;
25
28
  dispose(): void;
26
29
  private readonly enableDragging;
27
30
  private readonly disableDragging;
28
31
  private readonly rotateCamera;
29
32
  private readonly zoomCamera;
33
+ private getCursorRay;
34
+ private getTarget;
30
35
  }
@@ -85,4 +85,5 @@ export declare class PointCloudNode extends Group {
85
85
  set clippingPlanes(clippingPlanes: THREE.Plane[]);
86
86
  assignStyledPointCloudObjectCollection(styledCollection: StyledPointCloudObjectCollection): void;
87
87
  removeAllStyledPointCloudObjects(): void;
88
+ dispose(): void;
88
89
  }
@@ -16,7 +16,6 @@ export declare class PointCloudEptGeometry implements IPointCloudTreeGeometry {
16
16
  private readonly _spacing;
17
17
  private readonly _schema;
18
18
  private _root;
19
- private readonly _projection;
20
19
  get loader(): EptBinaryLoader;
21
20
  get root(): PointCloudEptGeometryNode | undefined;
22
21
  set root(r: PointCloudEptGeometryNode | undefined);
@@ -21,3 +21,4 @@ export { BasicPipelineExecutor } from './src/pipeline-executors/BasicPipelineExe
21
21
  export { RenderPipelineExecutor } from './src/RenderPipelineExecutor';
22
22
  export { RenderPipelineProvider } from './src/RenderPipelineProvider';
23
23
  export { ResizeHandler } from './src/ResizeHandler';
24
+ export { SettableRenderTarget } from './src/rendering/SettableRenderTarget';
@@ -7,7 +7,8 @@ import { RenderPass } from '../RenderPass';
7
7
  import { RenderPipelineProvider } from '../RenderPipelineProvider';
8
8
  import { RenderMode } from '../rendering/RenderMode';
9
9
  import { SceneHandler } from '../../../utilities';
10
- export declare class CadGeometryRenderModePipelineProvider implements RenderPipelineProvider {
10
+ import { SettableRenderTarget } from '../rendering/SettableRenderTarget';
11
+ export declare class CadGeometryRenderModePipelineProvider implements RenderPipelineProvider, SettableRenderTarget {
11
12
  private readonly _materialManager;
12
13
  private readonly _cadModels;
13
14
  private readonly _renderTargetData;
@@ -8,14 +8,15 @@ import { RenderPipelineProvider } from '../RenderPipelineProvider';
8
8
  import { RenderOptions } from '../rendering/types';
9
9
  import { SceneHandler } from '../../../utilities';
10
10
  import { PointCloudMaterialManager } from '../PointCloudMaterialManager';
11
- export declare class DefaultRenderPipelineProvider implements RenderPipelineProvider {
11
+ import { SettableRenderTarget } from '../rendering/SettableRenderTarget';
12
+ export declare class DefaultRenderPipelineProvider implements RenderPipelineProvider, SettableRenderTarget {
12
13
  private readonly _viewerScene;
13
14
  private readonly _renderTargetData;
14
15
  private readonly _cadModels;
15
16
  private readonly _pointCloudModels;
16
17
  private readonly _customObjects;
17
- private readonly _autoResizeOutputTarget;
18
- private readonly _outputRenderTarget;
18
+ private _autoResizeOutputTarget;
19
+ private _outputRenderTarget;
19
20
  private readonly _cadGeometryRenderPipeline;
20
21
  private readonly _pointCloudRenderPipeline;
21
22
  private readonly _postProcessingPass;
@@ -29,6 +30,7 @@ export declare class DefaultRenderPipelineProvider implements RenderPipelineProv
29
30
  target: THREE.WebGLRenderTarget;
30
31
  autoSize?: boolean;
31
32
  });
33
+ setOutputRenderTarget(target: THREE.WebGLRenderTarget | null, autoSizeRenderTarget?: boolean): void;
32
34
  pipeline(renderer: THREE.WebGLRenderer): Generator<RenderPass>;
33
35
  dispose(): void;
34
36
  private pipelineSetup;
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright 2022 Cognite AS
3
+ */
4
+ /**
5
+ * Interface for allowing render targets in renderPipelines to be changed dynamicaly in RevealManager.
6
+ */
7
+ export interface SettableRenderTarget {
8
+ setOutputRenderTarget(target: THREE.WebGLRenderTarget | null, autoSizeRenderTarget?: boolean): void;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.0.0-dev.20230117",
3
+ "version": "4.0.0-dev.20230119",
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,6 @@
81
81
  "loglevel": "1.8.1",
82
82
  "mixpanel-browser": "2.45.0",
83
83
  "path-browserify": "1.0.1",
84
- "proj4": "2.8.0",
85
84
  "rxjs": "7.8.0",
86
85
  "skmeans": "0.11.3",
87
86
  "three-stdlib": "2.21.1"
@@ -101,7 +100,6 @@
101
100
  "@types/lodash": "4.14.191",
102
101
  "@types/mixpanel-browser": "2.38.0",
103
102
  "@types/node": "18.11.3",
104
- "@types/proj4": "2.5.2",
105
103
  "@types/random-seed": "0.3.3",
106
104
  "@types/skmeans": "0.11.3",
107
105
  "@types/stats": "0.16.30",
@@ -143,7 +141,7 @@
143
141
  "shx": "0.3.4",
144
142
  "stats.js": "0.17.0",
145
143
  "three": "0.148.0",
146
- "ts-jest": "29.0.4",
144
+ "ts-jest": "29.0.5",
147
145
  "ts-loader": "9.4.2",
148
146
  "tsc-alias": "1.8.2",
149
147
  "typescript": "4.9.4",
@@ -1,31 +0,0 @@
1
- /*!
2
- * Copyright 2021 Cognite AS
3
- */
4
- import * as THREE from 'three';
5
- import { ParsedGeometry } from '../../../sector-parser';
6
- import { Materials } from '../../../rendering';
7
- export declare class GeometryBatchingManager {
8
- private readonly _batchedGeometriesGroup;
9
- private readonly _materials;
10
- private readonly _instancedTypeMap;
11
- private readonly _sectorMap;
12
- private static readonly TypedArrayViews;
13
- constructor(group: THREE.Group, materials: Materials);
14
- dispose(): void;
15
- batchGeometries(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
16
- removeSectorBatches(sectorId: number): void;
17
- private processGeometries;
18
- private updateInstanceAttributes;
19
- private extendUpdateRange;
20
- private reallocateBufferGeometry;
21
- private createSectorBatch;
22
- private createInstanceMeshGeometry;
23
- private getInstanceAttributesSharedView;
24
- private getTreeIndexAttribute;
25
- private removeTreeIndicesFromMeshUserData;
26
- private createDefragmentedBufferGeometry;
27
- private createInstanceMesh;
28
- private getAttributes;
29
- private copyGeometryWithBufferAttributes;
30
- private getShaderMaterial;
31
- }