import { j as SceneComponentConstants, k as Scene, C as Constants } from './index-Cl9U4nB-.esm.js';
import { G as GeometryBufferRenderer } from './geometryBufferRenderer-D18R6CC8.esm.js';
import './clipPlaneFragment-CQedrEmo.esm.js';
import './bumpFragment-DCabvCQl.esm.js';
import './helperFunctions-DF-aE5fb.esm.js';
import './pbrIBLFunctions-C6ZQbmZx.esm.js';
import './sceneUboDeclaration-DdP4S2XT.esm.js';
import './pbrBRDFFunctions-BXFk2Yx5.esm.js';
import './reflectionFunction-DfJ6TfWn.esm.js';
import './bakedVertexAnimation-BZsHr48q.esm.js';
import './morphTargetsVertex-BnfQ71Xm.esm.js';
import './instancesDeclaration-C5WP7Vem.esm.js';
import './clipPlaneVertex-byRBRQGF.esm.js';
import './harmonicsFunctions-BzWsJkte.esm.js';
import './bumpVertex-5-sT2YHh.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-Dx27J7tu.esm.js.map
