import { GLTFLoader } from './glTFLoader-Lv_a_ZrD.esm.js';
import { aD as unregisterGLTFExtension, aE as registerGLTFExtension } from './index-BvJBnIUK.esm.js';
import './bone.pure-hcmaz-xj.esm.js';
import './skeleton-DaBjFhlP.esm.js';
import './rawTexture-CcCH4bTg.esm.js';
import './assetContainer-BIQnS06u.esm.js';
import './objectModelMapping-BtiDAwYm.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;
            }
        });
    }
}
unregisterGLTFExtension(NAME);
registerGLTFExtension(NAME, true, (loader) => new MSFT_minecraftMesh(loader));

export { MSFT_minecraftMesh };
//# sourceMappingURL=MSFT_minecraftMesh-CDZ7CY1H.esm.js.map
