projekt_grafika/cw 2/shaders/shader_particle.vert

18 lines
466 B
GLSL
Raw Normal View History

2022-02-27 13:32:12 +01:00
#version 430 core
2022-02-02 00:25:38 +01:00
2022-02-27 13:32:12 +01:00
layout ( location = 0 ) in vec3 vertex_position;
layout ( location = 4 ) in vec4 position;
2022-02-02 00:25:38 +01:00
2022-02-27 13:32:12 +01:00
uniform mat4 M_v;
uniform mat4 M_p;
uniform mat4 transformation;
uniform float particleSize;
out float lifetime;
2022-02-02 00:25:38 +01:00
void main()
{
2022-02-27 13:32:12 +01:00
vec4 position_viewspace = M_v * transformation * vec4( position.xyz , 1 );
position_viewspace.xy += particleSize * (vertex_position.xy - vec2(0.5f));
gl_Position = M_p * position_viewspace;
lifetime = position.w;
}