Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/data_extern/programs/GLSL150/ParticleGS_DisplayGS.glsl @ 12202

Last change on this file since 12202 was 12115, checked in by wiesep, 6 years ago

Changed folder structure, deletet some unused files and cleaned up code

File size: 1023 bytes
Line 
1#version 150
2
3in block {
4    vec3 pos;
5    vec4 colour;
6    float radius;
7} ColouredFirework[];
8
9out block {
10    vec4 pos;
11    vec4 colour;
12    vec2 texcoord;
13} Firework;
14
15uniform mat4 inverseView;
16uniform mat4 worldViewProj;
17
18layout(points) in;
19layout(triangle_strip, max_vertices = 4) out;
20
21//The geometry shader that prepares the fireworks for display
22void main()
23{
24    vec3 g_positions[4] = vec3[4](vec3(-1, 1, 0), vec3(-1, -1, 0), vec3(1, 1, 0), vec3(1, -1, 0));
25    vec2 g_texcoords[4] = vec2[4](vec2(0, 1), vec2(1, 1), vec2(0, 0), vec2(1, 0));
26
27    //
28    // Emit two new triangles
29    //
30    for (int i = 0; i < 4; i++)
31    {
32        vec3 position = -g_positions[i] * ColouredFirework[0].radius;
33        position = mat3(inverseView) * position + ColouredFirework[0].pos;
34        gl_Position = worldViewProj * vec4(position, 1.0);
35
36        Firework.pos = gl_Position;
37        Firework.colour = ColouredFirework[0].colour;
38        Firework.texcoord = g_texcoords[i];
39        EmitVertex();
40    }
41    EndPrimitive();
42}
Note: See TracBrowser for help on using the repository browser.