@cognite/reveal 4.27.0-dev.20251001 → 4.27.1
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/dist/index.js +235 -239
- package/dist/index.js.map +1 -1
- package/dist/packages/cad-geometry-loaders/src/sector/ModelStateHandler.d.ts +4 -4
- package/dist/packages/cad-geometry-loaders/src/sector/rxSectorUtilities.d.ts +1 -1
- package/dist/packages/cad-model/src/wrappers/CadMeshManager.d.ts +60 -0
- package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +12 -2
- package/dist/packages/cad-parsers/index.d.ts +1 -1
- package/dist/packages/cad-parsers/src/cad/types.d.ts +7 -4
- package/dist/packages/cad-parsers/src/metadata/CadModelMetadata.d.ts +2 -2
- package/dist/packages/cad-parsers/src/metadata/CadModelMetadataRepository.d.ts +0 -1
- package/dist/packages/cad-parsers/src/sector/SectorNode.d.ts +1 -3
- package/dist/packages/data-providers/src/ModelIdentifier.d.ts +5 -0
- package/dist/packages/data-providers/src/model-identifiers/CdfModelIdentifier.d.ts +6 -1
- package/dist/packages/data-providers/src/model-identifiers/DMModelIdentifier.d.ts +1 -0
- package/dist/packages/data-providers/src/model-identifiers/LocalModelIdentifier.d.ts +1 -0
- package/dist/packages/rendering/src/CadMaterialManager.d.ts +14 -15
- package/dist/packages/rendering/src/utilities/renderUtilities.d.ts +1 -1
- package/dist/packages/sector-loader/src/GltfSectorLoader.d.ts +4 -5
- package/dist/packages/sector-loader/src/GltfSectorRepository.d.ts +9 -3
- package/dist/packages/sector-loader/src/SectorRepository.d.ts +6 -0
- package/dist/packages/utilities/index.d.ts +0 -1
- package/dist/packages/utilities/src/SceneHandler.d.ts +2 -2
- package/dist/packages/utilities/src/cache/MemoryRequestCache.d.ts +22 -2
- package/package.json +1 -1
- package/dist/packages/utilities/src/three/AutoDisposeGroup.d.ts +0 -18
|
@@ -5,8 +5,8 @@ import { LevelOfDetail } from '../../../cad-parsers';
|
|
|
5
5
|
export declare class ModelStateHandler {
|
|
6
6
|
private readonly _sceneModelState;
|
|
7
7
|
constructor();
|
|
8
|
-
hasStateChanged(modelIdentifier:
|
|
9
|
-
addModel(modelIdentifier:
|
|
10
|
-
removeModel(modelIdentifier:
|
|
11
|
-
updateState(modelIdentifier:
|
|
8
|
+
hasStateChanged(modelIdentifier: symbol, sectorId: number, levelOfDetail: LevelOfDetail): boolean;
|
|
9
|
+
addModel(modelIdentifier: symbol): void;
|
|
10
|
+
removeModel(modelIdentifier: symbol): void;
|
|
11
|
+
updateState(modelIdentifier: symbol, sectorId: number, levelOfDetail: LevelOfDetail): void;
|
|
12
12
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2021 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { CadMaterialManager } from '../../../rendering';
|
|
5
|
+
import { ParsedMeshGeometry } from '../../../cad-parsers';
|
|
6
|
+
import { TreeIndexToSectorsMap } from '../utilities/TreeIndexToSectorsMap';
|
|
7
|
+
import { SectorRepository } from '../../../sector-loader';
|
|
8
|
+
import { ModelIdentifier } from '../../../data-providers';
|
|
9
|
+
import { Group } from 'three';
|
|
10
|
+
/**
|
|
11
|
+
* Manages mesh data for CAD sectors.
|
|
12
|
+
* This class prepares mesh data for object creation.
|
|
13
|
+
*/
|
|
14
|
+
export declare class CadMeshManager {
|
|
15
|
+
private readonly _materialManager;
|
|
16
|
+
private readonly _modelIdentifier;
|
|
17
|
+
private readonly _treeIndexToSectorsMap;
|
|
18
|
+
private readonly _sectorMeshGroups;
|
|
19
|
+
constructor(materialManager: CadMaterialManager, modelIdentifier: symbol, treeIndexToSectorsMap: TreeIndexToSectorsMap);
|
|
20
|
+
/**
|
|
21
|
+
* Creates meshes from parsed geometries for a given sector.
|
|
22
|
+
* @param parsedMeshGeometries Array of parsed mesh geometries to create meshes from
|
|
23
|
+
* @param sectorId The sector ID these meshes belong to
|
|
24
|
+
* @returns Group containing the created meshes
|
|
25
|
+
*/
|
|
26
|
+
createMeshesFromParsedGeometries(parsedMeshGeometries: ParsedMeshGeometry[], sectorId: number): Group;
|
|
27
|
+
/**
|
|
28
|
+
* Removes mesh group for the given sector ID.
|
|
29
|
+
* Note: This does not dispose the underlying geometries as they may be shared with other models.
|
|
30
|
+
* @param sectorId The sector ID whose mesh group should be removed
|
|
31
|
+
*/
|
|
32
|
+
private removeSectorMeshGroup;
|
|
33
|
+
/**
|
|
34
|
+
* Removes mesh group and dereferences the sector in the repository.
|
|
35
|
+
* This should be called when a model stops using a sector to properly manage reference counting.
|
|
36
|
+
* @param sectorId The sector ID whose mesh group should be removed
|
|
37
|
+
* @param sectorRepository The sector repository to dereference from
|
|
38
|
+
* @param modelIdentifier The model identifier for dereferencing
|
|
39
|
+
*/
|
|
40
|
+
removeSectorMeshGroupAndDereference(sectorId: number, sectorRepository: SectorRepository, modelIdentifier: ModelIdentifier): void;
|
|
41
|
+
/**
|
|
42
|
+
* Gets all currently managed sector IDs.
|
|
43
|
+
*/
|
|
44
|
+
getManagedSectorIds(): number[];
|
|
45
|
+
/**
|
|
46
|
+
* Checks if a sector is currently managed by this mesh manager.
|
|
47
|
+
* @param sectorId The sector ID to check
|
|
48
|
+
* @returns True if the sector is managed, false otherwise
|
|
49
|
+
*/
|
|
50
|
+
hasManagedSector(sectorId: number): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a mesh from geometry, material, and bounding box.
|
|
53
|
+
*/
|
|
54
|
+
private createMeshFromGeometry;
|
|
55
|
+
/**
|
|
56
|
+
* Updates tree index to sectors mapping from a set of tree indices.
|
|
57
|
+
*/
|
|
58
|
+
private updateTreeIndexToSectorsMap;
|
|
59
|
+
private createTreeIndexSet;
|
|
60
|
+
}
|
|
@@ -6,14 +6,16 @@ import { SectorScene, CadModelMetadata, RootSectorNode, WantedSector, ConsumedSe
|
|
|
6
6
|
import { SectorRepository } from '../../../sector-loader';
|
|
7
7
|
import { ParsedGeometry } from '../../../sector-parser';
|
|
8
8
|
import { CadMaterialManager, NodeTransformProvider, RenderMode } from '../../../rendering';
|
|
9
|
-
import { Object3D, Plane, Matrix4, Object3DEventMap } from 'three';
|
|
9
|
+
import { Group, Object3D, Plane, Matrix4, Object3DEventMap } from 'three';
|
|
10
10
|
import { TreeIndexToSectorsMap } from '../utilities/TreeIndexToSectorsMap';
|
|
11
|
+
import { ParsedMeshGeometry } from '../../../cad-parsers';
|
|
11
12
|
export declare class CadNode extends Object3D<Object3DEventMap & {
|
|
12
13
|
update: undefined;
|
|
13
14
|
}> {
|
|
14
15
|
private readonly _cadModelMetadata;
|
|
15
16
|
private readonly _materialManager;
|
|
16
17
|
private readonly _sectorRepository;
|
|
18
|
+
private readonly _modelIdentifier;
|
|
17
19
|
private _rootSector;
|
|
18
20
|
private _sectorScene;
|
|
19
21
|
private _geometryBatchingManager?;
|
|
@@ -24,6 +26,7 @@ export declare class CadNode extends Object3D<Object3DEventMap & {
|
|
|
24
26
|
private readonly _styledTreeIndexSets;
|
|
25
27
|
private _isDisposed;
|
|
26
28
|
private _needsRedraw;
|
|
29
|
+
private readonly _meshManager;
|
|
27
30
|
readonly treeIndexToSectorsMap: TreeIndexToSectorsMap;
|
|
28
31
|
readonly type = "CadNode";
|
|
29
32
|
constructor(model: CadModelMetadata, materialManager: CadMaterialManager, sectorRepository: SectorRepository);
|
|
@@ -36,7 +39,7 @@ export declare class CadNode extends Object3D<Object3DEventMap & {
|
|
|
36
39
|
get clippingPlanes(): Plane[];
|
|
37
40
|
set clippingPlanes(planes: Plane[]);
|
|
38
41
|
get cadModelMetadata(): CadModelMetadata;
|
|
39
|
-
get cadModelIdentifier():
|
|
42
|
+
get cadModelIdentifier(): symbol;
|
|
40
43
|
get sectorScene(): SectorScene;
|
|
41
44
|
get rootSector(): RootSectorNode;
|
|
42
45
|
get materialManager(): CadMaterialManager;
|
|
@@ -59,6 +62,13 @@ export declare class CadNode extends Object3D<Object3DEventMap & {
|
|
|
59
62
|
get prioritizedAreas(): PrioritizedArea[];
|
|
60
63
|
batchGeometry(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
|
|
61
64
|
removeBatchedSectorGeometries(sectorId: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Removes sector mesh group and properly dereferences it in the sector repository.
|
|
67
|
+
* This ensures proper reference counting for shared geometry between duplicate models.
|
|
68
|
+
* @param sectorId The sector ID to remove and dereference
|
|
69
|
+
*/
|
|
70
|
+
removeSectorMeshGroupWithDereferencing(sectorId: number): void;
|
|
71
|
+
createMeshesFromParsedGeometries(parsedMeshGeometries: ParsedMeshGeometry[], sectorId: number): Group;
|
|
62
72
|
setCacheSize(sectorCount: number): void;
|
|
63
73
|
dispose(): void;
|
|
64
74
|
}
|
|
@@ -11,5 +11,5 @@ export { SectorNode } from './src/sector/SectorNode';
|
|
|
11
11
|
export { RootSectorNode } from './src/sector/RootSectorNode';
|
|
12
12
|
export { LevelOfDetail } from './src/cad/LevelOfDetail';
|
|
13
13
|
export { filterGeometryOutsideClipBox } from './src/cad/filterPrimitivesV9';
|
|
14
|
-
export { InstancedMeshFile, InstancedMesh, TriangleMesh, WantedSector, ConsumedSector } from './src/cad/types';
|
|
14
|
+
export { InstancedMeshFile, InstancedMesh, TriangleMesh, WantedSector, ConsumedSector, ParsedMeshGeometry } from './src/cad/types';
|
|
15
15
|
export { getDistanceToMeterConversionFactor } from './src/utilities/types';
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { AutoDisposeGroup } from '../../../utilities';
|
|
6
5
|
import { SectorMetadata } from '../metadata/types';
|
|
7
6
|
import { LevelOfDetail } from './LevelOfDetail';
|
|
8
7
|
import { ParsedGeometry } from '../../../sector-parser';
|
|
8
|
+
import { ModelIdentifier } from '../../../data-providers';
|
|
9
9
|
export type TriangleMesh = {
|
|
10
10
|
readonly fileId: number;
|
|
11
11
|
readonly indices: Uint32Array;
|
|
@@ -28,17 +28,20 @@ export type InstancedMesh = {
|
|
|
28
28
|
readonly treeIndices: Float32Array;
|
|
29
29
|
};
|
|
30
30
|
export interface ConsumedSector {
|
|
31
|
-
modelIdentifier:
|
|
31
|
+
modelIdentifier: ModelIdentifier;
|
|
32
32
|
metadata: SectorMetadata;
|
|
33
33
|
levelOfDetail: LevelOfDetail;
|
|
34
|
-
group: AutoDisposeGroup | undefined;
|
|
35
34
|
instancedMeshes: InstancedMeshFile[] | undefined;
|
|
36
35
|
geometryBatchingQueue?: ParsedGeometry[];
|
|
36
|
+
parsedMeshGeometries?: ParsedMeshGeometry[];
|
|
37
37
|
}
|
|
38
38
|
export interface WantedSector {
|
|
39
|
-
modelIdentifier:
|
|
39
|
+
modelIdentifier: ModelIdentifier;
|
|
40
40
|
modelBaseUrl: string;
|
|
41
41
|
geometryClipBox: THREE.Box3 | null;
|
|
42
42
|
levelOfDetail: LevelOfDetail;
|
|
43
43
|
metadata: SectorMetadata;
|
|
44
44
|
}
|
|
45
|
+
export type ParsedMeshGeometry = ParsedGeometry & {
|
|
46
|
+
wholeSectorBoundingBox: THREE.Box3;
|
|
47
|
+
};
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { SectorScene } from '../utilities/types';
|
|
6
6
|
import { CameraConfiguration } from '../../../utilities';
|
|
7
|
-
import { File3dFormat } from '../../../data-providers';
|
|
7
|
+
import { File3dFormat, ModelIdentifier } from '../../../data-providers';
|
|
8
8
|
export interface CadModelMetadata {
|
|
9
9
|
/**
|
|
10
10
|
* A unique identifier of the model.
|
|
11
11
|
*/
|
|
12
|
-
readonly modelIdentifier:
|
|
12
|
+
readonly modelIdentifier: ModelIdentifier;
|
|
13
13
|
/**
|
|
14
14
|
* File format of the 3D model (i3d/f3d, gltf, etc.)
|
|
15
15
|
*/
|
|
@@ -9,7 +9,6 @@ export declare class CadModelMetadataRepository implements MetadataRepository<Pr
|
|
|
9
9
|
private readonly _modelDataProvider;
|
|
10
10
|
private readonly _cadSceneParser;
|
|
11
11
|
private readonly _blobFileName;
|
|
12
|
-
private _currentModelIdentifier;
|
|
13
12
|
constructor(modelMetadataProvider: ModelMetadataProvider, modelDataProvider: ModelDataProvider, blobFileName?: string);
|
|
14
13
|
loadData(modelIdentifier: ModelIdentifier): Promise<CadModelMetadata>;
|
|
15
14
|
private getSupportedOutput;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { AutoDisposeGroup } from '../../../utilities';
|
|
6
5
|
import { LevelOfDetail } from '../cad/LevelOfDetail';
|
|
7
6
|
export declare class SectorNode extends THREE.Group {
|
|
8
7
|
readonly sectorPath: string;
|
|
@@ -16,7 +15,6 @@ export declare class SectorNode extends THREE.Group {
|
|
|
16
15
|
get levelOfDetail(): LevelOfDetail;
|
|
17
16
|
get group(): THREE.Group | undefined;
|
|
18
17
|
get updatedTimestamp(): number;
|
|
19
|
-
updateGeometry(geometryGroup:
|
|
20
|
-
dereference(): void;
|
|
18
|
+
updateGeometry(geometryGroup: THREE.Group | undefined, levelOfDetail: LevelOfDetail): void;
|
|
21
19
|
resetGeometry(): void;
|
|
22
20
|
}
|
|
@@ -10,5 +10,10 @@ export interface ModelIdentifier {
|
|
|
10
10
|
* Unique ID of the model.
|
|
11
11
|
*/
|
|
12
12
|
readonly revealInternalId: symbol;
|
|
13
|
+
/**
|
|
14
|
+
* Returns an identifier in a serialized form, which uniquely identifies
|
|
15
|
+
* the model from the data source
|
|
16
|
+
*/
|
|
17
|
+
sourceModelIdentifier(): string;
|
|
13
18
|
}
|
|
14
19
|
export declare function createModelIdentifier(identifier: ClassicModelIdentifierType | (DMModelIdentifierType & ClassicModelIdentifierType) | LocalModelIdentifierType): ModelIdentifier;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import { ModelIdentifier } from '
|
|
4
|
+
import { ModelIdentifier } from '../ModelIdentifier';
|
|
5
5
|
/**
|
|
6
6
|
* Identifies a 3D model stored in CDF by the combination of a modelId, a revisionId
|
|
7
7
|
* and a format.
|
|
@@ -12,4 +12,9 @@ export declare class CdfModelIdentifier implements ModelIdentifier {
|
|
|
12
12
|
readonly revisionId: number;
|
|
13
13
|
constructor(modelId: number, revisionId: number);
|
|
14
14
|
toString(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Returns an identifier in a serialized form, which uniquely identifies
|
|
17
|
+
* the model in CDF
|
|
18
|
+
*/
|
|
19
|
+
sourceModelIdentifier(): string;
|
|
15
20
|
}
|
|
@@ -9,4 +9,5 @@ export declare class DMModelIdentifier extends CdfModelIdentifier {
|
|
|
9
9
|
readonly revisionSpace: string;
|
|
10
10
|
constructor({ modelId, revisionId, revisionExternalId, revisionSpace }: DMModelIdentifierType & ClassicModelIdentifierType);
|
|
11
11
|
toString(): string;
|
|
12
|
+
sourceModelIdentifier(): string;
|
|
12
13
|
}
|
|
@@ -16,21 +16,20 @@ export declare class CadMaterialManager {
|
|
|
16
16
|
private _clippingPlanes;
|
|
17
17
|
on(event: 'materialsChanged', listener: () => void): void;
|
|
18
18
|
off(event: 'materialsChanged', listener: () => void): void;
|
|
19
|
-
addModelMaterials(modelIdentifier:
|
|
20
|
-
removeModelMaterials(modelIdentifier:
|
|
21
|
-
addTexturedMeshMaterial(modelIdentifier:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
getModelVisibleTreeIndices(modelIdentifier: string): IndexSet;
|
|
19
|
+
addModelMaterials(modelIdentifier: symbol, maxTreeIndex: number): void;
|
|
20
|
+
removeModelMaterials(modelIdentifier: symbol): void;
|
|
21
|
+
addTexturedMeshMaterial(modelIdentifier: symbol, sectorId: number, texture: THREE.Texture): THREE.RawShaderMaterial;
|
|
22
|
+
getModelMaterials(modelIdentifier: symbol): Materials;
|
|
23
|
+
getModelNodeAppearanceProvider(modelIdentifier: symbol): NodeAppearanceProvider;
|
|
24
|
+
getModelNodeTransformProvider(modelIdentifier: symbol): NodeTransformProvider;
|
|
25
|
+
getModelDefaultNodeAppearance(modelIdentifier: symbol): NodeAppearance;
|
|
26
|
+
getModelClippingPlanes(modelIdentifier: symbol): THREE.Plane[];
|
|
27
|
+
setModelClippingPlanes(modelIdentifier: symbol, clippingPlanes: THREE.Plane[]): void;
|
|
28
|
+
setModelDefaultNodeAppearance(modelIdentifier: symbol, defaultAppearance: NodeAppearance): void;
|
|
29
|
+
getModelBackTreeIndices(modelIdentifier: symbol): IndexSet;
|
|
30
|
+
getModelInFrontTreeIndices(modelIdentifier: symbol): IndexSet;
|
|
31
|
+
getModelGhostedTreeIndices(modelIdentifier: symbol): IndexSet;
|
|
32
|
+
getModelVisibleTreeIndices(modelIdentifier: symbol): IndexSet;
|
|
34
33
|
setRenderMode(mode: RenderMode): void;
|
|
35
34
|
getRenderMode(): RenderMode;
|
|
36
35
|
dispose(): void;
|
|
@@ -20,7 +20,7 @@ export declare enum RenderLayer {
|
|
|
20
20
|
Default = 0
|
|
21
21
|
}
|
|
22
22
|
export declare function getLayerMask(renderLayer: number): number;
|
|
23
|
-
export declare function hasStyledNodes(modelIdentifiers:
|
|
23
|
+
export declare function hasStyledNodes(modelIdentifiers: symbol[], materialManager: CadMaterialManager): {
|
|
24
24
|
back: boolean;
|
|
25
25
|
inFront: boolean;
|
|
26
26
|
ghost: boolean;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Cognite AS
|
|
3
|
+
*/
|
|
1
4
|
import { ConsumedSector, WantedSector } from '../../cad-parsers';
|
|
2
5
|
import { BinaryFileProvider } from '../../data-providers';
|
|
3
|
-
import { CadMaterialManager } from '../../rendering';
|
|
4
6
|
export declare class GltfSectorLoader {
|
|
5
7
|
private readonly _gltfSectorParser;
|
|
6
8
|
private readonly _sectorFileProvider;
|
|
7
|
-
|
|
8
|
-
constructor(sectorFileProvider: BinaryFileProvider, materialManager: CadMaterialManager);
|
|
9
|
+
constructor(sectorFileProvider: BinaryFileProvider);
|
|
9
10
|
loadSector(sector: WantedSector, abortSignal?: AbortSignal): Promise<ConsumedSector>;
|
|
10
|
-
private createTreeIndexSet;
|
|
11
|
-
private createMesh;
|
|
12
11
|
}
|
|
@@ -2,18 +2,24 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import { ConsumedSector, WantedSector } from '../../cad-parsers';
|
|
5
|
-
import { BinaryFileProvider } from '../../data-providers';
|
|
6
|
-
import { CadMaterialManager } from '../../rendering';
|
|
5
|
+
import { BinaryFileProvider, ModelIdentifier } from '../../data-providers';
|
|
7
6
|
import { SectorRepository } from './SectorRepository';
|
|
8
7
|
export declare class GltfSectorRepository implements SectorRepository {
|
|
9
8
|
private readonly _gltfSectorLoader;
|
|
10
9
|
private readonly _gltfCache;
|
|
11
|
-
constructor(sectorFileProvider: BinaryFileProvider
|
|
10
|
+
constructor(sectorFileProvider: BinaryFileProvider);
|
|
12
11
|
private getEmptySectorWithLod;
|
|
13
12
|
private getEmptyDetailedSector;
|
|
14
13
|
private getEmptyDiscardedSector;
|
|
15
14
|
loadSector(sector: WantedSector, abortSignal?: AbortSignal): Promise<ConsumedSector>;
|
|
16
15
|
setCacheSize(sectorCount: number): void;
|
|
17
16
|
clearCache(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Dereferences a sector when a model stops using it.
|
|
19
|
+
* The cache handles reference counting and automatic disposal when count reaches zero.
|
|
20
|
+
* @param modelIdentifier The model identifier that was using the sector
|
|
21
|
+
* @param sectorId The sector ID to dereference
|
|
22
|
+
*/
|
|
23
|
+
dereferenceSector(modelIdentifier: ModelIdentifier, sectorId: number): void;
|
|
18
24
|
private wantedSectorCacheKey;
|
|
19
25
|
}
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import { ConsumedSector, WantedSector } from '../../cad-parsers';
|
|
5
|
+
import { ModelIdentifier } from '../../data-providers';
|
|
5
6
|
export type SectorId = number;
|
|
6
7
|
export interface SectorRepository {
|
|
7
8
|
loadSector(sector: WantedSector, abortSignal?: AbortSignal): Promise<ConsumedSector>;
|
|
8
9
|
setCacheSize(sectorCount: number): void;
|
|
9
10
|
clearCache(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Dereferences a sector when a model stops using it.
|
|
13
|
+
* If this was the last reference, the sector will be disposed.
|
|
14
|
+
*/
|
|
15
|
+
dereferenceSector(modelIdentifier: ModelIdentifier, sectorId: number): void;
|
|
10
16
|
}
|
|
@@ -19,7 +19,6 @@ export { determinePowerOfTwoDimensions } from './src/determinePowerOfTwoDimensio
|
|
|
19
19
|
export { IndexSet } from './src/IndexSet';
|
|
20
20
|
export { DynamicDefragmentedBuffer } from './src/datastructures/DynamicDefragmentedBuffer';
|
|
21
21
|
export { AttributeDataAccessor } from './src/three/AttributeDataAccessor';
|
|
22
|
-
export { AutoDisposeGroup } from './src/three/AutoDisposeGroup';
|
|
23
22
|
export { toThreeBox3 } from './src/three/toThreeBox3';
|
|
24
23
|
export { fromThreeVector3 } from './src/three/fromThreeVector3';
|
|
25
24
|
export { unionBoxes } from './src/three/unionBoxes';
|
|
@@ -11,7 +11,7 @@ export declare class SceneHandler {
|
|
|
11
11
|
get scene(): THREE.Scene;
|
|
12
12
|
get cadModels(): {
|
|
13
13
|
cadNode: THREE.Object3D;
|
|
14
|
-
modelIdentifier:
|
|
14
|
+
modelIdentifier: symbol;
|
|
15
15
|
}[];
|
|
16
16
|
get pointCloudModels(): {
|
|
17
17
|
pointCloudNode: THREE.Object3D;
|
|
@@ -19,7 +19,7 @@ export declare class SceneHandler {
|
|
|
19
19
|
}[];
|
|
20
20
|
get customObjects(): ICustomObject[];
|
|
21
21
|
constructor();
|
|
22
|
-
addCadModel(cadNode: THREE.Object3D, modelIdentifier:
|
|
22
|
+
addCadModel(cadNode: THREE.Object3D, modelIdentifier: symbol): void;
|
|
23
23
|
addPointCloudModel(pointCloudNode: THREE.Object3D, modelIdentifier: symbol): void;
|
|
24
24
|
removePointCloudModel(pointCloudNode: THREE.Object3D): void;
|
|
25
25
|
removeCadModel(cadNode: THREE.Object3D): void;
|
|
@@ -9,9 +9,10 @@ export declare class MemoryRequestCache<Key, Data> implements RequestCache<Key,
|
|
|
9
9
|
private _maxElementsInCache;
|
|
10
10
|
private readonly _data;
|
|
11
11
|
private _defaultCleanupCount;
|
|
12
|
-
private readonly
|
|
12
|
+
private readonly _disposeCallback?;
|
|
13
|
+
private readonly _referenceCounts;
|
|
13
14
|
private static readonly CLEANUP_COUNT_TO_CAPACITY_RATIO;
|
|
14
|
-
constructor(maxElementsInCache
|
|
15
|
+
constructor(maxElementsInCache: number, defaultCleanupCount: number, disposeCallback?: (data: Data) => void);
|
|
15
16
|
has(id: Key): boolean;
|
|
16
17
|
forceInsert(id: Key, data: Data): void;
|
|
17
18
|
insert(id: Key, data: Data): void;
|
|
@@ -19,6 +20,25 @@ export declare class MemoryRequestCache<Key, Data> implements RequestCache<Key,
|
|
|
19
20
|
get(id: Key): Data;
|
|
20
21
|
isFull(): boolean;
|
|
21
22
|
cleanCache(count: number): void;
|
|
23
|
+
/**
|
|
24
|
+
* Adds a reference to the cached item. Items with active references will not be disposed
|
|
25
|
+
* until all references are removed.
|
|
26
|
+
* @param id The cache key to add a reference to
|
|
27
|
+
*/
|
|
28
|
+
addReference(id: Key): void;
|
|
29
|
+
/**
|
|
30
|
+
* Removes a reference to the cached item. Items remain in cache even when
|
|
31
|
+
* reference count reaches 0, allowing for potential reuse. Disposal only
|
|
32
|
+
* happens during cache cleanup when memory pressure exists.
|
|
33
|
+
* @param id The cache key to remove a reference from
|
|
34
|
+
*/
|
|
35
|
+
removeReference(id: Key): void;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the current reference count for a cached item.
|
|
38
|
+
* @param id The cache key to get reference count for
|
|
39
|
+
* @returns The number of active references, or 0 if not found
|
|
40
|
+
*/
|
|
41
|
+
getReferenceCount(id: Key): number;
|
|
22
42
|
resize(cacheSize: number): void;
|
|
23
43
|
clear(): void;
|
|
24
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.27.
|
|
3
|
+
"version": "4.27.1",
|
|
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": {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2021 Cognite AS
|
|
3
|
-
*/
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
/**
|
|
6
|
-
* Referenced count implementation of THREE.Group that
|
|
7
|
-
* automatically disposes all geometries contained in meshes that
|
|
8
|
-
* are direct children of the group.
|
|
9
|
-
*/
|
|
10
|
-
export declare class AutoDisposeGroup extends THREE.Group {
|
|
11
|
-
private _isDisposed;
|
|
12
|
-
private _referenceCount;
|
|
13
|
-
isDisposed(): boolean;
|
|
14
|
-
reference(): void;
|
|
15
|
-
dereference(): void;
|
|
16
|
-
private dispose;
|
|
17
|
-
private ensureNotDisposed;
|
|
18
|
-
}
|