generated from AfonsoCMSousa/CPP-OpenGLTemplate
Improved openGL and ImGUI implementation
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
#version 330 core
|
||||
layout (location = 0) in vec2 aPos;
|
||||
layout(location = 0) in vec3 aPos; // Position
|
||||
layout(location = 1) in vec4 aColor; // Color (RGBA)
|
||||
layout(location = 2) in float aLife; // Life
|
||||
|
||||
out vec3 vColor;
|
||||
out vec4 vColor;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(aPos, 0.0, 1.0);
|
||||
float alpha = aLife;
|
||||
if (aLife > 0.0) {
|
||||
alpha = aLife / 10.0; // Fade mortal particles
|
||||
} else if (aLife < 0.0) {
|
||||
alpha = 1.0; // Eternal particles are fully opaque
|
||||
}
|
||||
vColor = vec4(aColor.rgb, aColor.a * alpha);
|
||||
gl_Position = vec4(aPos, 1.0);
|
||||
gl_PointSize = 10.0; // Make them big enough to see!
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user