@cognite/reveal 4.0.0 → 4.1.0-dev.20230127
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.
- package/README.md +4 -15
- package/dist/api-entry-points/core.d.ts +2 -2
- package/dist/index.js +161 -145
- package/dist/index.js.map +1 -1
- package/dist/packages/360-images/index.d.ts +2 -0
- package/dist/packages/360-images/src/DefaultImage360Collection.d.ts +44 -0
- package/dist/packages/360-images/src/Image360Collection.d.ts +17 -0
- package/dist/packages/360-images/src/types.d.ts +12 -0
- package/dist/packages/api/index.d.ts +0 -1
- package/dist/packages/api/src/api-helpers/Image360ApiHelper.d.ts +4 -2
- package/dist/packages/api/src/public/RevealManager.d.ts +6 -2
- package/dist/packages/api/src/public/RevealOptions.d.ts +2 -1
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +25 -8
- package/dist/packages/api/src/public/migration/types.d.ts +26 -0
- package/dist/packages/cad-geometry-loaders/src/CadManager.d.ts +2 -1
- package/dist/packages/cad-geometry-loaders/src/InternalRevealCadOptions.d.ts +1 -1
- package/dist/packages/cad-geometry-loaders/src/sector/culling/ByScreenSizeSectorCuller.d.ts +2 -2
- package/dist/packages/cad-geometry-loaders/src/sector/culling/WeightFunctionsHelper.d.ts +2 -2
- package/dist/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV9SectorMap.d.ts +2 -2
- package/dist/packages/cad-geometry-loaders/src/sector/culling/types.d.ts +1 -1
- package/dist/packages/cad-model/src/batching/DrawCallBatchingManager.d.ts +9 -0
- package/dist/packages/cad-model/src/batching/MultiBufferBatchingManager.d.ts +38 -0
- package/dist/packages/cad-model/src/utilities/GeometryBufferUtils.d.ts +18 -0
- package/dist/packages/cad-model/src/utilities/getShaderMaterial.d.ts +7 -0
- package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +6 -0
- package/dist/packages/cad-model/src/wrappers/CogniteCadModel.d.ts +17 -0
- package/dist/packages/cad-parsers/index.d.ts +1 -1
- package/dist/packages/cad-parsers/src/metadata/parsers/types.d.ts +1 -28
- package/dist/packages/cad-parsers/src/metadata/types.d.ts +1 -35
- package/dist/packages/cad-parsers/src/utilities/SectorScene.d.ts +11 -0
- package/dist/packages/camera-manager/src/ComboControls.d.ts +1 -1
- package/dist/packages/camera-manager/src/StationaryCameraManager.d.ts +5 -0
- package/dist/packages/camera-manager/src/types.d.ts +1 -1
- package/dist/packages/data-providers/index.d.ts +0 -1
- package/dist/packages/data-providers/src/pointcloud-stylable-object-providers/DummyPointCloudStylableObjectProvider.d.ts +1 -1
- package/dist/packages/data-providers/src/pointcloud-stylable-object-providers/types.d.ts +21 -1
- package/dist/packages/data-providers/src/utilities/applyDefaultModelTransformation.d.ts +0 -1
- package/dist/packages/logger/index.d.ts +3 -2
- package/dist/packages/pointclouds/src/CognitePointCloudModel.d.ts +17 -0
- package/dist/packages/pointclouds/src/PointCloudIntersection.d.ts +5 -0
- package/dist/packages/pointclouds/src/PointCloudNode.d.ts +5 -2
- package/dist/packages/pointclouds/src/PointCloudPickingHandler.d.ts +5 -0
- package/dist/packages/pointclouds/src/potree-three-loader/Potree.d.ts +2 -0
- package/dist/packages/pointclouds/src/potree-three-loader/geometry/PointCloudEptGeometry.d.ts +0 -1
- package/dist/packages/pointclouds/src/potree-three-loader/tree/PointCloudOctree.d.ts +11 -1
- package/dist/packages/rendering/index.d.ts +4 -1
- package/dist/packages/rendering/src/CadMaterialManager.d.ts +1 -0
- package/dist/packages/rendering/src/PointCloudMaterialManager.d.ts +1 -4
- package/dist/packages/rendering/src/ResizeHandler.d.ts +29 -0
- package/dist/packages/rendering/src/pipeline-executors/BasicPipelineExecutor.d.ts +1 -11
- package/dist/packages/rendering/src/pointcloud-rendering/PointCloudMaterial.d.ts +5 -5
- package/dist/packages/rendering/src/pointcloud-rendering/PointCloudObjectAppearanceTexture.d.ts +1 -3
- package/dist/packages/rendering/src/render-pipeline-providers/CadGeometryRenderModePipelineProvider.d.ts +2 -3
- package/dist/packages/rendering/src/render-pipeline-providers/DefaultRenderPipelineProvider.d.ts +5 -3
- package/dist/packages/rendering/src/rendering/SettableRenderTarget.d.ts +9 -0
- package/dist/packages/rendering/src/utilities/renderUtilities.d.ts +2 -4
- package/dist/packages/rendering/src/utilities/types.d.ts +7 -0
- package/dist/packages/tools/src/Measurement/MeasurementLine.d.ts +2 -2
- package/dist/packages/utilities/index.d.ts +1 -0
- package/dist/packages/{api/src/public → utilities/src}/constants.d.ts +1 -0
- package/package.json +37 -36
- package/dist/packages/cad-model/src/batching/GeometryBatchingManager.d.ts +0 -31
|
@@ -7,3 +7,5 @@ export { Image360Facade } from './src/Image360Facade';
|
|
|
7
7
|
export { Image360EntityFactory } from './src/Image360EntityFactory';
|
|
8
8
|
export { Image360Entity } from './src/Image360Entity';
|
|
9
9
|
export { Image360Visualization } from './src/Image360Visualization';
|
|
10
|
+
export { Image360EnteredDelegate, Image360ExitedDelegate } from './src/types';
|
|
11
|
+
export { DefaultImage360Collection } from './src/DefaultImage360Collection';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { EventTrigger } from '../../utilities';
|
|
5
|
+
import { Image360 } from './Image360';
|
|
6
|
+
import { Image360Collection } from './Image360Collection';
|
|
7
|
+
import { Image360Entity } from './Image360Entity';
|
|
8
|
+
import { Image360EnteredDelegate, Image360ExitedDelegate } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Default implementation of {@link Image360Collection}. Used for events when entering
|
|
11
|
+
* and exiting 360 image mode
|
|
12
|
+
*/
|
|
13
|
+
export declare class DefaultImage360Collection implements Image360Collection {
|
|
14
|
+
/**
|
|
15
|
+
* A list containing all the 360 images in this set.
|
|
16
|
+
*/
|
|
17
|
+
readonly image360Entities: Image360Entity[];
|
|
18
|
+
private readonly _events;
|
|
19
|
+
/**
|
|
20
|
+
* The events from the image collection.
|
|
21
|
+
*/
|
|
22
|
+
get events(): {
|
|
23
|
+
image360Entered: EventTrigger<Image360EnteredDelegate>;
|
|
24
|
+
image360Exited: EventTrigger<Image360ExitedDelegate>;
|
|
25
|
+
};
|
|
26
|
+
constructor(entities: Image360[]);
|
|
27
|
+
/**
|
|
28
|
+
* Subscribes to events on 360 Image datasets. There are several event types:
|
|
29
|
+
* 'image360Entered' - Subscribes to a event for entering 360 image mode.
|
|
30
|
+
* 'image360Exited' - Subscribes to events indicating 360 image mode has exited.
|
|
31
|
+
* @param event The event type.
|
|
32
|
+
* @param callback Callback to be called when the event is fired.
|
|
33
|
+
*/
|
|
34
|
+
on(event: 'image360Entered', callback: Image360EnteredDelegate): void;
|
|
35
|
+
on(event: 'image360Exited', callback: Image360ExitedDelegate): void;
|
|
36
|
+
/**
|
|
37
|
+
* Unsubscribes from 360 image dataset event.
|
|
38
|
+
* @param event The event type.
|
|
39
|
+
* @param callback Callback function to be unsubscribed.
|
|
40
|
+
*/
|
|
41
|
+
off(event: 'image360Entered', callback: Image360EnteredDelegate): void;
|
|
42
|
+
off(event: 'image360Exited', callback: Image360ExitedDelegate): void;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import { Image360 } from './Image360';
|
|
5
|
+
import { Image360EnteredDelegate, Image360ExitedDelegate } from './types';
|
|
5
6
|
/**
|
|
6
7
|
* A wrapper that represents a set of 360 images.
|
|
7
8
|
*/
|
|
@@ -10,4 +11,20 @@ export interface Image360Collection {
|
|
|
10
11
|
* A list containing all the 360 images in this set.
|
|
11
12
|
*/
|
|
12
13
|
readonly image360Entities: Image360[];
|
|
14
|
+
/**
|
|
15
|
+
* Subscribes to events on 360 Image datasets. There are several event types:
|
|
16
|
+
* 'image360Entered' - Subscribes to a event for entering 360 image mode.
|
|
17
|
+
* 'image360Exited' - Subscribes to events indicating 360 image mode has exited.
|
|
18
|
+
* @param event The event type.
|
|
19
|
+
* @param callback Callback to be called when the event is fired.
|
|
20
|
+
*/
|
|
21
|
+
on(event: 'image360Entered', callback: Image360EnteredDelegate): void;
|
|
22
|
+
on(event: 'image360Exited', callback: Image360ExitedDelegate): void;
|
|
23
|
+
/**
|
|
24
|
+
* Unsubscribes from 360 image dataset event.
|
|
25
|
+
* @param event The event type.
|
|
26
|
+
* @param callback Callback function to be unsubscribed.
|
|
27
|
+
*/
|
|
28
|
+
off(event: 'image360Entered', callback: Image360EnteredDelegate): void;
|
|
29
|
+
off(event: 'image360Exited', callback: Image360ExitedDelegate): void;
|
|
13
30
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Image360 } from './Image360';
|
|
5
|
+
/**
|
|
6
|
+
* Delegate for 360 image mode entered events.
|
|
7
|
+
*/
|
|
8
|
+
export type Image360EnteredDelegate = (image360: Image360) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Delegate for 360 image mode exited events.
|
|
11
|
+
*/
|
|
12
|
+
export type Image360ExitedDelegate = () => void;
|
|
@@ -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 };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { CogniteClient } from '@cognite/sdk';
|
|
6
|
-
import { Image360Entity } from '../../../360-images';
|
|
6
|
+
import { Image360Collection, Image360Entity } from '../../../360-images';
|
|
7
7
|
import { InputHandler, SceneHandler } from '../../../utilities';
|
|
8
8
|
import { ProxyCameraManager } from '../../../camera-manager';
|
|
9
9
|
import { Image360 } from '../../../360-images/src/Image360';
|
|
@@ -17,14 +17,16 @@ export declare class Image360ApiHelper {
|
|
|
17
17
|
private readonly _activeCameraManager;
|
|
18
18
|
private readonly _image360Navigation;
|
|
19
19
|
private _cachedCameraManager;
|
|
20
|
+
private readonly _imageCollection;
|
|
20
21
|
constructor(cogniteClient: CogniteClient, sceneHandler: SceneHandler, domElement: HTMLElement, activeCameraManager: ProxyCameraManager, inputHandler: InputHandler, requestRedraw: () => void);
|
|
21
22
|
add360ImageSet(eventFilter: {
|
|
22
23
|
[key: string]: string;
|
|
23
|
-
}, collectionTransform: THREE.Matrix4, preMultipliedRotation: boolean): Promise<
|
|
24
|
+
}, collectionTransform: THREE.Matrix4, preMultipliedRotation: boolean): Promise<Image360Collection>;
|
|
24
25
|
remove360Images(entities: Image360[]): Promise<void>;
|
|
25
26
|
enter360Image(image360Entity: Image360Entity): Promise<void>;
|
|
26
27
|
private transition;
|
|
27
28
|
private tweenVisualizationAlpha;
|
|
29
|
+
private tweenVisualizationZoom;
|
|
28
30
|
private set360CameraManager;
|
|
29
31
|
exit360Image(): void;
|
|
30
32
|
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 } 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 = {
|
|
@@ -24,6 +24,7 @@ export declare class RevealManager {
|
|
|
24
24
|
private readonly _pointCloudManager;
|
|
25
25
|
private readonly _pipelineExecutor;
|
|
26
26
|
private readonly _renderPipeline;
|
|
27
|
+
private readonly _resizeHandler;
|
|
27
28
|
private _cameraInMotion;
|
|
28
29
|
private _isDisposed;
|
|
29
30
|
private readonly _subscriptions;
|
|
@@ -32,10 +33,11 @@ export declare class RevealManager {
|
|
|
32
33
|
private readonly _cameraManager;
|
|
33
34
|
private readonly _onCameraChange;
|
|
34
35
|
private readonly _onCameraStop;
|
|
35
|
-
constructor(cadManager: CadManager, pointCloudManager: PointCloudManager, pipelineExecutor: RenderPipelineExecutor, renderPipeline: RenderPipelineProvider, cameraManager: CameraManager);
|
|
36
|
+
constructor(cadManager: CadManager, pointCloudManager: PointCloudManager, pipelineExecutor: RenderPipelineExecutor, renderPipeline: RenderPipelineProvider & SettableRenderTarget, resizeHandler: ResizeHandler, cameraManager: CameraManager);
|
|
36
37
|
dispose(): void;
|
|
37
38
|
requestRedraw(): void;
|
|
38
39
|
resetRedraw(): void;
|
|
40
|
+
setOutputRenderTarget(target: THREE.WebGLRenderTarget | null, autoSizeRenderTarget?: boolean): void;
|
|
39
41
|
get materialManager(): CadMaterialManager;
|
|
40
42
|
get needsRedraw(): boolean;
|
|
41
43
|
update(camera: THREE.PerspectiveCamera): void;
|
|
@@ -50,6 +52,8 @@ export declare class RevealManager {
|
|
|
50
52
|
get clippingPlanes(): THREE.Plane[];
|
|
51
53
|
on(event: 'loadingStateChanged', listener: LoadingStateChangeListener): void;
|
|
52
54
|
off(event: 'loadingStateChanged', listener: LoadingStateChangeListener): void;
|
|
55
|
+
setResolutionThreshold(threshold: number): void;
|
|
56
|
+
setMovingCameraResolutionFactor(factor: number): void;
|
|
53
57
|
render(camera: THREE.PerspectiveCamera): void;
|
|
54
58
|
addModel(type: 'cad', modelIdentifier: ModelIdentifier, options?: AddCadModelOptions): Promise<CadNode>;
|
|
55
59
|
addModel(type: 'pointcloud', modelIdentifier: ModelIdentifier): Promise<PointCloudNode>;
|
|
@@ -6,7 +6,8 @@ import { RenderOptions } from '../../../rendering';
|
|
|
6
6
|
import { InternalRevealCadOptions } from '../../../cad-geometry-loaders';
|
|
7
7
|
/**
|
|
8
8
|
* @property logMetrics Might be used to disable usage statistics.
|
|
9
|
-
* @property
|
|
9
|
+
* @property movingCameraResolutionFactor Factor with which the resolution (number of screen pixels) is scaled
|
|
10
|
+
* when camera is moving.
|
|
10
11
|
* @property internal Internals are for internal usage only (like unit-testing).
|
|
11
12
|
*/
|
|
12
13
|
export type RevealOptions = {
|
|
@@ -5,7 +5,7 @@ import * as THREE from 'three';
|
|
|
5
5
|
import { PointerEventDelegate, SceneRenderedDelegate, DisposedDelegate, BeforeSceneRenderedDelegate } from '../../../../utilities';
|
|
6
6
|
import { CogniteCadModel } from '../../../../cad-model';
|
|
7
7
|
import { PointCloudBudget, CognitePointCloudModel } from '../../../../pointclouds';
|
|
8
|
-
import { AddImage360Options, AddModelOptions, Cognite3DViewerOptions, Intersection, CadModelBudget } from './types';
|
|
8
|
+
import { AddImage360Options, AddModelOptions, Cognite3DViewerOptions, Intersection, CadModelBudget, ResolutionOptions } from './types';
|
|
9
9
|
import { CogniteModel } from '../types';
|
|
10
10
|
import { ViewerState } from '../../utilities/ViewStateHelper';
|
|
11
11
|
import { CameraManager, CameraChangeDelegate } from '../../../../camera-manager';
|
|
@@ -48,13 +48,13 @@ export declare class Cognite3DViewer {
|
|
|
48
48
|
private readonly _revealManagerHelper;
|
|
49
49
|
private readonly _domElement;
|
|
50
50
|
private readonly _renderer;
|
|
51
|
+
private readonly _ownsRenderer;
|
|
51
52
|
private readonly _pickingHandler;
|
|
52
53
|
private readonly _pointCloudPickingHandler;
|
|
53
54
|
private readonly _boundAnimate;
|
|
54
55
|
private readonly _events;
|
|
55
56
|
private readonly _mouseHandler;
|
|
56
57
|
private readonly _models;
|
|
57
|
-
private readonly _extraObjects;
|
|
58
58
|
private isDisposed;
|
|
59
59
|
private latestRequestId;
|
|
60
60
|
private readonly clock;
|
|
@@ -90,6 +90,12 @@ export declare class Cognite3DViewer {
|
|
|
90
90
|
*/
|
|
91
91
|
get models(): CogniteModel[];
|
|
92
92
|
constructor(options: Cognite3DViewerOptions);
|
|
93
|
+
/**
|
|
94
|
+
* Set options to control resolution of the viewer. This includes
|
|
95
|
+
* settings for max resolution and limiting resolution when moving the camera.
|
|
96
|
+
* @param options Options to apply.
|
|
97
|
+
*/
|
|
98
|
+
setResolutionOptions(options: ResolutionOptions): void;
|
|
93
99
|
/**
|
|
94
100
|
* Returns reveal version installed.
|
|
95
101
|
*/
|
|
@@ -342,34 +348,45 @@ export declare class Cognite3DViewer {
|
|
|
342
348
|
* ```js
|
|
343
349
|
* // Hide pixels with values less than 0 in the x direction
|
|
344
350
|
* const plane = new THREE.Plane(new THREE.Vector3(1, 0, 0), 0);
|
|
345
|
-
* viewer.
|
|
351
|
+
* viewer.setGlobalClippingPlanes([plane]);
|
|
346
352
|
* ```
|
|
347
353
|
* ```js
|
|
348
354
|
* // Hide pixels with values greater than 20 in the x direction
|
|
349
355
|
* const plane = new THREE.Plane(new THREE.Vector3(-1, 0, 0), 20);
|
|
350
|
-
* viewer.
|
|
356
|
+
* viewer.setGlobalClippingPlanes([plane]);
|
|
351
357
|
* ```
|
|
352
358
|
* ```js
|
|
353
359
|
* // Hide pixels with values less than 0 in the x direction or greater than 0 in the y direction
|
|
354
360
|
* const xPlane = new THREE.Plane(new THREE.Vector3(1, 0, 0), 0);
|
|
355
361
|
* const yPlane = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0);
|
|
356
|
-
* viewer.
|
|
362
|
+
* viewer.setGlobalClippingPlanes([xPlane, yPlane]);
|
|
357
363
|
* ```
|
|
358
364
|
* ```js
|
|
359
365
|
* // Hide pixels behind an arbitrary, non axis-aligned plane
|
|
360
366
|
* const plane = new THREE.Plane(new THREE.Vector3(1.5, 20, -19), 20);
|
|
361
|
-
* viewer.
|
|
367
|
+
* viewer.setGlobalClippingPlanes([plane]);
|
|
362
368
|
* ```
|
|
363
369
|
* ```js
|
|
364
370
|
* // Disable clipping planes
|
|
365
|
-
* viewer.
|
|
371
|
+
* viewer.setGlobalClippingPlanes([]);
|
|
366
372
|
* ```
|
|
367
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
|
+
*/
|
|
368
380
|
setClippingPlanes(clippingPlanes: THREE.Plane[]): void;
|
|
369
381
|
/**
|
|
370
|
-
* Returns the current active clipping planes.
|
|
382
|
+
* Returns the current active global clipping planes.
|
|
383
|
+
* @deprecated Use {@link Cognite3DViewer.getGlobalClippingPlanes} instead.
|
|
371
384
|
*/
|
|
372
385
|
getClippingPlanes(): THREE.Plane[];
|
|
386
|
+
/**
|
|
387
|
+
* Returns the current active global clipping planes.
|
|
388
|
+
*/
|
|
389
|
+
getGlobalClippingPlanes(): THREE.Plane[];
|
|
373
390
|
/**
|
|
374
391
|
* Attempts to load the camera settings from the settings stored for the
|
|
375
392
|
* provided model. See {@link https://docs.cognite.com/api/v1/#operation/get3DRevision}
|
|
@@ -69,6 +69,8 @@ export interface Cognite3DViewerOptions {
|
|
|
69
69
|
* To ensure managable performance, Reveal will by default set an upper threshold to limit
|
|
70
70
|
* the resolution. Setting the {@link Cognite3DViewerOptions.rendererResolutionThreshold} will
|
|
71
71
|
* set this upper limit of what resolution Reveal will allow.
|
|
72
|
+
*
|
|
73
|
+
* @deprecated Use {@link Cognite3DViewer.setResolutionOptions} instead.
|
|
72
74
|
*/
|
|
73
75
|
rendererResolutionThreshold?: number;
|
|
74
76
|
/**
|
|
@@ -175,6 +177,30 @@ export type CadIntersection = {
|
|
|
175
177
|
*/
|
|
176
178
|
distanceToCamera: number;
|
|
177
179
|
};
|
|
180
|
+
/**
|
|
181
|
+
* Options to control resolution of the viewer. This includes
|
|
182
|
+
* settings for max resolution and limiting resolution when moving the camera.
|
|
183
|
+
*
|
|
184
|
+
* @module @cognite/reveal
|
|
185
|
+
*/
|
|
186
|
+
export type ResolutionOptions = {
|
|
187
|
+
/**
|
|
188
|
+
* Generally Reveal will follow the resolution given by the size
|
|
189
|
+
* of the encapsulating DOM element of the Canvas {@link Cognite3DViewerOptions.domElement}.
|
|
190
|
+
* To ensure managable performance, Reveal will by default set an upper threshold to limit
|
|
191
|
+
* the resolution. The `maxRenderResolution` option will
|
|
192
|
+
* directly control this upper limit. It corresponds to the number of pixels in the render target.
|
|
193
|
+
*/
|
|
194
|
+
maxRenderResolution?: number;
|
|
195
|
+
/**
|
|
196
|
+
* A factor that will scale down the resolution when moving the camera. This can
|
|
197
|
+
* be used to achieve a better user experience on devices with limited hardware.
|
|
198
|
+
* Values must be greater than 0 and at most 1.
|
|
199
|
+
* This factor is applied to the number of physical pixels of the canvas.
|
|
200
|
+
* A value of e.g. 0.25 will approximately divide the number of pixels rendered on the screen by four.
|
|
201
|
+
*/
|
|
202
|
+
movingCameraResolutionFactor?: number;
|
|
203
|
+
};
|
|
178
204
|
/**
|
|
179
205
|
* Represents the result from {@link Cognite3DViewer.getIntersectionFromPixel}.
|
|
180
206
|
* @module @cognite/reveal
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { CadModelMetadata } from '../../cad-parsers';
|
|
7
|
-
import { CadModelUpdateHandler
|
|
7
|
+
import { CadModelUpdateHandler } from './CadModelUpdateHandler';
|
|
8
8
|
import { LoadingState } from '../../model-base';
|
|
9
9
|
import { CadMaterialManager, RenderMode } from '../../rendering';
|
|
10
10
|
import { ModelIdentifier } from '../../data-providers';
|
|
11
|
+
import { CadModelBudget } from './CadModelBudget';
|
|
11
12
|
import { CadModelFactory, CadModelSectorLoadStatistics, CadNode, GeometryFilter } from '../../cad-model';
|
|
12
13
|
export declare class CadManager {
|
|
13
14
|
private readonly _materialManager;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { DetermineSectorCostDelegate, DetermineSectorsInput, SectorLoadingSpent } from './types';
|
|
5
5
|
import { SectorCuller } from './SectorCuller';
|
|
6
|
-
import {
|
|
6
|
+
import { SectorMetadata, WantedSector } from '../../../../cad-parsers';
|
|
7
7
|
export type ByScreenSizeSectorCullerOptions = {
|
|
8
8
|
/**
|
|
9
9
|
* Optional callback for determining the cost of a sector. The default unit of the cost
|
|
10
10
|
* function is bytes downloaded.
|
|
11
11
|
*/
|
|
12
|
-
determineSectorCost?: DetermineSectorCostDelegate<
|
|
12
|
+
determineSectorCost?: DetermineSectorCostDelegate<SectorMetadata>;
|
|
13
13
|
};
|
|
14
14
|
export declare class ByScreenSizeSectorCuller implements SectorCuller {
|
|
15
15
|
private readonly _determineSectorCost;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { SectorMetadata
|
|
5
|
+
import { SectorMetadata } from '../../../../cad-parsers';
|
|
6
6
|
import { PrioritizedArea } from '../../../../cad-styling';
|
|
7
7
|
export declare class WeightFunctionsHelper {
|
|
8
8
|
private readonly _camera;
|
|
@@ -35,7 +35,7 @@ export declare class WeightFunctionsHelper {
|
|
|
35
35
|
* sectors right below root sector.
|
|
36
36
|
* @param sector
|
|
37
37
|
*/
|
|
38
|
-
computeSectorTreePlacementWeight(sector:
|
|
38
|
+
computeSectorTreePlacementWeight(sector: SectorMetadata): number;
|
|
39
39
|
/**
|
|
40
40
|
* Computes a weight based on how large the biggest node within the sector
|
|
41
41
|
* will be on screen (a number in range [0-1]).
|
package/dist/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV9SectorMap.d.ts
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
import { DetermineSectorCostDelegate, PrioritizedWantedSector, SectorCost } from '../types';
|
|
5
5
|
import { CadModelBudget } from '../../../CadModelBudget';
|
|
6
6
|
import { TakenSectorMapBase } from './TakenSectorMapBase';
|
|
7
|
-
import { CadModelMetadata,
|
|
7
|
+
import { CadModelMetadata, SectorMetadata } from '../../../../../cad-parsers';
|
|
8
8
|
export declare class TakenV9SectorMap extends TakenSectorMapBase {
|
|
9
9
|
private readonly determineSectorCost;
|
|
10
10
|
private readonly _totalCost;
|
|
11
11
|
private readonly _models;
|
|
12
12
|
get totalCost(): SectorCost;
|
|
13
13
|
get modelsMetadata(): CadModelMetadata[];
|
|
14
|
-
constructor(determineSectorCost: DetermineSectorCostDelegate<
|
|
14
|
+
constructor(determineSectorCost: DetermineSectorCostDelegate<SectorMetadata>);
|
|
15
15
|
initializeScene(modelMetadata: CadModelMetadata): void;
|
|
16
16
|
markSectorDetailed(model: CadModelMetadata, sectorId: number, priority: number): void;
|
|
17
17
|
isWithinBudget(budget: CadModelBudget): boolean;
|
|
@@ -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
|
-
|
|
12
|
+
modelClippingPlanes: THREE.Plane[][];
|
|
13
13
|
cadModelsMetadata: CadModelMetadata[];
|
|
14
14
|
loadingHints: CadLoadingHints;
|
|
15
15
|
cameraInMotion: boolean;
|
|
@@ -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,38 @@
|
|
|
1
|
+
import { Group } from 'three';
|
|
2
|
+
import { Materials, StyledTreeIndexSets } 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
|
+
private readonly _styledTreeIndexSets;
|
|
20
|
+
constructor(batchGroup: Group, materials: Materials, styleTreeIndexSets: StyledTreeIndexSets, initialBufferSize?: number, numberOfInstanceBatches?: number);
|
|
21
|
+
batchGeometries(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
|
|
22
|
+
removeSectorBatches(sectorId: number): void;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
private removeTreeIndicesFromMeshUserData;
|
|
25
|
+
private processGeometries;
|
|
26
|
+
private batchInstanceAttributes;
|
|
27
|
+
private addTreeIndicesToMeshUserData;
|
|
28
|
+
private reallocateBufferGeometry;
|
|
29
|
+
private updateInstanceAttributes;
|
|
30
|
+
private extendUpdateRange;
|
|
31
|
+
private getBatchBufferToFill;
|
|
32
|
+
private getOrCreateInstanceBatch;
|
|
33
|
+
private createBatchBuffer;
|
|
34
|
+
private createInstanceMesh;
|
|
35
|
+
private createDefragmentedBufferGeometry;
|
|
36
|
+
private getTreeIndexAttribute;
|
|
37
|
+
private createSectorBatch;
|
|
38
|
+
}
|
|
@@ -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;
|
|
@@ -16,7 +16,12 @@ export declare class CadNode extends Object3D {
|
|
|
16
16
|
private _geometryBatchingManager?;
|
|
17
17
|
private readonly _sourceTransform;
|
|
18
18
|
private readonly _customTransform;
|
|
19
|
+
private readonly _setModelRenderLayers;
|
|
20
|
+
private readonly _batchedGeometryMeshGroup;
|
|
21
|
+
private readonly _styledTreeIndexSets;
|
|
22
|
+
private _needsRedraw;
|
|
19
23
|
constructor(model: CadModelMetadata, materialManager: CadMaterialManager, sectorRepository: SectorRepository);
|
|
24
|
+
get needsRedraw(): boolean;
|
|
20
25
|
get nodeTransformProvider(): NodeTransformProvider;
|
|
21
26
|
get nodeAppearanceProvider(): NodeAppearanceProvider;
|
|
22
27
|
get defaultNodeAppearance(): NodeAppearance;
|
|
@@ -42,6 +47,7 @@ export declare class CadNode extends Object3D {
|
|
|
42
47
|
*/
|
|
43
48
|
getModelTransformation(out?: Matrix4): Matrix4;
|
|
44
49
|
getCdfToDefaultModelTransformation(out?: Matrix4): Matrix4;
|
|
50
|
+
setModelRenderLayers(root?: Object3D): void;
|
|
45
51
|
get prioritizedAreas(): PrioritizedArea[];
|
|
46
52
|
batchGeometry(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
|
|
47
53
|
removeBatchedSectorGeometries(sectorId: number): void;
|
|
@@ -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.
|
|
@@ -202,6 +207,18 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
|
|
|
202
207
|
* @param out Preallocated `THREE.Matrix4` (optional)
|
|
203
208
|
*/
|
|
204
209
|
getCdfToDefaultModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
|
|
210
|
+
/**
|
|
211
|
+
* Map point from CDF to model space, taking the model's custom transformation into account
|
|
212
|
+
* @param point Point to compute transformation from
|
|
213
|
+
* @param out Optional pre-allocated point
|
|
214
|
+
*/
|
|
215
|
+
mapPointFromCdfToModelCoordinates(point: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
|
|
216
|
+
/**
|
|
217
|
+
* Map bounding box from CDF to model space, taking the model's custom transformation into account
|
|
218
|
+
* @param box Box to compute transformation from
|
|
219
|
+
* @param out Optional pre-allocated box
|
|
220
|
+
*/
|
|
221
|
+
mapBoxFromCdfToModelCoordinates(box: THREE.Box3, out?: THREE.Box3): THREE.Box3;
|
|
205
222
|
/**
|
|
206
223
|
* Fetches a bounding box from the CDF by the nodeId.
|
|
207
224
|
* @param nodeId
|
|
@@ -6,7 +6,7 @@ export { CadModelMetadata } from './src/metadata/CadModelMetadata';
|
|
|
6
6
|
export { SectorSceneFactory } from './src/utilities/SectorSceneFactory';
|
|
7
7
|
export { CadModelClipper } from './src/metadata/CadModelClipper';
|
|
8
8
|
export { SectorScene } from './src/utilities/types';
|
|
9
|
-
export { SectorMetadata
|
|
9
|
+
export { SectorMetadata } from './src/metadata/types';
|
|
10
10
|
export { SectorNode } from './src/sector/SectorNode';
|
|
11
11
|
export { RootSectorNode } from './src/sector/RootSectorNode';
|
|
12
12
|
export { LevelOfDetail } from './src/cad/LevelOfDetail';
|
|
@@ -7,9 +7,6 @@ export type CadSceneRootMetadata = {
|
|
|
7
7
|
readonly sectors: SceneSectorMetadata[];
|
|
8
8
|
readonly unit: string | null;
|
|
9
9
|
};
|
|
10
|
-
export type SceneSectorMetadata = BaseSceneSectorMetadata & (GltfSceneSectorMetadata | I3dF3dSceneSectorMetadata);
|
|
11
|
-
export type V8SceneSectorMetadata = BaseSceneSectorMetadata & I3dF3dSceneSectorMetadata;
|
|
12
|
-
export type V9SceneSectorMetadata = BaseSceneSectorMetadata & GltfSceneSectorMetadata;
|
|
13
10
|
export type BoundingBox = {
|
|
14
11
|
readonly min: {
|
|
15
12
|
x: number;
|
|
@@ -22,7 +19,7 @@ export type BoundingBox = {
|
|
|
22
19
|
z: number;
|
|
23
20
|
};
|
|
24
21
|
};
|
|
25
|
-
export type
|
|
22
|
+
export type SceneSectorMetadata = {
|
|
26
23
|
readonly id: number;
|
|
27
24
|
readonly parentId: number | null;
|
|
28
25
|
readonly path: string;
|
|
@@ -31,32 +28,8 @@ export type BaseSceneSectorMetadata = {
|
|
|
31
28
|
readonly estimatedTriangleCount: number;
|
|
32
29
|
readonly boundingBox: BoundingBox;
|
|
33
30
|
readonly geometryBoundingBox?: BoundingBox;
|
|
34
|
-
};
|
|
35
|
-
export type GltfSceneSectorMetadata = {
|
|
36
31
|
readonly sectorFileName: string | null;
|
|
37
32
|
readonly maxDiagonalLength: number;
|
|
38
33
|
readonly minDiagonalLength: number;
|
|
39
34
|
readonly downloadSize: number;
|
|
40
35
|
};
|
|
41
|
-
export type I3dF3dSceneSectorMetadata = {
|
|
42
|
-
readonly indexFile: {
|
|
43
|
-
readonly fileName: string;
|
|
44
|
-
readonly peripheralFiles: string[];
|
|
45
|
-
readonly downloadSize: number;
|
|
46
|
-
};
|
|
47
|
-
readonly facesFile: {
|
|
48
|
-
readonly quadSize: number;
|
|
49
|
-
readonly coverageFactors: {
|
|
50
|
-
xy: number;
|
|
51
|
-
yz: number;
|
|
52
|
-
xz: number;
|
|
53
|
-
};
|
|
54
|
-
readonly recursiveCoverageFactors: {
|
|
55
|
-
xy: number;
|
|
56
|
-
yz: number;
|
|
57
|
-
xz: number;
|
|
58
|
-
} | undefined;
|
|
59
|
-
readonly fileName: string | null;
|
|
60
|
-
readonly downloadSize: number;
|
|
61
|
-
} | null;
|
|
62
|
-
};
|
|
@@ -2,33 +2,7 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
export
|
|
6
|
-
readonly fileName: string;
|
|
7
|
-
readonly peripheralFiles: string[];
|
|
8
|
-
readonly downloadSize: number;
|
|
9
|
-
}
|
|
10
|
-
export interface SectorMetadataFacesFileSection {
|
|
11
|
-
readonly quadSize: number;
|
|
12
|
-
/**
|
|
13
|
-
* Coverage factors for the sector without children.
|
|
14
|
-
*/
|
|
15
|
-
readonly coverageFactors: {
|
|
16
|
-
xy: number;
|
|
17
|
-
yz: number;
|
|
18
|
-
xz: number;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Coverage factor for the sectors including children.
|
|
22
|
-
*/
|
|
23
|
-
readonly recursiveCoverageFactors: {
|
|
24
|
-
xy: number;
|
|
25
|
-
yz: number;
|
|
26
|
-
xz: number;
|
|
27
|
-
};
|
|
28
|
-
readonly fileName: string | null;
|
|
29
|
-
readonly downloadSize: number;
|
|
30
|
-
}
|
|
31
|
-
export type BaseSectorMetadata = {
|
|
5
|
+
export type SectorMetadata = {
|
|
32
6
|
readonly id: number;
|
|
33
7
|
readonly path: string;
|
|
34
8
|
readonly depth: number;
|
|
@@ -36,14 +10,6 @@ export type BaseSectorMetadata = {
|
|
|
36
10
|
readonly children: SectorMetadata[];
|
|
37
11
|
readonly estimatedDrawCallCount: number;
|
|
38
12
|
readonly estimatedRenderCost: number;
|
|
39
|
-
};
|
|
40
|
-
export type SectorMetadata = BaseSectorMetadata & (I3dF3dSectorMetadata | GltfSectorMetadata);
|
|
41
|
-
export type V9SectorMetadata = BaseSectorMetadata & GltfSectorMetadata;
|
|
42
|
-
export type I3dF3dSectorMetadata = {
|
|
43
|
-
readonly indexFile: SectorMetadataIndexFileSection;
|
|
44
|
-
readonly facesFile: SectorMetadataFacesFileSection;
|
|
45
|
-
};
|
|
46
|
-
export type GltfSectorMetadata = {
|
|
47
13
|
readonly sectorFileName: string | null;
|
|
48
14
|
readonly maxDiagonalLength: number;
|
|
49
15
|
readonly minDiagonalLength: number;
|