@cognite/reveal 4.37.0 → 4.38.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-AfUP5xy8.js.map +1 -0
- package/dist/index.js +3099 -2547
- package/dist/index.js.map +1 -1
- package/dist/packages/api/src/public/RevealManager.d.ts +2 -0
- package/dist/packages/api/src/public/RevealOptions.d.ts +1 -0
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +21 -0
- package/dist/packages/api/src/public/migration/renderOptionsHelpers.d.ts +6 -1
- package/dist/packages/api/src/public/migration/types.d.ts +9 -0
- package/dist/packages/api/src/public/types.d.ts +1 -1
- package/dist/packages/pointclouds/src/PointCloudPickingHandler.d.ts +17 -2
- package/dist/packages/rendering/index.d.ts +2 -0
- package/dist/packages/rendering/src/CadMaterialManager.d.ts +6 -1
- 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 +1 -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 +12 -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/CadShadowReceiverForCustomObjectMaterial.d.ts +15 -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 +1 -0
- package/dist/packages/utilities/src/SceneHandler.d.ts +2 -0
- package/dist/packages/utilities/src/customObject/CustomObject.d.ts +8 -0
- package/dist/packages/utilities/src/customObject/ICustomObject.d.ts +6 -0
- package/dist/packages/utilities/src/renderContextState.d.ts +4 -0
- package/package.json +6 -6
- package/dist/assets/eptBinaryDecoder.worker-C6kIzxA1.js.map +0 -1
|
@@ -45,6 +45,8 @@ export declare class RevealManager {
|
|
|
45
45
|
get cadLoadedStatistics(): CadModelSectorLoadStatistics;
|
|
46
46
|
get cadRenderMode(): RenderMode;
|
|
47
47
|
set cadRenderMode(renderMode: RenderMode);
|
|
48
|
+
get shadowsEnabled(): boolean;
|
|
49
|
+
set shadowsEnabled(enabled: boolean);
|
|
48
50
|
get pointCloudBudget(): PointCloudBudget;
|
|
49
51
|
set pointCloudBudget(budget: PointCloudBudget);
|
|
50
52
|
set clippingPlanes(clippingPlanes: Plane[]);
|
|
@@ -24,6 +24,8 @@ export declare class Cognite3DViewer<DataSourceT extends DataSourceType = Classi
|
|
|
24
24
|
private readonly _domElementResizeObserver;
|
|
25
25
|
private readonly _image360ApiHelper;
|
|
26
26
|
private readonly _unsubsribeOnLoading;
|
|
27
|
+
private _onContextLost;
|
|
28
|
+
private _onContextRestored;
|
|
27
29
|
/**
|
|
28
30
|
* Returns the rendering canvas, the DOM element where the renderer draws its output.
|
|
29
31
|
*/
|
|
@@ -83,6 +85,19 @@ export declare class Cognite3DViewer<DataSourceT extends DataSourceType = Classi
|
|
|
83
85
|
* budget is shared between all added CAD models and not a per-model budget.
|
|
84
86
|
*/
|
|
85
87
|
set cadBudget(budget: CadModelBudget);
|
|
88
|
+
/**
|
|
89
|
+
* Gets whether CAD shadows are currently enabled.
|
|
90
|
+
* @beta
|
|
91
|
+
*/
|
|
92
|
+
get shadowsEnabled(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Enables or disables CAD shadows at runtime, along with the world-space sun shading
|
|
95
|
+
* that matches them. Turning shadows on changes the CAD look even where no shadow is
|
|
96
|
+
* cast, including ghosted nodes. The GPU resources are allocated the first time shadows
|
|
97
|
+
* are enabled.
|
|
98
|
+
* @beta
|
|
99
|
+
*/
|
|
100
|
+
set shadowsEnabled(enabled: boolean);
|
|
86
101
|
/**
|
|
87
102
|
* Returns the point cloud budget. The budget is shared between all loaded
|
|
88
103
|
* point cloud models.
|
|
@@ -98,6 +113,12 @@ export declare class Cognite3DViewer<DataSourceT extends DataSourceType = Classi
|
|
|
98
113
|
*/
|
|
99
114
|
get models(): CogniteModel<DataSourceT>[];
|
|
100
115
|
constructor(options: Cognite3DViewerOptions);
|
|
116
|
+
/**
|
|
117
|
+
* Listens for render context loss/restore. On loss, prevents the default (so the
|
|
118
|
+
* browser attempts recovery) and sets `isRenderContextLost()`; on restore, clears
|
|
119
|
+
* the flag and requests a redraw.
|
|
120
|
+
*/
|
|
121
|
+
private registerContextLossHandlers;
|
|
101
122
|
/**
|
|
102
123
|
* Get resolution options that are set on the viewer. This includes
|
|
103
124
|
* settings for max resolution and limiting resolution when moving the camera.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SsaoParameters, AntiAliasingMode } from '../../../../rendering';
|
|
1
|
+
import { EdlOptions, SsaoParameters, AntiAliasingMode } from '../../../../rendering';
|
|
2
2
|
import { DeviceDescriptor } from '../../../../utilities';
|
|
3
3
|
import { PropType } from '../../utilities/reflection';
|
|
4
4
|
import { Cognite3DViewerOptions } from './types';
|
|
@@ -30,4 +30,9 @@ export declare function determineSsaoRenderParameters(qualityHint: SsaoQualityHi
|
|
|
30
30
|
* @param devicePixelRatio Device pixel ratio set on the renderer.
|
|
31
31
|
*/
|
|
32
32
|
export declare function determineResolutionCap(rendererResolutionThreshold: number | undefined, device: DeviceDescriptor, devicePixelRatio: number): number;
|
|
33
|
+
/**
|
|
34
|
+
* Create EDL options from input options. The radius is clamped to the maximum supported radius.
|
|
35
|
+
* @param inputOptions
|
|
36
|
+
*/
|
|
37
|
+
export declare function createCompleteEdlOptions(inputOptions?: Partial<EdlOptions> | 'disabled'): EdlOptions;
|
|
33
38
|
export {};
|
|
@@ -147,6 +147,15 @@ export interface Cognite3DViewerOptions {
|
|
|
147
147
|
* Enables / disables visualizing the edges of geometry. Defaults to true.
|
|
148
148
|
*/
|
|
149
149
|
enableEdges?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Enables shadows cast by CAD geometry, and the world-space sun shading that goes with
|
|
152
|
+
* them. Turning shadows on changes the CAD look even where no shadow is cast, including
|
|
153
|
+
* ghosted nodes. Defaults to false. Can also be toggled at runtime through
|
|
154
|
+
* {@link Cognite3DViewer.shadowsEnabled}.
|
|
155
|
+
* GPU resources for shadows are only allocated the first time they are enabled.
|
|
156
|
+
* @beta
|
|
157
|
+
*/
|
|
158
|
+
enableShadows?: boolean;
|
|
150
159
|
/** Callback to download stream progress. */
|
|
151
160
|
onLoading?: OnLoadingCallback;
|
|
152
161
|
/**
|
|
@@ -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 } from '../../../rendering';
|
|
10
|
+
export { PointShape, PointColorType, PointSizeType, CadShadowReceiverForCustomObjectMaterial } from '../../../rendering';
|
|
11
11
|
/**
|
|
12
12
|
* A tuple of a 360 image and its collection.
|
|
13
13
|
*/
|
|
@@ -3,13 +3,22 @@ import { IntersectInput } from '../../model-base';
|
|
|
3
3
|
import { PointCloudNode } from './PointCloudNode';
|
|
4
4
|
import { DataSourceType } from '../../data-providers';
|
|
5
5
|
import { IntersectPointCloudNodeResult } from './types';
|
|
6
|
+
import { EdlOptions } from '../../rendering';
|
|
6
7
|
export declare class PointCloudPickingHandler {
|
|
7
8
|
private readonly _normalized;
|
|
9
|
+
private readonly _drawingBufferSize;
|
|
8
10
|
private readonly _raycaster;
|
|
11
|
+
private readonly _renderer;
|
|
9
12
|
private readonly _picker;
|
|
13
|
+
private readonly _edlOptions;
|
|
10
14
|
private readonly _mutex;
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
/**
|
|
16
|
+
* @param renderer Renderer used for the pick render.
|
|
17
|
+
* @param edlOptions EDL options the point clouds are rendered with, if any. EDL shades empty pixels
|
|
18
|
+
* within its radius of a point, closing small gaps on screen that the pick render (which has no EDL)
|
|
19
|
+
* still sees as empty, so the pick window is widened to cover that radius.
|
|
20
|
+
*/
|
|
21
|
+
constructor(renderer: WebGLRenderer, edlOptions?: EdlOptions);
|
|
13
22
|
dispose(): void;
|
|
14
23
|
/**
|
|
15
24
|
* Invalidates the picker's cached full-frame pick buffer. Must be called whenever a new
|
|
@@ -17,4 +26,10 @@ export declare class PointCloudPickingHandler {
|
|
|
17
26
|
*/
|
|
18
27
|
invalidatePickCache(): void;
|
|
19
28
|
intersectPointClouds(nodes: PointCloudNode<DataSourceType>[], input: IntersectInput): Promise<IntersectPointCloudNodeResult<DataSourceType>[]>;
|
|
29
|
+
private getPickWindowSize;
|
|
20
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Pick window size in drawing buffer pixels. Odd, so the window is centered on the pick position.
|
|
33
|
+
* Wide enough to cover the EDL outline, which is drawn around points on screen but not in the pick render.
|
|
34
|
+
*/
|
|
35
|
+
export declare function computePickWindowSize(edlOptions: EdlOptions | undefined, drawingBufferHeight: number): number;
|
|
@@ -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 { CadShadowReceiverForCustomObjectMaterial } from './src/rendering/CadShadowReceiverForCustomObjectMaterial';
|
|
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,4 +1,4 @@
|
|
|
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';
|
|
@@ -18,6 +18,9 @@ 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;
|
|
23
26
|
addModelMaterials(modelIdentifier: symbol, cadMaterial: CadMaterial): void;
|
|
@@ -35,6 +38,8 @@ export declare class CadMaterialManager {
|
|
|
35
38
|
getModelVisibleTreeIndices(modelIdentifier: symbol): IndexSet;
|
|
36
39
|
setRenderMode(mode: RenderMode): void;
|
|
37
40
|
getRenderMode(): RenderMode;
|
|
41
|
+
setCadLightingEnabled(enabled: boolean): void;
|
|
42
|
+
updateViewLighting(camera: Camera): void;
|
|
38
43
|
resetRedraw(): void;
|
|
39
44
|
dispose(): void;
|
|
40
45
|
private updateClippingPlanesForModel;
|
|
@@ -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>>;
|
|
@@ -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,7 +1,9 @@
|
|
|
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';
|
|
6
|
+
import { ICustomObject } from '../../../utilities';
|
|
5
7
|
/**
|
|
6
8
|
* Single pass that applies post processing effects and
|
|
7
9
|
* combines results from geometry passes.
|
|
@@ -13,9 +15,18 @@ export declare class PostProcessingPass implements RenderPass {
|
|
|
13
15
|
private readonly _postProcessingObjects;
|
|
14
16
|
private readonly _pointcloudBlitMaterial;
|
|
15
17
|
private readonly _postProcessingOptions;
|
|
18
|
+
private readonly _cadShadowPass;
|
|
19
|
+
private readonly _cadShadowMap;
|
|
20
|
+
private readonly _backBlitMaterial;
|
|
16
21
|
private readonly setBlendFactorByBackVisibility;
|
|
22
|
+
private _receiversForCustomObjectsEnabled;
|
|
17
23
|
updateRenderObjectsVisibility(visibilityParameters: PostProcessingObjectsVisibilityParameters): void;
|
|
18
|
-
constructor(scene: Scene, postProcessingPipelineOptions: PostProcessingPipelineOptions);
|
|
24
|
+
constructor(scene: Scene, postProcessingPipelineOptions: PostProcessingPipelineOptions, cadShadowPassDependencies?: Partial<CadShadowPassFactories>);
|
|
25
|
+
setSize(width: number, height: number): void;
|
|
26
|
+
adoptCustomObject(customObject: ICustomObject): void;
|
|
27
|
+
releaseCustomObject(customObject: ICustomObject): void;
|
|
28
|
+
setReceiversForCustomObjectsEnabled(enabled: boolean): void;
|
|
19
29
|
render(renderer: WebGLRenderer, camera: Camera): void;
|
|
30
|
+
private renderCadShadows;
|
|
20
31
|
dispose(): void;
|
|
21
32
|
}
|
|
@@ -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,15 @@
|
|
|
1
|
+
import { Camera, ColorRepresentation, Texture, WebGLRenderer, Scene, RawShaderMaterial } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Surface on a custom object that samples a color or texture and receives CAD shadows.
|
|
4
|
+
* The viewer creates one for each up-facing plane that receives shadows.
|
|
5
|
+
* A skybox stays on its own material when `receiveShadow` is false.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class CadShadowReceiverForCustomObjectMaterial extends RawShaderMaterial {
|
|
9
|
+
private static frameShadowMap;
|
|
10
|
+
constructor(color?: ColorRepresentation, map?: Texture | null);
|
|
11
|
+
onBeforeRender(_renderer: WebGLRenderer, _scene: Scene, camera: Camera, _geometry: unknown, _object: unknown, _group: unknown): void;
|
|
12
|
+
setMap(map: Texture | null): void;
|
|
13
|
+
setColor(color: ColorRepresentation): void;
|
|
14
|
+
private refreshMapTransform;
|
|
15
|
+
}
|
|
@@ -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 {};
|
|
@@ -61,6 +61,7 @@ export { isPointVisibleByPlanes } from './src/three/isPointVisibleByPlanes';
|
|
|
61
61
|
export { CDF_TO_VIEWER_TRANSFORMATION } from './src/constants';
|
|
62
62
|
export { createUint8View } from './src/createUint8View';
|
|
63
63
|
export { isDefined } from './src/isDefined';
|
|
64
|
+
export { isRenderContextLost, setRenderContextLost } from './src/renderContextState';
|
|
64
65
|
export * from './src/fdm';
|
|
65
66
|
export * from './src/assetMappings';
|
|
66
67
|
export * from './src/shapes';
|
|
@@ -5,6 +5,8 @@ export declare class SceneHandler {
|
|
|
5
5
|
private readonly _cadModels;
|
|
6
6
|
private readonly _pointCloudModels;
|
|
7
7
|
private readonly _customObjects;
|
|
8
|
+
onCustomObjectAdded: ((customObject: ICustomObject) => void) | undefined;
|
|
9
|
+
onCustomObjectRemoved: ((customObject: ICustomObject) => void) | undefined;
|
|
8
10
|
get scene(): Scene;
|
|
9
11
|
get cadModels(): {
|
|
10
12
|
cadNode: Object3D;
|
|
@@ -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,13 @@ 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
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
get receiveShadow(): boolean;
|
|
61
|
+
set receiveShadow(value: boolean);
|
|
54
62
|
/**
|
|
55
63
|
* Get the bounding box from the object
|
|
56
64
|
* @beta
|
|
@@ -36,6 +36,12 @@ 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
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
readonly receiveShadow?: boolean;
|
|
39
45
|
/**
|
|
40
46
|
* Get the bounding box from the object
|
|
41
47
|
* @beta
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.38.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": {
|
|
@@ -85,12 +85,12 @@
|
|
|
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.
|
|
88
|
+
"@types/three": "^0.186.0",
|
|
89
89
|
"@vitest/coverage-v8": "^4.1.7",
|
|
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",
|
|
@@ -101,7 +101,7 @@
|
|
|
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",
|
|
@@ -112,10 +112,10 @@
|
|
|
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.11.2"
|
|
121
121
|
}
|