2022-01-24 18:07:31 +01:00
|
|
|
#version 330 core
|
|
|
|
|
|
|
|
layout(location = 0) in vec3 squareVertices;
|
|
|
|
layout(location = 1) in vec4 xyzs; // Position of the center of the particule and size of the square
|
|
|
|
layout(location = 2) in vec4 color; // Position of the center of the particule and size of the square
|
|
|
|
|
|
|
|
out vec2 UV;
|
|
|
|
out vec4 particlecolor;
|
|
|
|
|
|
|
|
uniform vec3 CameraRight_worldspace;
|
|
|
|
uniform vec3 CameraUp_worldspace;
|
2022-01-24 19:08:28 +01:00
|
|
|
uniform mat4 VP;
|
2022-01-24 18:07:31 +01:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2022-01-24 19:08:28 +01:00
|
|
|
float particleSize = xyzs.w;
|
2022-01-24 18:07:31 +01:00
|
|
|
vec3 particleCenter_wordspace = xyzs.xyz;
|
|
|
|
|
|
|
|
vec3 vertexPosition_worldspace =
|
|
|
|
particleCenter_wordspace
|
|
|
|
+ CameraRight_worldspace * squareVertices.x * particleSize
|
|
|
|
+ CameraUp_worldspace * squareVertices.y * particleSize;
|
|
|
|
|
|
|
|
gl_Position = VP * vec4(vertexPosition_worldspace, 1.0f);
|
|
|
|
|
|
|
|
UV = squareVertices.xy + vec2(0.5, 0.5);
|
|
|
|
particlecolor = color;
|
|
|
|
}
|