File: particles.vert

package info (click to toggle)
qt3d-opensource-src 5.11.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 124,732 kB
  • sloc: cpp: 301,057; ansic: 12,723; python: 445; objc: 244; pascal: 102; makefile: 34; xml: 30
file content (27 lines) | stat: -rw-r--r-- 601 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#version 430 core

in vec3 vertexPosition;
in vec3 vertexNormal;

in vec3 particlePosition;
in vec3 particleColor;

out VertexBlock
{
    flat vec3 color;
    vec3 pos;
    vec3 normal;
} v_out;

uniform mat4 mvp;
uniform mat3 modelViewNormal;
uniform mat4 modelView;

void main(void)
{
    vec4 pos = vec4(vertexPosition.xyz, 1.0) + vec4(particlePosition, 0.0);
    gl_Position = mvp * pos;
    v_out.pos = vec4(modelView * pos).xyz;
    v_out.normal = normalize(modelViewNormal * vertexNormal);
    v_out.color = mix(particleColor * 0.2, particleColor, smoothstep(0.5, 0.8, abs(v_out.normal).z));
}