32 lines
668 B
GLSL
32 lines
668 B
GLSL
#version 330 core
|
|
|
|
uniform mat4 u_mvp;
|
|
uniform mat4 u_transmat;
|
|
uniform vec3 u_campos;
|
|
|
|
uniform float u_time;
|
|
|
|
layout (location = 0) in vec3 position;
|
|
layout (location = 1) in vec3 normal;
|
|
layout (location = 2) in vec2 texcoord;
|
|
|
|
out vec3 v_position;
|
|
out vec3 v_normal;
|
|
out vec2 v_texcoord;
|
|
|
|
flat out int v_id;
|
|
|
|
out vec4 v_projected_normal;
|
|
|
|
void main()
|
|
{
|
|
float time = sin((u_time + (position.x - position.z) * 4.0) / 24.0) * 0.2;
|
|
v_id = int(position.x - position.z);
|
|
v_position = position + vec3(0.0, time, 0.0);
|
|
v_normal = normal;
|
|
v_texcoord = texcoord;
|
|
|
|
v_projected_normal = u_transmat * vec4(v_normal, 1.0);
|
|
|
|
gl_Position = u_mvp * vec4(v_position, 1.0);
|
|
}
|