import { j as SceneComponentConstants, k as Scene, C as Constants } from './index-BHma8tVs.esm.js';
import { G as GeometryBufferRenderer } from './geometryBufferRenderer-D_r4YnWa.esm.js';
import './clipPlaneFragment-eejU0tip.esm.js';
import './bumpFragment-HO17NCF-.esm.js';
import './helperFunctions-Der3Qob4.esm.js';
import './pbrIBLFunctions-yKO_nwjq.esm.js';
import './sceneUboDeclaration-DL1Carv0.esm.js';
import './pbrBRDFFunctions-nwNPro3b.esm.js';
import './reflectionFunction-COqjMw8h.esm.js';
import './bakedVertexAnimation-CQdkI3BQ.esm.js';
import './morphTargetsVertex-DPTF4TBT.esm.js';
import './instancesDeclaration-DMRRNnSZ.esm.js';
import './clipPlaneVertex-Czg1nGDS.esm.js';
import './harmonicsFunctions-vvFJgHDe.esm.js';
import './bumpVertex-B-xnzqgP.esm.js';

Object.defineProperty(Scene.prototype, "geometryBufferRenderer", {
    get: function () {
        return this._geometryBufferRenderer;
    },
    set: function (value) {
        if (value && value.isSupported) {
            this._geometryBufferRenderer = value;
        }
    },
    enumerable: true,
    configurable: true,
});
Scene.prototype.enableGeometryBufferRenderer = function (ratio = 1, depthFormat = Constants.TEXTUREFORMAT_DEPTH16, textureTypesAndFormats) {
    if (this._geometryBufferRenderer) {
        return this._geometryBufferRenderer;
    }
    this._geometryBufferRenderer = new GeometryBufferRenderer(this, ratio, depthFormat, textureTypesAndFormats);
    if (!this._geometryBufferRenderer.isSupported) {
        this._geometryBufferRenderer = null;
    }
    return this._geometryBufferRenderer;
};
Scene.prototype.disableGeometryBufferRenderer = function () {
    if (!this._geometryBufferRenderer) {
        return;
    }
    this._geometryBufferRenderer.dispose();
    this._geometryBufferRenderer = null;
};
/**
 * Defines the Geometry Buffer scene component responsible to manage a G-Buffer useful
 * in several rendering techniques.
 */
class GeometryBufferRendererSceneComponent {
    /**
     * Creates a new instance of the component for the given scene
     * @param scene Defines the scene to register the component in
     */
    constructor(scene) {
        /**
         * The component name helpful to identify the component in the list of scene components.
         */
        this.name = SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER;
        this.scene = scene;
    }
    /**
     * Registers the component in a given scene
     */
    register() {
        this.scene._gatherRenderTargetsStage.registerStep(SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER, this, this._gatherRenderTargets);
    }
    /**
     * Rebuilds the elements related to this component in case of
     * context lost for instance.
     */
    rebuild() {
        // Nothing to do for this component
    }
    /**
     * Disposes the component and the associated resources
     */
    dispose() {
        // Nothing to do for this component
    }
    _gatherRenderTargets(renderTargets) {
        if (this.scene._geometryBufferRenderer) {
            renderTargets.push(this.scene._geometryBufferRenderer.getGBuffer());
        }
    }
}
GeometryBufferRenderer._SceneComponentInitialization = (scene) => {
    // Register the G Buffer component to the scene.
    let component = scene._getComponent(SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER);
    if (!component) {
        component = new GeometryBufferRendererSceneComponent(scene);
        scene._addComponent(component);
    }
};

export { GeometryBufferRendererSceneComponent };
//# sourceMappingURL=geometryBufferRendererSceneComponent-BN0jF-do.esm.js.map
