Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSL150/ParticleGS_DisplayGS.glsl @ 12083

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

Reorganised shader programs

File size: 1.0 KB
Line 
1#version 150
2
3in block {
4        vec3    pos;
5    vec4        color;
6        float   radius;
7} ColoredFirework[];
8
9out block {
10        vec4    pos;
11    vec4        color;
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] * ColoredFirework[0].radius;
33        position = mat3(inverseView) * position + ColoredFirework[0].pos;
34        gl_Position = worldViewProj * vec4(position, 1.0);
35
36        Firework.pos = gl_Position;
37        Firework.color = ColoredFirework[0].color;
38        Firework.texcoord = g_texcoords[i];
39        EmitVertex();
40    }
41    EndPrimitive();
42}
Note: See TracBrowser for help on using the repository browser.