import { ssaoPixels } from "../../PostProcessPass.js";
import { createProductionDepthProxy, createProductionPostProcessOutput } from "./ProductionPostProcessTypes.js";
export class SSAOPass {
    options;
    name = "production-ssao";
    enabled;
    lastResult = null;
    constructor(options = {}) {
        this.options = options;
        this.enabled = options.enabled ?? true;
    }
    apply(input) {
        const result = ssaoPixels(input.pixels, input.width, input.height, {
            depth: this.options.depth ?? input.depth ?? createProductionDepthProxy(input.width, input.height),
            radius: this.options.radius ?? 2,
            intensity: this.enabled ? this.options.intensity ?? 0.58 : 0,
            bias: this.options.bias ?? 0.01
        });
        this.lastResult = result;
        return createProductionPostProcessOutput(input, this.name, result.pixels, {
            occludedPixels: result.occludedPixels,
            averageOcclusion: result.averageOcclusion,
            radius: result.radius
        }, ["SSAOPass applies the renderer SSAO pixel kernel with supplied or generated depth evidence."]);
    }
    getLastResult() {
        return this.lastResult ? { ...this.lastResult, pixels: new Uint8Array(this.lastResult.pixels) } : null;
    }
}
//# sourceMappingURL=SSAOPass.js.map