@cognite/reveal 4.38.0 → 4.39.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/assets/eptBinaryDecoder.worker-DaGMeDuG.js.map +1 -0
- package/dist/index.js +5927 -6103
- package/dist/index.js.map +1 -1
- package/dist/packages/360-images/src/entity/Image360RevisionEntity.d.ts +1 -0
- package/dist/packages/api/src/public/RevealManager.d.ts +9 -1
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +10 -1
- package/dist/packages/api/src/public/migration/types.d.ts +3 -1
- package/dist/packages/api/src/public/types.d.ts +1 -1
- package/dist/packages/cad-geometry-loaders/src/CadManager.d.ts +3 -1
- package/dist/packages/cad-geometry-loaders/src/createCadManager.d.ts +2 -1
- package/dist/packages/cad-geometry-loaders/src/sector/SectorDownloadScheduler.d.ts +6 -0
- package/dist/packages/cad-geometry-loaders/src/sector/SectorLoader.d.ts +10 -1
- package/dist/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV9SectorMap.d.ts +8 -1
- package/dist/packages/cad-model/src/CadModelFactory.d.ts +3 -1
- package/dist/packages/cad-model/src/picking/CadPickBuffer.d.ts +22 -0
- package/dist/packages/cad-model/src/picking/CadPickCache.d.ts +43 -0
- package/dist/packages/cad-model/src/picking/PickingHandler.d.ts +11 -19
- package/dist/packages/cad-model/src/picking/depthToIntersection.d.ts +12 -0
- package/dist/packages/cad-model/src/picking/types.d.ts +9 -0
- package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +3 -1
- package/dist/packages/cad-styling/src/NodeAppearanceTextureBuilder.d.ts +5 -2
- package/dist/packages/data-providers/src/utilities/gzipUtils.d.ts +3 -0
- package/dist/packages/pointclouds/src/PointCloudFactory.d.ts +3 -1
- package/dist/packages/pointclouds/src/PointCloudManager.d.ts +8 -1
- package/dist/packages/pointclouds/src/PointCloudNode.d.ts +4 -2
- package/dist/packages/pointclouds/src/PointCloudPickingHandler.d.ts +2 -2
- package/dist/packages/pointclouds/src/createPointCloudManager.d.ts +2 -1
- package/dist/packages/pointclouds/src/potree-three-loader/tree/PointCloudOctreePicker.d.ts +2 -2
- package/dist/packages/rendering/index.d.ts +1 -1
- package/dist/packages/rendering/src/CadMaterialManager.d.ts +4 -2
- package/dist/packages/rendering/src/pointcloud-rendering/PointCloudObjectAppearanceTexture.d.ts +6 -0
- package/dist/packages/rendering/src/render-passes/PostProcessingPass.d.ts +0 -5
- package/dist/packages/rendering/src/rendering/CustomObjectEffectMaterial.d.ts +75 -0
- package/dist/packages/utilities/index.d.ts +1 -0
- package/dist/packages/utilities/src/PickCacheInvalidator.d.ts +17 -0
- package/dist/packages/utilities/src/SceneHandler.d.ts +0 -2
- package/dist/packages/utilities/src/customObject/CustomObject.d.ts +2 -0
- package/dist/packages/utilities/src/customObject/ICustomObject.d.ts +2 -0
- package/package.json +7 -7
- package/dist/assets/eptBinaryDecoder.worker-AfUP5xy8.js.map +0 -1
- package/dist/packages/data-providers/src/utilities/brotliDecompressTypes.d.ts +0 -6
- package/dist/packages/rendering/src/rendering/CadShadowReceiverForCustomObjectMaterial.d.ts +0 -15
|
@@ -58,6 +58,7 @@ export declare class Image360RevisionEntity<T extends DataSourceType> implements
|
|
|
58
58
|
* Clear the cached textures used by this revision.
|
|
59
59
|
*/
|
|
60
60
|
dispose(): void;
|
|
61
|
+
disposeGpuResources(): void;
|
|
61
62
|
/**
|
|
62
63
|
* Apply cached textures to the image360VisualizationBox.
|
|
63
64
|
*/
|
|
@@ -6,6 +6,7 @@ import { LoadingState } from '../../../model-base';
|
|
|
6
6
|
import { CadManager, CadModelBudget } from '../../../cad-geometry-loaders';
|
|
7
7
|
import { NodeAppearanceProvider } from '../../../cad-styling';
|
|
8
8
|
import { RenderMode, RenderPipelineExecutor, CadMaterialManager, RenderPipelineProvider, ResizeHandler, SettableRenderTarget } from '../../../rendering';
|
|
9
|
+
import { PickCacheInvalidator } from '../../../utilities';
|
|
9
10
|
import { CameraManager } from '../../../camera-manager';
|
|
10
11
|
import { DataSourceType, File3dFormat, InternalDataSourceType } from '../../../data-providers';
|
|
11
12
|
import { AddModelOptionsWithModelRevisionId } from '../../../data-providers/src/utilities/internalAddModelOptions';
|
|
@@ -25,19 +26,25 @@ export declare class RevealManager {
|
|
|
25
26
|
private readonly _renderPipeline;
|
|
26
27
|
private readonly _resizeHandler;
|
|
27
28
|
private _cameraInMotion;
|
|
29
|
+
private _lastCameraSnapshot;
|
|
30
|
+
private readonly _pickCacheInvalidator;
|
|
28
31
|
private _isDisposed;
|
|
29
32
|
private readonly _subscriptions;
|
|
30
33
|
private readonly _events;
|
|
31
34
|
private readonly _cameraManager;
|
|
32
35
|
private readonly _onCameraChange;
|
|
33
36
|
private readonly _onCameraStop;
|
|
34
|
-
constructor(cadManager: CadManager, pointCloudManager: PointCloudManager, pipelineExecutor: RenderPipelineExecutor, renderPipeline: RenderPipelineProvider & SettableRenderTarget, resizeHandler: ResizeHandler, cameraManager: CameraManager);
|
|
37
|
+
constructor(cadManager: CadManager, pointCloudManager: PointCloudManager, pipelineExecutor: RenderPipelineExecutor, renderPipeline: RenderPipelineProvider & SettableRenderTarget, resizeHandler: ResizeHandler, cameraManager: CameraManager, pickCacheInvalidator: PickCacheInvalidator);
|
|
35
38
|
dispose(): void;
|
|
36
39
|
requestRedraw(): void;
|
|
37
40
|
resetRedraw(): void;
|
|
38
41
|
setOutputRenderTarget(target: WebGLRenderTarget | null, autoSizeRenderTarget?: boolean): void;
|
|
39
42
|
get materialManager(): CadMaterialManager;
|
|
40
43
|
get needsRedraw(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Flag that is set whenever something that can change what a pick hits changes. See {@link PickCacheInvalidator}.
|
|
46
|
+
*/
|
|
47
|
+
get pickCacheInvalidator(): PickCacheInvalidator;
|
|
41
48
|
get cameraInMotion(): boolean;
|
|
42
49
|
update(camera: PerspectiveCamera): void;
|
|
43
50
|
get cadBudget(): CadModelBudget;
|
|
@@ -63,4 +70,5 @@ export declare class RevealManager {
|
|
|
63
70
|
removeModel(type: 'cad', model: CadNode): void;
|
|
64
71
|
removeModel(type: 'pointcloud', model: PointCloudNode): void;
|
|
65
72
|
private initLoadingStateObserver;
|
|
73
|
+
private requestPickCacheInvalidationIfCameraChanged;
|
|
66
74
|
}
|
|
@@ -409,6 +409,8 @@ export declare class Cognite3DViewer<DataSourceT extends DataSourceType = Classi
|
|
|
409
409
|
addObject3D(object: Object3D): void;
|
|
410
410
|
/**
|
|
411
411
|
* Add a CustomObject to the viewer.
|
|
412
|
+
* Meshes in the custom object can use {@link CustomObjectEffectMaterial}, which supports
|
|
413
|
+
* effects specific to custom objects.
|
|
412
414
|
* @param customObject
|
|
413
415
|
* @example
|
|
414
416
|
* ```js
|
|
@@ -419,6 +421,13 @@ export declare class Cognite3DViewer<DataSourceT extends DataSourceType = Classi
|
|
|
419
421
|
* const customObject = CustomObject(sphere);
|
|
420
422
|
* customObject.isPartOfBoundingBox = false;
|
|
421
423
|
* viewer.addCustomObject(customObject);
|
|
424
|
+
*
|
|
425
|
+
* // Ground plane that receives CAD shadows and texture variation
|
|
426
|
+
* const groundMaterial = new CustomObjectEffectMaterial('#ffffff', texture);
|
|
427
|
+
* groundMaterial.setReceivesShadow(true);
|
|
428
|
+
* groundMaterial.setTextureVariation('hexTiling');
|
|
429
|
+
* const plane = new Mesh(new PlaneGeometry(100, 100), groundMaterial);
|
|
430
|
+
* viewer.addCustomObject(CustomObject(plane));
|
|
422
431
|
* ```
|
|
423
432
|
* @beta
|
|
424
433
|
*/
|
|
@@ -698,7 +707,7 @@ export declare class Cognite3DViewer<DataSourceT extends DataSourceType = Classi
|
|
|
698
707
|
* @param options
|
|
699
708
|
* @param options.stopOnHitting360Icon
|
|
700
709
|
* @param options.predicate Check whether a CustomObject should be intersected.
|
|
701
|
-
* @param options.forceWindowedPick Skip point
|
|
710
|
+
* @param options.forceWindowedPick Skip point cloud and CAD full-frame pick caching for this call.
|
|
702
711
|
* @returns A promise that if there was an intersection then return the intersection object - otherwise it
|
|
703
712
|
* returns `null` if there were no intersections.
|
|
704
713
|
* @beta
|
|
@@ -152,7 +152,9 @@ export interface Cognite3DViewerOptions {
|
|
|
152
152
|
* them. Turning shadows on changes the CAD look even where no shadow is cast, including
|
|
153
153
|
* ghosted nodes. Defaults to false. Can also be toggled at runtime through
|
|
154
154
|
* {@link Cognite3DViewer.shadowsEnabled}.
|
|
155
|
-
*
|
|
155
|
+
* Custom objects receive shadows when they use {@link CustomObjectEffectMaterial} and request
|
|
156
|
+
* it with {@link CustomObjectEffectMaterial.setReceivesShadow}. GPU resources are only allocated
|
|
157
|
+
* when first enabled.
|
|
156
158
|
* @beta
|
|
157
159
|
*/
|
|
158
160
|
enableShadows?: boolean;
|
|
@@ -7,7 +7,7 @@ import { CognitePointCloudModel } from '../../../pointclouds';
|
|
|
7
7
|
*/
|
|
8
8
|
export type CogniteModel<T extends DataSourceType = ClassicDataSourceType> = CogniteCadModel | CognitePointCloudModel<T>;
|
|
9
9
|
export { WellKnownAsprsPointClassCodes } from '../../../pointclouds';
|
|
10
|
-
export { PointShape, PointColorType, PointSizeType, CadShadowReceiverForCustomObjectMaterial } from '../../../rendering';
|
|
10
|
+
export { PointShape, PointColorType, PointSizeType, CustomObjectEffectMaterial, CadShadowReceiverForCustomObjectMaterial, type TextureVariationType } from '../../../rendering';
|
|
11
11
|
/**
|
|
12
12
|
* A tuple of a 360 image and its collection.
|
|
13
13
|
*/
|
|
@@ -6,6 +6,7 @@ import { CadMaterialManager, RenderMode } from '../../rendering';
|
|
|
6
6
|
import { ModelIdentifier, File3dFormat } from '../../data-providers';
|
|
7
7
|
import { CadModelBudget } from './CadModelBudget';
|
|
8
8
|
import { CadModelFactory, CadModelSectorLoadStatistics, CadNode, GeometryFilter } from '../../cad-model';
|
|
9
|
+
import { PickCacheInvalidator } from '../../utilities';
|
|
9
10
|
export declare class CadManager {
|
|
10
11
|
private readonly _materialManager;
|
|
11
12
|
private readonly _cadModelFactory;
|
|
@@ -15,6 +16,7 @@ export declare class CadManager {
|
|
|
15
16
|
private readonly _unsubscribeLoadingState;
|
|
16
17
|
private _compatibleFileFormat;
|
|
17
18
|
private _needsRedraw;
|
|
19
|
+
private readonly _pickCacheInvalidator;
|
|
18
20
|
private readonly _loadingStateChangedTrigger;
|
|
19
21
|
private readonly _markNeedsRedrawBound;
|
|
20
22
|
private readonly _sectorBufferTime;
|
|
@@ -26,7 +28,7 @@ export declare class CadManager {
|
|
|
26
28
|
* Returns statistics about how data loaded (or data about to be loaded).
|
|
27
29
|
*/
|
|
28
30
|
get loadedStatistics(): CadModelSectorLoadStatistics;
|
|
29
|
-
constructor(materialManger: CadMaterialManager, cadModelFactory: CadModelFactory, cadModelUpdateHandler: CadModelUpdateHandler);
|
|
31
|
+
constructor(materialManger: CadMaterialManager, cadModelFactory: CadModelFactory, cadModelUpdateHandler: CadModelUpdateHandler, pickCacheInvalidator: PickCacheInvalidator);
|
|
30
32
|
dispose(): void;
|
|
31
33
|
requestRedraw(): void;
|
|
32
34
|
resetRedraw(): void;
|
|
@@ -2,6 +2,7 @@ import { CadManager } from './CadManager';
|
|
|
2
2
|
import { InternalRevealCadOptions } from './InternalRevealCadOptions';
|
|
3
3
|
import { CadMaterialManager } from '../../rendering';
|
|
4
4
|
import { ModelDataProvider, ModelMetadataProvider } from '../../data-providers';
|
|
5
|
+
import { PickCacheInvalidator } from '../../utilities';
|
|
5
6
|
export declare function createCadManager(modelMetadataProvider: ModelMetadataProvider, modelDataProvider: ModelDataProvider, materialManager: CadMaterialManager, cadOptions: InternalRevealCadOptions & {
|
|
6
7
|
continuousModelStreaming?: boolean;
|
|
7
|
-
}): CadManager;
|
|
8
|
+
}, pickCacheInvalidator: PickCacheInvalidator): CadManager;
|
|
@@ -12,12 +12,18 @@ export declare class SectorDownloadScheduler {
|
|
|
12
12
|
get numberOfQueuedDownloads(): number;
|
|
13
13
|
constructor(maxConcurrentSectorDownloads?: number);
|
|
14
14
|
queueSectorBatchForDownload(downloadData: SectorDownloadData[]): Promise<ConsumedSector>[];
|
|
15
|
+
/**
|
|
16
|
+
* Drops all downloads that are queued but not yet started, resolving them as discarded.
|
|
17
|
+
* Downloads that are already in progress are left untouched.
|
|
18
|
+
*/
|
|
19
|
+
clearQueuedDownloads(): void;
|
|
15
20
|
private createDiscardedConsumedSector;
|
|
16
21
|
private abortPendingDownload;
|
|
17
22
|
private removeDownloadFromQueue;
|
|
18
23
|
private getOrAddToQueuedDownloads;
|
|
19
24
|
private addSectorToPendingDownloads;
|
|
20
25
|
private processNextQueuedSectorDownload;
|
|
26
|
+
private downloadOrDiscard;
|
|
21
27
|
private getSectorIdentifier;
|
|
22
28
|
private createAbortSignal;
|
|
23
29
|
}
|
|
@@ -24,6 +24,15 @@ export declare class SectorLoader {
|
|
|
24
24
|
reportNewSectorsLoaded(loadedCountChange: number): void;
|
|
25
25
|
private shouldLoad;
|
|
26
26
|
private getSectorCuller;
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Culls the batch against already loaded geometry and queues the remaining sectors for download.
|
|
29
|
+
* Resolves to no downloads if the load is superseded.
|
|
30
|
+
*/
|
|
31
|
+
private startBatch;
|
|
32
|
+
/**
|
|
33
|
+
* Yields the sectors of a batch as they finish downloading, and reports progress.
|
|
34
|
+
* Stops as soon as the load is superseded.
|
|
35
|
+
*/
|
|
36
|
+
private consumeBatch;
|
|
28
37
|
private startLoadingBatch;
|
|
29
38
|
}
|
package/dist/packages/cad-geometry-loaders/src/sector/culling/takensectors/TakenV9SectorMap.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { CadModelMetadata, SectorMetadata } from '../../../../../cad-parsers';
|
|
|
5
5
|
export declare class TakenV9SectorMap extends TakenSectorMapBase {
|
|
6
6
|
private readonly determineSectorCost;
|
|
7
7
|
private readonly _totalCost;
|
|
8
|
+
/** Cost of sectors force-included via {@link markSectorForced}; these bypass the budget. */
|
|
9
|
+
private readonly _forcedCost;
|
|
8
10
|
private readonly _models;
|
|
9
11
|
get totalCost(): SectorCost;
|
|
10
12
|
get modelsMetadata(): CadModelMetadata[];
|
|
@@ -13,9 +15,14 @@ export declare class TakenV9SectorMap extends TakenSectorMapBase {
|
|
|
13
15
|
markSectorDetailed(model: CadModelMetadata, sectorId: number, priority: number): void;
|
|
14
16
|
/**
|
|
15
17
|
* Marks a sector as forced-detailed with infinite priority.
|
|
16
|
-
* These sectors are always loaded regardless of budget constraints
|
|
18
|
+
* These sectors are always loaded regardless of budget constraints, and their cost
|
|
19
|
+
* does not count against the budget (see {@link isWithinBudget}).
|
|
17
20
|
*/
|
|
18
21
|
markSectorForced(model: CadModelMetadata, sectorId: number): void;
|
|
22
|
+
/**
|
|
23
|
+
* Cost of non-forced sectors is compared against the budget. Forced sectors (e.g. fully locked
|
|
24
|
+
* models) are excluded so they cannot starve other models of budget.
|
|
25
|
+
*/
|
|
19
26
|
isWithinBudget(budget: CadModelBudget): boolean;
|
|
20
27
|
collectWantedSectors(): PrioritizedWantedSector[];
|
|
21
28
|
clear(): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PickCacheInvalidator } from '../../utilities';
|
|
1
2
|
import { GeometryFilter } from './types';
|
|
2
3
|
import { CadMaterialManager } from '../../rendering';
|
|
3
4
|
import { CadModelMetadata } from '../../cad-parsers';
|
|
@@ -5,10 +6,11 @@ import { ModelDataProvider, ModelMetadataProvider, ModelIdentifier, File3dFormat
|
|
|
5
6
|
import { CadNode } from './wrappers/CadNode';
|
|
6
7
|
export declare class CadModelFactory {
|
|
7
8
|
private readonly _materialManager;
|
|
9
|
+
private readonly _pickCacheInvalidator;
|
|
8
10
|
private readonly _modelDataProvider;
|
|
9
11
|
private readonly _cadModelMetadataRepository;
|
|
10
12
|
private _gltfSectorRepository;
|
|
11
|
-
constructor(materialManager: CadMaterialManager, modelMetadataProvider: ModelMetadataProvider, modelDataProvider: ModelDataProvider);
|
|
13
|
+
constructor(materialManager: CadMaterialManager, modelMetadataProvider: ModelMetadataProvider, modelDataProvider: ModelDataProvider, pickCacheInvalidator: PickCacheInvalidator);
|
|
12
14
|
loadModelMetadata(externalModelIdentifier: ModelIdentifier, outputFormat?: File3dFormat): Promise<CadModelMetadata>;
|
|
13
15
|
createModel(metadata: CadModelMetadata, geometryFilter?: GeometryFilter): CadNode;
|
|
14
16
|
private getSectorRepository;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
export type CadPickBufferHit = {
|
|
5
|
+
modelIndex: number;
|
|
6
|
+
treeIndex: number;
|
|
7
|
+
depth: number;
|
|
8
|
+
};
|
|
9
|
+
export declare class CadPickBuffer {
|
|
10
|
+
readonly width: number;
|
|
11
|
+
readonly height: number;
|
|
12
|
+
readonly treeIndexPixels: Uint8Array;
|
|
13
|
+
readonly depthPixels: Uint8Array;
|
|
14
|
+
constructor(width: number, height: number);
|
|
15
|
+
static decodeModelIndex(pixels: Uint8Array, offset: number): number | undefined;
|
|
16
|
+
static decodeTreeIndex(pixels: Uint8Array, offset: number): number;
|
|
17
|
+
static unpackDepth(pixels: Uint8Array, offset: number): number;
|
|
18
|
+
getHit(normalizedCoords: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}): CadPickBufferHit | undefined;
|
|
22
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { WebGLRenderer } from 'three';
|
|
2
|
+
import { IntersectInput } from '../../../model-base';
|
|
3
|
+
import { CadMaterialManager } from '../../../rendering';
|
|
4
|
+
import { SceneHandler } from '../../../utilities';
|
|
5
|
+
import { CadNode } from '../wrappers/CadNode';
|
|
6
|
+
import { IntersectCadNodesResult } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Full-frame pick cache. Renders the tree index and depth of all visible models in one pass each
|
|
9
|
+
* and serves picks from the CPU copy until the scene is rendered again.
|
|
10
|
+
*/
|
|
11
|
+
export declare class CadPickCache {
|
|
12
|
+
private static readonly REBUILD_HOLDOFF_MS;
|
|
13
|
+
private static readonly MAX_CACHED_MODELS;
|
|
14
|
+
private readonly _clearColor;
|
|
15
|
+
private readonly _clearAlpha;
|
|
16
|
+
private readonly _renderTarget;
|
|
17
|
+
private readonly _pipelineExecutor;
|
|
18
|
+
private readonly _depthRenderPipeline;
|
|
19
|
+
private readonly _treeIndexRenderPipeline;
|
|
20
|
+
private _cache;
|
|
21
|
+
private _invalidationCount;
|
|
22
|
+
private _lastInvalidatedAt;
|
|
23
|
+
private _isDisposed;
|
|
24
|
+
constructor(renderer: WebGLRenderer, materialManager: CadMaterialManager, sceneHandler: SceneHandler);
|
|
25
|
+
/**
|
|
26
|
+
* Marks the cache stale. Must be called whenever the camera or scene content that affects picking changes, as the
|
|
27
|
+
* cache does not compare the camera itself.
|
|
28
|
+
*/
|
|
29
|
+
invalidate(): void;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Picks from the cache, rebuilding it first when it is stale and the frame is likely to stay
|
|
33
|
+
* unchanged. Returns undefined when the per-model path should be used instead.
|
|
34
|
+
*/
|
|
35
|
+
intersect(visibleCadNodes: CadNode[], input: IntersectInput, shouldRunAsync: boolean): Promise<IntersectCadNodesResult | undefined>;
|
|
36
|
+
private isUsable;
|
|
37
|
+
/**
|
|
38
|
+
* Renders the tree index and depth of all visible models into full-frame buffers, one pass each,
|
|
39
|
+
* so every pixel holds the hit closest to the camera. Returns false if the result is stale.
|
|
40
|
+
*/
|
|
41
|
+
private build;
|
|
42
|
+
private renderAndReadFullFrame;
|
|
43
|
+
}
|
|
@@ -1,40 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WebGLRenderer } from 'three';
|
|
2
2
|
import { IntersectInput } from '../../../model-base';
|
|
3
3
|
import { CadMaterialManager } from '../../../rendering';
|
|
4
4
|
import { SceneHandler } from '../../../utilities';
|
|
5
5
|
import { CadNode } from '../wrappers/CadNode';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
point: Vector3;
|
|
9
|
-
treeIndex: number;
|
|
10
|
-
cadNode: CadNode;
|
|
11
|
-
object: Object3D;
|
|
12
|
-
};
|
|
6
|
+
import { CadPickCache } from './CadPickCache';
|
|
7
|
+
import { IntersectCadNodesResult } from './types';
|
|
13
8
|
export declare class PickingHandler {
|
|
14
9
|
private readonly _clearColor;
|
|
15
10
|
private readonly _clearAlpha;
|
|
16
11
|
private readonly _raycaster;
|
|
17
12
|
private readonly _pickPixelColorStorage;
|
|
18
|
-
private readonly _rgbaVector;
|
|
19
|
-
/**
|
|
20
|
-
* These factors are used for undoing the `packDepthToRGBA` GLSL operation defined by ThreeJS.
|
|
21
|
-
* They are taken from https://github.com/WestLangley/three.js/blob/bc58fecba18150103b95fbde5aaa3cc7cddf95a7/src/renderers/shaders/ShaderChunk/packing.glsl.js#L19
|
|
22
|
-
*/
|
|
23
|
-
private readonly _unpackFactors;
|
|
24
13
|
private readonly _pipelineExecutor;
|
|
25
14
|
private readonly _depthRenderPipeline;
|
|
26
15
|
private readonly _treeIndexRenderPipeline;
|
|
27
16
|
private readonly _mutex;
|
|
28
|
-
|
|
17
|
+
private readonly _pickCache;
|
|
18
|
+
constructor(renderer: WebGLRenderer, materialManager: CadMaterialManager, sceneHandler: SceneHandler, pickCache?: CadPickCache);
|
|
19
|
+
/**
|
|
20
|
+
* Invalidates the cached full-frame pick buffer. Must be called whenever a new frame of the
|
|
21
|
+
* scene content that affects picking changes (sector loading, styling, clipping or model transforms).
|
|
22
|
+
*/
|
|
23
|
+
invalidatePickCache(): void;
|
|
24
|
+
dispose(): void;
|
|
29
25
|
intersectCadNodes(cadNodes: CadNode[], input: IntersectInput, shouldRunAsync?: boolean): Promise<IntersectCadNodesResult[]>;
|
|
30
26
|
private filterOutOfBoundCadNodes;
|
|
31
27
|
private intersectCadNodeDepth;
|
|
32
28
|
private intersectCadNodeTreeIndex;
|
|
33
29
|
private pickTreeIndex;
|
|
34
|
-
private perspectiveDepthToViewZ;
|
|
35
30
|
private pickDepth;
|
|
36
|
-
private getPosition;
|
|
37
31
|
private pickPixel;
|
|
38
|
-
private unpackRGBAToDepth;
|
|
39
32
|
}
|
|
40
|
-
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PerspectiveCamera, Vector3 } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a non-linear depth in [0, 1] at the given normalized device coordinates
|
|
4
|
+
* to a world space position and its distance from the camera.
|
|
5
|
+
*/
|
|
6
|
+
export declare function depthToIntersection(depth: number, camera: PerspectiveCamera, normalizedCoords: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}): {
|
|
10
|
+
distance: number;
|
|
11
|
+
point: Vector3;
|
|
12
|
+
};
|
|
@@ -3,6 +3,7 @@ import { SectorScene, CadModelMetadata, WantedSector, ConsumedSector, RootSector
|
|
|
3
3
|
import { SectorRepository } from '../../../sector-loader';
|
|
4
4
|
import { ParsedGeometry } from '../../../sector-parser';
|
|
5
5
|
import { CadMaterial } from '../../../rendering';
|
|
6
|
+
import { PickCacheInvalidator } from '../../../utilities';
|
|
6
7
|
import { Plane, Object3DEventMap, Group, Object3D, Matrix4 } from 'three';
|
|
7
8
|
import { TreeIndexToSectorsMap } from '../utilities/TreeIndexToSectorsMap';
|
|
8
9
|
export declare class CadNode extends Object3D<Object3DEventMap & {
|
|
@@ -21,12 +22,13 @@ export declare class CadNode extends Object3D<Object3DEventMap & {
|
|
|
21
22
|
private readonly _cadMaterial;
|
|
22
23
|
private _isDisposed;
|
|
23
24
|
private _needsRedraw;
|
|
25
|
+
private readonly _pickCacheInvalidator;
|
|
24
26
|
private readonly _meshManager;
|
|
25
27
|
readonly treeIndexToSectorsMap: TreeIndexToSectorsMap;
|
|
26
28
|
private readonly _lockedTreeIndices;
|
|
27
29
|
private readonly _lockedSectorIds;
|
|
28
30
|
readonly type = "CadNode";
|
|
29
|
-
constructor(model: CadModelMetadata, sectorRepository: SectorRepository);
|
|
31
|
+
constructor(model: CadModelMetadata, sectorRepository: SectorRepository, pickCacheInvalidator: PickCacheInvalidator);
|
|
30
32
|
get needsRedraw(): boolean;
|
|
31
33
|
resetRedraw(): void;
|
|
32
34
|
get cadMaterial(): CadMaterial;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DataTexture } from 'three';
|
|
2
|
-
import { IndexSet } from '../../utilities';
|
|
2
|
+
import { PickCacheInvalidator, IndexSet } from '../../utilities';
|
|
3
3
|
import { NodeAppearance } from './NodeAppearance';
|
|
4
4
|
import { NodeAppearanceProvider } from './NodeAppearanceProvider';
|
|
5
5
|
export declare class NodeAppearanceTextureBuilder {
|
|
6
6
|
private _defaultAppearance;
|
|
7
7
|
private readonly _styleProvider;
|
|
8
|
+
private readonly _pickCacheInvalidator;
|
|
8
9
|
private readonly _handleStylesChangedListener;
|
|
9
10
|
private _needsUpdate;
|
|
10
11
|
private readonly _allTreeIndices;
|
|
@@ -14,7 +15,7 @@ export declare class NodeAppearanceTextureBuilder {
|
|
|
14
15
|
private readonly _ghostedNodesTreeIndices;
|
|
15
16
|
private readonly _infrontNodesTreeIndices;
|
|
16
17
|
private readonly _visibleNodesTreeIndices;
|
|
17
|
-
constructor(treeIndexCount: number, styleProvider: NodeAppearanceProvider);
|
|
18
|
+
constructor(treeIndexCount: number, styleProvider: NodeAppearanceProvider, pickCacheInvalidator: PickCacheInvalidator);
|
|
18
19
|
getDefaultAppearance(): NodeAppearance;
|
|
19
20
|
/**
|
|
20
21
|
* Sets the default style and invalidates the builder. Note that this causes a full
|
|
@@ -44,6 +45,8 @@ export declare class NodeAppearanceTextureBuilder {
|
|
|
44
45
|
get overrideColorPerTreeIndexTexture(): DataTexture;
|
|
45
46
|
dispose(): void;
|
|
46
47
|
build(): void;
|
|
48
|
+
/** The sets that decide whether a node can be picked: hidden nodes are not visible, ghosted nodes are not drawn. */
|
|
49
|
+
private snapshotPickableSets;
|
|
47
50
|
private populateTexture;
|
|
48
51
|
private populateNodeSets;
|
|
49
52
|
private applyStyleToNodes;
|
|
@@ -4,6 +4,7 @@ import { Potree } from './potree-three-loader';
|
|
|
4
4
|
import { DMDataSourceType, DataSourceType, PointCloudStylableObjectProvider } from '../../data-providers';
|
|
5
5
|
import { IPointClassificationsProvider } from './classificationsProviders/IPointClassificationsProvider';
|
|
6
6
|
import { PointCloudMaterialManager } from '../../rendering';
|
|
7
|
+
import { PickCacheInvalidator } from '../../utilities';
|
|
7
8
|
import { ModelIdentifier } from '../../data-providers/src/ModelIdentifier';
|
|
8
9
|
export declare class PointCloudFactory {
|
|
9
10
|
private readonly _potreeInstance;
|
|
@@ -11,7 +12,8 @@ export declare class PointCloudFactory {
|
|
|
11
12
|
private readonly _pointCloudDMProvider;
|
|
12
13
|
private readonly _classificationsProvider;
|
|
13
14
|
private readonly _pointCloudMaterialManager;
|
|
14
|
-
|
|
15
|
+
private readonly _pickCacheInvalidator;
|
|
16
|
+
constructor(potreeInstance: Potree, pointCloudObjectProvider: PointCloudStylableObjectProvider, pointCloudDMProvider: PointCloudStylableObjectProvider<DMDataSourceType>, classificationsProvider: IPointClassificationsProvider, pointCloudMaterialManager: PointCloudMaterialManager, pickCacheInvalidator: PickCacheInvalidator);
|
|
15
17
|
dispose(): void;
|
|
16
18
|
createModel<T extends DataSourceType>(identifier: T['modelIdentifier'], modelIdentifier: ModelIdentifier, modelMetadata: PointCloudMetadata): Promise<PointCloudNode<T>>;
|
|
17
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PerspectiveCamera, Plane, Scene, WebGLRenderer, Mesh } from 'three';
|
|
2
|
+
import { PickCacheInvalidator } from '../../utilities';
|
|
2
3
|
import { LoadingState } from '../../model-base';
|
|
3
4
|
import { PointCloudFactory } from './PointCloudFactory';
|
|
4
5
|
import { PointCloudNode } from './PointCloudNode';
|
|
@@ -20,12 +21,18 @@ export declare class PointCloudManager {
|
|
|
20
21
|
private readonly _budgetSubject;
|
|
21
22
|
private readonly _renderer;
|
|
22
23
|
private _needsRedraw;
|
|
23
|
-
|
|
24
|
+
private readonly _pickCacheInvalidator;
|
|
25
|
+
constructor(metadataRepository: PointCloudMetadataRepository, materialManager: PointCloudMaterialManager, modelFactory: PointCloudFactory, potreeInstance: Potree, scene: Scene, renderer: WebGLRenderer, pickCacheInvalidator: PickCacheInvalidator);
|
|
24
26
|
requestRedraw(): void;
|
|
25
27
|
resetRedraw(): void;
|
|
26
28
|
get pointBudget(): number;
|
|
27
29
|
set pointBudget(points: number);
|
|
28
30
|
get needsRedraw(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Requests a pick cache invalidation if point buffers were loaded since the last drawn frame. Call
|
|
33
|
+
* before drawing, as drawing marks the loaded buffers as seen.
|
|
34
|
+
*/
|
|
35
|
+
requestPickCacheInvalidationOnUpdatedData(): void;
|
|
29
36
|
set clippingPlanes(planes: Plane[]);
|
|
30
37
|
getLoadingStateObserver(): Observable<LoadingState>;
|
|
31
38
|
updatePointClouds(camera: PerspectiveCamera): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CameraConfiguration } from '../../utilities';
|
|
1
|
+
import { CameraConfiguration, PickCacheInvalidator } from '../../utilities';
|
|
2
2
|
import { ClassificationInfo, PointCloudOctree, PickPoint } from './potree-three-loader';
|
|
3
3
|
import { WellKnownAsprsPointClassCodes } from './types';
|
|
4
4
|
import { PointSizeType, PointColorType, PointShape } from '../../rendering';
|
|
@@ -11,11 +11,13 @@ export declare class PointCloudNode<T extends DataSourceType = DataSourceType> e
|
|
|
11
11
|
private readonly _objectIdToAnnotationsMap;
|
|
12
12
|
private readonly _classificationHandler;
|
|
13
13
|
private _needsRedraw;
|
|
14
|
+
private _clippingPlanes;
|
|
15
|
+
private readonly _pickCacheInvalidator;
|
|
14
16
|
private static readonly pickingWindowSize;
|
|
15
17
|
private readonly _modelIdentifier;
|
|
16
18
|
private readonly _sourceTransform;
|
|
17
19
|
private readonly _customTransform;
|
|
18
|
-
constructor(modelIdentifier: symbol, sourceTransform: Matrix4, octree: PointCloudOctree, annotations: PointCloudObject<T>[], classificationInfo: ClassificationInfo, cameraConfiguration?: CameraConfiguration);
|
|
20
|
+
constructor(modelIdentifier: symbol, sourceTransform: Matrix4, octree: PointCloudOctree, annotations: PointCloudObject<T>[], classificationInfo: ClassificationInfo, pickCacheInvalidator: PickCacheInvalidator, cameraConfiguration?: CameraConfiguration);
|
|
19
21
|
get modelIdentifier(): symbol;
|
|
20
22
|
get octree(): PointCloudOctree;
|
|
21
23
|
get needsRedraw(): boolean;
|
|
@@ -21,8 +21,8 @@ export declare class PointCloudPickingHandler {
|
|
|
21
21
|
constructor(renderer: WebGLRenderer, edlOptions?: EdlOptions);
|
|
22
22
|
dispose(): void;
|
|
23
23
|
/**
|
|
24
|
-
* Invalidates the picker's cached full-frame pick buffer.
|
|
25
|
-
*
|
|
24
|
+
* Invalidates the picker's cached full-frame pick buffer. Call it when scene content that can
|
|
25
|
+
* change what a pick hits has changed.
|
|
26
26
|
*/
|
|
27
27
|
invalidatePickCache(): void;
|
|
28
28
|
intersectPointClouds(nodes: PointCloudNode<DataSourceType>[], input: IntersectInput): Promise<IntersectPointCloudNodeResult<DataSourceType>[]>;
|
|
@@ -3,4 +3,5 @@ import { Scene, WebGLRenderer } from 'three';
|
|
|
3
3
|
import { DMDataSourceType, ModelMetadataProvider, PointCloudStylableObjectProvider, CachedModelDataProvider } from '../../data-providers';
|
|
4
4
|
import { IPointClassificationsProvider } from './classificationsProviders/IPointClassificationsProvider';
|
|
5
5
|
import { PointCloudMaterialManager } from '../../rendering';
|
|
6
|
-
|
|
6
|
+
import { PickCacheInvalidator } from '../../utilities';
|
|
7
|
+
export declare function createPointCloudManager(modelMetadataProvider: ModelMetadataProvider, pointCloudStylableObjectProvider: PointCloudStylableObjectProvider, classificationsProvider: IPointClassificationsProvider, pointCloudDMProvider: PointCloudStylableObjectProvider<DMDataSourceType>, pointCloudMaterialManager: PointCloudMaterialManager, cachedProvider: CachedModelDataProvider, scene: Scene, renderer: WebGLRenderer, pickCacheInvalidator: PickCacheInvalidator): PointCloudManager;
|
|
@@ -16,8 +16,8 @@ export declare class PointCloudOctreePicker {
|
|
|
16
16
|
constructor(renderer: WebGLRenderer);
|
|
17
17
|
dispose(): void;
|
|
18
18
|
/**
|
|
19
|
-
* Invalidates the cached full-frame pick buffer. Must be called whenever
|
|
20
|
-
*
|
|
19
|
+
* Invalidates the cached full-frame pick buffer. Must be called whenever the camera or scene content that
|
|
20
|
+
* affects picking changes (point cloud LOD, styling or clipping), as the cache does not compare the camera itself.
|
|
21
21
|
*/
|
|
22
22
|
invalidateCache(): void;
|
|
23
23
|
pick(camera: Camera, ray: Ray, octrees: PointCloudOctree[], params?: Partial<PickParams>): Promise<PickPoint | null>;
|
|
@@ -18,7 +18,7 @@ export type { StyledTreeIndexSets } from './src/utilities/types';
|
|
|
18
18
|
export { type Materials, initializeDefinesAndUniforms, forEachMaterial } from './src/rendering/materials';
|
|
19
19
|
export type { OctreeMaterialParams } from './src/pointcloud-rendering';
|
|
20
20
|
export { PointCloudMaterial } from './src/pointcloud-rendering';
|
|
21
|
-
export { CadShadowReceiverForCustomObjectMaterial } from './src/rendering/
|
|
21
|
+
export { CustomObjectEffectMaterial, CadShadowReceiverForCustomObjectMaterial, type TextureVariationType } from './src/rendering/CustomObjectEffectMaterial';
|
|
22
22
|
export { DefaultRenderPipelineProvider } from './src/render-pipeline-providers/DefaultRenderPipelineProvider';
|
|
23
23
|
export { CadGeometryRenderModePipelineProvider } from './src/render-pipeline-providers/CadGeometryRenderModePipelineProvider';
|
|
24
24
|
export { BasicPipelineExecutor } from './src/pipeline-executors/BasicPipelineExecutor';
|
|
@@ -2,7 +2,7 @@ import { Camera, Plane, RawShaderMaterial, Texture } from 'three';
|
|
|
2
2
|
import { Materials } from './rendering/materials';
|
|
3
3
|
import { RenderMode } from './rendering/RenderMode';
|
|
4
4
|
import { NodeAppearance, ClippingPlanesProvider, NodeAppearanceProvider, NodeAppearanceTextureBuilder, NodeTransformProvider, NodeTransformTextureBuilder } from '../../cad-styling';
|
|
5
|
-
import { IndexSet } from '../../utilities';
|
|
5
|
+
import { IndexSet, PickCacheInvalidator } from '../../utilities';
|
|
6
6
|
export type CadMaterial = {
|
|
7
7
|
materials: Materials;
|
|
8
8
|
nodeAppearanceProvider: NodeAppearanceProvider;
|
|
@@ -23,6 +23,8 @@ export declare class CadMaterialManager {
|
|
|
23
23
|
private _cadLightingEnabled;
|
|
24
24
|
private _clippingPlanes;
|
|
25
25
|
private _needsRedraw;
|
|
26
|
+
private readonly _pickCacheInvalidator;
|
|
27
|
+
constructor(pickCacheInvalidator: PickCacheInvalidator);
|
|
26
28
|
addModelMaterials(modelIdentifier: symbol, cadMaterial: CadMaterial): void;
|
|
27
29
|
removeModelMaterials(modelIdentifier: symbol): void;
|
|
28
30
|
addTexturedMeshMaterial(modelIdentifier: symbol, sectorId: number, texture: Texture): RawShaderMaterial;
|
|
@@ -49,4 +51,4 @@ export declare class CadMaterialManager {
|
|
|
49
51
|
private applyToAllMaterials;
|
|
50
52
|
private initializeDefinesAndUniforms;
|
|
51
53
|
}
|
|
52
|
-
export declare function createCadMaterial(maxTreeIndex: number): CadMaterial;
|
|
54
|
+
export declare function createCadMaterial(maxTreeIndex: number, pickCacheInvalidator: PickCacheInvalidator): CadMaterial;
|
package/dist/packages/rendering/src/pointcloud-rendering/PointCloudObjectAppearanceTexture.d.ts
CHANGED
|
@@ -16,7 +16,13 @@ export declare class PointCloudObjectAppearanceTexture {
|
|
|
16
16
|
private setObjectStyle;
|
|
17
17
|
private setObjectCollectionStyle;
|
|
18
18
|
private resetTexture;
|
|
19
|
+
/**
|
|
20
|
+
* Called when rebuilding the texture changed the visibility of at least one object. Only visibility affects
|
|
21
|
+
* what can be picked, so color-only style changes do not call it.
|
|
22
|
+
*/
|
|
23
|
+
onVisibilityChanged: (() => void) | undefined;
|
|
19
24
|
onBeforeRender(): void;
|
|
25
|
+
private copyVisibility;
|
|
20
26
|
assignStyledObjectSet(styledCollection: StyledPointCloudVolumeCollection<DataSourceType>): void;
|
|
21
27
|
removeStyledObjectSet(collection: StyledPointCloudVolumeCollection<DataSourceType>['volumeCollection']): void;
|
|
22
28
|
removeAllStyledObjectSets(): void;
|
|
@@ -3,7 +3,6 @@ import { PostProcessingObjectsVisibilityParameters } from './types';
|
|
|
3
3
|
import { RenderPass } from '../RenderPass';
|
|
4
4
|
import { CadShadowPassFactories } from './CadShadowPass';
|
|
5
5
|
import { PostProcessingPipelineOptions } from '../render-pipeline-providers/types';
|
|
6
|
-
import { ICustomObject } from '../../../utilities';
|
|
7
6
|
/**
|
|
8
7
|
* Single pass that applies post processing effects and
|
|
9
8
|
* combines results from geometry passes.
|
|
@@ -19,13 +18,9 @@ export declare class PostProcessingPass implements RenderPass {
|
|
|
19
18
|
private readonly _cadShadowMap;
|
|
20
19
|
private readonly _backBlitMaterial;
|
|
21
20
|
private readonly setBlendFactorByBackVisibility;
|
|
22
|
-
private _receiversForCustomObjectsEnabled;
|
|
23
21
|
updateRenderObjectsVisibility(visibilityParameters: PostProcessingObjectsVisibilityParameters): void;
|
|
24
22
|
constructor(scene: Scene, postProcessingPipelineOptions: PostProcessingPipelineOptions, cadShadowPassDependencies?: Partial<CadShadowPassFactories>);
|
|
25
23
|
setSize(width: number, height: number): void;
|
|
26
|
-
adoptCustomObject(customObject: ICustomObject): void;
|
|
27
|
-
releaseCustomObject(customObject: ICustomObject): void;
|
|
28
|
-
setReceiversForCustomObjectsEnabled(enabled: boolean): void;
|
|
29
24
|
render(renderer: WebGLRenderer, camera: Camera): void;
|
|
30
25
|
private renderCadShadows;
|
|
31
26
|
dispose(): void;
|