1
0
This commit is contained in:
Niklas Birk
2020-02-11 19:01:50 +01:00
parent e8ecec7cef
commit 05038da3df
7 changed files with 242 additions and 35 deletions

View File

@ -0,0 +1,10 @@
#version 460 core
in vec3 col; // the input variable from the vertex shader (same name and same type)
out vec4 outCol;
void main()
{
outCol = vec4(vertexColor, 1.0);
}

26
shaders/VertexShader.glsl Normal file
View File

@ -0,0 +1,26 @@
#version 460 core
layout (location = 0) in vec3 pos; // the position variable has attribute position 0
layout (location = 1) in vec3 dir; // the direction variable has attribute position 1
layout (location = 2) in vec3 col; // the color variable has attribute position 2
layout (location = 3) in float age; // the age variable has attribute position 3
//in vec3 emitterPos; // the emitter pos variable
//in float newAge; // the age variable
out vec3 outCol; // output a color to the fragment shader
void main()
{
if (age < 0)
{
pos = emitterPos;
age = newAge;
}
age -= 0.1f;
vec3 newPos = pos.xyz + dir.xyz;
gl_Position = vec4(newPos, 1.0);
outCol = col; // set ourColor to the input color we got from the vertex data
}