projekt_grafika/cw 2/shaders/shader_particle.vert

18 lines
466 B
GLSL

#version 430 core
layout ( location = 0 ) in vec3 vertex_position;
layout ( location = 4 ) in vec4 position;
uniform mat4 M_v;
uniform mat4 M_p;
uniform mat4 transformation;
uniform float particleSize;
out float lifetime;
void main()
{
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;
}