Jump to content

legacyPbrMaterial + webpack + ES6 + typescript


Hersir
 Share

Recommended Posts

Hi,

Someone have tried to use LegacyPbrMaterial with webpack? I copied file babylon.legacyPbrMaterial.min.js and made import in project (import "babylonjs/babylon.legacyPbrMaterial") but after that I get error

Uncaught ReferenceError: __extends is not defined
    at babylon.legacyPbrMaterial.js:1
    at BABYLON (babylon.legacyPbrMaterial.js:1)
    at Object.exports.byteLength (babylon.legacyPbrMaterial.js:2)
    at __webpack_require__ (bootstrap 3ce2b0a…:19)

I have same erro if i try ti use inpsector.

I am missing some config for webpack or typescript?

Link to comment
Share on other sites

@Sebavan yes I had some issues with new one , I create PBR in babylon file like this

{
   customType: "BABYLON.PBRMaterial",
   name: "Material name",
   id: "material id",
   reflectionTexture: {
        customType: "BABYLON.HDRCubeTexture",
        name: "environment.hdr",
        isBABYLONPreprocessed: true,
        hasAlpha: 0,
        level: 1,
        coordinatesMode: 3,
   },
   microSurface: 0.9,
   reflectivityColor: [0.8, 0.8, 0.8],
   albedoColor: [0.02, 0.02, 0.02],
   environmentIntensity: 0.5
}

But it was complaining that this is legacy one and I need to import it. After checking code I found that

if (parsedMaterial.customType === "BABYLON.PBRMaterial" && !parsedMaterial.overloadedAlbedo) {}

overloadedAlbedo should be added to material to not use legacy one, but I didn't found how to add it in babylon file.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...