import { GLTFLoader } from './glTFLoader-Vd6flhix.esm.js';
import { bS as unregisterGLTFExtension, bR as registerGLTFExtension } from './index-D9EJJo2H.esm.js';
import './bone-BM72szmN.esm.js';
import './skeleton-7tYVghzo.esm.js';
import './rawTexture-9EtxB5-k.esm.js';
import './assetContainer-CIzNyjOh.esm.js';
import './objectModelMapping-B3k5cPS3.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) {
                if (!this._loader._pbrMaterialImpl) {
                    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-BvYYp9i5.esm.js.map
