yupplemayham/Resources/shaders/GL_postprocess.vert

55 lines
No EOL
1.1 KiB
GLSL

#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 shakeIntensity;
float shakeTime;
int effects;
vec3 colorMod_hud;
float blurIntensity_hud;
float shakeIntensity_hud;
float shakeTime_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(shakeTime_hud - 90) * 0.01;
gl_Position.y += cos(shakeTime_hud - 80) * 0.01;
}
}
}