Giter Site home page Giter Site logo

Comments (2)

MadsHolten avatar MadsHolten commented on August 17, 2024 1

Sorry for late reply. I can confirm that the problem seems to be solved in the latest version.

And thanks for the hint on the setVisibility method. This solved another issue I had with elements behind a hidden element not being loaded from the culler.

I am looking forward to the staticFragments property of the streamer since this will solve many problems I'm facing when trying to control styling of the streamed scene! This is also needed when isolating objects in the scene. I tried to achieve that with the setVisibility (1. use hider to hide all, 2. use setVisibility to make specific elements visible) but it only works until you pan the scene and new elements become visible..

from components.

agviegas avatar agviegas commented on August 17, 2024

Hey @MadsHolten this might be already solved in the latest version. The reason might be that that trying to set the visibility of a fragment passing IDs that it doesn't have returned an error before. Now it just skips them.

So I can't reproduce it anymore adding the following code to the streamer tutorial:

const highlighter = components.get(OBCF.Highlighter);
highlighter.add("example", new THREE.Color(1, 0, 0));
const hider = components.get(OBC.Hider);

loader.onFragmentsLoaded.add((frags) => {
  const fragments = components.get(OBC.FragmentsManager);
  const model = Array.from(fragments.groups.values())[0];
  const map = model.getFragmentMap([186]);
  const keys = new Set(Object.keys(map));
  let found = false;
  for (const frag of frags) {
    if (keys.has(frag.id)) {
      found = true;
    }
  }

  if (found) {
    highlighter.highlightByID("example", map);
  }

  hider.isolate(map);
  hider.set(true);
});

This is the result:

2024-07-18.17-40-57.mp4

Now, just FYI, if you want to hide elements using streaming, there is a specific setVisibility method that makes it simpler, and also avoids streaming fragments that are fully invisible. We could add an isolate method in the future if that's useful.

As for highlighting, I'm going to take care of this feature by adding a staticFragments property to the streamer that are forced to be streamed and never unloaded from memory until removed from that list. That should make it easier, as you won't have to update the highlighter in the onFragmentsLoaded event, and all highlighted elements will be forced to be visible. That will probably also help you.

Let me know if the issue persists on your end. Cheers!

from components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.