We can split the structured object into two groups - visible and hidden. Then, we can hide a group of objects during a camera move - i.e. pan, tilt, orbit, zoom.
The image above shows an extreme situation, were most objects are hidden. This will only reveal a skelekton. The perforance is super smooth - but the user experience might suffer.
Group Objects
There are many ways achieve this. Here's my simple take.
functionbuildScene(e) {let structured =e.data;structured.MainObject = mainObject; structured =buildGeometry(structured);/** * Split the structured into two groups: Visible & Hidden */let { visible, hidden } =groupStructure(structured);// TODO}export { buildScene };
An Array with Hidden Objects
I have created an array with all the IFC objects that I want to disappear during a camera move. These are called hidden objects.
Notice that we use the children parmameter of the Three.Object3D().
Add Groups to Scene
Let's add the two groups to the scene. This is very straigh forward and easy to do.
functionbuildScene(e) {let structured =e.data;structured.MainObject = mainObject; structured =buildGeometry(structured);let { visible, hidden } =groupStructure(structured);/** * Add visible objects to the first group */constvisibleGroup=newTHREE.Group();visibleGroup.add(visible);/** * Add hidden objects to the second group */consthiddenGroup=newTHREE.Group();hiddenGroup.add(hidden);/** * Add both groups to the scene */scene.add(visibleGroup);scene.add(hiddenGroup);initScene();document.getElementById('c').style.display ='block';toggleLoader();}export { buildScene };
Hide on Camera Movement
The next step is to actually hide the hiddenGroup during a camera movement. A simple (!) way to do this is to place an event listener during a mouse press.