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.

69 lines (65 loc) 2.62 kB
import { b as GLTFLoader } from './glTFLoader.pure-BaIedO7s.esm.js'; import { bo as unregisterGLTFExtension, bp as registerGLTFExtension } from './index-MZPybX0H.esm.js'; import './morphTargetManager-CK7B3gaT.esm.js'; import './bone.pure-CjsCww39.esm.js'; import './skeleton-D7Sw58cv.esm.js'; import './assetContainer-Bm0vsreJ.esm.js'; import './objectModelMapping-De5EKNEZ.esm.js'; import './spotLight.pure-CRdZC6Ci.esm.js'; const NAME = "MSFT_minecraftMesh"; /** @internal */ // eslint-disable-next-line @typescript-eslint/naming-convention class MSFT_minecraftMesh { /** @internal */ constructor(loader) { /** @internal */ this.name = NAME; this._loader = loader; this.enabled = this._loader.isExtensionUsed(NAME); } /** @internal */ dispose() { this._loader = null; } /** @internal */ // eslint-disable-next-line no-restricted-syntax loadMaterialPropertiesAsync(context, material, babylonMaterial) { return GLTFLoader.LoadExtraAsync(context, material, this.name, async (extraContext, extra) => { if (extra) { const impl = this._loader._pbrMaterialImpls.get("pbr"); if (!impl) { throw new Error(`${extraContext}: Material type not supported`); } const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial); if (babylonMaterial.needAlphaBlending()) { babylonMaterial.forceDepthWrite = true; babylonMaterial.separateCullingPass = true; } babylonMaterial.backFaceCulling = babylonMaterial.forceDepthWrite; babylonMaterial.twoSidedLighting = true; return await promise; } }); } } let _Registered = false; /** * Registers the MSFT_minecraftMesh glTF loader extension. * Safe to call multiple times; only the first call has an effect. */ // eslint-disable-next-line @typescript-eslint/naming-convention function RegisterMSFT_minecraftMesh() { if (_Registered) { return; } _Registered = true; unregisterGLTFExtension(NAME); registerGLTFExtension(NAME, true, (loader) => new MSFT_minecraftMesh(loader)); } /** * Re-exports the pure implementation and applies the runtime registration side effect. * Import "./MSFT_minecraftMesh.pure" for tree-shakeable, side-effect-free usage. */ RegisterMSFT_minecraftMesh(); export { MSFT_minecraftMesh, RegisterMSFT_minecraftMesh }; //# sourceMappingURL=MSFT_minecraftMesh-Yyp-iyX8.esm.js.map