#include "client/rendering/Framebuffers.h"

Framebuffers::Framebuffers(const WindowSize& size) :
world(size, Framebuffer::POSITION | Framebuffer::NORMAL | Framebuffer::COLOR | Framebuffer::RED | Framebuffer::DEPTH),
ssao(size, Framebuffer::RED),
ssaoBlur(size, Framebuffer::RED),
shadow(size, Framebuffer::DEPTH),
antialias(size, Framebuffer::COLOR) {
}

void Framebuffers::resize(uint width, uint height) {
    world.resize(width, height);
    ssao.resize(width, height);
    ssaoBlur.resize(width, height);
    shadow.resize(width, height);
    antialias.resize(width, height);
}

bool Framebuffers::hasError() const {
    return world.hasError() || ssao.hasError() || ssaoBlur.hasError() || shadow.hasError() || antialias.hasError();
}

void Framebuffers::setFactor(int factor) {
    world.setFactor(factor);
    ssao.setFactor(factor);
    ssaoBlur.setFactor(factor);
    shadow.setFactor(factor);
    antialias.setFactor(factor);
}