@cognite/reveal 4.28.6 → 4.28.7-dev.20260108
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 +136 -136
- package/dist/index.js.map +1 -1
- package/dist/packages/3d-overlays/src/IconOctree.d.ts +52 -1
- package/dist/packages/cad-geometry-loaders/src/CadManager.d.ts +0 -2
- package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +3 -5
- package/dist/packages/rendering/index.d.ts +1 -1
- package/dist/packages/rendering/src/CadMaterialManager.d.ts +14 -6
- package/dist/packages/rendering/src/rendering/materials.d.ts +1 -1
- package/dist/packages/utilities/src/fdm/typeGuards.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,15 +2,66 @@
|
|
|
2
2
|
* Copyright 2023 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import { Node, PointOctant, PointOctree } from 'sparse-octree';
|
|
5
|
-
import { Box3, Matrix4 } from 'three';
|
|
5
|
+
import { Box3, Matrix4, Vector3 } from 'three';
|
|
6
6
|
import { Overlay3DIcon } from './Overlay3DIcon';
|
|
7
7
|
import { DefaultOverlay3DContentType } from './OverlayCollection';
|
|
8
8
|
export declare class IconOctree<ContentType = DefaultOverlay3DContentType> extends PointOctree<Overlay3DIcon<ContentType>> {
|
|
9
9
|
private readonly _nodeCenters;
|
|
10
|
+
private readonly _distanceBoxChecker;
|
|
10
11
|
static getMinimalOctreeBoundsFromIcons<ContentType>(icons: Overlay3DIcon<ContentType>[]): Box3;
|
|
11
12
|
constructor(icons: Overlay3DIcon<ContentType>[], bounds: Box3, maxLeafSize: number);
|
|
12
13
|
getNodeIcon(node: Node): Overlay3DIcon | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Get all icons from a node's subtree recursively
|
|
16
|
+
* @param node - The octree node to get icons from
|
|
17
|
+
* @returns Array of Overlay3DIcons contained in the node's subtree
|
|
18
|
+
*/
|
|
19
|
+
getAllIconsFromNode(node: Node): Overlay3DIcon<ContentType>[];
|
|
20
|
+
/**
|
|
21
|
+
* Check if a node or any of its descendants exists in the given set
|
|
22
|
+
* @param node - The octree node to check
|
|
23
|
+
* @param nodeSet - Set of nodes to check against
|
|
24
|
+
* @returns True if the node or any descendant is in the set, false otherwise
|
|
25
|
+
*/
|
|
26
|
+
hasDescendantInSet(node: Node, nodeSet: Set<Node>): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get LOD nodes based on projected screen area.
|
|
29
|
+
* Nodes with projected area above the threshold are expanded,
|
|
30
|
+
* while those below are selected as LOD representatives.
|
|
31
|
+
* @param areaThreshold - Screen area threshold (0 to 1) for LOD selection
|
|
32
|
+
* @param projection - View projection matrix
|
|
33
|
+
* @param minimumLevel - Minimum octree level to expand to (default: 0)
|
|
34
|
+
* @returns Set of PointOctant nodes selected for LOD based on screen area
|
|
35
|
+
*/
|
|
13
36
|
getLODByScreenArea(areaThreshold: number, projection: Matrix4, minimumLevel?: number): Set<PointOctant<Overlay3DIcon>>;
|
|
37
|
+
/**
|
|
38
|
+
* Get LOD nodes based purely on camera distance.
|
|
39
|
+
* This provides consistent behavior regardless of view angle.
|
|
40
|
+
*
|
|
41
|
+
* @param cameraPosition - Camera position in model space
|
|
42
|
+
* @param distanceThreshold - Distance from camera within which all icons are shown (no clustering)
|
|
43
|
+
* @param clusteringLevel - The octree level at which to cluster far icons (higher = finer clusters)
|
|
44
|
+
* @returns Set of PointOctant nodes selected for LOD based on distance
|
|
45
|
+
*/
|
|
46
|
+
getLODByDistance(cameraPosition: Vector3 | undefined, distanceThreshold: number, clusteringLevel?: number): Set<PointOctant<Overlay3DIcon>>;
|
|
47
|
+
/**
|
|
48
|
+
* Get all icons from a node's subtree that are within the given distance from a point.
|
|
49
|
+
* Also returns the representative icon if no close icons are found (for clustering).
|
|
50
|
+
*
|
|
51
|
+
* @param node - The octree node to get icons from
|
|
52
|
+
* @param cameraPosition - Camera position for distance calculation
|
|
53
|
+
* @param distanceThreshold - Distance threshold for "close" icons
|
|
54
|
+
* @returns Object containing close icons and whether to show representative
|
|
55
|
+
*/
|
|
56
|
+
getIconsFromClusteredNode(node: Node, cameraPosition: Vector3, distanceThreshold: number): Overlay3DIcon<ContentType | DefaultOverlay3DContentType>[];
|
|
57
|
+
/**
|
|
58
|
+
* Check if any icon in the node's subtree is within the given distance from a point
|
|
59
|
+
* @param node - The octree node to check
|
|
60
|
+
* @param point - The point to measure distance from
|
|
61
|
+
* @param distance - Distance threshold
|
|
62
|
+
* @returns True if any icon is within distance, false otherwise
|
|
63
|
+
*/
|
|
64
|
+
private isNodeWithinDistance;
|
|
14
65
|
private populateNodeCenters;
|
|
15
66
|
private filterEmptyLeaves;
|
|
16
67
|
private hasChildren;
|
|
@@ -20,7 +20,6 @@ export declare class CadManager {
|
|
|
20
20
|
private _needsRedraw;
|
|
21
21
|
private readonly _loadingStateChangedTrigger;
|
|
22
22
|
private readonly _markNeedsRedrawBound;
|
|
23
|
-
private readonly _materialsChangedListener;
|
|
24
23
|
private readonly _sectorBufferTime;
|
|
25
24
|
get materialManager(): CadMaterialManager;
|
|
26
25
|
get budget(): CadModelBudget;
|
|
@@ -57,6 +56,5 @@ export declare class CadManager {
|
|
|
57
56
|
*/
|
|
58
57
|
private setCacheSizeForModel;
|
|
59
58
|
private markNeedsRedraw;
|
|
60
|
-
private handleMaterialsChanged;
|
|
61
59
|
private updateTreeIndexToSectorsMap;
|
|
62
60
|
}
|
|
@@ -5,7 +5,7 @@ import { NodeAppearanceProvider, NodeAppearance, PrioritizedArea, type NodeTrans
|
|
|
5
5
|
import { SectorScene, CadModelMetadata, RootSectorNode, WantedSector, ConsumedSector } from '../../../cad-parsers';
|
|
6
6
|
import { SectorRepository } from '../../../sector-loader';
|
|
7
7
|
import { ParsedGeometry } from '../../../sector-parser';
|
|
8
|
-
import { CadMaterialManager,
|
|
8
|
+
import { CadMaterialManager, type CadMaterial } from '../../../rendering';
|
|
9
9
|
import { Group, Object3D, Plane, Matrix4, Object3DEventMap } from 'three';
|
|
10
10
|
import { TreeIndexToSectorsMap } from '../utilities/TreeIndexToSectorsMap';
|
|
11
11
|
import { ParsedMeshGeometry } from '../../../cad-parsers';
|
|
@@ -21,9 +21,9 @@ export declare class CadNode extends Object3D<Object3DEventMap & {
|
|
|
21
21
|
private _geometryBatchingManager?;
|
|
22
22
|
private readonly _sourceTransform;
|
|
23
23
|
private readonly _customTransform;
|
|
24
|
-
private readonly _setModelRenderLayers;
|
|
25
24
|
private readonly _batchedGeometryMeshGroup;
|
|
26
25
|
private readonly _styledTreeIndexSets;
|
|
26
|
+
private readonly _cadMaterial;
|
|
27
27
|
private _isDisposed;
|
|
28
28
|
private _needsRedraw;
|
|
29
29
|
private readonly _meshManager;
|
|
@@ -32,6 +32,7 @@ export declare class CadNode extends Object3D<Object3DEventMap & {
|
|
|
32
32
|
constructor(model: CadModelMetadata, materialManager: CadMaterialManager, sectorRepository: SectorRepository);
|
|
33
33
|
get needsRedraw(): boolean;
|
|
34
34
|
resetRedraw(): void;
|
|
35
|
+
get cadMaterial(): CadMaterial;
|
|
35
36
|
get nodeTransformProvider(): NodeTransformProvider;
|
|
36
37
|
get nodeAppearanceProvider(): NodeAppearanceProvider;
|
|
37
38
|
get defaultNodeAppearance(): NodeAppearance;
|
|
@@ -42,9 +43,6 @@ export declare class CadNode extends Object3D<Object3DEventMap & {
|
|
|
42
43
|
get cadModelIdentifier(): symbol;
|
|
43
44
|
get sectorScene(): SectorScene;
|
|
44
45
|
get rootSector(): RootSectorNode;
|
|
45
|
-
get materialManager(): CadMaterialManager;
|
|
46
|
-
set renderMode(mode: RenderMode);
|
|
47
|
-
get renderMode(): RenderMode;
|
|
48
46
|
get isDisposed(): boolean;
|
|
49
47
|
loadSector(sector: WantedSector, abortSignal?: AbortSignal): Promise<ConsumedSector>;
|
|
50
48
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
export { CadMaterialManager } from './src/CadMaterialManager';
|
|
4
|
+
export { CadMaterialManager, createCadMaterial, CadMaterial } from './src/CadMaterialManager';
|
|
5
5
|
export { PointCloudMaterialManager } from './src/PointCloudMaterialManager';
|
|
6
6
|
export { RenderOptions, defaultRenderOptions, SsaoParameters, SsaoSampleQuality, AntiAliasingMode, EdlOptions } from './src/rendering/types';
|
|
7
7
|
export * from './src/pointcloud-rendering/constants';
|
|
@@ -4,18 +4,25 @@
|
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { Materials } from './rendering/materials';
|
|
6
6
|
import { RenderMode } from './rendering/RenderMode';
|
|
7
|
-
import { NodeAppearance, NodeAppearanceProvider, NodeTransformProvider } from '../../cad-styling';
|
|
7
|
+
import { NodeAppearance, NodeAppearanceProvider, NodeAppearanceTextureBuilder, NodeTransformProvider, NodeTransformTextureBuilder } from '../../cad-styling';
|
|
8
8
|
import { IndexSet } from '../../utilities';
|
|
9
|
+
export type CadMaterial = {
|
|
10
|
+
materials: Materials;
|
|
11
|
+
nodeAppearanceProvider: NodeAppearanceProvider;
|
|
12
|
+
nodeTransformProvider: NodeTransformProvider;
|
|
13
|
+
nodeAppearanceTextureBuilder: NodeAppearanceTextureBuilder;
|
|
14
|
+
nodeTransformTextureBuilder: NodeTransformTextureBuilder;
|
|
15
|
+
matCapTexture: THREE.Texture;
|
|
16
|
+
};
|
|
9
17
|
export declare class CadMaterialManager {
|
|
10
|
-
private readonly _events;
|
|
11
18
|
get clippingPlanes(): THREE.Plane[];
|
|
12
19
|
set clippingPlanes(clippingPlanes: THREE.Plane[]);
|
|
20
|
+
get needsRedraw(): boolean;
|
|
13
21
|
private _renderMode;
|
|
14
22
|
private readonly materialsMap;
|
|
15
23
|
private _clippingPlanes;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
addModelMaterials(modelIdentifier: symbol, maxTreeIndex: number): void;
|
|
24
|
+
private _needsRedraw;
|
|
25
|
+
addModelMaterials(modelIdentifier: symbol, cadMaterial: CadMaterial): void;
|
|
19
26
|
removeModelMaterials(modelIdentifier: symbol): void;
|
|
20
27
|
addTexturedMeshMaterial(modelIdentifier: symbol, sectorId: number, texture: THREE.Texture): THREE.RawShaderMaterial;
|
|
21
28
|
getModelMaterials(modelIdentifier: symbol): Materials;
|
|
@@ -31,12 +38,13 @@ export declare class CadMaterialManager {
|
|
|
31
38
|
getModelVisibleTreeIndices(modelIdentifier: symbol): IndexSet;
|
|
32
39
|
setRenderMode(mode: RenderMode): void;
|
|
33
40
|
getRenderMode(): RenderMode;
|
|
41
|
+
resetRedraw(): void;
|
|
34
42
|
dispose(): void;
|
|
35
43
|
private updateClippingPlanesForModel;
|
|
36
44
|
private updateMaterials;
|
|
37
45
|
private updateTransforms;
|
|
38
46
|
private getModelMaterialsWrapper;
|
|
39
47
|
private applyToAllMaterials;
|
|
40
|
-
private triggerMaterialsChanged;
|
|
41
48
|
private initializeDefinesAndUniforms;
|
|
42
49
|
}
|
|
50
|
+
export declare function createCadMaterial(maxTreeIndex: number): CadMaterial;
|
|
@@ -22,5 +22,5 @@ export interface Materials {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
export declare function forEachMaterial(materials: Materials, callback: (material: THREE.RawShaderMaterial) => void): void;
|
|
25
|
-
export declare function createMaterials(
|
|
25
|
+
export declare function createMaterials(overrideColorPerTreeIndex: THREE.DataTexture, transformOverrideIndexTexture: THREE.DataTexture, transformOverrideLookupTexture: THREE.DataTexture, matCapTexture: THREE.Texture): Materials;
|
|
26
26
|
export declare function initializeDefinesAndUniforms(material: THREE.RawShaderMaterial, overrideColorPerTreeIndex: THREE.DataTexture, transformOverrideIndexTexture: THREE.DataTexture, transformOverrideTexture: THREE.DataTexture, matCapTexture: THREE.Texture, renderMode: RenderMode): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.28.
|
|
3
|
+
"version": "4.28.7-dev.20260108",
|
|
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": {
|