If I Implement my IEdgesRenderer without using the existing EdgeRenderer, the file "Rendering/edgesRenderer.js" get stripped by webpack tree-shaking.
As a consequence, the side-effects in this file which adds enableEdgesRendering and disableEdgesRendering methods to the AbstractMesh class get stripped as well.
So trying to call enableEdgesRendering causes an exception this.mesh.enableEdgesRendering is not a function
You might think of a way to fix that if possible.
Workaround :
I can disable the tree-shaking for this file by adding this line :
export class DisableTreeShaking extends EdgesRenderer {}
Pinging @sebavan
another workaround is to import the file directly :
import '@babylonjs/core/Rendering/edgesRenderer'
Actually enableEdgesRendering and disableEdgesRendering are creating the EdgesRenderer object itself without relying on the interface there would be of no use with you custom implementation of IEdgesRenderer.
importing IEdgesRenderer would not result in embedding the entire file as it is only an interface but it is true it would result in having the typings available for enableEdgesRendering and disableEdgesRendering.
I guess it left us only one option:
This way you could create your own edge renderer and instead of relying on enable/disable you would simply call new CustomEdgeRenderer(mesh) and customEdgeRenderer.dispose()
Would that work for you ?
Actually I'm using both a custom EdgeRenderer and the babylon EdgeRenderer for some mesh, so the exception happened when I was calling enableEdgesRendering to turn on the babylon EdgeRenderer.
Having the interface in its own file might do the job, if typescript prompts me to import the file that contains the side-effect when I try to call enableEdgesRendering
Fixed by adding the error message