Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(react-components): FDM scene loader component #3971

Merged
merged 31 commits into from
Dec 12, 2023

Conversation

anders-hopland
Copy link
Contributor

@anders-hopland anders-hopland commented Nov 30, 2023

Type of change

Feat

Jira ticket 📘

BND3D-2319

Adds component in reveal react components for loading scenes stored in FDM. A scene is used to define everything that goes into a 3D scene. This include:

  • CAD models with a transformation
  • Point Cloud models with a transformation
  • 360 Image collections with a transformation
  • A camera position
  • One or more groundplanes (plane with a texture)
  • A skybox

How has this been tested? 🔍

Test instructions ℹ️

Checklist ☑️

  • I am proud of this feature.
  • I have performed a self-review of my own code.
  • I have added PR type (Feat, Bug, Chore, Test, Docs, Style, Refactor) to the PR title.
  • I have manually tested this for different scenarios (different models, formats, devices, browsers).
  • I have commented my code in hard-to-understand areas.
  • I have made corresponding changes to the public documentation.
  • I have added unit and visuals tests to prove that my feature works to the best of my ability.
  • I have refactored the code for readability to the best of my ability.
  • I have checked that my changes do not introduce regressions in the public documentation.
  • I have outlined any known defects / lacking capabilities in the contents of this PR.
  • I have listed any remaining work that should follow this PR in the description or jira/miro/etc.
  • I have added TSDoc to any public facing changes.
  • I have added "developer documentation" in any package README.md that is related / applicable to this PR.
  • I have noted down and am currently tracking any technical debt introduced in this PR.
  • I have thoroughly thought about the architecture of this implementation.
  • I have asked peers to test this feature.

Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Merging #3971 (4f003b9) into master (53cd345) will increase coverage by 0.00%.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3971   +/-   ##
=======================================
  Coverage   73.54%   73.54%           
=======================================
  Files         357      357           
  Lines       35855    35855           
  Branches     2735     2736    +1     
=======================================
+ Hits        26369    26371    +2     
+ Misses       9381     9379    -2     
  Partials      105      105           

see 1 file with indirect coverage changes

onLoadError={onModelLoadedError}
/>
);
if ('siteId' in addModelOption) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could be a nice helper function to distinguish between FDM/events based 360 images.

Comment on lines 32 to 34
sceneExternalId,
sceneSpaceId,
sdk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API for this component should be an extension of Reveal3DResources component, i.e. support styling of instances and callback for when models are loaded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for that is FDX and other apps relies on styling capabilities a lot.

Copy link
Contributor

@Savokr Savokr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but a few questions related to queries and coordinates for FDM stored data.

// There is a bug with setCameraState rotation, so must first set transform
// and then lookAt the correct direction
viewer.cameraManager.setCameraState({ position });
viewer.cameraManager.getCamera().lookAt(position.clone().add(vec));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very wrong to do that. Any camera manipulation should be done through setCameraState.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I set the position and rotation like follows:
viewer.cameraManager.setCameraState({ position, rotation: quaternion });
I get a problem where I can not rotate my camera, only pane it. I have tried with several different rotations, so the problem should not be a one off where I have used a specific rotation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should then investigate the issue within reveal. The reason why we always should use setCameraState is because changes in camera transformation affects when and how to render sectors of the model and we track "changes" through the method as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also just realised that it is probably better to set camera parameteres with position and target instead of rotation. What do you think about that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be also much easier to convert it from/to CDF coordinates

react-components/src/hooks/useCameraFromScene.tsx Outdated Show resolved Hide resolved
react-components/src/hooks/useGroundPlaneFromScene.tsx Outdated Show resolved Hide resolved
react-components/src/hooks/useSceneConfigQuery.ts Outdated Show resolved Hide resolved
react-components/src/hooks/useSceneConfigQuery.ts Outdated Show resolved Hide resolved
react-components/src/hooks/useSkyboxFromScene.tsx Outdated Show resolved Hide resolved
@anders-hopland anders-hopland changed the title WIP Scene loader Scene loader Dec 11, 2023
@Savokr Savokr changed the title Scene loader feat(react-components): FDM scene loader component Dec 11, 2023
@anders-hopland anders-hopland added the auto-update Makes bulldozer automatically update this PR when there are changes to the target branch label Dec 12, 2023
@anders-hopland anders-hopland merged commit ea36ab0 into master Dec 12, 2023
15 checks passed
@anders-hopland anders-hopland deleted the andersmh/fdm-scene-loader-component branch December 12, 2023 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-update Makes bulldozer automatically update this PR when there are changes to the target branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants