Skip to content

Instantly share code, notes, and snippets.

@pingpoli
Created August 6, 2020 19:41
Show Gist options
  • Save pingpoli/2fda6c28d2d0a25c009ca184351a6e62 to your computer and use it in GitHub Desktop.
Save pingpoli/2fda6c28d2d0a25c009ca184351a6e62 to your computer and use it in GitHub Desktop.
const std::string SimpleParticleShader::VS = "#version 330 core\n"
"layout ( location = 0 ) in vec3 vertex_position;"
"layout ( location = 4 ) in vec4 position;"
"uniform mat4 M_v;"
"uniform mat4 M_p;"
"uniform float particleSize;"
"out float lifetime;"
"void main()"
"{"
" vec4 position_viewspace = M_v * vec4( position.xyz , 1 );"
" position_viewspace.xy += particleSize * (vertex_position.xy - vec2(0.5));"
" gl_Position = M_p * position_viewspace;"
" lifetime = position.w;"
"}";
const std::string SimpleParticleShader::FS = "#version 330 core\n"
"in float lifetime;"
"out vec4 fragColor;"
"void main()"
"{"
" fragColor = vec4( 1.0 );"
"}";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment