@cognite/reveal 4.0.0-dev.20221122 → 4.0.0-dev.20221124

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.
Files changed (89) hide show
  1. package/dist/index.js +59 -63
  2. package/dist/index.js.map +1 -1
  3. package/dist/packages/api/index.d.ts +1 -0
  4. package/dist/packages/api/src/public/RevealManager.d.ts +1 -1
  5. package/dist/packages/api/src/public/constants.d.ts +11 -0
  6. package/dist/packages/api/src/public/migration/renderOptionsHelpers.d.ts +2 -2
  7. package/dist/packages/api/src/public/migration/types.d.ts +5 -5
  8. package/dist/packages/api/src/public/types.d.ts +3 -3
  9. package/dist/packages/api/src/utilities/Spinner.d.ts +1 -1
  10. package/dist/packages/api/src/utilities/ViewStateHelper.d.ts +3 -3
  11. package/dist/packages/api/src/utilities/reflection.d.ts +1 -1
  12. package/dist/packages/cad-geometry-loaders/src/CadLoadingHints.d.ts +1 -1
  13. package/dist/packages/cad-geometry-loaders/src/CadModelBudget.d.ts +1 -1
  14. package/dist/packages/cad-geometry-loaders/src/InternalRevealCadOptions.d.ts +1 -1
  15. package/dist/packages/cad-geometry-loaders/src/sector/SectorDownloadScheduler.d.ts +1 -1
  16. package/dist/packages/cad-geometry-loaders/src/sector/culling/ByScreenSizeSectorCuller.d.ts +1 -1
  17. package/dist/packages/cad-geometry-loaders/src/sector/culling/types.d.ts +5 -5
  18. package/dist/packages/cad-geometry-loaders/src/utilities/PromiseUtils.d.ts +1 -1
  19. package/dist/packages/cad-model/src/picking/PickingHandler.d.ts +1 -1
  20. package/dist/packages/cad-model/src/types.d.ts +3 -3
  21. package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +9 -6
  22. package/dist/packages/cad-model/src/wrappers/CogniteCadModel.d.ts +8 -40
  23. package/dist/packages/cad-parsers/src/cad/types.d.ts +3 -3
  24. package/dist/packages/cad-parsers/src/metadata/parsers/types.d.ts +8 -8
  25. package/dist/packages/cad-parsers/src/metadata/types.d.ts +5 -5
  26. package/dist/packages/cad-parsers/src/utilities/computeBoundingBoxFromAttributes.d.ts +1 -1
  27. package/dist/packages/cad-styling/src/CdfModelNodeCollectionDataProvider.d.ts +6 -4
  28. package/dist/packages/cad-styling/src/CdfNodeCollectionBase.d.ts +1 -1
  29. package/dist/packages/cad-styling/src/NodeAppearance.d.ts +2 -2
  30. package/dist/packages/cad-styling/src/NodeAppearanceProvider.d.ts +1 -1
  31. package/dist/packages/cad-styling/src/NodeCollectionDeserializer.d.ts +1 -1
  32. package/dist/packages/cad-styling/src/PropertyFilterNodeCollection.d.ts +1 -1
  33. package/dist/packages/cad-styling/src/SerializedNodeCollection.d.ts +1 -1
  34. package/dist/packages/cad-styling/src/prioritized/types.d.ts +1 -1
  35. package/dist/packages/camera-manager/src/types.d.ts +5 -5
  36. package/dist/packages/data-providers/index.d.ts +1 -0
  37. package/dist/packages/data-providers/src/pointcloud-stylable-object-providers/StylableObject.d.ts +2 -2
  38. package/dist/packages/data-providers/src/pointcloud-stylable-object-providers/types.d.ts +3 -3
  39. package/dist/packages/data-providers/src/types.d.ts +2 -2
  40. package/dist/packages/data-providers/src/utilities/applyDefaultModelTransformation.d.ts +1 -0
  41. package/dist/packages/metrics/src/types.d.ts +2 -2
  42. package/dist/packages/model-base/src/SupportedModelTypes.d.ts +1 -1
  43. package/dist/packages/model-base/src/types.d.ts +1 -1
  44. package/dist/packages/nodes-api/src/types.d.ts +2 -2
  45. package/dist/packages/pointcloud-styling/src/PointCloudAppearance.d.ts +2 -2
  46. package/dist/packages/pointclouds/src/CognitePointCloudModel.d.ts +10 -2
  47. package/dist/packages/pointclouds/src/PointCloudBudget.d.ts +1 -1
  48. package/dist/packages/pointclouds/src/PointCloudIntersection.d.ts +1 -1
  49. package/dist/packages/pointclouds/src/PointCloudNode.d.ts +7 -4
  50. package/dist/packages/pointclouds/src/potree-three-loader/loading/ClassificationInfo.d.ts +3 -3
  51. package/dist/packages/pointclouds/src/potree-three-loader/loading/EptJson.d.ts +3 -3
  52. package/dist/packages/pointclouds/src/potree-three-loader/tree/PointAttributes.d.ts +1 -1
  53. package/dist/packages/pointclouds/src/potree-three-loader/utils/lru.d.ts +1 -1
  54. package/dist/packages/pointclouds/src/potree-three-loader/workers/types.d.ts +3 -3
  55. package/dist/packages/pointclouds/wasm/index.d.ts +3 -3
  56. package/dist/packages/rendering/src/CadMaterialManager.d.ts +1 -0
  57. package/dist/packages/rendering/src/pipeline-executors/BasicPipelineExecutor.d.ts +1 -1
  58. package/dist/packages/rendering/src/pointcloud-rendering/PointCloudObjectIdMaps.d.ts +1 -1
  59. package/dist/packages/rendering/src/pointcloud-rendering/types.d.ts +2 -2
  60. package/dist/packages/rendering/src/render-passes/types.d.ts +8 -8
  61. package/dist/packages/rendering/src/render-pipeline-providers/types.d.ts +4 -4
  62. package/dist/packages/rendering/src/rendering/NodeAppearanceTextureBuilder.d.ts +2 -0
  63. package/dist/packages/rendering/src/rendering/types.d.ts +5 -5
  64. package/dist/packages/rendering/src/transform/NodeTransformProvider.d.ts +1 -1
  65. package/dist/packages/sector-loader/src/SectorRepository.d.ts +1 -1
  66. package/dist/packages/sector-parser/src/DracoDecoderHelper.d.ts +2 -2
  67. package/dist/packages/sector-parser/src/types.d.ts +12 -12
  68. package/dist/packages/tools/index.d.ts +0 -1
  69. package/dist/packages/tools/src/AxisView/types.d.ts +5 -5
  70. package/dist/packages/tools/src/HtmlOverlay/HtmlOverlayTool.d.ts +5 -5
  71. package/dist/packages/tools/src/Measurement/MeasurementManager.d.ts +1 -1
  72. package/dist/packages/tools/src/Measurement/types.d.ts +5 -5
  73. package/dist/packages/tools/src/Timeline/types.d.ts +1 -1
  74. package/dist/packages/tools/src/types.d.ts +1 -1
  75. package/dist/packages/utilities/src/CameraConfiguration.d.ts +1 -1
  76. package/dist/packages/utilities/src/WebGLRendererStateHelper.d.ts +1 -1
  77. package/dist/packages/utilities/src/device.d.ts +1 -1
  78. package/dist/packages/utilities/src/events/InputHandler.d.ts +1 -1
  79. package/dist/packages/utilities/src/events/types.d.ts +5 -5
  80. package/dist/packages/utilities/src/indexset/IndexSet.d.ts +1 -1
  81. package/dist/packages/utilities/src/linalg.d.ts +3 -3
  82. package/dist/packages/utilities/src/shapes/SerializableBox.d.ts +1 -1
  83. package/dist/packages/utilities/src/shapes/SerializableCompositeShape.d.ts +1 -1
  84. package/dist/packages/utilities/src/shapes/SerializableCylinder.d.ts +1 -1
  85. package/dist/packages/utilities/src/types.d.ts +2 -2
  86. package/dist/packages/utilities/src/workers/workerize-transferable/on-main.d.ts +1 -1
  87. package/dist/packages/utilities/src/workers/workerize-transferable/on-worker.d.ts +1 -1
  88. package/package.json +7 -7
  89. package/dist/packages/tools/src/ExplodedViewTool.d.ts +0 -12
