Giter Site home page Giter Site logo

Comments (8)

agviegas avatar agviegas commented on August 17, 2024 1

I'm actually currently implementing Fragment cloning. Once I solve that, implementing this should be a piece of cake.

from components.

agviegas avatar agviegas commented on August 17, 2024

You are right! We temporarily removed the highlight feature for the new refactor, as the way the highlight works has changed drastically. This is not a but. But don't worry, we'll put it back the next milestone. I'll remove the bug flag and add a feature flag instead

from components.

vishal-eartheon avatar vishal-eartheon commented on August 17, 2024

Hi @agviegas any update on this issue/feature? I noticed this as well in my recent migration to the new refactor.

from components.

agviegas avatar agviegas commented on August 17, 2024

I'll do it asap. We have few hands. Hopefully these weeks, I'll post any updates here

from components.

vishal-eartheon avatar vishal-eartheon commented on August 17, 2024

Thanks for the update @agviegas

Shall I take it up and create a pull request once done? I would like to contribute if possible.

from components.

VictorTrumpel avatar VictorTrumpel commented on August 17, 2024

For temporary solution I use this code. Maybe It will helpful for somebody

const highlightMats = {
  default: new MeshBasicMaterial({
    color: '#674db3',
    depthTest: false,
    opacity: 0.8,
    transparent: true,
  }),
};

const highlightFragment = (fragmentMap: FragmentIdMap) => {
  const components = new Components();
  const fragmentsManager = components.get(OBC.FragmentsManager);
  for (const fragID in fragmentMap) {
    const fragment = fragmentsManager.list.get(fragID);
    if (!fragment) continue;
    fragment.mesh.material = [highlightMats.default];
  }
};

It looks like this
скрин 3

скрин 1
скрин 2

from components.

vishal-eartheon avatar vishal-eartheon commented on August 17, 2024

Yeah, this workaround is good.

But, one extra thing it probably needs is to make a copy of the mesh and highlight the copy so that the original mesh retains it materials once the highlight is disabled. The copy can be deleted on highlight removal.

from components.

agviegas avatar agviegas commented on August 17, 2024

Will be available from @thatopen/[email protected] (I hope to publish later today). Now there's an outline component that allows to add outlines to fragments and can be used with the highlighter easily. With this code:

const outliner = components.get(OBCF.Outliner);
outliner.world = world;
outliner.enabled = true;

outliner.create(
  "example",
  new THREE.MeshBasicMaterial({
    color: 0xbcf124,
    transparent: true,
    opacity: 0.5,
  }),
);

highlighter.events.select.onHighlight.add((fragIdMap) => {
  outliner.clear("example");
  outliner.add("example", fragIdMap);
});

This is the result:

2024-08-06.13-39-54.mp4

The highlighter tutorial will also be updated with this.

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.