#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
layout (std140) uniform uPostProcess {
    int curTime;

    int dt;
    vec3 colorMod;
    float blurIntensity;
    float blurDuration;
    float shakeIntensity;
    float shakeDuration;
    int effects;

    vec3 colorMod_hud;
    float blurIntensity_hud;
    float blurDuration_hud;
    float shakeIntensity_hud;
    float shakeDuration_hud;
    int effects_hud;
};

/*
BLUR:       0001
SHAKE:      0010
NEGATIVE:   0100
COLORMOD:   1000
GREYSCALE:1 0000
*/

uniform bool worldOrHud;

out vec2 texCoord;

void main()
{
    texCoord = aTexCoord;
    gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
    if (worldOrHud == false)
    {
        // SHAKE
        if ((effects & (1 << 1)) != 0)
        {
            gl_Position.x += cos(dt * 10) * shakeIntensity;
            gl_Position.y += cos(dt * 15) * shakeIntensity;
        }
    }
    else
    {
        //SHAKE
        if ((effects_hud & (1 << 1)) != 0)
        {
            gl_Position.x += cos(dt - 90) * shakeIntensity_hud;
            gl_Position.y += cos(dt - 80) * shakeIntensity_hud;
        }
    }
}