import { PostProcessStageLibrary, PostProcessStage, Color } from '@taotieh/cesium_extend';
var StageControl = /** @class */ (function () {
    function StageControl(viewer) {
        this._viewer = viewer;
        var collection = viewer.scene.postProcessStages;
        /** *************************************************
       *  silhouette 描边
       ****************************************************/
        var silhouette = collection.add(
        // @ts-ignore
        PostProcessStageLibrary.createSilhouetteStage());
        silhouette.uniforms['color'] = Color.BLACK;
        silhouette.enabled = false;
        this._silhouette = silhouette;
        /** *************************************************
         *  lensflare
         ****************************************************/
        var lensflare = collection.add(
        // @ts-ignore
        PostProcessStageLibrary.createLensFlareStage());
        lensflare.enabled = false;
        this._lensflare = lensflare;
        /** *************************************************
         *  lensflare
         ****************************************************/
        var edgedetection = collection.add(
        // @ts-ignore
        PostProcessStageLibrary.createEdgeDetectionStage());
        edgedetection.enabled = false;
        this._edgedetection = edgedetection;
    }
    StageControl.prototype._removeProcess = function (process) {
        var scene = this._viewer.scene;
        scene.postProcessStages.remove(process);
    };
    StageControl.prototype._createProcess = function (fs, uniforms) {
        var scene = this._viewer.scene;
        // @ts-ignore
        var process = scene.postProcessStages.add(new PostProcessStage({
            fragmentShader: fs,
            uniforms: uniforms
        }));
        return process;
    };
    Object.defineProperty(StageControl.prototype, "isSilhouetted", {
        get: function () {
            return this._silhouette.enabled;
        },
        set: function (val) {
            this._silhouette.enabled = val;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StageControl.prototype, "isFXAA", {
        get: function () {
            var scene = this._viewer.scene;
            return scene.postProcessStages.fxaa.enabled;
        },
        set: function (val) {
            var scene = this._viewer.scene;
            scene.postProcessStages.fxaa.enabled = val && true;
        },
        enumerable: false,
        configurable: true
    });
    StageControl.prototype.create = function (fs, uniforms) {
        return this._createProcess(fs, uniforms);
    };
    return StageControl;
}());
export default StageControl;
