import { bloomPixels } from "../../PostProcessPass.js";
import { createProductionPostProcessOutput } from "./ProductionPostProcessTypes.js";
export class BloomPass {
    options;
    name = "production-bloom";
    enabled;
    lastResult = null;
    constructor(options = {}) {
        this.options = options;
        this.enabled = options.enabled ?? true;
    }
    apply(input) {
        const result = bloomPixels(input.pixels, input.width, input.height, {
            threshold: this.options.threshold ?? 0.62,
            intensity: this.enabled ? this.options.intensity ?? 0.36 : 0,
            radius: this.options.radius ?? 2
        });
        this.lastResult = result;
        return createProductionPostProcessOutput(input, this.name, result.pixels, {
            brightPixelCount: result.brightPixelCount,
            changedPixels: result.changedPixels,
            maxNeighborBoost: result.maxNeighborBoost
        }, ["BloomPass applies the renderer bloom pixel kernel and mutates image pixels, not only options metadata."]);
    }
    getLastResult() {
        return this.lastResult
            ? {
                ...this.lastResult,
                pixels: new Uint8Array(this.lastResult.pixels),
                brightPixels: new Uint8Array(this.lastResult.brightPixels),
                horizontalBlurPixels: new Uint8Array(this.lastResult.horizontalBlurPixels),
                verticalBlurPixels: new Uint8Array(this.lastResult.verticalBlurPixels)
            }
            : null;
    }
}
//# sourceMappingURL=BloomPass.js.map