@cognite/reveal 4.37.0 → 4.39.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.
- package/dist/assets/eptBinaryDecoder.worker-DjciQFFi.js.map +1 -0
- package/dist/index.js +6313 -5940
- package/dist/index.js.map +1 -1
- package/dist/packages/api/src/public/RevealManager.d.ts +11 -1
- package/dist/packages/api/src/public/RevealOptions.d.ts +1 -0
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +31 -1
- package/dist/packages/api/src/public/migration/renderOptionsHelpers.d.ts +6 -1
- package/dist/packages/api/src/public/migration/types.d.ts +11 -0
- 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 +19 -4
- 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 +2 -0
- package/dist/packages/rendering/src/CadMaterialManager.d.ts +10 -3
- package/dist/packages/rendering/src/RenderPipelineProvider.d.ts +4 -1
- package/dist/packages/rendering/src/pointcloud-rendering/PointCloudMaterial.d.ts +1 -0
- package/dist/packages/rendering/src/pointcloud-rendering/PointCloudObjectAppearanceTexture.d.ts +7 -0
- package/dist/packages/rendering/src/pointcloud-rendering/constants.d.ts +43 -0
- package/dist/packages/rendering/src/render-passes/CadShadowPass.d.ts +31 -0
- package/dist/packages/rendering/src/render-passes/PostProcessingPass.d.ts +7 -1
- package/dist/packages/rendering/src/render-passes/ShadowMapPass.d.ts +56 -0
- package/dist/packages/rendering/src/render-passes/types.d.ts +3 -0
- package/dist/packages/rendering/src/render-pipeline-providers/DefaultRenderPipelineProvider.d.ts +10 -2
- package/dist/packages/rendering/src/render-pipeline-providers/types.d.ts +19 -1
- package/dist/packages/rendering/src/rendering/CustomObjectEffectMaterial.d.ts +75 -0
- package/dist/packages/rendering/src/rendering/cadLighting.d.ts +5 -0
- package/dist/packages/rendering/src/rendering/shaders.d.ts +1 -0
- package/dist/packages/rendering/src/rendering/types.d.ts +1 -0
- package/dist/packages/utilities/index.d.ts +2 -0
- package/dist/packages/utilities/src/PickCacheInvalidator.d.ts +17 -0
- package/dist/packages/utilities/src/customObject/CustomObject.d.ts +10 -0
- package/dist/packages/utilities/src/customObject/ICustomObject.d.ts +8 -0
- package/dist/packages/utilities/src/renderContextState.d.ts +4 -0
- package/package.json +10 -10
- package/dist/assets/eptBinaryDecoder.worker-C6kIzxA1.js.map +0 -1
- package/dist/packages/data-providers/src/utilities/brotliDecompressTypes.d.ts +0 -6
|
@@ -6,6 +6,7 @@ export { CadMaterialManager, createCadMaterial } from './src/CadMaterialManager'
|
|
|
6
6
|
export { PointCloudMaterialManager } from './src/PointCloudMaterialManager';
|
|
7
7
|
export type { RenderOptions, SsaoParameters, EdlOptions } from './src/rendering/types';
|
|
8
8
|
export { defaultRenderOptions, SsaoSampleQuality, AntiAliasingMode } from './src/rendering/types';
|
|
9
|
+
export { shouldApplyEdl } from './src/render-pipeline-providers/pointCloudParameterUtils';
|
|
9
10
|
export * from './src/pointcloud-rendering/constants';
|
|
10
11
|
export * from './src/pointcloud-rendering/enums';
|
|
11
12
|
export type * from './src/pointcloud-rendering/types';
|
|
@@ -17,6 +18,7 @@ export type { StyledTreeIndexSets } from './src/utilities/types';
|
|
|
17
18
|
export { type Materials, initializeDefinesAndUniforms, forEachMaterial } from './src/rendering/materials';
|
|
18
19
|
export type { OctreeMaterialParams } from './src/pointcloud-rendering';
|
|
19
20
|
export { PointCloudMaterial } from './src/pointcloud-rendering';
|
|
21
|
+
export { CustomObjectEffectMaterial, CadShadowReceiverForCustomObjectMaterial, type TextureVariationType } from './src/rendering/CustomObjectEffectMaterial';
|
|
20
22
|
export { DefaultRenderPipelineProvider } from './src/render-pipeline-providers/DefaultRenderPipelineProvider';
|
|
21
23
|
export { CadGeometryRenderModePipelineProvider } from './src/render-pipeline-providers/CadGeometryRenderModePipelineProvider';
|
|
22
24
|
export { BasicPipelineExecutor } from './src/pipeline-executors/BasicPipelineExecutor';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Plane, RawShaderMaterial, Texture } from 'three';
|
|
1
|
+
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;
|
|
@@ -18,8 +18,13 @@ export declare class CadMaterialManager {
|
|
|
18
18
|
get needsRedraw(): boolean;
|
|
19
19
|
private _renderMode;
|
|
20
20
|
private readonly materialsMap;
|
|
21
|
+
private readonly _cadLightView;
|
|
22
|
+
private readonly _cadUpView;
|
|
23
|
+
private _cadLightingEnabled;
|
|
21
24
|
private _clippingPlanes;
|
|
22
25
|
private _needsRedraw;
|
|
26
|
+
private readonly _pickCacheInvalidator;
|
|
27
|
+
constructor(pickCacheInvalidator: PickCacheInvalidator);
|
|
23
28
|
addModelMaterials(modelIdentifier: symbol, cadMaterial: CadMaterial): void;
|
|
24
29
|
removeModelMaterials(modelIdentifier: symbol): void;
|
|
25
30
|
addTexturedMeshMaterial(modelIdentifier: symbol, sectorId: number, texture: Texture): RawShaderMaterial;
|
|
@@ -35,6 +40,8 @@ export declare class CadMaterialManager {
|
|
|
35
40
|
getModelVisibleTreeIndices(modelIdentifier: symbol): IndexSet;
|
|
36
41
|
setRenderMode(mode: RenderMode): void;
|
|
37
42
|
getRenderMode(): RenderMode;
|
|
43
|
+
setCadLightingEnabled(enabled: boolean): void;
|
|
44
|
+
updateViewLighting(camera: Camera): void;
|
|
38
45
|
resetRedraw(): void;
|
|
39
46
|
dispose(): void;
|
|
40
47
|
private updateClippingPlanesForModel;
|
|
@@ -44,4 +51,4 @@ export declare class CadMaterialManager {
|
|
|
44
51
|
private applyToAllMaterials;
|
|
45
52
|
private initializeDefinesAndUniforms;
|
|
46
53
|
}
|
|
47
|
-
export declare function createCadMaterial(maxTreeIndex: number): CadMaterial;
|
|
54
|
+
export declare function createCadMaterial(maxTreeIndex: number, pickCacheInvalidator: PickCacheInvalidator): CadMaterial;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WebGLRenderer } from 'three';
|
|
1
|
+
import { WebGLRenderer, Vector3 } from 'three';
|
|
2
2
|
import { RenderPass } from './RenderPass';
|
|
3
3
|
/**
|
|
4
4
|
* Defines a provider that provides a set of renderpasses
|
|
@@ -10,4 +10,7 @@ import { RenderPass } from './RenderPass';
|
|
|
10
10
|
export interface RenderPipelineProvider {
|
|
11
11
|
pipeline(renderer: WebGLRenderer): Generator<RenderPass>;
|
|
12
12
|
dispose(): void;
|
|
13
|
+
shadowsEnabled?: boolean;
|
|
14
|
+
setShadowFocus?(focus: Vector3): void;
|
|
15
|
+
readonly needsRedraw?: boolean;
|
|
13
16
|
}
|
|
@@ -48,6 +48,7 @@ export declare class PointCloudMaterial extends RawShaderMaterial {
|
|
|
48
48
|
private readonly _gradient;
|
|
49
49
|
private gradientTexture;
|
|
50
50
|
private _objectAppearanceTexture;
|
|
51
|
+
private _ownsObjectAppearanceTexture;
|
|
51
52
|
private _classification;
|
|
52
53
|
private classificationTexture;
|
|
53
54
|
uniforms: IPointCloudMaterialUniforms & Record<string, IUniform<any>>;
|
package/dist/packages/rendering/src/pointcloud-rendering/PointCloudObjectAppearanceTexture.d.ts
CHANGED
|
@@ -16,11 +16,18 @@ 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;
|
|
23
29
|
set defaultAppearance(appearance: CompletePointCloudAppearance);
|
|
24
30
|
get defaultAppearance(): CompletePointCloudAppearance;
|
|
25
31
|
get objectStyleTexture(): DataTexture;
|
|
32
|
+
dispose(): void;
|
|
26
33
|
}
|
|
@@ -12,5 +12,48 @@ export declare const PERSPECTIVE_CAMERA = "PerspectiveCamera";
|
|
|
12
12
|
export declare const COLOR_BLACK: Color;
|
|
13
13
|
export declare const COLOR_WHITE: Color;
|
|
14
14
|
export declare const DEFAULT_EDL_NEIGHBOURS_COUNT = 16;
|
|
15
|
+
export declare const POINT_SIZE_REFERENCE_SCREEN_HEIGHT = 1080;
|
|
16
|
+
export declare const MAX_EDL_RADIUS = 5;
|
|
17
|
+
/**
|
|
18
|
+
* Half-width, in samples, of the depth-aware gap fill applied while compositing the point
|
|
19
|
+
* cloud. An empty pixel with enough covered neighbours adopts the nearest one, closing the gap
|
|
20
|
+
* without inflating point sizes. Cost is O(radius^2) texture taps per empty pixel per step.
|
|
21
|
+
* 0 disables it.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_POINTCLOUD_GAP_FILL_RADIUS = 2;
|
|
24
|
+
/**
|
|
25
|
+
* Number of strided search widths the gap fill tries per empty pixel: step 1px, 2px, 4px, ...
|
|
26
|
+
* The tight step closes fine gaps seen from a distance; wider steps bridge the large gaps that
|
|
27
|
+
* open up with the camera close. Reaches ~GAP_FILL_RADIUS * 2^(steps-1) pixels.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DEFAULT_POINTCLOUD_GAP_FILL_STEPS = 5;
|
|
30
|
+
/**
|
|
31
|
+
* Largest hole the fill will bridge, in world units (scene metres) at the surrounding
|
|
32
|
+
* surface's depth - NOT pixels. This is what makes the fill camera-distance aware: 0.3 m of
|
|
33
|
+
* surface projects to many pixels up close (big on-screen gaps get filled) but only a few
|
|
34
|
+
* pixels from far away (the model keeps its true silhouette). Independent of the depth checks.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DEFAULT_POINTCLOUD_GAP_FILL_MAX_WORLD_GAP = 0.3;
|
|
37
|
+
/**
|
|
38
|
+
* Depth spread a gap fill tolerates as "one surface", as a fraction of the surface's view-space
|
|
39
|
+
* distance. Covers curvature and noise. Lower = fills only very flat patches, less bleeding
|
|
40
|
+
* across silhouettes; higher = fills more aggressively.
|
|
41
|
+
*/
|
|
42
|
+
export declare const DEFAULT_POINTCLOUD_GAP_FILL_DEPTH_TOLERANCE = 0.02;
|
|
43
|
+
/**
|
|
44
|
+
* Extra depth spread tolerated per world unit of search-window width, to allow steeply grazing
|
|
45
|
+
* surfaces (a floor seen edge-on) whose depth changes fast across the screen. ~tan of the
|
|
46
|
+
* steepest grazing angle still treated as a fillable surface (3 ~= 72 degrees).
|
|
47
|
+
*/
|
|
48
|
+
export declare const DEFAULT_POINTCLOUD_GAP_FILL_GRAZE_TOLERANCE = 3;
|
|
49
|
+
/**
|
|
50
|
+
* Coverage-weight threshold, under point blending, below which a pixel is treated as a gap even
|
|
51
|
+
* though the depth pre-pass gave it valid depth. The depth pre-pass writes full opaque depth for
|
|
52
|
+
* any pixel inside a point's circular footprint, including one right at the sprite's edge that
|
|
53
|
+
* the separate weighted colour pass only gave a sliver of coverage (color.w near 0) - visually a
|
|
54
|
+
* gap, but invisible to a depth>=1 check alone. 0 disables this (only literal depth>=1 gaps are
|
|
55
|
+
* filled).
|
|
56
|
+
*/
|
|
57
|
+
export declare const DEFAULT_POINTCLOUD_GAP_FILL_MIN_COVERAGE_WEIGHT = 0.2;
|
|
15
58
|
export declare const OBJECT_STYLING_TEXTURE_WIDTH = 256;
|
|
16
59
|
export declare const OBJECT_STYLING_TEXTURE_HEIGHT = 256;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Camera, RenderTargetOptions, ShaderMaterialParameters, Texture, WebGLRenderer, RawShaderMaterial, WebGLRenderTarget } from 'three';
|
|
2
|
+
import { RenderPass } from '../RenderPass';
|
|
3
|
+
import { createFullScreenTriangleMesh } from '../utilities/renderUtilities';
|
|
4
|
+
import { CadShadowMap } from '../render-pipeline-providers/types';
|
|
5
|
+
export type CadShadowPassFactories = {
|
|
6
|
+
createRenderTarget: (width: number, height: number, options: RenderTargetOptions) => WebGLRenderTarget;
|
|
7
|
+
createMaterial: (parameters: ShaderMaterialParameters) => RawShaderMaterial;
|
|
8
|
+
createFullScreenTriangleMesh: typeof createFullScreenTriangleMesh;
|
|
9
|
+
};
|
|
10
|
+
export declare const defaultCadShadowPassDependencies: CadShadowPassFactories;
|
|
11
|
+
export declare class CadShadowPass implements RenderPass {
|
|
12
|
+
private readonly _renderTarget;
|
|
13
|
+
private readonly _material;
|
|
14
|
+
private readonly _mesh;
|
|
15
|
+
private readonly _scene;
|
|
16
|
+
private readonly _shadowMap;
|
|
17
|
+
private readonly _clearColor;
|
|
18
|
+
private readonly _focusProbe;
|
|
19
|
+
private readonly _viewProjection;
|
|
20
|
+
private _focusDistance;
|
|
21
|
+
private _disposed;
|
|
22
|
+
constructor(cameraDepthTexture: Texture | null, shadowMap: CadShadowMap, terminatorFade?: number, factories?: Partial<CadShadowPassFactories>);
|
|
23
|
+
get texture(): Texture;
|
|
24
|
+
setSize(width: number, height: number): void;
|
|
25
|
+
render(renderer: WebGLRenderer, camera: Camera): void;
|
|
26
|
+
probeFocus(renderer: WebGLRenderer, camera: Camera): void;
|
|
27
|
+
dispose(): void;
|
|
28
|
+
private issueFocusReading;
|
|
29
|
+
private collectFocusReading;
|
|
30
|
+
private applyFocusReading;
|
|
31
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Camera, Scene, WebGLRenderer } from 'three';
|
|
2
2
|
import { PostProcessingObjectsVisibilityParameters } from './types';
|
|
3
3
|
import { RenderPass } from '../RenderPass';
|
|
4
|
+
import { CadShadowPassFactories } from './CadShadowPass';
|
|
4
5
|
import { PostProcessingPipelineOptions } from '../render-pipeline-providers/types';
|
|
5
6
|
/**
|
|
6
7
|
* Single pass that applies post processing effects and
|
|
@@ -13,9 +14,14 @@ export declare class PostProcessingPass implements RenderPass {
|
|
|
13
14
|
private readonly _postProcessingObjects;
|
|
14
15
|
private readonly _pointcloudBlitMaterial;
|
|
15
16
|
private readonly _postProcessingOptions;
|
|
17
|
+
private readonly _cadShadowPass;
|
|
18
|
+
private readonly _cadShadowMap;
|
|
19
|
+
private readonly _backBlitMaterial;
|
|
16
20
|
private readonly setBlendFactorByBackVisibility;
|
|
17
21
|
updateRenderObjectsVisibility(visibilityParameters: PostProcessingObjectsVisibilityParameters): void;
|
|
18
|
-
constructor(scene: Scene, postProcessingPipelineOptions: PostProcessingPipelineOptions);
|
|
22
|
+
constructor(scene: Scene, postProcessingPipelineOptions: PostProcessingPipelineOptions, cadShadowPassDependencies?: Partial<CadShadowPassFactories>);
|
|
23
|
+
setSize(width: number, height: number): void;
|
|
19
24
|
render(renderer: WebGLRenderer, camera: Camera): void;
|
|
25
|
+
private renderCadShadows;
|
|
20
26
|
dispose(): void;
|
|
21
27
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Box3, Camera, Texture, WebGLRenderer, Matrix4, Vector3 } from 'three';
|
|
2
|
+
import { SceneHandler } from '../../../utilities';
|
|
3
|
+
import { CadMaterialManager } from '../CadMaterialManager';
|
|
4
|
+
import { RenderPass } from '../RenderPass';
|
|
5
|
+
import { CadShadowMap } from '../render-pipeline-providers/types';
|
|
6
|
+
export declare function resolveShadowMapResolution(maxTextureSize: number, mobileOrTablet: boolean): number;
|
|
7
|
+
export declare class ShadowMapPass implements RenderPass, CadShadowMap {
|
|
8
|
+
private readonly _renderTarget;
|
|
9
|
+
private readonly _depthTexture;
|
|
10
|
+
private readonly _lightCamera;
|
|
11
|
+
private readonly _geometryPass;
|
|
12
|
+
private readonly _matrix;
|
|
13
|
+
private readonly _center;
|
|
14
|
+
private readonly _corner;
|
|
15
|
+
private readonly _rayOrigin;
|
|
16
|
+
private readonly _rayDir;
|
|
17
|
+
private readonly _hit;
|
|
18
|
+
private readonly _focusPoint;
|
|
19
|
+
private readonly _boundingSphere;
|
|
20
|
+
private _hasFocus;
|
|
21
|
+
private _focusDistance;
|
|
22
|
+
private _renderedFocusDistance;
|
|
23
|
+
private _focusReadbackPending;
|
|
24
|
+
private _spanLevel;
|
|
25
|
+
private _fullLeft;
|
|
26
|
+
private _fullRight;
|
|
27
|
+
private _fullBottom;
|
|
28
|
+
private _fullTop;
|
|
29
|
+
private _stableTexelWorldSize;
|
|
30
|
+
private _resolution;
|
|
31
|
+
private _texelWorldSize;
|
|
32
|
+
private _depthRange;
|
|
33
|
+
private _hasValidBounds;
|
|
34
|
+
private _userEnabled;
|
|
35
|
+
private readonly _mobileOrTablet;
|
|
36
|
+
constructor(sceneHandler: SceneHandler, materialManager: CadMaterialManager, userEnabled?: boolean, mobileOrTablet?: boolean);
|
|
37
|
+
get depthTexture(): Texture;
|
|
38
|
+
get matrix(): Matrix4;
|
|
39
|
+
get texelWorldSize(): number;
|
|
40
|
+
get stableTexelWorldSize(): number;
|
|
41
|
+
get depthRange(): number;
|
|
42
|
+
get enabled(): boolean;
|
|
43
|
+
get userEnabled(): boolean;
|
|
44
|
+
setEnabled(enabled: boolean): void;
|
|
45
|
+
setFocusPoint(point: Vector3 | null): void;
|
|
46
|
+
setFocusDistance(distance: number | undefined, readbackPending?: boolean): void;
|
|
47
|
+
get focusNeedsRedraw(): boolean;
|
|
48
|
+
setCadBounds(bounds: Box3): void;
|
|
49
|
+
render(renderer: WebGLRenderer, camera?: Camera): void;
|
|
50
|
+
dispose(): void;
|
|
51
|
+
private applyShadowMapResolution;
|
|
52
|
+
private fitWindowToFocus;
|
|
53
|
+
private quantizeSpan;
|
|
54
|
+
private captureStableTexel;
|
|
55
|
+
private updateTexelWorldSize;
|
|
56
|
+
}
|
|
@@ -21,6 +21,7 @@ export type BlitOptions = {
|
|
|
21
21
|
overrideAlpha?: number;
|
|
22
22
|
edges?: boolean;
|
|
23
23
|
outline?: boolean;
|
|
24
|
+
cadShadow?: boolean;
|
|
24
25
|
};
|
|
25
26
|
export type DepthBlendBlitOptions = {
|
|
26
27
|
texture: Texture;
|
|
@@ -37,6 +38,8 @@ export type PointCloudPostProcessingOptions = {
|
|
|
37
38
|
depthTexture: DepthTexture | null;
|
|
38
39
|
pointBlending: boolean;
|
|
39
40
|
edlOptions: EdlOptions;
|
|
41
|
+
/** Half-width in samples of the gap fill. Defaults to DEFAULT_POINTCLOUD_GAP_FILL_RADIUS; 0 disables it. */
|
|
42
|
+
gapFillRadius?: number;
|
|
40
43
|
};
|
|
41
44
|
export declare const transparentBlendOptions: BlendOptions;
|
|
42
45
|
export type ThreeUniforms = {
|
package/dist/packages/rendering/src/render-pipeline-providers/DefaultRenderPipelineProvider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WebGLRenderTarget, WebGLRenderer } from 'three';
|
|
1
|
+
import { Vector3, WebGLRenderTarget, WebGLRenderer } from 'three';
|
|
2
2
|
import { CadMaterialManager } from '../CadMaterialManager';
|
|
3
3
|
import { RenderPass } from '../RenderPass';
|
|
4
4
|
import { RenderPipelineProvider } from '../RenderPipelineProvider';
|
|
@@ -17,17 +17,22 @@ export declare class DefaultRenderPipelineProvider implements RenderPipelineProv
|
|
|
17
17
|
private readonly _cadGeometryRenderPipeline;
|
|
18
18
|
private readonly _pointCloudRenderPipeline;
|
|
19
19
|
private readonly _postProcessingPass;
|
|
20
|
+
private readonly _shadowMapPass;
|
|
20
21
|
private readonly _ssaoPass;
|
|
21
22
|
private readonly _blitToScreenMaterial;
|
|
22
23
|
private readonly _blitToScreenMesh;
|
|
23
24
|
private readonly _materialManager;
|
|
24
25
|
private _rendererStateHelper;
|
|
25
26
|
private _ssaoSampleSize;
|
|
27
|
+
private readonly _cadBounds;
|
|
28
|
+
private readonly _cadModelBounds;
|
|
29
|
+
get shadowsEnabled(): boolean;
|
|
30
|
+
set shadowsEnabled(enabled: boolean);
|
|
26
31
|
set renderOptions(renderOptions: RenderOptions);
|
|
27
32
|
constructor(materialManager: CadMaterialManager, pointCloudMaterialManager: PointCloudMaterialManager, sceneHandler: SceneHandler, renderOptions: RenderOptions, outputRenderTarget?: {
|
|
28
33
|
target: WebGLRenderTarget;
|
|
29
34
|
autoSize?: boolean;
|
|
30
|
-
});
|
|
35
|
+
}, enableShadows?: boolean);
|
|
31
36
|
setOutputRenderTarget(target: WebGLRenderTarget | null, autoSizeRenderTarget?: boolean): void;
|
|
32
37
|
pipeline(renderer: WebGLRenderer): Generator<RenderPass>;
|
|
33
38
|
dispose(): void;
|
|
@@ -35,4 +40,7 @@ export declare class DefaultRenderPipelineProvider implements RenderPipelineProv
|
|
|
35
40
|
private updateRenderTargetSizes;
|
|
36
41
|
private shouldRenderSsao;
|
|
37
42
|
private shouldRenderPointClouds;
|
|
43
|
+
setShadowFocus(focus: Vector3): void;
|
|
44
|
+
get needsRedraw(): boolean;
|
|
45
|
+
private updateShadowCasterBounds;
|
|
38
46
|
}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import { Texture, Vector2, WebGLRenderTarget } from 'three';
|
|
1
|
+
import { Matrix4, Object3D, Texture, Vector2, WebGLRenderTarget } from 'three';
|
|
2
|
+
import { SectorScene } from '../../../cad-parsers';
|
|
2
3
|
import { EdlOptions } from '../rendering/types';
|
|
4
|
+
export type CadNodeLike = Object3D & {
|
|
5
|
+
readonly sectorScene: SectorScene;
|
|
6
|
+
readonly rootSector: Object3D;
|
|
7
|
+
};
|
|
8
|
+
export type CadShadowMap = {
|
|
9
|
+
readonly depthTexture: Texture;
|
|
10
|
+
readonly matrix: Matrix4;
|
|
11
|
+
readonly texelWorldSize: number;
|
|
12
|
+
readonly stableTexelWorldSize: number;
|
|
13
|
+
readonly depthRange: number;
|
|
14
|
+
readonly enabled: boolean;
|
|
15
|
+
setFocusDistance?(distance: number | undefined, readbackPending: boolean): void;
|
|
16
|
+
};
|
|
3
17
|
export type RenderTargetData = {
|
|
4
18
|
currentRenderSize: Vector2;
|
|
5
19
|
ssaoRenderTarget: WebGLRenderTarget;
|
|
@@ -17,7 +31,11 @@ export type PointCloudRenderTargets = {
|
|
|
17
31
|
};
|
|
18
32
|
export type PostProcessingPipelineOptions = CadGeometryRenderTargets & PointCloudRenderTargets & {
|
|
19
33
|
ssaoTexture: Texture;
|
|
34
|
+
cadShadow?: {
|
|
35
|
+
map: CadShadowMap;
|
|
36
|
+
};
|
|
20
37
|
edges: boolean;
|
|
21
38
|
pointBlending?: boolean;
|
|
22
39
|
edlOptions: EdlOptions;
|
|
23
40
|
};
|
|
41
|
+
export type PointCloudBlitUniformName = 'screenWidth' | 'screenHeight' | 'cameraNear' | 'cameraFar' | 'orthographicCamera' | 'worldPerPixel';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ColorRepresentation, Texture, RawShaderMaterial } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Technique that hides the repeat of a tiled texture.
|
|
4
|
+
* - `'none'`: the texture is sampled as is.
|
|
5
|
+
* - `'hexTiling'`: cells rotate and shift the texture. Suits ground such as concrete, gravel and grass.
|
|
6
|
+
* - `'waterTiling'`: cells shift the texture without rotating it, so waves keep their direction.
|
|
7
|
+
* A second, larger copy of the texture is blended in and the contrast is kept. Suits water and ocean.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export type TextureVariationType = 'none' | 'hexTiling' | 'waterTiling';
|
|
11
|
+
/**
|
|
12
|
+
* Opt-in material for custom objects: an effect is compiled into the shader only while requested.
|
|
13
|
+
*
|
|
14
|
+
* {@link CustomObjectEffectMaterial.setReceivesShadow} requests the CAD shadow; the shader recompiles whenever the
|
|
15
|
+
* viewer's shadow map appears or disappears, so give each viewer its own material if shadow state can differ.
|
|
16
|
+
*
|
|
17
|
+
* Only the methods declared here are supported; inherited `RawShaderMaterial` internals may change.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare class CustomObjectEffectMaterial extends RawShaderMaterial {
|
|
21
|
+
private _receivesShadow;
|
|
22
|
+
private _textureVariation;
|
|
23
|
+
/**
|
|
24
|
+
* White and no texture when omitted. Effects are requested afterwards through their setters.
|
|
25
|
+
* @param color - Diffuse color.
|
|
26
|
+
* @param diffuseTexture - Diffuse texture.
|
|
27
|
+
*/
|
|
28
|
+
constructor(color?: ColorRepresentation, diffuseTexture?: Texture | null);
|
|
29
|
+
/** Whether this material requested the CAD shadow. */
|
|
30
|
+
get receivesShadow(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Sets the diffuse texture. Pass null to clear it. A requested texture variation follows the
|
|
33
|
+
* new texture.
|
|
34
|
+
*/
|
|
35
|
+
setDiffuseTexture(texture: Texture | null): void;
|
|
36
|
+
/**
|
|
37
|
+
* Sets the diffuse texture.
|
|
38
|
+
* @deprecated Use {@link CustomObjectEffectMaterial.setDiffuseTexture}.
|
|
39
|
+
*/
|
|
40
|
+
setMap(map: Texture | null): void;
|
|
41
|
+
/**
|
|
42
|
+
* Chooses the technique that hides the repeat of the texture. It is drawn only while the material has a
|
|
43
|
+
* texture; the choice itself is kept, so it may be made before or after the texture is set.
|
|
44
|
+
*/
|
|
45
|
+
setTextureVariation(type: TextureVariationType): void;
|
|
46
|
+
/** The texture variation this material requested. */
|
|
47
|
+
get textureVariation(): TextureVariationType;
|
|
48
|
+
private applyTextureVariation;
|
|
49
|
+
private setEffectEnabled;
|
|
50
|
+
/**
|
|
51
|
+
* Requests or drops the CAD shadow for this material; the request is kept and drawn only while the viewer has
|
|
52
|
+
* shadows enabled (`Cognite3DViewer.shadowsEnabled`), taking effect on the next draw.
|
|
53
|
+
*/
|
|
54
|
+
setReceivesShadow(receivesShadow: boolean): void;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the diffuse color. With a texture, the color multiplies it: white leaves the texture
|
|
57
|
+
* unchanged and any other color tints it.
|
|
58
|
+
*/
|
|
59
|
+
setColor(color: ColorRepresentation): void;
|
|
60
|
+
private updateShadowUniforms;
|
|
61
|
+
private clearShadowUniforms;
|
|
62
|
+
private refreshMapTransform;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Alias for {@link CustomObjectEffectMaterial}.
|
|
66
|
+
* @deprecated Use {@link CustomObjectEffectMaterial}.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export declare const CadShadowReceiverForCustomObjectMaterial: typeof CustomObjectEffectMaterial;
|
|
70
|
+
/**
|
|
71
|
+
* Alias for {@link CustomObjectEffectMaterial}, so the old name still works as a type.
|
|
72
|
+
* @deprecated Use {@link CustomObjectEffectMaterial}.
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export type CadShadowReceiverForCustomObjectMaterial = CustomObjectEffectMaterial;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Camera, Vector3 } from 'three';
|
|
2
|
+
export declare const CAD_LIGHT_WORLD: Vector3;
|
|
3
|
+
export declare const CAD_SHADOW_STRENGTH = 0.4;
|
|
4
|
+
export declare function cadLightDirectionInViewSpace(camera: Camera, target: Vector3): Vector3;
|
|
5
|
+
export declare function cadUpDirectionInViewSpace(camera: Camera, target: Vector3): Vector3;
|
|
@@ -34,5 +34,6 @@ export declare const pointCloudShaders: PointCloudShaders;
|
|
|
34
34
|
*/
|
|
35
35
|
export declare const ssaoShaders: ShaderPair;
|
|
36
36
|
export declare const blitShaders: ShaderPair;
|
|
37
|
+
export declare const cadShadowShaders: ShaderPair;
|
|
37
38
|
export declare const depthBlendBlitShaders: ShaderPair;
|
|
38
39
|
export {};
|
|
@@ -51,6 +51,7 @@ export { LineGeometry } from './src/three/lines/LineGeometry';
|
|
|
51
51
|
export { LineMaterial } from './src/three/lines/LineMaterial';
|
|
52
52
|
export { DeferredPromise } from './src/DeferredPromise';
|
|
53
53
|
export { SceneHandler } from './src/SceneHandler';
|
|
54
|
+
export { PickCacheInvalidator } from './src/PickCacheInvalidator';
|
|
54
55
|
export { CustomObject } from './src/customObject/CustomObject';
|
|
55
56
|
export type { ICustomObject } from './src/customObject/ICustomObject';
|
|
56
57
|
export { CustomObjectIntersectInput } from './src/customObject/CustomObjectIntersectInput';
|
|
@@ -61,6 +62,7 @@ export { isPointVisibleByPlanes } from './src/three/isPointVisibleByPlanes';
|
|
|
61
62
|
export { CDF_TO_VIEWER_TRANSFORMATION } from './src/constants';
|
|
62
63
|
export { createUint8View } from './src/createUint8View';
|
|
63
64
|
export { isDefined } from './src/isDefined';
|
|
65
|
+
export { isRenderContextLost, setRenderContextLost } from './src/renderContextState';
|
|
64
66
|
export * from './src/fdm';
|
|
65
67
|
export * from './src/assetMappings';
|
|
66
68
|
export * from './src/shapes';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2026 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Flag for whether the cached picking results are stale. Set it with {@link PickCacheInvalidator.request} wherever
|
|
6
|
+
* something that can change what a pick hits changes (models, sectors, clipping, transforms, or styling that hides or
|
|
7
|
+
* ghosts objects). Changes that are only drawn but never picked, such as colors or custom objects, should not set it.
|
|
8
|
+
* The camera and canvas size do not need to be set, as the pick caches compare them on every pick.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PickCacheInvalidator {
|
|
11
|
+
private _requested;
|
|
12
|
+
request(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Returns whether an invalidation was requested since the last call, and clears the flag.
|
|
15
|
+
*/
|
|
16
|
+
consume(): boolean;
|
|
17
|
+
}
|
|
@@ -13,6 +13,7 @@ export declare class CustomObject implements ICustomObject {
|
|
|
13
13
|
private _shouldPick;
|
|
14
14
|
private _shouldPickBoundingBox;
|
|
15
15
|
private _useDepthTest;
|
|
16
|
+
private _receiveShadow;
|
|
16
17
|
/**
|
|
17
18
|
* Constructor
|
|
18
19
|
* @beta
|
|
@@ -51,6 +52,15 @@ export declare class CustomObject implements ICustomObject {
|
|
|
51
52
|
*/
|
|
52
53
|
get useDepthTest(): boolean;
|
|
53
54
|
set useDepthTest(value: boolean);
|
|
55
|
+
/**
|
|
56
|
+
* Whether CAD shadows fall on this object.
|
|
57
|
+
* Default is false.
|
|
58
|
+
* @deprecated No longer read. Request the shadow on the material instead with
|
|
59
|
+
* `CustomObjectEffectMaterial.setReceivesShadow`.
|
|
60
|
+
* @beta
|
|
61
|
+
*/
|
|
62
|
+
get receiveShadow(): boolean;
|
|
63
|
+
set receiveShadow(value: boolean);
|
|
54
64
|
/**
|
|
55
65
|
* Get the bounding box from the object
|
|
56
66
|
* @beta
|
|
@@ -36,6 +36,14 @@ export interface ICustomObject {
|
|
|
36
36
|
* @beta
|
|
37
37
|
*/
|
|
38
38
|
get useDepthTest(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether CAD shadows fall on this object.
|
|
41
|
+
* Optional. When omitted, the object does not receive shadows.
|
|
42
|
+
* @deprecated No longer read. Request the shadow on the material instead with
|
|
43
|
+
* `CustomObjectEffectMaterial.setReceivesShadow`.
|
|
44
|
+
* @beta
|
|
45
|
+
*/
|
|
46
|
+
readonly receiveShadow?: boolean;
|
|
39
47
|
/**
|
|
40
48
|
* Get the bounding box from the object
|
|
41
49
|
* @beta
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.39.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": {
|
|
@@ -81,41 +81,41 @@
|
|
|
81
81
|
"@types/jsdom": "^30.0.0",
|
|
82
82
|
"@types/lodash-es": "^4.17.12",
|
|
83
83
|
"@types/mixpanel-browser": "^2.49.0",
|
|
84
|
-
"@types/node": "^
|
|
84
|
+
"@types/node": "^26.0.0",
|
|
85
85
|
"@types/random-seed": "^0.3.5",
|
|
86
86
|
"@types/skmeans": "^0.11.7",
|
|
87
87
|
"@types/stats": "^0.16.30",
|
|
88
|
-
"@types/three": "^0.
|
|
89
|
-
"@vitest/coverage-v8": "^
|
|
88
|
+
"@types/three": "^0.186.0",
|
|
89
|
+
"@vitest/coverage-v8": "^5.0.0",
|
|
90
90
|
"dat.gui": "^0.7.9",
|
|
91
91
|
"eslint": "^10.5.0",
|
|
92
92
|
"eslint-config-prettier": "^10.0.0",
|
|
93
|
-
"eslint-plugin-jsdoc": "^
|
|
93
|
+
"eslint-plugin-jsdoc": "^65.0.0",
|
|
94
94
|
"eslint-plugin-prettier": "^5.1.3",
|
|
95
95
|
"eslint-plugin-unused-imports": "^4.0.0",
|
|
96
96
|
"globals": "^17.0.0",
|
|
97
97
|
"typescript-eslint": "^8.0.0",
|
|
98
98
|
"glob": "^13.0.0",
|
|
99
|
-
"happy-dom": "^
|
|
99
|
+
"happy-dom": "^21.0.0",
|
|
100
100
|
"moq.ts": "10.0.8",
|
|
101
101
|
"prettier": "^3.2.5",
|
|
102
102
|
"shx": "^0.4.0",
|
|
103
103
|
"stats.js": "^0.17.0",
|
|
104
|
-
"three": "0.
|
|
104
|
+
"three": "0.186.1",
|
|
105
105
|
"typescript": "^6.0.3",
|
|
106
106
|
"unplugin-dts": "^1.0.2",
|
|
107
107
|
"vite": "^8.1.0",
|
|
108
108
|
"vite-plugin-glsl": "^1.6.0",
|
|
109
|
-
"vitest": "^
|
|
109
|
+
"vitest": "^5.0.0",
|
|
110
110
|
"vitest-canvas-mock": "^1.1.4",
|
|
111
111
|
"wasm-pack": "^0.15.0"
|
|
112
112
|
},
|
|
113
113
|
"peerDependencies": {
|
|
114
114
|
"@cognite/sdk": "^10.0.0",
|
|
115
|
-
"three": "0.
|
|
115
|
+
"three": "0.186.1"
|
|
116
116
|
},
|
|
117
117
|
"files": [
|
|
118
118
|
"dist"
|
|
119
119
|
],
|
|
120
|
-
"packageManager": "pnpm@12.
|
|
120
|
+
"packageManager": "pnpm@12.15.0"
|
|
121
121
|
}
|