Skip to content

Commit

Permalink
expose SceneData and from the types file
Browse files Browse the repository at this point in the history
  • Loading branch information
danpriori committed Nov 16, 2024
1 parent d1a1a8c commit 620e48d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
5 changes: 4 additions & 1 deletion react-components/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ export { use3dScenes } from './scenes/use3dScenes';
export { useSceneConfig } from './scenes/useSceneConfig';
export { useGhostMode } from './useGhostMode';

export type { SceneData } from './scenes/types';

export type { CameraNavigationActions } from './useCameraNavigation';
export type { ClickedNodeData, FdmNodeDataResult } from './useClickedNode';
export type {
PointCloudAnnotationMappedAssetData,
Image360AnnotationMappedAssetData,
ThreeDModelFdmMappings
ThreeDModelFdmMappings,
} from './types';

20 changes: 20 additions & 0 deletions react-components/src/hooks/scenes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
*/
import { type SourceSelectorV3 } from '@cognite/sdk/dist/src';
import { type DmsUniqueIdentifier } from '../../data-providers/FdmSDK';
import {
type AddCadResourceOptions,
type AddImage360CollectionDatamodelsOptions,
type AddPointCloudResourceOptions
} from '../../components';
import { type GroundPlane, type Skybox } from '../../components/SceneContainer/sceneTypes';

export type Transformation3d = {
translationX: number;
Expand All @@ -16,6 +22,20 @@ export type Transformation3d = {
scaleZ: number;
};

export type SceneData = {
name: string;
cameraTranslationX: number;
cameraTranslationY: number;
cameraTranslationZ: number;
cameraEulerRotationX: number;
cameraEulerRotationY: number;
cameraEulerRotationZ: number;
cadModelOptions: Array<AddCadResourceOptions | AddPointCloudResourceOptions>;
image360CollectionOptions: AddImage360CollectionDatamodelsOptions[];
groundPlanes: GroundPlane[];
skybox?: Skybox;
};

export type SceneModelsProperties = Transformation3d & {
revisionId: number;
};
Expand Down
23 changes: 3 additions & 20 deletions react-components/src/hooks/scenes/use3dScenes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ import { useMemo } from 'react';
import { type EdgeItem, FdmSDK, type NodeItem } from '../../data-providers/FdmSDK';
import { Euler, MathUtils, Matrix4 } from 'three';
import { CDF_TO_VIEWER_TRANSFORMATION } from '@cognite/reveal';
import { type GroundPlane, type Skybox } from '../../components/SceneContainer/sceneTypes';
import {
type AddCadResourceOptions,
type AddPointCloudResourceOptions,
type AddImage360CollectionDatamodelsOptions
} from '../../components/Reveal3DResources/types';
import { type GroundPlane } from '../../components/SceneContainer/sceneTypes';
import { type AddImage360CollectionDatamodelsOptions } from '../../components/Reveal3DResources/types';
import {
type Cdf3dImage360CollectionProperties,
type Cdf3dRevisionProperties,
Expand All @@ -29,6 +25,7 @@ import {
revisionSourceWithProperties,
type SCENE_SOURCE,
type SceneConfigurationProperties,
type SceneData,
sceneSourceWithProperties,
type SkyboxProperties,
type Transformation3d,
Expand All @@ -40,20 +37,6 @@ import { tryGetModelIdFromExternalId } from '../../utilities/tryGetModelIdFromEx
export type Space = string;
export type ExternalId = string;

export type SceneData = {
name: string;
cameraTranslationX: number;
cameraTranslationY: number;
cameraTranslationZ: number;
cameraEulerRotationX: number;
cameraEulerRotationY: number;
cameraEulerRotationZ: number;
cadModelOptions: Array<AddCadResourceOptions | AddPointCloudResourceOptions>;
image360CollectionOptions: AddImage360CollectionDatamodelsOptions[];
groundPlanes: GroundPlane[];
skybox?: Skybox;
};

type Use3dScenesQueryResult = {
scenes: Array<NodeItem<SceneConfigurationProperties>>;
sceneModels: Array<EdgeItem<Record<string, Record<string, Cdf3dRevisionProperties>>>>;
Expand Down

0 comments on commit 620e48d

Please sign in to comment.