@@ -5,5 +5,6 @@ export { Cognite3DViewer } from './src/public/migration/Cognite3DViewer';
5
5
  export { CogniteCadModel } from '../cad-model';
6
6
  export { ViewerState, ModelState } from './src/utilities/ViewStateHelper';
7
7
  export * from './src/public/types';
8
+ export { CDF_TO_VIEWER_TRANSFORMATION } from './src/public/constants';
8
9
  declare const REVEAL_VERSION: string;
9
10
  export { REVEAL_VERSION };
@@ -9,7 +9,7 @@ import { CadManager, CadModelBudget } from '../../../cad-geometry-loaders';
9
9
  import { NodeAppearanceProvider } from '../../../cad-styling';
10
10
  import { RenderMode, RenderPipelineExecutor, CadMaterialManager, RenderPipelineProvider } from '../../../rendering';
11
11
  import { ModelIdentifier } from '../../../data-providers';
12
- export declare type AddCadModelOptions = {
12
+ export type AddCadModelOptions = {
13
13
  nodeAppearanceProvider?: NodeAppearanceProvider;
14
14
  geometryFilter?: GeometryFilter;
15
15
  };
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright 2022 Cognite AS
3
+ */
4
+ import { Matrix4 } from 'three';
5
+ /**
6
+ * The transformation matrix from CDF coordinates to ThreeJS/Reveal.
7
+ * Note that this is already applied to {@link CogniteCadModel} and {@link CognitePointCloudModel}
8
+ * automatically, as it is factored into the matrix returned from e.g.
9
+ * the {@link CogniteCadModel.getCdfToDefaultModelTransformation} method.
10
+ */
11
+ export declare const CDF_TO_VIEWER_TRANSFORMATION: Matrix4;
@@ -5,8 +5,8 @@ import { AntiAliasingMode, SsaoParameters } from '../../../../rendering';
5
5
  import { DeviceDescriptor } from '../../../../utilities';
6
6
  import { PropType } from '../../utilities/reflection';
7
7
  import { Cognite3DViewerOptions } from './types';
8
- declare type AntiAliasingHintOption = NonNullable<PropType<Cognite3DViewerOptions, 'antiAliasingHint'>>;
9
- declare type SsaoQualityHintOption = PropType<Cognite3DViewerOptions, 'ssaoQualityHint'>;
8
+ type AntiAliasingHintOption = NonNullable<PropType<Cognite3DViewerOptions, 'antiAliasingHint'>>;
9
+ type SsaoQualityHintOption = PropType<Cognite3DViewerOptions, 'ssaoQualityHint'>;
10
10
  /**
11
11
  * Determines anti-aliasing mode based on the mode requested and the device in question.
12
12
  * For mobile and tablets MSAA is disabled. FXAA is supported on all devices.
@@ -17,7 +17,7 @@ import { EdlOptions } from '../../../../rendering';
17
17
  * @param itemsRequested Total number of items to load in this batch.
18
18
  * @param itemsCulled Number of items deemed unnecessary to load in this batch.
19
19
  */
20
- export declare type OnLoadingCallback = (itemsLoaded: number, itemsRequested: number, itemsCulled: number) => void;
20
+ export type OnLoadingCallback = (itemsLoaded: number, itemsRequested: number, itemsCulled: number) => void;
21
21
  /**
22
22
  * @module @cognite/reveal
23
23
  */
@@ -129,7 +129,7 @@ export interface Cognite3DViewerOptions {
129
129
  * the camera is moving. Note that this option should left to false on
130
130
  * low-end devices as more loading can cause frame drops.
131
131
  *
132
- * Default value is set to false.
132
+ * Default value is set to true.
133
133
  */
134
134
  continuousModelStreaming?: boolean;
135
135
  }
@@ -142,7 +142,7 @@ export interface AddModelOptions {
142
142
  localPath?: string;
143
143
  geometryFilter?: GeometryFilter;
144
144
  }
145
- export declare type AddImage360Options = {
145
+ export type AddImage360Options = {
146
146
  /**
147
147
  * An optional transformation which will be applied to all 360 images that are fetched.
148
148
  */
@@ -153,7 +153,7 @@ export declare type AddImage360Options = {
153
153
  */
154
154
  preMultipliedRotation?: boolean;
155
155
  };
156
- export declare type CadIntersection = {
156
+ export type CadIntersection = {
157
157
  /**
158
158
  * The intersection type.
159
159
  */
@@ -179,7 +179,7 @@ export declare type CadIntersection = {
179
179
  * Represents the result from {@link Cognite3DViewer.getIntersectionFromPixel}.
180
180
  * @module @cognite/reveal
181
181
  */
182
- export declare type Intersection = CadIntersection | PointCloudIntersection;
182
+ export type Intersection = CadIntersection | PointCloudIntersection;
183
183
  /**
184
184
  * @module @cognite/reveal
185
185
  */
@@ -12,7 +12,7 @@ import { CognitePointCloudModel } from '../../../pointclouds';
12
12
  * @property nodeAppearanceProvider Style node by tree-index.
13
13
  * @property internal Internals are for internal usage only (like unit-testing).
14
14
  */
15
- export declare type RevealOptions = {
15
+ export type RevealOptions = {
16
16
  logMetrics?: boolean;
17
17
  renderOptions?: RenderOptions;
18
18
  continuousModelStreaming?: boolean;
@@ -28,11 +28,11 @@ export declare type RevealOptions = {
28
28
  /**
29
29
  * Type abstraction for CogniteCadModel or CognitePointCloudModel;.
30
30
  */
31
- export declare type CogniteModel = CogniteCadModel | CognitePointCloudModel;
31
+ export type CogniteModel = CogniteCadModel | CognitePointCloudModel;
32
32
  /**
33
33
  * Handler for events about data being loaded.
34
34
  */
35
- export declare type LoadingStateChangeListener = (loadingState: LoadingState) => any;
35
+ export type LoadingStateChangeListener = (loadingState: LoadingState) => any;
36
36
  export { WellKnownAsprsPointClassCodes } from '../../../pointclouds';
37
37
  export { PointShape, PointColorType, PointSizeType } from '../../../rendering';
38
38
  export * from './migration/types';
@@ -2,7 +2,7 @@
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
4
  import * as THREE from 'three';
5
- export declare type Corner = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
5
+ export type Corner = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
6
6
  export declare class Spinner {
7
7
  private static readonly stylesId;
8
8
  private static readonly classnames;
@@ -1,7 +1,7 @@
1
1
  import { Cognite3DViewer } from '../public/migration/Cognite3DViewer';
2
2
  import { CogniteClient } from '@cognite/sdk';
3
3
  import { SerializableNodeAppearance } from '../../../cad-styling/src/NodeAppearance';
4
- export declare type ViewerState = {
4
+ export type ViewerState = {
5
5
  camera?: {
6
6
  position: {
7
7
  x: number;
@@ -17,13 +17,13 @@ export declare type ViewerState = {
17
17
  models?: ModelState[];
18
18
  clippingPlanes?: ClippingPlanesState[];
19
19
  };
20
- export declare type ClippingPlanesState = {
20
+ export type ClippingPlanesState = {
21
21
  nx: number;
22
22
  ny: number;
23
23
  nz: number;
24
24
  constant: number;
25
25
  };
26
- export declare type ModelState = {
26
+ export type ModelState = {
27
27
  defaultNodeAppearance: SerializableNodeAppearance;
28
28
  modelId: number;
29
29
  revisionId: number;
@@ -4,4 +4,4 @@
4
4
  /**
5
5
  * Retrieves the property type of a single property of a type.
6
6
  */
7
- export declare type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];
7
+ export type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];
@@ -5,7 +5,7 @@
5
5
  * Hints that are used to modify how CAD sectors are loaded.
6
6
  * @property `suspendLoading` - disables loading of sectors.
7
7
  */
8
- export declare type CadLoadingHints = {
8
+ export type CadLoadingHints = {
9
9
  suspendLoading?: boolean;
10
10
  };
11
11
  export declare const defaultLoadingHints: Required<CadLoadingHints>;
@@ -4,7 +4,7 @@
4
4
  /**
5
5
  * Represents a measurement of how much geometry can be loaded.
6
6
  */
7
- export declare type CadModelBudget = {
7
+ export type CadModelBudget = {
8
8
  /**
9
9
  * Sectors within this distance from the camera will always be loaded in high details.
10
10
  * @deprecated This is only used for 3D models processed prior to the Reveal 3.0 release (Q1 2022).
@@ -2,6 +2,6 @@
2
2
  * Copyright 2022 Cognite AS
3
3
  */
4
4
  import { SectorCuller } from '../../cad-geometry-loaders';
5
- export declare type InternalRevealCadOptions = {
5
+ export type InternalRevealCadOptions = {
6
6
  sectorCuller?: SectorCuller;
7
7
  };
@@ -2,7 +2,7 @@
2
2
  * Copyright 2022 Cognite AS
3
3
  */
4
4
  import { ConsumedSector, WantedSector } from '../../../cad-parsers';
5
- export declare type SectorDownloadData = {
5
+ export type SectorDownloadData = {
6
6
  sector: WantedSector;
7
7
  downloadSector: (sector: WantedSector) => Promise<ConsumedSector>;
8
8
  };
@@ -4,7 +4,7 @@
4
4
  import { DetermineSectorCostDelegate, DetermineSectorsInput, SectorLoadingSpent } from './types';
5
5
  import { SectorCuller } from './SectorCuller';
6
6
  import { V9SectorMetadata, WantedSector } from '../../../../cad-parsers';
7
- export declare type ByScreenSizeSectorCullerOptions = {
7
+ export type ByScreenSizeSectorCullerOptions = {
8
8
  /**
9
9
  * Optional callback for determining the cost of a sector. The default unit of the cost
10
10
  * function is bytes downloaded.
@@ -16,7 +16,7 @@ export interface DetermineSectorsInput {
16
16
  budget: CadModelBudget;
17
17
  prioritizedAreas: PrioritizedArea[];
18
18
  }
19
- export declare type DetermineSectorsPayload = {
19
+ export type DetermineSectorsPayload = {
20
20
  camera: THREE.PerspectiveCamera;
21
21
  clippingPlanes: THREE.Plane[];
22
22
  models: CadNode[];
@@ -28,7 +28,7 @@ export declare type DetermineSectorsPayload = {
28
28
  /**
29
29
  * Statistics for how much data is required to load set of sectors.
30
30
  */
31
- export declare type SectorLoadingSpent = {
31
+ export type SectorLoadingSpent = {
32
32
  /**
33
33
  * Estimated number of bytes to download sectors.
34
34
  */
@@ -67,17 +67,17 @@ export declare type SectorLoadingSpent = {
67
67
  */
68
68
  readonly accumulatedPriority: number;
69
69
  };
70
- export declare type SectorCost = {
70
+ export type SectorCost = {
71
71
  downloadSize: number;
72
72
  drawCalls: number;
73
73
  renderCost: number;
74
74
  };
75
75
  export declare function addSectorCost(sum: SectorCost, cost: SectorCost): void;
76
76
  export declare function reduceSectorCost(sum: SectorCost, cost: SectorCost): void;
77
- export declare type PrioritizedWantedSector = WantedSector & {
77
+ export type PrioritizedWantedSector = WantedSector & {
78
78
  priority: number;
79
79
  };
80
80
  /**
81
81
  * Delegates that computes 'cost' of loading/visualizing a given sector.
82
82
  */
83
- export declare type DetermineSectorCostDelegate<TSectorMetadata> = (sector: TSectorMetadata, levelOfDetail: LevelOfDetail) => SectorCost;
83
+ export type DetermineSectorCostDelegate<TSectorMetadata> = (sector: TSectorMetadata, levelOfDetail: LevelOfDetail) => SectorCost;
@@ -6,7 +6,7 @@
6
6
  * promise together with and indicator of whether the
7
7
  * the promise resolved or rejected
8
8
  */
9
- declare type PromiseResult<T> = {
9
+ type PromiseResult<T> = {
10
10
  result?: T;
11
11
  error?: any;
12
12
  };
@@ -6,7 +6,7 @@ import { IntersectInput } from '../../../model-base';
6
6
  import { CadMaterialManager } from '../../../rendering';
7
7
  import { SceneHandler } from '../../../utilities';
8
8
  import { CadNode } from '../wrappers/CadNode';
9
- declare type IntersectCadNodesResult = {
9
+ type IntersectCadNodesResult = {
10
10
  distance: number;
11
11
  point: THREE.Vector3;
12
12
  treeIndex: number;
@@ -4,8 +4,8 @@
4
4
  /**
5
5
  * Units supported by {@link CogniteCadModel}.
6
6
  */
7
- export declare type WellKnownUnit = 'Meters' | 'Centimeters' | 'Millimeters' | 'Micrometers' | 'Kilometers' | 'Feet' | 'Inches' | 'Yards' | 'Miles' | 'Mils' | 'Microinches';
8
- export declare type GeometryFilter = {
7
+ export type WellKnownUnit = 'Meters' | 'Centimeters' | 'Millimeters' | 'Micrometers' | 'Kilometers' | 'Feet' | 'Inches' | 'Yards' | 'Miles' | 'Mils' | 'Microinches';
8
+ export type GeometryFilter = {
9
9
  /**
10
10
  * The bounds to load geometry within. By default this box is in CDF coordinate space which
11
11
  * will be transformed into coordinates relative to the model using the the model transformation
@@ -22,7 +22,7 @@ export declare type GeometryFilter = {
22
22
  */
23
23
  isBoundingBoxInModelCoordinates?: boolean;
24
24
  };
25
- export declare type CadModelSectorLoadStatistics = {
25
+ export type CadModelSectorLoadStatistics = {
26
26
  /**
27
27
  * Estimated number of bytes to download sectors.
28
28
  */
@@ -1,26 +1,28 @@
1
1
  /**
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
- import * as THREE from 'three';
5
4
  import { NodeAppearanceProvider, NodeAppearance, PrioritizedArea } from '../../../cad-styling';
6
5
  import { SectorScene, CadModelMetadata, RootSectorNode, WantedSector, ConsumedSector } from '../../../cad-parsers';
7
6
  import { SectorRepository } from '../../../sector-loader';
8
7
  import { ParsedGeometry } from '../../../sector-parser';
9
8
  import { CadMaterialManager, NodeTransformProvider, RenderMode } from '../../../rendering';
10
- export declare class CadNode extends THREE.Object3D {
9
+ import { Object3D, Plane, Matrix4 } from 'three';
10
+ export declare class CadNode extends Object3D {
11
11
  private readonly _cadModelMetadata;
12
12
  private readonly _materialManager;
13
13
  private readonly _sectorRepository;
14
14
  private _rootSector;
15
15
  private _sectorScene;
16
16
  private _geometryBatchingManager?;
17
+ private readonly _sourceTransform;
18
+ private readonly _customTransform;
17
19
  constructor(model: CadModelMetadata, materialManager: CadMaterialManager, sectorRepository: SectorRepository);
18
20
  get nodeTransformProvider(): NodeTransformProvider;
19
21
  get nodeAppearanceProvider(): NodeAppearanceProvider;
20
22
  get defaultNodeAppearance(): NodeAppearance;
21
23
  set defaultNodeAppearance(appearance: NodeAppearance);
22
- get clippingPlanes(): THREE.Plane[];
23
- set clippingPlanes(planes: THREE.Plane[]);
24
+ get clippingPlanes(): Plane[];
25
+ set clippingPlanes(planes: Plane[]);
24
26
  get cadModelMetadata(): CadModelMetadata;
25
27
  get cadModelIdentifier(): string;
26
28
  get sectorScene(): SectorScene;
@@ -33,12 +35,13 @@ export declare class CadNode extends THREE.Object3D {
33
35
  * Sets transformation matrix of the model. This overrides the current transformation.
34
36
  * @param matrix Transformation matrix.
35
37
  */
36
- setModelTransformation(matrix: THREE.Matrix4): void;
38
+ setModelTransformation(matrix: Matrix4): void;
37
39
  /**
38
40
  * Gets transformation matrix of the model
39
41
  * @param out Preallocated `THREE.Matrix4` (optional).
40
42
  */
41
- getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
43
+ getModelTransformation(out?: Matrix4): Matrix4;
44
+ getCdfToDefaultModelTransformation(out?: Matrix4): Matrix4;
42
45
  get prioritizedAreas(): PrioritizedArea[];
43
46
  batchGeometry(geometryBatchingQueue: ParsedGeometry[], sectorId: number): void;
44
47
  removeBatchedSectorGeometries(sectorId: number): void;
@@ -125,45 +125,6 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
125
125
  * @param applyToChildren
126
126
  */
127
127
  resetNodeTransformByTreeIndex(treeIndex: number, applyToChildren?: boolean): Promise<number>;
128
- /**
129
- * Maps a position retrieved from the CDF API (e.g. 3D node information) to
130
- * coordinates in "ThreeJS model space". This is necessary because CDF has a right-handed
131
- * Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system.
132
- * @param p The CDF coordinate to transform.
133
- * @param out Optional preallocated buffer for storing the result. May be `p`.
134
- * @returns Transformed position.
135
- */
136
- mapFromCdfToModelCoordinates(p: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
137
- /**
138
- * Maps from a 3D position in "ThreeJS model space" (e.g. a ray intersection coordinate)
139
- * to coordinates in "CDF space". This is necessary because CDF has a right-handed
140
- * Z-up coordinate system while ThreeJS uses a right-hand Y-up coordinate system.
141
- * This function also accounts for transformation applied to the model.
142
- * @param p The ThreeJS coordinate to transform.
143
- * @param out Optional preallocated buffer for storing the result. May be `p`.
144
- * @returns Transformed position.
145
- */
146
- mapPositionFromModelToCdfCoordinates(p: THREE.Vector3, out?: THREE.Vector3): THREE.Vector3;
147
- /**
148
- * Maps from a 3D position in "ThreeJS model space" to coordinates in "CDF space".
149
- * This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS
150
- * uses a right-hand Y-up coordinate system. This function also accounts for transformation
151
- * applied to the model.
152
- * @param box The box in ThreeJS/model coordinates.
153
- * @param out Optional preallocated buffer for storing the result. May be same input as `box`.
154
- * @returns Transformed box.
155
- */
156
- mapBoxFromModelToCdfCoordinates(box: THREE.Box3, out?: THREE.Box3): THREE.Box3;
157
- /**
158
- * Maps from a 3D position in "CDF space" to coordinates in "ThreeJS model space".
159
- * This is necessary because CDF has a right-handed Z-up coordinate system while ThreeJS
160
- * uses a right-hand Y-up coordinate system. This function also accounts for transformation
161
- * applied to the model.
162
- * @param box The box in CDF model coordinates.
163
- * @param out Optional preallocated buffer for storing the result. May be same input as `box`.
164
- * @returns Transformed box.
165
- */
166
- mapBoxFromCdfToModelCoordinates(box: THREE.Box3, out?: THREE.Box3): THREE.Box3;
167
128
  /**
168
129
  * Cleans up used resources.
169
130
  */
@@ -218,10 +179,17 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
218
179
  */
219
180
  setModelTransformation(matrix: THREE.Matrix4): void;
220
181
  /**
221
- * Gets transformation matrix of the model.
182
+ * Gets transformation matrix that has previously been set with {@link CogniteCadModel.setModelTransformation}.
222
183
  * @param out Preallocated `THREE.Matrix4` (optional).
223
184
  */
224
185
  getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
186
+ /**
187
+ * Gets transformation from CDF space to ThreeJS space,
188
+ * which includes any additional "default" transformations assigned to this model.
189
+ * Does not include any custom transformations set by {@link CognitePointcloudmodel.setModelTransformation}
190
+ * @param out Preallocated `THREE.Matrix4` (optional)
191
+ */
192
+ getCdfToDefaultModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
225
193
  /**
226
194
  * Fetches a bounding box from the CDF by the nodeId.
227
195
  * @param nodeId
@@ -6,7 +6,7 @@ import { AutoDisposeGroup } from '../../../utilities';
6
6
  import { SectorMetadata } from '../metadata/types';
7
7
  import { LevelOfDetail } from './LevelOfDetail';
8
8
  import { ParsedGeometry } from '../../../sector-parser';
9
- export declare type TriangleMesh = {
9
+ export type TriangleMesh = {
10
10
  readonly fileId: number;
11
11
  readonly indices: Uint32Array;
12
12
  readonly treeIndices: Float32Array;
@@ -14,13 +14,13 @@ export declare type TriangleMesh = {
14
14
  readonly normals: Float32Array | undefined;
15
15
  readonly colors: Uint8Array;
16
16
  };
17
- export declare type InstancedMeshFile = {
17
+ export type InstancedMeshFile = {
18
18
  readonly fileId: number;
19
19
  readonly indices: Uint32Array;
20
20
  readonly vertices: Float32Array;
21
21
  readonly instances: InstancedMesh[];
22
22
  };
23
- export declare type InstancedMesh = {
23
+ export type InstancedMesh = {
24
24
  readonly triangleCount: number;
25
25
  readonly triangleOffset: number;
26
26
  readonly colors: Uint8Array;
@@ -1,16 +1,16 @@
1
1
  /*!
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
- export declare type CadSceneRootMetadata = {
4
+ export type CadSceneRootMetadata = {
5
5
  readonly version: number;
6
6
  readonly maxTreeIndex: number;
7
7
  readonly sectors: SceneSectorMetadata[];
8
8
  readonly unit: string | null;
9
9
  };
10
- export declare type SceneSectorMetadata = BaseSceneSectorMetadata & (GltfSceneSectorMetadata | I3dF3dSceneSectorMetadata);
11
- export declare type V8SceneSectorMetadata = BaseSceneSectorMetadata & I3dF3dSceneSectorMetadata;
12
- export declare type V9SceneSectorMetadata = BaseSceneSectorMetadata & GltfSceneSectorMetadata;
13
- export declare type BoundingBox = {
10
+ export type SceneSectorMetadata = BaseSceneSectorMetadata & (GltfSceneSectorMetadata | I3dF3dSceneSectorMetadata);
11
+ export type V8SceneSectorMetadata = BaseSceneSectorMetadata & I3dF3dSceneSectorMetadata;
12
+ export type V9SceneSectorMetadata = BaseSceneSectorMetadata & GltfSceneSectorMetadata;
13
+ export type BoundingBox = {
14
14
  readonly min: {
15
15
  x: number;
16
16
  y: number;
@@ -22,7 +22,7 @@ export declare type BoundingBox = {
22
22
  z: number;
23
23
  };
24
24
  };
25
- export declare type BaseSceneSectorMetadata = {
25
+ export type BaseSceneSectorMetadata = {
26
26
  readonly id: number;
27
27
  readonly parentId: number | null;
28
28
  readonly path: string;
@@ -32,13 +32,13 @@ export declare type BaseSceneSectorMetadata = {
32
32
  readonly boundingBox: BoundingBox;
33
33
  readonly geometryBoundingBox?: BoundingBox;
34
34
  };
35
- export declare type GltfSceneSectorMetadata = {
35
+ export type GltfSceneSectorMetadata = {
36
36
  readonly sectorFileName: string | null;
37
37
  readonly maxDiagonalLength: number;
38
38
  readonly minDiagonalLength: number;
39
39
  readonly downloadSize: number;
40
40
  };
41
- export declare type I3dF3dSceneSectorMetadata = {
41
+ export type I3dF3dSceneSectorMetadata = {
42
42
  readonly indexFile: {
43
43
  readonly fileName: string;
44
44
  readonly peripheralFiles: string[];
@@ -28,7 +28,7 @@ export interface SectorMetadataFacesFileSection {
28
28
  readonly fileName: string | null;
29
29
  readonly downloadSize: number;
30
30
  }
31
- export declare type BaseSectorMetadata = {
31
+ export type BaseSectorMetadata = {
32
32
  readonly id: number;
33
33
  readonly path: string;
34
34
  readonly depth: number;
@@ -37,13 +37,13 @@ export declare type BaseSectorMetadata = {
37
37
  readonly estimatedDrawCallCount: number;
38
38
  readonly estimatedRenderCost: number;
39
39
  };
40
- export declare type SectorMetadata = BaseSectorMetadata & (I3dF3dSectorMetadata | GltfSectorMetadata);
41
- export declare type V9SectorMetadata = BaseSectorMetadata & GltfSectorMetadata;
42
- export declare type I3dF3dSectorMetadata = {
40
+ export type SectorMetadata = BaseSectorMetadata & (I3dF3dSectorMetadata | GltfSectorMetadata);
41
+ export type V9SectorMetadata = BaseSectorMetadata & GltfSectorMetadata;
42
+ export type I3dF3dSectorMetadata = {
43
43
  readonly indexFile: SectorMetadataIndexFileSection;
44
44
  readonly facesFile: SectorMetadataFacesFileSection;
45
45
  };
46
- export declare type GltfSectorMetadata = {
46
+ export type GltfSectorMetadata = {
47
47
  readonly sectorFileName: string | null;
48
48
  readonly maxDiagonalLength: number;
49
49
  readonly minDiagonalLength: number;
@@ -2,7 +2,7 @@
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
4
  import * as THREE from 'three';
5
- declare type ParsePrimitiveAttribute = {
5
+ type ParsePrimitiveAttribute = {
6
6
  offset: number;
7
7
  size: number;
8
8
  };
@@ -7,13 +7,15 @@ import * as THREE from 'three';
7
7
  */
8
8
  export interface CdfModelNodeCollectionDataProvider {
9
9
  /**
10
- * Maps a box from Reveal space to CDF space
10
+ * Gets the transformation of the model in ThreeJS space
11
11
  */
12
- mapBoxFromModelToCdfCoordinates: (box: THREE.Box3, out?: THREE.Box3) => THREE.Box3;
12
+ getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
13
13
  /**
14
- * Maps a box from CDF space to Reveal space
14
+ * Gets the default transformation of the model from CDF space.
15
+ * The current total transformation of the model from the backend to its transform in ThreeJS space
16
+ * is thus `model.getCdfToDefaultModelTransformation() * model.getModelTransformation()`.
15
17
  */
16
- mapBoxFromCdfToModelCoordinates: (box: THREE.Box3, out?: THREE.Box3) => THREE.Box3;
18
+ getCdfToDefaultModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
17
19
  /**
18
20
  * Total count of nodes in the model
19
21
  */
@@ -6,7 +6,7 @@ import { IndexSet } from '../../utilities';
6
6
  export declare abstract class CdfNodeCollectionBase extends NodeCollection {
7
7
  private _indexSet;
8
8
  private _areas;
9
- private readonly _boundsMapper;
9
+ private readonly _cadModelData;
10
10
  private _fetchResultHelper;
11
11
  constructor(classToken: string, model: CdfModelNodeCollectionDataProvider);
12
12
  get isLoading(): boolean;
@@ -16,7 +16,7 @@ export declare enum NodeOutlineColor {
16
16
  * Type for defining node appearance profiles to style a 3D CAD model.
17
17
  * @see {@link DefaultNodeAppearance}
18
18
  */
19
- export declare type NodeAppearance = {
19
+ export type NodeAppearance = {
20
20
  /**
21
21
  * Overrides the default color of the node in RGB. Black,
22
22
  * or `new Color(0, 0, 0)` means no override.
@@ -69,7 +69,7 @@ export declare type NodeAppearance = {
69
69
  /**
70
70
  * Type that represents a {@link NodeAppearance} in a serializable format
71
71
  */
72
- export declare type SerializableNodeAppearance = {
72
+ export type SerializableNodeAppearance = {
73
73
  /**
74
74
  * Color as an RGB number tuple, with values in the range [0, 255]
75
75
  */
@@ -10,7 +10,7 @@ import { IndexSet } from '../../utilities';
10
10
  * @param treeIndices Set of tree indices that the style is applied to.
11
11
  * @param appearance Style to be applied to the nodes.
12
12
  */
13
- export declare type ApplyStyleDelegate = (treeIndices: IndexSet, appearance: NodeAppearance) => void;
13
+ export type ApplyStyleDelegate = (treeIndices: IndexSet, appearance: NodeAppearance) => void;
14
14
  export declare class NodeAppearanceProvider {
15
15
  private readonly _styledCollections;
16
16
  private _lastFiredLoadingState?;
@@ -5,7 +5,7 @@ import { CogniteClient } from '@cognite/sdk';
5
5
  import { CdfModelNodeCollectionDataProvider } from './CdfModelNodeCollectionDataProvider';
6
6
  import { NodeCollection } from './NodeCollection';
7
7
  import { SerializedNodeCollection } from './SerializedNodeCollection';
8
- export declare type NodeCollectionSerializationContext = {
8
+ export type NodeCollectionSerializationContext = {
9
9
  client: CogniteClient;
10
10
  model: CdfModelNodeCollectionDataProvider;
11
11
  };
@@ -8,7 +8,7 @@ import { CdfNodeCollectionBase } from './CdfNodeCollectionBase';
8
8
  /**
9
9
  * Options for {@link PropertyFilterNodeCollection}.
10
10
  */
11
- export declare type PropertyFilterNodeCollectionOptions = {
11
+ export type PropertyFilterNodeCollectionOptions = {
12
12
  /**
13
13
  * How many partitions to split the request into. More partitions can yield better performance
14
14
  * for queries with very large result set (in order of magnitude 100.000 plus).
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2022 Cognite AS
3
3
  */
4
- export declare type SerializedNodeCollection = {
4
+ export type SerializedNodeCollection = {
5
5
  token: string;
6
6
  state: any;
7
7
  options?: any;
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
- export declare type PrioritizedArea = {
4
+ export type PrioritizedArea = {
5
5
  area: THREE.Box3;
6
6
  extraPriority: number;
7
7
  };
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
- export declare type CameraControlsOptions = {
4
+ export type CameraControlsOptions = {
5
5
  /**
6
6
  * Sets mouse wheel initiated action.
7
7
  *
@@ -25,11 +25,11 @@ export declare type CameraControlsOptions = {
25
25
  */
26
26
  changeCameraTargetOnClick?: boolean;
27
27
  };
28
- export declare type ControlsState = {
28
+ export type ControlsState = {
29
29
  position: THREE.Vector3;
30
30
  target: THREE.Vector3;
31
31
  };
32
- export declare type CameraState = {
32
+ export type CameraState = {
33
33
  /**
34
34
  * Camera position in world space.
35
35
  */
@@ -47,8 +47,8 @@ export declare type CameraState = {
47
47
  * Delegate for camera update events.
48
48
  * @module @cognite/reveal
49
49
  */
50
- export declare type CameraChangeDelegate = (position: THREE.Vector3, target: THREE.Vector3) => void;
51
- export declare type CameraManagerCallbackData = {
50
+ export type CameraChangeDelegate = (position: THREE.Vector3, target: THREE.Vector3) => void;
51
+ export type CameraManagerCallbackData = {
52
52
  intersection: {
53
53
  /**
54
54
  * Coordinate of the intersection.