UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

3 lines (2 loc) 2.15 kB
import{b as e}from"./glTFLoader.pure-Bdyl6AcK.esm.min.js";import{bo as a,bp as o}from"./index-BPURObVq.esm.min.js";import"./morphTargetManager-CdEb1BHc.esm.min.js";import"./bone.pure-BcPT5kCP.esm.min.js";import"./skeleton-DinTjF3y.esm.min.js";import"./assetContainer-CAncviZo.esm.min.js";import"./objectModelMapping-ClgDmo5Q.esm.min.js";import"./spotLight.pure-5s2DDDIt.esm.min.js";const t="KHR_materials_clearcoat";class r{constructor(e){this.name=t,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(t)}dispose(){this._loader=null}loadMaterialPropertiesAsync(a,o,t){return e.LoadExtensionAsync(a,o,this.name,async(e,r)=>{const s=new Array;s.push(this._loader.loadMaterialPropertiesAsync(a,o,t)),s.push(this._loadClearCoatPropertiesAsync(e,r,t)),await Promise.all(s)})}_loadClearCoatPropertiesAsync(e,a,o){const t=this._loader._getOrCreateMaterialAdapter(o),r=new Array;return t.configureCoat(),t.coatWeight=void 0!==a.clearcoatFactor?a.clearcoatFactor:0,t.coatRoughness=void 0!==a.clearcoatRoughnessFactor?a.clearcoatRoughnessFactor:0,a.clearcoatTexture&&r.push(this._loader.loadTextureInfoAsync(`${e}/clearcoatTexture`,a.clearcoatTexture,e=>{e.name=`${o.name} (ClearCoat)`,t.coatWeightTexture=e})),a.clearcoatRoughnessTexture&&(a.clearcoatRoughnessTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync(`${e}/clearcoatRoughnessTexture`,a.clearcoatRoughnessTexture,e=>{e.name=`${o.name} (ClearCoat Roughness)`,t.coatRoughnessTexture=e}))),a.clearcoatNormalTexture&&(a.clearcoatNormalTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync(`${e}/clearcoatNormalTexture`,a.clearcoatNormalTexture,e=>{e.name=`${o.name} (ClearCoat Normal)`,t.geometryCoatNormalTexture=e,null!=a.clearcoatNormalTexture?.scale&&(t.geometryCoatNormalTextureScale=a.clearcoatNormalTexture.scale)})),t.setNormalMapInversions(!o.getScene().useRightHandedSystem,o.getScene().useRightHandedSystem)),Promise.all(r).then(()=>{})}}let s=!1;function n(){s||(s=!0,a(t),o(t,!0,e=>new r(e)))}n();export{r as KHR_materials_clearcoat,n as RegisterKHR_materials_clearcoat}; //# sourceMappingURL=KHR_materials_clearcoat-BEEXWshN.esm.min.js.map