EdgeRenderer fast switch

Hi all,

Here is the PG: https://playground.babylonjs.com/#6G9LPH#1

I was playing with highlighting meshes through the enableEdgesRendering property.
In my application, I need to highlight/light-off lots of meshes in such a way, but this process gets quite slow as the number of mesh increases.

I found that it is because disable/enableEdgeRendering() is creating and disposing the BABYLON.EdgeRenderer for each switch!
I looked at the source code, and found that rendering returns prematurely if isReady() is false. That is why I tried (see PG) to change this method and rebind it on-the-fly to get a performant switch behaviour.

The resulting code is not pretty, and I am sure it is a simple modification that can be pretty handy :slight_smile: Probably adding a method to BABYLON.EdgeRenderer, like setEnabled or setActive or any other idea…! And then add a check at the beginning of the render() method.

Thanks again for the amazing engine!

You can use the isEnabled property of the edgeRender to enable/disable the display.


I don’t know why I thought it was just a getter method… Obviously it is the right way to go!

Sorry to have missed this possibility :no_mouth: