BabylonJS / Extensions

Extensions for Babylon.js
178 stars 157 forks source link

HtmlMesh isn't compatible with "babylonjs/core": ">=7.10.3" #298

Closed etceterad closed 3 months ago

etceterad commented 3 months ago

Hi there,

I ran into following exception after updating to a newer version of babylonjs:

TypeError: material._getEffectiveOrientation is not a function
    at _HighlightLayer._renderSubMesh (effectLayer.ts:879:40)

I assume that it's directly related to one of the breaking changes introduced by this PR. @ericwood73 Could you please address the issue? It appears that the version of this package is outdated in this repo.

ericwood73 commented 3 months ago

Thanks for bringing it to my attention. I will take a look.

ericwood73 commented 3 months ago

I updated to Babylon 7.12 and ran the example and I did not see an issue. Can you please provide steps to reproduce this error?

etceterad commented 3 months ago

I'm sorry I didn't mention this from the start - I'm encountering this error when attempting to use the HighlightLayer. The steps for me are the following:

Let me know if this doesn't help, I'll try to provide you with a sandbox perhaps.

ericwood73 commented 3 months ago

I think I understand, but a PG that reproduces this would be much appreciated.

etceterad commented 3 months ago

Here is a PG where you can reproduce the problem with rendering submeshes with a HighlightLayer instance in the scene. To trigger it just hover the sphere or the box.

I would assume that in order to resolve that you can either update the babylon version used by the package or disable its pre-bundling. But I think you might have a better idea.

ericwood73 commented 3 months ago

Thanks. We actually don't bundle Babylon with HtmlMesh; it is marked external, so not sure what the issue is, but the PG helps.

etceterad commented 3 months ago

Thanks for confirmation. I figured that too by looking at the vite config, but was unsure since I stumbled upon some poc's apparently from the core package in the bundle. Let me know if I can do anything to help with the issue.

etceterad commented 3 months ago

Hey @ericwood73 , just checking in. Any updates on this one?

ericwood73 commented 3 months ago

Yeah. @babylonjs/core is being bundled even though I'm configuring it to be external. @sebavan, If you or anyone else on the team can see the issue, I would be grateful for any assistance. I've listed core as a peer and dev dependency, configured it in vite.config to be external. And yet for some reason my npm build is still bundling core. I realized that I wasn't using inspectors or loaders and removed those, but it did not make a difference.

sebavan commented 3 months ago

maybe @RaananW ?

RaananW commented 3 months ago

I can look at the build process tomorrow, see if I can find something

ericwood73 commented 3 months ago

Thanks. I posted a question in the forums as well. In case somebody else has gotten this to work and I can see how they did it.

RaananW commented 3 months ago

https://github.com/BabylonJS/Extensions/pull/300

ericwood73 commented 3 months ago

I feel like an idiot. I thought I checked for @babylonjs/core imports but clearly I missed some. Thanks @RaananW

etceterad commented 2 months ago

Many thanks Raanan! @ericwood73 May I ask when is the next release will be? We are currently blocked by the resolved issue, would be nice to have the fix live as soon as possible.

ericwood73 commented 2 months ago

@etceterad This is included in babylon-htmlmesh 2.0.0