@cognite/reveal 4.31.2 → 4.32.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.
@@ -34,6 +34,7 @@ export declare class HtmlClusterRenderer {
34
34
  setHoveredCluster(icon: Overlay3DIcon | undefined): void;
35
35
  getHoveredCluster(): Overlay3DIcon | undefined;
36
36
  setVisible(visible: boolean): void;
37
+ private clearAllElements;
37
38
  dispose(): void;
38
39
  private createContainer;
39
40
  private injectStyles;
@@ -10,11 +10,12 @@ import { CadManager, CadModelBudget } from '../../../cad-geometry-loaders';
10
10
  import { NodeAppearanceProvider } from '../../../cad-styling';
11
11
  import { RenderMode, RenderPipelineExecutor, CadMaterialManager, RenderPipelineProvider, ResizeHandler, SettableRenderTarget } from '../../../rendering';
12
12
  import { CameraManager } from '../../../camera-manager';
13
- import { DataSourceType, InternalDataSourceType } from '../../../data-providers';
13
+ import { DataSourceType, File3dFormat, InternalDataSourceType } from '../../../data-providers';
14
14
  import { AddModelOptionsWithModelRevisionId } from '../../../data-providers/src/utilities/internalAddModelOptions';
15
15
  export type AddCadModelOptions = {
16
16
  nodeAppearanceProvider?: NodeAppearanceProvider;
17
17
  geometryFilter?: GeometryFilter;
18
+ outputFormat?: File3dFormat;
18
19
  };
19
20
  /**
20
21
  * Handler for events about data being loaded.
@@ -6,7 +6,7 @@ import { CadModelMetadata } from '../../cad-parsers';
6
6
  import { CadModelUpdateHandler } from './CadModelUpdateHandler';
7
7
  import { LoadingState } from '../../model-base';
8
8
  import { CadMaterialManager, RenderMode } from '../../rendering';
9
- import { ModelIdentifier } from '../../data-providers';
9
+ import { File3dFormat, ModelIdentifier } from '../../data-providers';
10
10
  import { CadModelBudget } from './CadModelBudget';
11
11
  import { CadModelFactory, CadModelSectorLoadStatistics, CadNode, GeometryFilter } from '../../cad-model';
12
12
  export declare class CadManager {
@@ -21,6 +21,7 @@ export declare class CadManager {
21
21
  private readonly _loadingStateChangedTrigger;
22
22
  private readonly _markNeedsRedrawBound;
23
23
  private readonly _sectorBufferTime;
24
+ private readonly _compatibleGltfFormats;
24
25
  get materialManager(): CadMaterialManager;
25
26
  get budget(): CadModelBudget;
26
27
  set budget(budget: CadModelBudget);
@@ -40,7 +41,7 @@ export declare class CadManager {
40
41
  set renderMode(renderMode: RenderMode);
41
42
  doesModelHaveCompatibleFormat(modelMetadata: CadModelMetadata): boolean;
42
43
  updateModelCompatibilityFormat(modelMetadata: CadModelMetadata): void;
43
- addModel(modelIdentifier: ModelIdentifier, geometryFilter?: GeometryFilter): Promise<CadNode>;
44
+ addModel(modelIdentifier: ModelIdentifier, geometryFilter?: GeometryFilter, outputFormat?: File3dFormat): Promise<CadNode>;
44
45
  removeModel(model: CadNode): void;
45
46
  on(event: 'loadingStateChanged', listener: (loadingState: LoadingState) => void): void;
46
47
  off(event: 'loadingStateChanged', listener: (loadingState: LoadingState) => void): void;
@@ -14,6 +14,11 @@ export declare class TakenV9SectorMap extends TakenSectorMapBase {
14
14
  constructor(determineSectorCost: DetermineSectorCostDelegate<SectorMetadata>);
15
15
  initializeScene(modelMetadata: CadModelMetadata): void;
16
16
  markSectorDetailed(model: CadModelMetadata, sectorId: number, priority: number): void;
17
+ /**
18
+ * Marks a sector as forced-detailed with infinite priority.
19
+ * These sectors are always loaded regardless of budget constraints.
20
+ */
21
+ markSectorForced(model: CadModelMetadata, sectorId: number): void;
17
22
  isWithinBudget(budget: CadModelBudget): boolean;
18
23
  collectWantedSectors(): PrioritizedWantedSector[];
19
24
  clear(): void;
@@ -15,6 +15,16 @@ export interface DetermineSectorsInput {
15
15
  cameraInMotion: boolean;
16
16
  budget: CadModelBudget;
17
17
  prioritizedAreas: PrioritizedArea[];
18
+ /**
19
+ * Models whose sectors must always be loaded regardless of budget.
20
+ * Identified by their `revealInternalId` symbol.
21
+ */
22
+ lockedModelIdentifiers: Set<symbol>;
23
+ /**
24
+ * Per-model set of specific sector IDs that must always be loaded
25
+ * regardless of budget. Keyed by model `revealInternalId`.
26
+ */
27
+ lockedSectorIdsByModel: Map<symbol, ReadonlySet<number>>;
18
28
  }
19
29
  export type DetermineSectorsPayload = {
20
30
  camera: THREE.PerspectiveCamera;
@@ -24,6 +34,8 @@ export type DetermineSectorsPayload = {
24
34
  cameraInMotion: boolean;
25
35
  budget: CadModelBudget;
26
36
  prioritizedAreas: PrioritizedArea[];
37
+ lockedModelIdentifiers: Set<symbol>;
38
+ lockedSectorIdsByModel: Map<symbol, ReadonlySet<number>>;
27
39
  };
28
40
  /**
29
41
  * Statistics for how much data is required to load set of sectors.
@@ -1,7 +1,7 @@
1
1
  import { GeometryFilter } from './types';
2
2
  import { CadMaterialManager } from '../../rendering';
3
3
  import { CadModelMetadata } from '../../cad-parsers';
4
- import { ModelDataProvider, ModelMetadataProvider, ModelIdentifier } from '../../data-providers';
4
+ import { ModelDataProvider, ModelMetadataProvider, ModelIdentifier, File3dFormat } from '../../data-providers';
5
5
  import { CadNode } from './wrappers/CadNode';
6
6
  export declare class CadModelFactory {
7
7
  private readonly _materialManager;
@@ -9,7 +9,7 @@ export declare class CadModelFactory {
9
9
  private readonly _cadModelMetadataRepository;
10
10
  private _gltfSectorRepository;
11
11
  constructor(materialManager: CadMaterialManager, modelMetadataProvider: ModelMetadataProvider, modelDataProvider: ModelDataProvider);
12
- loadModelMetadata(externalModelIdentifier: ModelIdentifier): Promise<CadModelMetadata>;
12
+ loadModelMetadata(externalModelIdentifier: ModelIdentifier, outputFormat?: File3dFormat): Promise<CadModelMetadata>;
13
13
  createModel(metadata: CadModelMetadata, geometryFilter?: GeometryFilter): CadNode;
14
14
  private getSectorRepository;
15
15
  dispose(): void;
@@ -28,6 +28,8 @@ export declare class CadNode extends Object3D<Object3DEventMap & {
28
28
  private _needsRedraw;
29
29
  private readonly _meshManager;
30
30
  readonly treeIndexToSectorsMap: TreeIndexToSectorsMap;
31
+ private readonly _lockedTreeIndices;
32
+ private readonly _lockedSectorIds;
31
33
  readonly type = "CadNode";
32
34
  constructor(model: CadModelMetadata, materialManager: CadMaterialManager, sectorRepository: SectorRepository);
33
35
  get needsRedraw(): boolean;
@@ -58,6 +60,16 @@ export declare class CadNode extends Object3D<Object3DEventMap & {
58
60
  getCdfToDefaultModelTransformation(out?: Matrix4): Matrix4;
59
61
  setModelRenderLayers(root?: Object3D): void;
60
62
  get prioritizedAreas(): PrioritizedArea[];
63
+ get lockedSectorIds(): ReadonlySet<number>;
64
+ lockTreeIndices(treeIndices: number[]): void;
65
+ unlockTreeIndices(treeIndices: number[]): void;
66
+ unlockAllTreeIndices(): void;
67
+ /**
68
+ * Called when a new sector is discovered for a tree index.
69
+ * If that tree index is locked, the sector is added to the locked set.
70
+ */
71
+ onTreeIndexSectorDiscovered(treeIndex: number, sectorId: number): void;
72
+ private recomputeLockedSectorIds;
61
73
  batchGeometry(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
62
74
  removeBatchedSectorGeometries(sectorId: number): void;
63
75
  /**
@@ -111,6 +111,26 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
111
111
  * default appearance.
112
112
  */
113
113
  removeAllStyledNodeCollections(): void;
114
+ /**
115
+ * Locks the sectors containing the given tree indices so they are never
116
+ * evicted when the CAD budget is reduced. The lock is reactive: if a
117
+ * tree index's geometry is later discovered in a new sector (when that
118
+ * sector loads), the new sector is automatically locked as well.
119
+ *
120
+ * @param treeIndices Tree indices of nodes whose sectors should be locked.
121
+ */
122
+ lockTreeIndices(treeIndices: number[]): void;
123
+ /**
124
+ * Removes the lock for the given tree indices. Sectors that were only
125
+ * locked because of these tree indices will become eligible for eviction.
126
+ *
127
+ * @param treeIndices Tree indices to unlock.
128
+ */
129
+ unlockTreeIndices(treeIndices: number[]): void;
130
+ /**
131
+ * Removes all tree-index-based sector locks on this model.
132
+ */
133
+ unlockAllTreeIndices(): void;
114
134
  /**
115
135
  * Apply a transformation matrix to the tree indices given, changing
116
136
  * rotation, scale and/or position.
@@ -3,13 +3,13 @@
3
3
  */
4
4
  import { CadModelMetadata } from './CadModelMetadata';
5
5
  import { MetadataRepository } from '../../../model-base';
6
- import { ModelDataProvider, ModelMetadataProvider, ModelIdentifier } from '../../../data-providers';
6
+ import { ModelDataProvider, ModelMetadataProvider, ModelIdentifier, File3dFormat } from '../../../data-providers';
7
7
  export declare class CadModelMetadataRepository implements MetadataRepository<Promise<CadModelMetadata>> {
8
8
  private readonly _modelMetadataProvider;
9
9
  private readonly _modelDataProvider;
10
10
  private readonly _cadSceneParser;
11
11
  private readonly _blobFileName;
12
12
  constructor(modelMetadataProvider: ModelMetadataProvider, modelDataProvider: ModelDataProvider, blobFileName?: string);
13
- loadData(modelIdentifier: ModelIdentifier): Promise<CadModelMetadata>;
13
+ loadData(modelIdentifier: ModelIdentifier, outputFormat?: File3dFormat): Promise<CadModelMetadata>;
14
14
  private getSupportedOutput;
15
15
  }
@@ -2,6 +2,7 @@
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
4
  import { ClassicModelIdentifierType, DMModelIdentifierType, LocalModelIdentifierType } from './DataSourceType';
5
+ import { File3dFormat } from './types';
5
6
  /**
6
7
  * Identifies a 3D model. Typically, implementations will use {@link CdfModelIdentifier}.
7
8
  */
@@ -16,4 +17,4 @@ export interface ModelIdentifier {
16
17
  */
17
18
  sourceModelIdentifier(): string;
18
19
  }
19
- export declare function createModelIdentifier(identifier: ClassicModelIdentifierType | (DMModelIdentifierType & ClassicModelIdentifierType) | LocalModelIdentifierType): ModelIdentifier;
20
+ export declare function createModelIdentifier(identifier: ClassicModelIdentifierType | (DMModelIdentifierType & ClassicModelIdentifierType) | LocalModelIdentifierType, outputFormat?: File3dFormat): ModelIdentifier;
@@ -2,6 +2,7 @@
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
4
  import { ModelIdentifier } from '../ModelIdentifier';
5
+ import { File3dFormat } from '../types';
5
6
  /**
6
7
  * Identifies a 3D model stored in CDF by the combination of a modelId, a revisionId
7
8
  * and a format.
@@ -10,7 +11,8 @@ export declare class CdfModelIdentifier implements ModelIdentifier {
10
11
  readonly revealInternalId: symbol;
11
12
  readonly modelId: number;
12
13
  readonly revisionId: number;
13
- constructor(modelId: number, revisionId: number);
14
+ readonly outputFormat: File3dFormat | undefined;
15
+ constructor(modelId: number, revisionId: number, outputFormat?: File3dFormat);
14
16
  toString(): string;
15
17
  /**
16
18
  * Returns an identifier in a serialized form, which uniquely identifies
@@ -110,6 +110,12 @@ export declare enum File3dFormat {
110
110
  * Reveal v9 and above (GLTF based output)
111
111
  */
112
112
  GltfCadModel = "gltf-directory",
113
+ /**
114
+ * High-detail geometry for a prioritized subset of nodes.
115
+ * Same GLTF structure as GltfCadModel but only contains
116
+ * geometry for nodes specified in a PrioritizedNodes job.
117
+ */
118
+ GltfPrioritizedNodes = "gltf-prioritized-nodes-directory",
113
119
  AnyFormat = "all-outputs"
114
120
  }
115
121
  export interface BlobOutputMetadata {
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { GeometryFilter } from '../../../cad-model';
5
5
  import { ClassicModelIdentifierType, InternalDataSourceType, LocalModelIdentifierType } from '../DataSourceType';
6
+ import { File3dFormat } from '../types';
6
7
  /**
7
8
  * Model options common to all model types.
8
9
  */
@@ -15,6 +16,12 @@ export type CommonModelOptions = {
15
16
  * An optional geometryFilter which will be applied to loading model.
16
17
  */
17
18
  geometryFilter?: GeometryFilter;
19
+ /**
20
+ * Override which output format to load for this model revision.
21
+ * Defaults to 'gltf-directory'. Set to 'gltf-prioritized-nodes-directory'
22
+ * to load high-detail geometry from a PrioritizedNodes job output.
23
+ */
24
+ outputFormat?: File3dFormat;
18
25
  };
19
26
  export type LocalAddModelOptions = CommonModelOptions & LocalModelIdentifierType;
20
27
  export type InternalAddModelOptions<T extends InternalDataSourceType> = CommonModelOptions & T['modelIdentifier'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.31.2",
3
+ "version": "4.32.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": {