Debian Codegraph @

tests/manual/compute-particles/shaders/gl45/particles.vert

raw
1 #version 450 core
2
3 layout(location = 0) in vec3 vertexPosition;
4 layout(location = 1) in vec3 vertexNormal;
5
6 layout(location = 2) in vec3 particlePosition;
7 layout(location = 3) in vec3 particleColor;
8
9 layout (location = 0) out VertexBlock
10 {
11 flat vec3 color;
12 vec3 pos;
13 vec3 normal;
14 } v_out;
15
16 layout(std140, binding = 1) uniform qt3d_command_uniforms {
17 mat4 modelMatrix;
18 mat4 inverseModelMatrix;
19 mat4 modelViewMatrix;
20 mat3 modelNormalMatrix;
21 mat4 inverseModelViewMatrix;
22 mat4 modelViewProjection;
23 mat4 inverseModelViewProjectionMatrix;
24 };
25
26 void main(void)
27 {
28 vec4 pos = vec4(vertexPosition.xyz, 1.0) + vec4(particlePosition, 0.0);
29 gl_Position = modelViewProjection * pos;
30 v_out.pos = vec4(modelViewMatrix * pos).xyz;
31 v_out.normal = normalize(modelNormalMatrix * vertexNormal);
32 v_out.color = mix(particleColor * 0.2, particleColor, smoothstep(0.5, 0.8, abs(v_out.normal).z));
33 }